| Index: src/interpreter/control-flow-builders.h
|
| diff --git a/src/interpreter/control-flow-builders.h b/src/interpreter/control-flow-builders.h
|
| index c9be6dcdc73ef57a59de53f78aaac99b227f80f2..1f5196861a4edca17ccc2eb6c9f1e1bf297bbf35 100644
|
| --- a/src/interpreter/control-flow-builders.h
|
| +++ b/src/interpreter/control-flow-builders.h
|
| @@ -44,6 +44,7 @@ class BreakableControlFlowBuilder : public ControlFlowBuilder {
|
| // SetBreakTarget is called.
|
| void Break() { EmitJump(&break_sites_); }
|
| void BreakIfTrue() { EmitJumpIfTrue(&break_sites_); }
|
| + void BreakIfFalse() { EmitJumpIfFalse(&break_sites_); }
|
| void BreakIfUndefined() { EmitJumpIfUndefined(&break_sites_); }
|
| void BreakIfNull() { EmitJumpIfNull(&break_sites_); }
|
|
|
| @@ -52,6 +53,8 @@ class BreakableControlFlowBuilder : public ControlFlowBuilder {
|
| void EmitJump(ZoneVector<BytecodeLabel>* labels, int index);
|
| void EmitJumpIfTrue(ZoneVector<BytecodeLabel>* labels);
|
| void EmitJumpIfTrue(ZoneVector<BytecodeLabel>* labels, int index);
|
| + void EmitJumpIfFalse(ZoneVector<BytecodeLabel>* labels);
|
| + void EmitJumpIfFalse(ZoneVector<BytecodeLabel>* labels, int index);
|
| void EmitJumpIfUndefined(ZoneVector<BytecodeLabel>* labels);
|
| void EmitJumpIfNull(ZoneVector<BytecodeLabel>* labels);
|
|
|
| @@ -64,7 +67,6 @@ class BreakableControlFlowBuilder : public ControlFlowBuilder {
|
|
|
| // A class to help with co-ordinating break and continue statements with
|
| // their loop.
|
| -// TODO(oth): add support for TF branch/merge info.
|
| class LoopBuilder final : public BreakableControlFlowBuilder {
|
| public:
|
| explicit LoopBuilder(BytecodeArrayBuilder* builder)
|
| @@ -72,9 +74,12 @@ class LoopBuilder final : public BreakableControlFlowBuilder {
|
| continue_sites_(builder->zone()) {}
|
| ~LoopBuilder();
|
|
|
| - // This methods should be called by the LoopBuilder owner before
|
| - // destruction to update sites that emit jumps for continue.
|
| - void SetContinueTarget(const BytecodeLabel& continue_target);
|
| + void LoopHeader() { builder()->Bind(&loop_header_); }
|
| + void Condition() { builder()->Bind(&condition_); }
|
| + void Next() { builder()->Bind(&next_); }
|
| + void JumpToHeader() { builder()->Jump(&loop_header_); }
|
| + void JumpToHeaderIfTrue() { builder()->JumpIfTrue(&loop_header_); }
|
| + void LoopEnd();
|
|
|
| // This method is called when visiting continue statements in the AST.
|
| // Inserts a jump to a unbound label that is patched when the corresponding
|
| @@ -85,6 +90,13 @@ class LoopBuilder final : public BreakableControlFlowBuilder {
|
| void ContinueIfNull() { EmitJumpIfNull(&continue_sites_); }
|
|
|
| private:
|
| + void SetContinueTarget(const BytecodeLabel& continue_target);
|
| +
|
| + BytecodeLabel loop_header_;
|
| + BytecodeLabel condition_;
|
| + BytecodeLabel next_;
|
| + BytecodeLabel loop_end_;
|
| +
|
| // Unbound labels that identify jumps for continue statements in the code.
|
| ZoneVector<BytecodeLabel> continue_sites_;
|
| };
|
|
|