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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 private: | 158 private: |
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, bool will_catch) |
169 : ControlFlowBuilder(builder), | 169 : ControlFlowBuilder(builder), |
170 handler_id_(builder->NewHandlerEntry()), | 170 handler_id_(builder->NewHandlerEntry()), |
171 finalization_sites_(builder->zone()) {} | 171 finalization_sites_(builder->zone()), |
| 172 will_catch_(will_catch) {} |
172 | 173 |
173 void BeginTry(Register context); | 174 void BeginTry(Register context); |
174 void LeaveTry(); | 175 void LeaveTry(); |
175 void EndTry(); | 176 void EndTry(); |
176 void BeginHandler(); | 177 void BeginHandler(); |
177 void BeginFinally(); | 178 void BeginFinally(); |
178 void EndFinally(); | 179 void EndFinally(); |
179 | 180 |
180 private: | 181 private: |
181 int handler_id_; | 182 int handler_id_; |
182 BytecodeLabel handler_; | 183 BytecodeLabel handler_; |
183 | 184 |
184 // Unbound labels that identify jumps to the finally block in the code. | 185 // Unbound labels that identify jumps to the finally block in the code. |
185 ZoneVector<BytecodeLabel> finalization_sites_; | 186 ZoneVector<BytecodeLabel> finalization_sites_; |
| 187 |
| 188 // Conservative prediction of whether exceptions thrown into the handler for |
| 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. |
| 191 bool will_catch_; |
186 }; | 192 }; |
187 | 193 |
188 } // namespace interpreter | 194 } // namespace interpreter |
189 } // namespace internal | 195 } // namespace internal |
190 } // namespace v8 | 196 } // namespace v8 |
191 | 197 |
192 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ | 198 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ |
OLD | NEW |