| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 void BreakableControlFlowBuilder::BindLabels(const BytecodeLabel& target, | 74 void BreakableControlFlowBuilder::BindLabels(const BytecodeLabel& target, |
| 75 ZoneVector<BytecodeLabel>* sites) { | 75 ZoneVector<BytecodeLabel>* sites) { |
| 76 for (size_t i = 0; i < sites->size(); i++) { | 76 for (size_t i = 0; i < sites->size(); i++) { |
| 77 BytecodeLabel& site = sites->at(i); | 77 BytecodeLabel& site = sites->at(i); |
| 78 builder()->Bind(target, &site); | 78 builder()->Bind(target, &site); |
| 79 } | 79 } |
| 80 sites->clear(); | 80 sites->clear(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 | 83 |
| 84 void BlockBuilder::EndBlock() { |
| 85 builder()->Bind(&block_end_); |
| 86 SetBreakTarget(block_end_); |
| 87 } |
| 88 |
| 89 |
| 84 LoopBuilder::~LoopBuilder() { DCHECK(continue_sites_.empty()); } | 90 LoopBuilder::~LoopBuilder() { DCHECK(continue_sites_.empty()); } |
| 85 | 91 |
| 86 | 92 |
| 87 void LoopBuilder::LoopEnd() { | 93 void LoopBuilder::EndLoop() { |
| 88 // Loop must have closed form, i.e. all loop elements are within the loop, | 94 // Loop must have closed form, i.e. all loop elements are within the loop, |
| 89 // the loop header precedes the body and next elements in the loop. | 95 // the loop header precedes the body and next elements in the loop. |
| 90 DCHECK(loop_header_.is_bound()); | 96 DCHECK(loop_header_.is_bound()); |
| 91 builder()->Bind(&loop_end_); | 97 builder()->Bind(&loop_end_); |
| 92 SetBreakTarget(loop_end_); | 98 SetBreakTarget(loop_end_); |
| 93 if (next_.is_bound()) { | 99 if (next_.is_bound()) { |
| 94 DCHECK(!condition_.is_bound() || next_.offset() >= condition_.offset()); | 100 DCHECK(!condition_.is_bound() || next_.offset() >= condition_.offset()); |
| 95 SetContinueTarget(next_); | 101 SetContinueTarget(next_); |
| 96 } else { | 102 } else { |
| 97 DCHECK(condition_.is_bound()); | 103 DCHECK(condition_.is_bound()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 117 | 123 |
| 118 | 124 |
| 119 void SwitchBuilder::SetCaseTarget(int index) { | 125 void SwitchBuilder::SetCaseTarget(int index) { |
| 120 BytecodeLabel& site = case_sites_.at(index); | 126 BytecodeLabel& site = case_sites_.at(index); |
| 121 builder()->Bind(&site); | 127 builder()->Bind(&site); |
| 122 } | 128 } |
| 123 | 129 |
| 124 } // namespace interpreter | 130 } // namespace interpreter |
| 125 } // namespace internal | 131 } // namespace internal |
| 126 } // namespace v8 | 132 } // namespace v8 |
| OLD | NEW |