OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/interpreter/control-flow-builders.h" | 5 #include "src/interpreter/control-flow-builders.h" |
6 #include "src/objects-inl.h" | 6 #include "src/objects-inl.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 namespace interpreter { | 10 namespace interpreter { |
11 | 11 |
12 | 12 |
13 BreakableControlFlowBuilder::~BreakableControlFlowBuilder() { | 13 BreakableControlFlowBuilder::~BreakableControlFlowBuilder() { |
14 DCHECK(break_labels_.empty() || break_labels_.is_bound()); | 14 DCHECK(break_labels_.empty() || break_labels_.is_bound()); |
15 } | 15 } |
16 | 16 |
17 void BreakableControlFlowBuilder::BindBreakTarget() { | 17 void BreakableControlFlowBuilder::BindBreakTarget() { |
18 break_labels_.Bind(builder()); | 18 break_labels_.Bind(builder()); |
19 } | 19 } |
20 | 20 |
21 void BreakableControlFlowBuilder::EmitJump(BytecodeLabels* sites) { | 21 void BreakableControlFlowBuilder::EmitJump(BytecodeLabels* sites) { |
22 builder()->Jump(sites->New()); | 22 builder()->Jump(sites->New()); |
23 } | 23 } |
24 | 24 |
25 void BreakableControlFlowBuilder::EmitJumpIfTrue(BytecodeLabels* sites) { | 25 void BreakableControlFlowBuilder::EmitJumpIfTrue( |
26 builder()->JumpIfTrue(sites->New()); | 26 BytecodeArrayBuilder::ToBooleanMode mode, BytecodeLabels* sites) { |
| 27 builder()->JumpIfTrue(mode, sites->New()); |
27 } | 28 } |
28 | 29 |
29 void BreakableControlFlowBuilder::EmitJumpIfFalse(BytecodeLabels* sites) { | 30 void BreakableControlFlowBuilder::EmitJumpIfFalse( |
30 builder()->JumpIfFalse(sites->New()); | 31 BytecodeArrayBuilder::ToBooleanMode mode, BytecodeLabels* sites) { |
| 32 builder()->JumpIfFalse(mode, sites->New()); |
31 } | 33 } |
32 | 34 |
33 void BreakableControlFlowBuilder::EmitJumpIfUndefined(BytecodeLabels* sites) { | 35 void BreakableControlFlowBuilder::EmitJumpIfUndefined(BytecodeLabels* sites) { |
34 builder()->JumpIfUndefined(sites->New()); | 36 builder()->JumpIfUndefined(sites->New()); |
35 } | 37 } |
36 | 38 |
37 void BreakableControlFlowBuilder::EmitJumpIfNull(BytecodeLabels* sites) { | 39 void BreakableControlFlowBuilder::EmitJumpIfNull(BytecodeLabels* sites) { |
38 builder()->JumpIfNull(sites->New()); | 40 builder()->JumpIfNull(sites->New()); |
39 } | 41 } |
40 | 42 |
41 | |
42 void BlockBuilder::EndBlock() { | 43 void BlockBuilder::EndBlock() { |
43 builder()->Bind(&block_end_); | 44 builder()->Bind(&block_end_); |
44 BindBreakTarget(); | 45 BindBreakTarget(); |
45 } | 46 } |
46 | 47 |
47 LoopBuilder::~LoopBuilder() { | 48 LoopBuilder::~LoopBuilder() { |
48 DCHECK(continue_labels_.empty() || continue_labels_.is_bound()); | 49 DCHECK(continue_labels_.empty() || continue_labels_.is_bound()); |
49 DCHECK(header_labels_.empty() || header_labels_.is_bound()); | 50 DCHECK(header_labels_.empty() || header_labels_.is_bound()); |
50 } | 51 } |
51 | 52 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 134 |
134 void TryFinallyBuilder::BeginFinally() { finalization_sites_.Bind(builder()); } | 135 void TryFinallyBuilder::BeginFinally() { finalization_sites_.Bind(builder()); } |
135 | 136 |
136 void TryFinallyBuilder::EndFinally() { | 137 void TryFinallyBuilder::EndFinally() { |
137 // Nothing to be done here. | 138 // Nothing to be done here. |
138 } | 139 } |
139 | 140 |
140 } // namespace interpreter | 141 } // namespace interpreter |
141 } // namespace internal | 142 } // namespace internal |
142 } // namespace v8 | 143 } // namespace v8 |
OLD | NEW |