| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #define DECLARE_VISIT(type) void Visit##type(type* node); | 29 #define DECLARE_VISIT(type) void Visit##type(type* node); |
| 30 AST_NODE_LIST(DECLARE_VISIT) | 30 AST_NODE_LIST(DECLARE_VISIT) |
| 31 #undef DECLARE_VISIT | 31 #undef DECLARE_VISIT |
| 32 | 32 |
| 33 // Visiting function for declarations list and statements are overridden. | 33 // Visiting function for declarations list and statements are overridden. |
| 34 void VisitDeclarations(ZoneList<Declaration*>* declarations); | 34 void VisitDeclarations(ZoneList<Declaration*>* declarations); |
| 35 void VisitStatements(ZoneList<Statement*>* statments); | 35 void VisitStatements(ZoneList<Statement*>* statments); |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 class AccumulatorResultScope; |
| 38 class ContextScope; | 39 class ContextScope; |
| 39 class ControlScope; | 40 class ControlScope; |
| 40 class ControlScopeForBreakable; | 41 class ControlScopeForBreakable; |
| 41 class ControlScopeForIteration; | 42 class ControlScopeForIteration; |
| 42 class ControlScopeForTopLevel; | 43 class ControlScopeForTopLevel; |
| 43 class ControlScopeForTryCatch; | 44 class ControlScopeForTryCatch; |
| 44 class ControlScopeForTryFinally; | 45 class ControlScopeForTryFinally; |
| 45 class ExpressionResultScope; | 46 class ExpressionResultScope; |
| 46 class EffectResultScope; | 47 class EffectResultScope; |
| 47 class AccumulatorResultScope; | 48 class GlobalDeclarationsBuilder; |
| 48 class RegisterResultScope; | 49 class RegisterResultScope; |
| 49 class RegisterAllocationScope; | 50 class RegisterAllocationScope; |
| 50 | 51 |
| 51 void MakeBytecodeBody(); | 52 void GenerateBytecode(); |
| 53 void GenerateBytecodeBody(); |
| 52 | 54 |
| 53 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 55 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| 54 | 56 |
| 55 // Dispatched from VisitBinaryOperation. | 57 // Dispatched from VisitBinaryOperation. |
| 56 void VisitArithmeticExpression(BinaryOperation* binop); | 58 void VisitArithmeticExpression(BinaryOperation* binop); |
| 57 void VisitCommaExpression(BinaryOperation* binop); | 59 void VisitCommaExpression(BinaryOperation* binop); |
| 58 void VisitLogicalOrExpression(BinaryOperation* binop); | 60 void VisitLogicalOrExpression(BinaryOperation* binop); |
| 59 void VisitLogicalAndExpression(BinaryOperation* binop); | 61 void VisitLogicalAndExpression(BinaryOperation* binop); |
| 60 | 62 |
| 61 // Dispatched from VisitUnaryOperation. | 63 // Dispatched from VisitUnaryOperation. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 191 } |
| 190 ExpressionResultScope* execution_result() const { return execution_result_; } | 192 ExpressionResultScope* execution_result() const { return execution_result_; } |
| 191 inline void set_register_allocator( | 193 inline void set_register_allocator( |
| 192 RegisterAllocationScope* register_allocator) { | 194 RegisterAllocationScope* register_allocator) { |
| 193 register_allocator_ = register_allocator; | 195 register_allocator_ = register_allocator; |
| 194 } | 196 } |
| 195 RegisterAllocationScope* register_allocator() const { | 197 RegisterAllocationScope* register_allocator() const { |
| 196 return register_allocator_; | 198 return register_allocator_; |
| 197 } | 199 } |
| 198 | 200 |
| 199 ZoneVector<Handle<Object>>* globals() { return &globals_; } | 201 GlobalDeclarationsBuilder* globals_builder() { return globals_builder_; } |
| 200 inline LanguageMode language_mode() const; | 202 inline LanguageMode language_mode() const; |
| 201 int feedback_index(FeedbackVectorSlot slot) const; | 203 int feedback_index(FeedbackVectorSlot slot) const; |
| 202 | 204 |
| 203 Isolate* isolate_; | 205 Isolate* isolate_; |
| 204 Zone* zone_; | 206 Zone* zone_; |
| 205 BytecodeArrayBuilder* builder_; | 207 BytecodeArrayBuilder* builder_; |
| 206 CompilationInfo* info_; | 208 CompilationInfo* info_; |
| 207 Scope* scope_; | 209 Scope* scope_; |
| 208 ZoneVector<Handle<Object>> globals_; | 210 GlobalDeclarationsBuilder* globals_builder_; |
| 211 ZoneVector<GlobalDeclarationsBuilder*> global_declarations_; |
| 209 ControlScope* execution_control_; | 212 ControlScope* execution_control_; |
| 210 ContextScope* execution_context_; | 213 ContextScope* execution_context_; |
| 211 ExpressionResultScope* execution_result_; | 214 ExpressionResultScope* execution_result_; |
| 212 RegisterAllocationScope* register_allocator_; | 215 RegisterAllocationScope* register_allocator_; |
| 213 ZoneVector<BytecodeLabel> generator_resume_points_; | 216 ZoneVector<BytecodeLabel> generator_resume_points_; |
| 214 Register generator_state_; | 217 Register generator_state_; |
| 215 }; | 218 }; |
| 216 | 219 |
| 217 } // namespace interpreter | 220 } // namespace interpreter |
| 218 } // namespace internal | 221 } // namespace internal |
| 219 } // namespace v8 | 222 } // namespace v8 |
| 220 | 223 |
| 221 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 224 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
| OLD | NEW |