OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "src/interpreter/control-flow-builders.h" | |
6 | |
7 namespace v8 { | |
8 namespace internal { | |
9 namespace interpreter { | |
10 | |
11 | |
12 LoopBuilder::~LoopBuilder() { | |
13 BindLabels(continue_label(), &continue_labels_); | |
14 BindLabels(break_label(), &break_labels_); | |
rmcilroy
2015/10/01 09:18:56
Either move this to an explicit function or call t
oth
2015/10/01 11:43:02
Done.
| |
15 } | |
16 | |
17 | |
18 void LoopBuilder::Break() { | |
19 break_labels_.push_back(BytecodeLabel()); | |
20 builder()->Jump(&break_labels_.back()); | |
21 } | |
22 | |
23 | |
24 void LoopBuilder::Continue() { | |
25 continue_labels_.push_back(BytecodeLabel()); | |
26 builder()->Jump(&continue_labels_.back()); | |
27 } | |
28 | |
29 | |
30 void LoopBuilder::BindLabels(BytecodeLabel* target, | |
31 ZoneVector<BytecodeLabel>* labels) { | |
32 for (size_t i = 0; i < labels->size(); i++) { | |
33 BytecodeLabel& unbound = labels->at(i); | |
34 builder()->Bind(&unbound, target); | |
35 } | |
36 } | |
37 | |
38 } // namespace interpreter | |
39 } // namespace internal | |
40 } // namespace v8 | |
OLD | NEW |