| 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/interpreter/bytecode-label.h" | 10 #include "src/interpreter/bytecode-label.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // A class to help with co-ordinating break and continue statements with | 82 // A class to help with co-ordinating break and continue statements with |
| 83 // their loop. | 83 // their loop. |
| 84 class LoopBuilder final : public BreakableControlFlowBuilder { | 84 class LoopBuilder final : public BreakableControlFlowBuilder { |
| 85 public: | 85 public: |
| 86 explicit LoopBuilder(BytecodeArrayBuilder* builder) | 86 explicit LoopBuilder(BytecodeArrayBuilder* builder) |
| 87 : BreakableControlFlowBuilder(builder), | 87 : BreakableControlFlowBuilder(builder), |
| 88 continue_sites_(builder->zone()) {} | 88 continue_sites_(builder->zone()) {} |
| 89 ~LoopBuilder(); | 89 ~LoopBuilder(); |
| 90 | 90 |
| 91 void LoopHeader(ZoneVector<BytecodeLabel>* additional_labels); | 91 void LoopHeader(ZoneVector<BytecodeLabel>* additional_labels); |
| 92 void JumpToHeader() { builder()->Jump(&loop_header_); } | 92 void JumpToHeader(); |
| 93 void JumpToHeaderIfTrue() { builder()->JumpIfTrue(&loop_header_); } | 93 void JumpToHeaderIfTrue(); |
| 94 void SetContinueTarget(); | 94 void SetContinueTarget(); |
| 95 void EndLoop(); | 95 void EndLoop(); |
| 96 | 96 |
| 97 // This method is called when visiting continue statements in the AST. | 97 // This method is called when visiting continue statements in the AST. |
| 98 // Inserts a jump to an unbound label that is patched when SetContinueTarget | 98 // Inserts a jump to an unbound label that is patched when SetContinueTarget |
| 99 // is called. | 99 // is called. |
| 100 void Continue() { EmitJump(&continue_sites_); } | 100 void Continue() { EmitJump(&continue_sites_); } |
| 101 void ContinueIfTrue() { EmitJumpIfTrue(&continue_sites_); } | 101 void ContinueIfTrue() { EmitJumpIfTrue(&continue_sites_); } |
| 102 void ContinueIfUndefined() { EmitJumpIfUndefined(&continue_sites_); } | 102 void ContinueIfUndefined() { EmitJumpIfUndefined(&continue_sites_); } |
| 103 void ContinueIfNull() { EmitJumpIfNull(&continue_sites_); } | 103 void ContinueIfNull() { EmitJumpIfNull(&continue_sites_); } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 // Unbound labels that identify jumps to the finally block in the code. | 187 // Unbound labels that identify jumps to the finally block in the code. |
| 188 ZoneVector<BytecodeLabel> finalization_sites_; | 188 ZoneVector<BytecodeLabel> finalization_sites_; |
| 189 }; | 189 }; |
| 190 | 190 |
| 191 } // namespace interpreter | 191 } // namespace interpreter |
| 192 } // namespace internal | 192 } // namespace internal |
| 193 } // namespace v8 | 193 } // namespace v8 |
| 194 | 194 |
| 195 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ | 195 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ |
| OLD | NEW |