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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 private: | 138 private: |
139 // Unbound labels that identify jumps for case statements in the code. | 139 // Unbound labels that identify jumps for case statements in the code. |
140 ZoneVector<BytecodeLabel> case_sites_; | 140 ZoneVector<BytecodeLabel> case_sites_; |
141 }; | 141 }; |
142 | 142 |
143 | 143 |
144 // A class to help with co-ordinating control flow in try-catch statements. | 144 // A class to help with co-ordinating control flow in try-catch statements. |
145 class TryCatchBuilder final : public ControlFlowBuilder { | 145 class TryCatchBuilder final : public ControlFlowBuilder { |
146 public: | 146 public: |
147 explicit TryCatchBuilder(BytecodeArrayBuilder* builder, bool catch_predicted) | 147 explicit TryCatchBuilder(BytecodeArrayBuilder* builder, |
| 148 HandlerTable::CatchPrediction catch_prediction) |
148 : ControlFlowBuilder(builder), | 149 : ControlFlowBuilder(builder), |
149 handler_id_(builder->NewHandlerEntry()), | 150 handler_id_(builder->NewHandlerEntry()), |
150 catch_predicted_(catch_predicted) {} | 151 catch_prediction_(catch_prediction) {} |
151 | 152 |
152 void BeginTry(Register context); | 153 void BeginTry(Register context); |
153 void EndTry(); | 154 void EndTry(); |
154 void EndCatch(); | 155 void EndCatch(); |
155 | 156 |
156 private: | 157 private: |
157 int handler_id_; | 158 int handler_id_; |
158 bool catch_predicted_; | 159 HandlerTable::CatchPrediction catch_prediction_; |
159 BytecodeLabel handler_; | 160 BytecodeLabel handler_; |
160 BytecodeLabel exit_; | 161 BytecodeLabel exit_; |
161 }; | 162 }; |
162 | 163 |
163 | 164 |
164 // 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. |
165 class TryFinallyBuilder final : public ControlFlowBuilder { | 166 class TryFinallyBuilder final : public ControlFlowBuilder { |
166 public: | 167 public: |
167 explicit TryFinallyBuilder(BytecodeArrayBuilder* builder, | 168 explicit TryFinallyBuilder(BytecodeArrayBuilder* builder, |
168 bool catch_predicted) | 169 HandlerTable::CatchPrediction catch_prediction) |
169 : ControlFlowBuilder(builder), | 170 : ControlFlowBuilder(builder), |
170 handler_id_(builder->NewHandlerEntry()), | 171 handler_id_(builder->NewHandlerEntry()), |
171 catch_predicted_(catch_predicted), | 172 catch_prediction_(catch_prediction), |
172 finalization_sites_(builder->zone()) {} | 173 finalization_sites_(builder->zone()) {} |
173 | 174 |
174 void BeginTry(Register context); | 175 void BeginTry(Register context); |
175 void LeaveTry(); | 176 void LeaveTry(); |
176 void EndTry(); | 177 void EndTry(); |
177 void BeginHandler(); | 178 void BeginHandler(); |
178 void BeginFinally(); | 179 void BeginFinally(); |
179 void EndFinally(); | 180 void EndFinally(); |
180 | 181 |
181 private: | 182 private: |
182 int handler_id_; | 183 int handler_id_; |
183 bool catch_predicted_; | 184 HandlerTable::CatchPrediction catch_prediction_; |
184 BytecodeLabel handler_; | 185 BytecodeLabel handler_; |
185 | 186 |
186 // Unbound labels that identify jumps to the finally block in the code. | 187 // Unbound labels that identify jumps to the finally block in the code. |
187 ZoneVector<BytecodeLabel> finalization_sites_; | 188 ZoneVector<BytecodeLabel> finalization_sites_; |
188 }; | 189 }; |
189 | 190 |
190 } // namespace interpreter | 191 } // namespace interpreter |
191 } // namespace internal | 192 } // namespace internal |
192 } // namespace v8 | 193 } // namespace v8 |
193 | 194 |
194 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ | 195 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ |
OLD | NEW |