| 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_; }
|
| + 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_;
|
| + ZoneVector<BytecodeLabel> break_labels_;
|
| +};
|
| +
|
| +} // namespace interpreter
|
| +} // namespace internal
|
| +} // namespace v8
|
| +
|
| +#endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_
|
|
|