| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 class ControlScopeForIteration; | 42 class ControlScopeForIteration; |
| 43 class ControlScopeForTopLevel; | 43 class ControlScopeForTopLevel; |
| 44 class ControlScopeForTryCatch; | 44 class ControlScopeForTryCatch; |
| 45 class ControlScopeForTryFinally; | 45 class ControlScopeForTryFinally; |
| 46 class ExpressionResultScope; | 46 class ExpressionResultScope; |
| 47 class EffectResultScope; | 47 class EffectResultScope; |
| 48 class GlobalDeclarationsBuilder; | 48 class GlobalDeclarationsBuilder; |
| 49 class RegisterAllocationScope; | 49 class RegisterAllocationScope; |
| 50 class TestResultScope; | 50 class TestResultScope; |
| 51 class ValueResultScope; | 51 class ValueResultScope; |
| 52 class SimpleTryCatchBuilder; |
| 53 class SimpleTryFinallyBuilder; |
| 54 |
| 55 template <class T> |
| 56 class TryBlockBuilder; |
| 57 typedef TryBlockBuilder<SimpleTryCatchBuilder> TryBlockBuilderForCatch; |
| 58 typedef TryBlockBuilder<SimpleTryFinallyBuilder> TryBlockBuilderForFinally; |
| 59 class CatchBlockBuilder; |
| 60 class FinallyBlockBuilder; |
| 61 |
| 62 friend class SimpleTryCatchBuilder; |
| 63 friend class SimpleTryFinallyBuilder; |
| 52 | 64 |
| 53 enum class TestFallthrough { kThen, kElse, kNone }; | 65 enum class TestFallthrough { kThen, kElse, kNone }; |
| 54 | 66 |
| 55 void GenerateBytecodeBody(); | 67 void GenerateBytecodeBody(); |
| 68 void GenerateBytecodeBodyForAsyncFunction(FunctionLiteral* literal); |
| 69 void GenerateBytecodeBodyForGenerator(FunctionLiteral* literal); |
| 70 void GenerateBytecodeBodyForModule(FunctionLiteral* literal); |
| 71 |
| 72 enum class BuildJSGeneratorObject { kNoInitialYield, kInitialYield }; |
| 73 void BuildAllocateAndStoreJSGeneratorObject(FunctionLiteral* literal, |
| 74 BuildJSGeneratorObject tag); |
| 75 void BuildAllocateAndStoreJSPromise(); |
| 76 void BindUnboundGeneratorResumePoints(); |
| 77 |
| 56 void AllocateDeferredConstants(Isolate* isolate); | 78 void AllocateDeferredConstants(Isolate* isolate); |
| 57 | 79 |
| 58 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 80 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| 59 | 81 |
| 60 // Dispatched from VisitBinaryOperation. | 82 // Dispatched from VisitBinaryOperation. |
| 61 void VisitArithmeticExpression(BinaryOperation* binop); | 83 void VisitArithmeticExpression(BinaryOperation* binop); |
| 62 void VisitCommaExpression(BinaryOperation* binop); | 84 void VisitCommaExpression(BinaryOperation* binop); |
| 63 void VisitLogicalOrExpression(BinaryOperation* binop); | 85 void VisitLogicalOrExpression(BinaryOperation* binop); |
| 64 void VisitLogicalAndExpression(BinaryOperation* binop); | 86 void VisitLogicalAndExpression(BinaryOperation* binop); |
| 65 | 87 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // register, or just getting the effect. | 179 // register, or just getting the effect. |
| 158 void VisitForAccumulatorValue(Expression* expr); | 180 void VisitForAccumulatorValue(Expression* expr); |
| 159 void VisitForAccumulatorValueOrTheHole(Expression* expr); | 181 void VisitForAccumulatorValueOrTheHole(Expression* expr); |
| 160 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expr); | 182 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expr); |
| 161 void VisitForRegisterValue(Expression* expr, Register destination); | 183 void VisitForRegisterValue(Expression* expr, Register destination); |
| 162 void VisitAndPushIntoRegisterList(Expression* expr, RegisterList* reg_list); | 184 void VisitAndPushIntoRegisterList(Expression* expr, RegisterList* reg_list); |
| 163 void VisitForEffect(Expression* expr); | 185 void VisitForEffect(Expression* expr); |
| 164 void VisitForTest(Expression* expr, BytecodeLabels* then_labels, | 186 void VisitForTest(Expression* expr, BytecodeLabels* then_labels, |
| 165 BytecodeLabels* else_labels, TestFallthrough fallthrough); | 187 BytecodeLabels* else_labels, TestFallthrough fallthrough); |
| 166 | 188 |
| 189 void BuildYield(int yield_id, Register generator, Register value); |
| 190 void BuildYieldResumePoint(int yield_id, Yield::OnException on_exception, |
| 191 Register generator, int position); |
| 192 |
| 167 // Returns the runtime function id for a store to super for the function's | 193 // Returns the runtime function id for a store to super for the function's |
| 168 // language mode. | 194 // language mode. |
| 169 inline Runtime::FunctionId StoreToSuperRuntimeId(); | 195 inline Runtime::FunctionId StoreToSuperRuntimeId(); |
| 170 inline Runtime::FunctionId StoreKeyedToSuperRuntimeId(); | 196 inline Runtime::FunctionId StoreKeyedToSuperRuntimeId(); |
| 171 | 197 |
| 172 inline BytecodeArrayBuilder* builder() const { return builder_; } | 198 inline BytecodeArrayBuilder* builder() const { return builder_; } |
| 173 inline Zone* zone() const { return zone_; } | 199 inline Zone* zone() const { return zone_; } |
| 174 inline DeclarationScope* scope() const { return scope_; } | 200 inline DeclarationScope* scope() const { return scope_; } |
| 175 inline CompilationInfo* info() const { return info_; } | 201 inline CompilationInfo* info() const { return info_; } |
| 176 | 202 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 ZoneVector<std::pair<ObjectLiteral*, size_t>> object_literals_; | 239 ZoneVector<std::pair<ObjectLiteral*, size_t>> object_literals_; |
| 214 ZoneVector<std::pair<ArrayLiteral*, size_t>> array_literals_; | 240 ZoneVector<std::pair<ArrayLiteral*, size_t>> array_literals_; |
| 215 | 241 |
| 216 ControlScope* execution_control_; | 242 ControlScope* execution_control_; |
| 217 ContextScope* execution_context_; | 243 ContextScope* execution_context_; |
| 218 ExpressionResultScope* execution_result_; | 244 ExpressionResultScope* execution_result_; |
| 219 | 245 |
| 220 ZoneVector<BytecodeLabel> generator_resume_points_; | 246 ZoneVector<BytecodeLabel> generator_resume_points_; |
| 221 Register generator_state_; | 247 Register generator_state_; |
| 222 int loop_depth_; | 248 int loop_depth_; |
| 249 HandlerTable::CatchPrediction catch_prediction_; |
| 223 | 250 |
| 224 Handle<Name> home_object_symbol_; | 251 Handle<Name> home_object_symbol_; |
| 225 Handle<Name> iterator_symbol_; | 252 Handle<Name> iterator_symbol_; |
| 226 Handle<Name> prototype_string_; | 253 Handle<Name> prototype_string_; |
| 227 Handle<FixedArray> empty_fixed_array_; | 254 Handle<FixedArray> empty_fixed_array_; |
| 228 const AstRawString* undefined_string_; | 255 const AstRawString* undefined_string_; |
| 229 }; | 256 }; |
| 230 | 257 |
| 231 } // namespace interpreter | 258 } // namespace interpreter |
| 232 } // namespace internal | 259 } // namespace internal |
| 233 } // namespace v8 | 260 } // namespace v8 |
| 234 | 261 |
| 235 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 262 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
| OLD | NEW |