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, bool will_catch) | 168 explicit TryFinallyBuilder(BytecodeArrayBuilder* builder) |
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) {} | |
173 | 172 |
174 void BeginTry(Register context); | 173 void BeginTry(Register context); |
175 void LeaveTry(); | 174 void LeaveTry(); |
176 void EndTry(); | 175 void EndTry(); |
177 void BeginHandler(); | 176 void BeginHandler(); |
178 void BeginFinally(); | 177 void BeginFinally(); |
179 void EndFinally(); | 178 void EndFinally(); |
180 | 179 |
181 private: | 180 private: |
182 int handler_id_; | 181 int handler_id_; |
183 BytecodeLabel handler_; | 182 BytecodeLabel handler_; |
184 | 183 |
185 // 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. |
186 ZoneVector<BytecodeLabel> finalization_sites_; | 185 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_; | |
192 }; | 186 }; |
193 | 187 |
194 } // namespace interpreter | 188 } // namespace interpreter |
195 } // namespace internal | 189 } // namespace internal |
196 } // namespace v8 | 190 } // namespace v8 |
197 | 191 |
198 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ | 192 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ |
OLD | NEW |