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 148 matching lines...) Loading... |
159 int handler_id_; | 159 int handler_id_; |
160 BytecodeLabel handler_; | 160 BytecodeLabel handler_; |
161 BytecodeLabel exit_; | 161 BytecodeLabel exit_; |
162 }; | 162 }; |
163 | 163 |
164 | 164 |
165 // A class to help with co-ordinating control flow in try-finally statements. | 165 // A class to help with co-ordinating control flow in try-finally statements. |
166 class TryFinallyBuilder final : public ControlFlowBuilder { | 166 class TryFinallyBuilder final : public ControlFlowBuilder { |
167 public: | 167 public: |
168 explicit TryFinallyBuilder(BytecodeArrayBuilder* builder) | 168 explicit TryFinallyBuilder(BytecodeArrayBuilder* builder) |
169 : ControlFlowBuilder(builder), handler_id_(builder->NewHandlerEntry()) {} | 169 : ControlFlowBuilder(builder), |
| 170 handler_id_(builder->NewHandlerEntry()), |
| 171 finalization_sites_(builder->zone()) {} |
170 | 172 |
171 void BeginTry(Register context); | 173 void BeginTry(Register context); |
| 174 void LeaveTry(); |
172 void EndTry(); | 175 void EndTry(); |
| 176 void BeginHandler(); |
| 177 void BeginFinally(); |
173 void EndFinally(); | 178 void EndFinally(); |
174 | 179 |
175 private: | 180 private: |
176 int handler_id_; | 181 int handler_id_; |
177 BytecodeLabel handler_; | 182 BytecodeLabel handler_; |
| 183 |
| 184 // Unbound labels that identify jumps to the finally block in the code. |
| 185 ZoneVector<BytecodeLabel> finalization_sites_; |
178 }; | 186 }; |
179 | 187 |
180 } // namespace interpreter | 188 } // namespace interpreter |
181 } // namespace internal | 189 } // namespace internal |
182 } // namespace v8 | 190 } // namespace v8 |
183 | 191 |
184 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ | 192 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ |
OLD | NEW |