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 DCHECK_EQ(continue_sites_.size(), 0); | |
rmcilroy
2015/10/01 12:12:08
nit - DCHECK(continue_sites_.empty());
oth
2015/10/01 13:13:56
Done.
| |
14 DCHECK_EQ(break_sites_.size(), 0); | |
15 } | |
16 | |
17 | |
18 void LoopBuilder::SetContinueTarget(const BytecodeLabel* const target) { | |
19 BindLabels(target, &continue_sites_); | |
20 } | |
21 | |
22 | |
23 void LoopBuilder::SetBreakTarget(const BytecodeLabel* const target) { | |
24 BindLabels(target, &break_sites_); | |
25 } | |
26 | |
27 | |
28 void LoopBuilder::EmitJump(ZoneVector<BytecodeLabel>* sites) { | |
29 sites->push_back(BytecodeLabel()); | |
30 builder()->Jump(&sites->back()); | |
31 } | |
32 | |
33 | |
34 void LoopBuilder::BindLabels(const BytecodeLabel* const target, | |
35 ZoneVector<BytecodeLabel>* labels) { | |
36 for (size_t i = 0; i < labels->size(); i++) { | |
37 BytecodeLabel& unbound = labels->at(i); | |
38 builder()->Bind(&unbound, target); | |
39 } | |
40 labels->resize(0); | |
rmcilroy
2015/10/01 12:12:07
nit - labels->clear() ?
oth
2015/10/01 13:13:56
Done.
| |
41 } | |
42 | |
43 } // namespace interpreter | |
44 } // namespace internal | |
45 } // namespace v8 | |
OLD | NEW |