Index: src/interpreter/control-flow-builders.h |
diff --git a/src/interpreter/control-flow-builders.h b/src/interpreter/control-flow-builders.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d8be9814ef61c14586b8c4f12ddef271146703e1 |
--- /dev/null |
+++ b/src/interpreter/control-flow-builders.h |
@@ -0,0 +1,60 @@ |
+// Copyright 2015 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ |
+#define V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ |
+ |
+#include "src/interpreter/bytecode-array-builder.h" |
+ |
+#include "src/zone-containers.h" |
+ |
+namespace v8 { |
+namespace internal { |
+namespace interpreter { |
+ |
+class ControlFlowBuilder BASE_EMBEDDED { |
+ public: |
+ explicit ControlFlowBuilder(BytecodeArrayBuilder* builder) |
+ : builder_(builder) {} |
+ virtual ~ControlFlowBuilder() {} |
+ |
+ protected: |
+ BytecodeArrayBuilder* builder() const { return builder_; } |
+ |
+ private: |
+ BytecodeArrayBuilder* builder_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ControlFlowBuilder); |
+}; |
+ |
+ |
+class LoopBuilder : public ControlFlowBuilder { |
+ public: |
+ explicit LoopBuilder(BytecodeArrayBuilder* builder) |
+ : ControlFlowBuilder(builder), |
+ continue_labels_(builder->zone()), |
+ break_labels_(builder->zone()) {} |
+ ~LoopBuilder(); |
+ |
+ 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.
|
+ BytecodeLabel* break_label() { return &break_label_; } |
+ |
+ void Break(); |
+ void Continue(); |
+ |
+ private: |
+ void BindLabels(BytecodeLabel* target, ZoneVector<BytecodeLabel>* labels); |
+ |
+ BytecodeLabel continue_label_; |
+ BytecodeLabel break_label_; |
+ |
+ 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.
|
+ ZoneVector<BytecodeLabel> break_labels_; |
+}; |
+ |
+} // namespace interpreter |
+} // namespace internal |
+} // namespace v8 |
+ |
+#endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ |