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 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace interpreter { | 9 namespace interpreter { |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 | 83 |
84 void BlockBuilder::EndBlock() { | 84 void BlockBuilder::EndBlock() { |
85 builder()->Bind(&block_end_); | 85 builder()->Bind(&block_end_); |
86 SetBreakTarget(block_end_); | 86 SetBreakTarget(block_end_); |
87 } | 87 } |
88 | 88 |
89 | 89 |
90 LoopBuilder::~LoopBuilder() { DCHECK(continue_sites_.empty()); } | 90 LoopBuilder::~LoopBuilder() { DCHECK(continue_sites_.empty()); } |
91 | 91 |
92 | 92 |
93 void LoopBuilder::LoopHeader() { | 93 void LoopBuilder::LoopHeader(ZoneVector<BytecodeLabel>* additional_labels) { |
94 // Jumps from before the loop header into the loop violate ordering | 94 // Jumps from before the loop header into the loop violate ordering |
95 // requirements of bytecode basic blocks. The only entry into a loop | 95 // requirements of bytecode basic blocks. The only entry into a loop |
96 // must be the loop header. Surely breaks is okay? Not if nested | 96 // must be the loop header. Surely breaks is okay? Not if nested |
97 // and misplaced between the headers. | 97 // and misplaced between the headers. |
98 DCHECK(break_sites_.empty() && continue_sites_.empty()); | 98 DCHECK(break_sites_.empty() && continue_sites_.empty()); |
99 builder()->Bind(&loop_header_); | 99 builder()->Bind(&loop_header_); |
100 for (auto& label : *additional_labels) { | |
101 builder()->Bind(loop_header_, &label); | |
102 } | |
Jarin
2016/04/26 12:59:51
Any reason why you cannot bind in BytecodeGenerato
neis
2016/04/26 14:59:10
I can, but see the previous discussion. I leave i
| |
100 } | 103 } |
101 | 104 |
102 | 105 |
103 void LoopBuilder::EndLoop() { | 106 void LoopBuilder::EndLoop() { |
104 // Loop must have closed form, i.e. all loop elements are within the loop, | 107 // Loop must have closed form, i.e. all loop elements are within the loop, |
105 // the loop header precedes the body and next elements in the loop. | 108 // the loop header precedes the body and next elements in the loop. |
106 DCHECK(loop_header_.is_bound()); | 109 DCHECK(loop_header_.is_bound()); |
107 builder()->Bind(&loop_end_); | 110 builder()->Bind(&loop_end_); |
108 SetBreakTarget(loop_end_); | 111 SetBreakTarget(loop_end_); |
109 if (next_.is_bound()) { | 112 if (next_.is_bound()) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 } | 187 } |
185 | 188 |
186 | 189 |
187 void TryFinallyBuilder::EndFinally() { | 190 void TryFinallyBuilder::EndFinally() { |
188 // Nothing to be done here. | 191 // Nothing to be done here. |
189 } | 192 } |
190 | 193 |
191 } // namespace interpreter | 194 } // namespace interpreter |
192 } // namespace internal | 195 } // namespace internal |
193 } // namespace v8 | 196 } // namespace v8 |
OLD | NEW |