| 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 for (auto& label : *additional_labels) { | 58 if (additional_labels != nullptr) { |
| 59 builder()->Bind(&label); | 59 for (auto& label : *additional_labels) { |
| 60 builder()->Bind(&label); |
| 61 } |
| 60 } | 62 } |
| 61 } | 63 } |
| 62 | 64 |
| 63 void LoopBuilder::JumpToHeader(int loop_depth) { | 65 void LoopBuilder::JumpToHeader(int loop_depth) { |
| 64 // Pass the proper loop nesting level to the backwards branch, to trigger | 66 // Pass the proper loop nesting level to the backwards branch, to trigger |
| 65 // on-stack replacement when armed for the given loop nesting depth. | 67 // on-stack replacement when armed for the given loop nesting depth. |
| 66 int level = Min(loop_depth, AbstractCode::kMaxLoopNestingMarker - 1); | 68 int level = Min(loop_depth, AbstractCode::kMaxLoopNestingMarker - 1); |
| 67 // Loop must have closed form, i.e. all loop elements are within the loop, | 69 // Loop must have closed form, i.e. all loop elements are within the loop, |
| 68 // the loop header precedes the body and next elements in the loop. | 70 // the loop header precedes the body and next elements in the loop. |
| 69 DCHECK(loop_header_.is_bound()); | 71 DCHECK(loop_header_.is_bound()); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 132 |
| 131 void TryFinallyBuilder::BeginFinally() { finalization_sites_.Bind(builder()); } | 133 void TryFinallyBuilder::BeginFinally() { finalization_sites_.Bind(builder()); } |
| 132 | 134 |
| 133 void TryFinallyBuilder::EndFinally() { | 135 void TryFinallyBuilder::EndFinally() { |
| 134 // Nothing to be done here. | 136 // Nothing to be done here. |
| 135 } | 137 } |
| 136 | 138 |
| 137 } // namespace interpreter | 139 } // namespace interpreter |
| 138 } // namespace internal | 140 } // namespace internal |
| 139 } // namespace v8 | 141 } // namespace v8 |
| OLD | NEW |