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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 DCHECK(header_labels_.empty() || header_labels_.is_bound()); | 48 DCHECK(header_labels_.empty() || header_labels_.is_bound()); |
49 } | 49 } |
50 | 50 |
51 void LoopBuilder::LoopHeader(ZoneVector<BytecodeLabel>* additional_labels) { | 51 void LoopBuilder::LoopHeader(ZoneVector<BytecodeLabel>* additional_labels) { |
52 // Jumps from before the loop header into the loop violate ordering | 52 // Jumps from before the loop header into the loop violate ordering |
53 // requirements of bytecode basic blocks. The only entry into a loop | 53 // requirements of bytecode basic blocks. The only entry into a loop |
54 // must be the loop header. Surely breaks is okay? Not if nested | 54 // must be the loop header. Surely breaks is okay? Not if nested |
55 // and misplaced between the headers. | 55 // and misplaced between the headers. |
56 DCHECK(break_labels_.empty() && continue_labels_.empty()); | 56 DCHECK(break_labels_.empty() && continue_labels_.empty()); |
57 builder()->Bind(&loop_header_); | 57 builder()->Bind(&loop_header_); |
58 if (additional_labels != nullptr) { | 58 for (auto& label : *additional_labels) { |
59 for (auto& label : *additional_labels) { | 59 builder()->Bind(&label); |
60 builder()->Bind(&label); | |
61 } | |
62 } | 60 } |
63 } | 61 } |
64 | 62 |
65 void LoopBuilder::JumpToHeader(int loop_depth) { | 63 void LoopBuilder::JumpToHeader(int loop_depth) { |
66 // Pass the proper loop nesting level to the backwards branch, to trigger | 64 // Pass the proper loop nesting level to the backwards branch, to trigger |
67 // on-stack replacement when armed for the given loop nesting depth. | 65 // on-stack replacement when armed for the given loop nesting depth. |
68 int level = Min(loop_depth, AbstractCode::kMaxLoopNestingMarker - 1); | 66 int level = Min(loop_depth, AbstractCode::kMaxLoopNestingMarker - 1); |
69 // Loop must have closed form, i.e. all loop elements are within the loop, | 67 // Loop must have closed form, i.e. all loop elements are within the loop, |
70 // the loop header precedes the body and next elements in the loop. | 68 // the loop header precedes the body and next elements in the loop. |
71 DCHECK(loop_header_.is_bound()); | 69 DCHECK(loop_header_.is_bound()); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 130 |
133 void TryFinallyBuilder::BeginFinally() { finalization_sites_.Bind(builder()); } | 131 void TryFinallyBuilder::BeginFinally() { finalization_sites_.Bind(builder()); } |
134 | 132 |
135 void TryFinallyBuilder::EndFinally() { | 133 void TryFinallyBuilder::EndFinally() { |
136 // Nothing to be done here. | 134 // Nothing to be done here. |
137 } | 135 } |
138 | 136 |
139 } // namespace interpreter | 137 } // namespace interpreter |
140 } // namespace internal | 138 } // namespace internal |
141 } // namespace v8 | 139 } // namespace v8 |
OLD | NEW |