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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 // A class to help with co-ordinating break and continue statements with | 81 // A class to help with co-ordinating break and continue statements with |
82 // their loop. | 82 // their loop. |
83 class LoopBuilder final : public BreakableControlFlowBuilder { | 83 class LoopBuilder final : public BreakableControlFlowBuilder { |
84 public: | 84 public: |
85 explicit LoopBuilder(BytecodeArrayBuilder* builder) | 85 explicit LoopBuilder(BytecodeArrayBuilder* builder) |
86 : BreakableControlFlowBuilder(builder), | 86 : BreakableControlFlowBuilder(builder), |
87 continue_sites_(builder->zone()) {} | 87 continue_sites_(builder->zone()) {} |
88 ~LoopBuilder(); | 88 ~LoopBuilder(); |
89 | 89 |
90 void LoopHeader(); | 90 void LoopHeader(ZoneVector<BytecodeLabel>* additional_labels); |
91 void Condition() { builder()->Bind(&condition_); } | 91 void Condition() { builder()->Bind(&condition_); } |
92 void Next() { builder()->Bind(&next_); } | 92 void Next() { builder()->Bind(&next_); } |
93 void JumpToHeader() { builder()->Jump(&loop_header_); } | 93 void JumpToHeader() { builder()->Jump(&loop_header_); } |
94 void JumpToHeaderIfTrue() { builder()->JumpIfTrue(&loop_header_); } | 94 void JumpToHeaderIfTrue() { builder()->JumpIfTrue(&loop_header_); } |
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 a unbound label that is patched when the corresponding | 98 // Inserts a jump to a unbound label that is patched when the corresponding |
99 // SetContinueTarget is called. | 99 // SetContinueTarget is called. |
100 void Continue() { EmitJump(&continue_sites_); } | 100 void Continue() { EmitJump(&continue_sites_); } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 // this finally block will be caught. Note that such a prediction depends on | 189 // this finally block will be caught. Note that such a prediction depends on |
190 // whether this try-finally is nested inside a surrounding try-catch. | 190 // whether this try-finally is nested inside a surrounding try-catch. |
191 bool will_catch_; | 191 bool will_catch_; |
192 }; | 192 }; |
193 | 193 |
194 } // namespace interpreter | 194 } // namespace interpreter |
195 } // namespace internal | 195 } // namespace internal |
196 } // namespace v8 | 196 } // namespace v8 |
197 | 197 |
198 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ | 198 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ |
OLD | NEW |