| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ | 5 #ifndef V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ |
| 6 #define V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ | 6 #define V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ |
| 7 | 7 |
| 8 #include "src/interpreter/bytecode-array-builder.h" | 8 #include "src/interpreter/bytecode-array-builder.h" |
| 9 | 9 |
| 10 #include "src/zone-containers.h" | 10 #include "src/zone-containers.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // These methods should be called by the LoopBuilder owner before | 42 // These methods should be called by the LoopBuilder owner before |
| 43 // destruction to update sites that emit jumps for break/continue. | 43 // destruction to update sites that emit jumps for break/continue. |
| 44 void SetContinueTarget(const BytecodeLabel& continue_target); | 44 void SetContinueTarget(const BytecodeLabel& continue_target); |
| 45 void SetBreakTarget(const BytecodeLabel& break_target); | 45 void SetBreakTarget(const BytecodeLabel& break_target); |
| 46 | 46 |
| 47 // These methods are called when visiting break and continue | 47 // These methods are called when visiting break and continue |
| 48 // statements in the AST. Inserts a jump to a unbound label that is | 48 // statements in the AST. Inserts a jump to a unbound label that is |
| 49 // patched when the corresponding SetContinueTarget/SetBreakTarget | 49 // patched when the corresponding SetContinueTarget/SetBreakTarget |
| 50 // is called. | 50 // is called. |
| 51 void Break() { EmitJump(&break_sites_); } | 51 void Break() { EmitJump(&break_sites_); } |
| 52 void BreakIfTrue() { EmitJumpIfTrue(&break_sites_); } |
| 53 void BreakIfUndefined() { EmitJumpIfUndefined(&break_sites_); } |
| 54 void BreakIfNull() { EmitJumpIfNull(&break_sites_); } |
| 52 void Continue() { EmitJump(&continue_sites_); } | 55 void Continue() { EmitJump(&continue_sites_); } |
| 56 void ContinueIfTrue() { EmitJumpIfTrue(&continue_sites_); } |
| 57 void ContinueIfUndefined() { EmitJumpIfUndefined(&continue_sites_); } |
| 58 void ContinueIfNull() { EmitJumpIfNull(&continue_sites_); } |
| 53 | 59 |
| 54 private: | 60 private: |
| 55 void BindLabels(const BytecodeLabel& target, ZoneVector<BytecodeLabel>* site); | 61 void BindLabels(const BytecodeLabel& target, ZoneVector<BytecodeLabel>* site); |
| 56 void EmitJump(ZoneVector<BytecodeLabel>* labels); | 62 void EmitJump(ZoneVector<BytecodeLabel>* labels); |
| 63 void EmitJumpIfTrue(ZoneVector<BytecodeLabel>* labels); |
| 64 void EmitJumpIfUndefined(ZoneVector<BytecodeLabel>* labels); |
| 65 void EmitJumpIfNull(ZoneVector<BytecodeLabel>* labels); |
| 57 | 66 |
| 58 // Unbound labels that identify jumps for continue/break statements | 67 // Unbound labels that identify jumps for continue/break statements |
| 59 // in the code. | 68 // in the code. |
| 60 ZoneVector<BytecodeLabel> continue_sites_; | 69 ZoneVector<BytecodeLabel> continue_sites_; |
| 61 ZoneVector<BytecodeLabel> break_sites_; | 70 ZoneVector<BytecodeLabel> break_sites_; |
| 62 }; | 71 }; |
| 63 | 72 |
| 64 } // namespace interpreter | 73 } // namespace interpreter |
| 65 } // namespace internal | 74 } // namespace internal |
| 66 } // namespace v8 | 75 } // namespace v8 |
| 67 | 76 |
| 68 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ | 77 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ |
| OLD | NEW |