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_BYTECODE_GENERATOR_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
6 #define V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 6 #define V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
7 | 7 |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/interpreter/bytecode-array-builder.h" | 9 #include "src/interpreter/bytecode-array-builder.h" |
10 #include "src/interpreter/bytecode-label.h" | 10 #include "src/interpreter/bytecode-label.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // register, or just getting the effect. | 157 // register, or just getting the effect. |
158 void VisitForAccumulatorValue(Expression* expr); | 158 void VisitForAccumulatorValue(Expression* expr); |
159 void VisitForAccumulatorValueOrTheHole(Expression* expr); | 159 void VisitForAccumulatorValueOrTheHole(Expression* expr); |
160 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expr); | 160 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expr); |
161 void VisitForRegisterValue(Expression* expr, Register destination); | 161 void VisitForRegisterValue(Expression* expr, Register destination); |
162 void VisitAndPushIntoRegisterList(Expression* expr, RegisterList* reg_list); | 162 void VisitAndPushIntoRegisterList(Expression* expr, RegisterList* reg_list); |
163 void VisitForEffect(Expression* expr); | 163 void VisitForEffect(Expression* expr); |
164 void VisitForTest(Expression* expr, BytecodeLabels* then_labels, | 164 void VisitForTest(Expression* expr, BytecodeLabels* then_labels, |
165 BytecodeLabels* else_labels, TestFallthrough fallthrough); | 165 BytecodeLabels* else_labels, TestFallthrough fallthrough); |
166 | 166 |
| 167 void BuildYield(int yield_id, Yield::OnException on_exception, Register value, |
| 168 int position); |
| 169 void BuildAwait(int yield_id, Yield::OnException on_exception, Register value, |
| 170 int position); |
| 171 void BuildYieldResumePoint(int yield_id, Yield::OnException on_exception, |
| 172 int position); |
| 173 |
| 174 void BuildTryCatch(HandlerTable::CatchPrediction catch_prediction, |
| 175 std::function<void()> build_try, |
| 176 std::function<void(Register context)> build_catch); |
| 177 void BuildTryFinally(std::function<void()> build_try, |
| 178 std::function<void()> build_finally); |
| 179 void BuildTryCatchFinally(HandlerTable::CatchPrediction catch_prediction, |
| 180 std::function<void()> build_try, |
| 181 std::function<void(Register context)> build_catch, |
| 182 std::function<void()> build_finally); |
| 183 |
| 184 // If FLAG_trace is enabled, invoke Runtime::kTraceExit with the return value |
| 185 // in the accumulator. The return value is restored on exit. |
| 186 void BuildTraceExit(); |
| 187 |
167 // Returns the runtime function id for a store to super for the function's | 188 // Returns the runtime function id for a store to super for the function's |
168 // language mode. | 189 // language mode. |
169 inline Runtime::FunctionId StoreToSuperRuntimeId(); | 190 inline Runtime::FunctionId StoreToSuperRuntimeId(); |
170 inline Runtime::FunctionId StoreKeyedToSuperRuntimeId(); | 191 inline Runtime::FunctionId StoreKeyedToSuperRuntimeId(); |
171 | 192 |
172 inline BytecodeArrayBuilder* builder() const { return builder_; } | 193 inline BytecodeArrayBuilder* builder() const { return builder_; } |
173 inline Zone* zone() const { return zone_; } | 194 inline Zone* zone() const { return zone_; } |
174 inline DeclarationScope* scope() const { return scope_; } | 195 inline DeclarationScope* scope() const { return scope_; } |
175 inline CompilationInfo* info() const { return info_; } | 196 inline CompilationInfo* info() const { return info_; } |
176 | 197 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 native_function_literals_; | 233 native_function_literals_; |
213 ZoneVector<std::pair<ObjectLiteral*, size_t>> object_literals_; | 234 ZoneVector<std::pair<ObjectLiteral*, size_t>> object_literals_; |
214 ZoneVector<std::pair<ArrayLiteral*, size_t>> array_literals_; | 235 ZoneVector<std::pair<ArrayLiteral*, size_t>> array_literals_; |
215 | 236 |
216 ControlScope* execution_control_; | 237 ControlScope* execution_control_; |
217 ContextScope* execution_context_; | 238 ContextScope* execution_context_; |
218 ExpressionResultScope* execution_result_; | 239 ExpressionResultScope* execution_result_; |
219 | 240 |
220 ZoneVector<BytecodeLabel> generator_resume_points_; | 241 ZoneVector<BytecodeLabel> generator_resume_points_; |
221 Register generator_state_; | 242 Register generator_state_; |
| 243 Register generator_object_; |
| 244 Register promise_; |
222 int loop_depth_; | 245 int loop_depth_; |
| 246 HandlerTable::CatchPrediction catch_prediction_; |
223 | 247 |
224 Handle<Name> home_object_symbol_; | 248 Handle<Name> home_object_symbol_; |
225 Handle<Name> iterator_symbol_; | 249 Handle<Name> iterator_symbol_; |
226 Handle<Name> prototype_string_; | 250 Handle<Name> prototype_string_; |
227 Handle<FixedArray> empty_fixed_array_; | 251 Handle<FixedArray> empty_fixed_array_; |
228 const AstRawString* undefined_string_; | 252 const AstRawString* undefined_string_; |
229 }; | 253 }; |
230 | 254 |
231 } // namespace interpreter | 255 } // namespace interpreter |
232 } // namespace internal | 256 } // namespace internal |
233 } // namespace v8 | 257 } // namespace v8 |
234 | 258 |
235 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 259 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
OLD | NEW |