| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // A class to help with co-ordinating break and continue statements with | 78 // A class to help with co-ordinating break and continue statements with |
| 79 // their loop. | 79 // their loop. |
| 80 class LoopBuilder final : public BreakableControlFlowBuilder { | 80 class LoopBuilder final : public BreakableControlFlowBuilder { |
| 81 public: | 81 public: |
| 82 explicit LoopBuilder(BytecodeArrayBuilder* builder) | 82 explicit LoopBuilder(BytecodeArrayBuilder* builder) |
| 83 : BreakableControlFlowBuilder(builder), | 83 : BreakableControlFlowBuilder(builder), |
| 84 continue_labels_(builder->zone()), | 84 continue_labels_(builder->zone()), |
| 85 header_labels_(builder->zone()) {} | 85 header_labels_(builder->zone()) {} |
| 86 ~LoopBuilder(); | 86 ~LoopBuilder(); |
| 87 | 87 |
| 88 void LoopHeader(ZoneVector<BytecodeLabel>* additional_labels); | 88 void LoopHeader(ZoneVector<BytecodeLabel>* additional_labels = nullptr); |
| 89 void JumpToHeader(int loop_depth); | 89 void JumpToHeader(int loop_depth); |
| 90 void BindContinueTarget(); | 90 void BindContinueTarget(); |
| 91 void EndLoop(); | 91 void EndLoop(); |
| 92 | 92 |
| 93 // This method is called when visiting continue statements in the AST. | 93 // This method is called when visiting continue statements in the AST. |
| 94 // Inserts a jump to an unbound label that is patched when BindContinueTarget | 94 // Inserts a jump to an unbound label that is patched when BindContinueTarget |
| 95 // is called. | 95 // is called. |
| 96 void Continue() { EmitJump(&continue_labels_); } | 96 void Continue() { EmitJump(&continue_labels_); } |
| 97 void ContinueIfTrue() { EmitJumpIfTrue(&continue_labels_); } | 97 void ContinueIfTrue() { EmitJumpIfTrue(&continue_labels_); } |
| 98 void ContinueIfUndefined() { EmitJumpIfUndefined(&continue_labels_); } | 98 void ContinueIfUndefined() { EmitJumpIfUndefined(&continue_labels_); } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 // Unbound labels that identify jumps to the finally block in the code. | 184 // Unbound labels that identify jumps to the finally block in the code. |
| 185 BytecodeLabels finalization_sites_; | 185 BytecodeLabels finalization_sites_; |
| 186 }; | 186 }; |
| 187 | 187 |
| 188 } // namespace interpreter | 188 } // namespace interpreter |
| 189 } // namespace internal | 189 } // namespace internal |
| 190 } // namespace v8 | 190 } // namespace v8 |
| 191 | 191 |
| 192 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ | 192 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ |
| OLD | NEW |