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 #ifndef V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ | |
6 #define V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ | |
7 | |
8 #include "src/interpreter/bytecode-array-builder.h" | |
9 | |
10 #include "src/zone-containers.h" | |
11 | |
12 namespace v8 { | |
13 namespace internal { | |
14 namespace interpreter { | |
15 | |
16 class ControlFlowBuilder BASE_EMBEDDED { | |
17 public: | |
18 explicit ControlFlowBuilder(BytecodeArrayBuilder* builder) | |
19 : builder_(builder) {} | |
20 virtual ~ControlFlowBuilder() {} | |
21 | |
22 protected: | |
23 BytecodeArrayBuilder* builder() const { return builder_; } | |
24 | |
25 private: | |
26 BytecodeArrayBuilder* builder_; | |
27 | |
28 DISALLOW_COPY_AND_ASSIGN(ControlFlowBuilder); | |
29 }; | |
30 | |
31 | |
32 class LoopBuilder : public ControlFlowBuilder { | |
33 public: | |
34 explicit LoopBuilder(BytecodeArrayBuilder* builder) | |
35 : ControlFlowBuilder(builder), | |
36 continue_labels_(builder->zone()), | |
37 break_labels_(builder->zone()) {} | |
38 ~LoopBuilder(); | |
39 | |
40 BytecodeLabel* continue_label() { return &continue_label_; } | |
rmcilroy
2015/10/01 09:18:56
As discussed offline, instead of this could we hav
oth
2015/10/01 11:43:02
The code is re-worked to partially accommodate thi
Michael Starzinger
2015/10/01 11:49:36
Acknowledged. Works for me, it's clearer now.
| |
41 BytecodeLabel* break_label() { return &break_label_; } | |
42 | |
43 void Break(); | |
44 void Continue(); | |
45 | |
46 private: | |
47 void BindLabels(BytecodeLabel* target, ZoneVector<BytecodeLabel>* labels); | |
48 | |
49 BytecodeLabel continue_label_; | |
50 BytecodeLabel break_label_; | |
51 | |
52 ZoneVector<BytecodeLabel> continue_labels_; | |
Michael Starzinger
2015/10/01 08:55:24
nit: The naming overlap is a little bit confusing
oth
2015/10/01 11:43:02
Done.
| |
53 ZoneVector<BytecodeLabel> break_labels_; | |
54 }; | |
55 | |
56 } // namespace interpreter | |
57 } // namespace internal | |
58 } // namespace v8 | |
59 | |
60 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ | |
OLD | NEW |