| 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/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 namespace interpreter { | 14 namespace interpreter { |
| 15 | 15 |
| 16 class LoopBuilder; |
| 17 |
| 16 class BytecodeGenerator final : public AstVisitor { | 18 class BytecodeGenerator final : public AstVisitor { |
| 17 public: | 19 public: |
| 18 BytecodeGenerator(Isolate* isolate, Zone* zone); | 20 BytecodeGenerator(Isolate* isolate, Zone* zone); |
| 19 | 21 |
| 20 Handle<BytecodeArray> MakeBytecode(CompilationInfo* info); | 22 Handle<BytecodeArray> MakeBytecode(CompilationInfo* info); |
| 21 | 23 |
| 22 #define DECLARE_VISIT(type) void Visit##type(type* node) override; | 24 #define DECLARE_VISIT(type) void Visit##type(type* node) override; |
| 23 AST_NODE_LIST(DECLARE_VISIT) | 25 AST_NODE_LIST(DECLARE_VISIT) |
| 24 #undef DECLARE_VISIT | 26 #undef DECLARE_VISIT |
| 25 | 27 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 void VisitNewLocalCatchContext(Variable* variable); | 89 void VisitNewLocalCatchContext(Variable* variable); |
| 88 void VisitNewLocalWithContext(); | 90 void VisitNewLocalWithContext(); |
| 89 void VisitFunctionClosureForContext(); | 91 void VisitFunctionClosureForContext(); |
| 90 void VisitSetHomeObject(Register value, Register home_object, | 92 void VisitSetHomeObject(Register value, Register home_object, |
| 91 ObjectLiteralProperty* property, int slot_number = 0); | 93 ObjectLiteralProperty* property, int slot_number = 0); |
| 92 void VisitObjectLiteralAccessor(Register home_object, | 94 void VisitObjectLiteralAccessor(Register home_object, |
| 93 ObjectLiteralProperty* property, | 95 ObjectLiteralProperty* property, |
| 94 Register value_out); | 96 Register value_out); |
| 95 void VisitForInAssignment(Expression* expr, FeedbackVectorSlot slot); | 97 void VisitForInAssignment(Expression* expr, FeedbackVectorSlot slot); |
| 96 | 98 |
| 99 // Visit the body of a loop iteration. |
| 100 void VisitIterationBody(IterationStatement* stmt, LoopBuilder* loop_builder); |
| 101 |
| 97 // Visit a statement and switch scopes, the context is in the accumulator. | 102 // Visit a statement and switch scopes, the context is in the accumulator. |
| 98 void VisitInScope(Statement* stmt, Scope* scope); | 103 void VisitInScope(Statement* stmt, Scope* scope); |
| 99 | 104 |
| 100 // Visitors for obtaining expression result in the accumulator, in a | 105 // Visitors for obtaining expression result in the accumulator, in a |
| 101 // register, or just getting the effect. | 106 // register, or just getting the effect. |
| 102 void VisitForAccumulatorValue(Expression* expression); | 107 void VisitForAccumulatorValue(Expression* expression); |
| 103 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expression); | 108 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expression); |
| 104 void VisitForEffect(Expression* node); | 109 void VisitForEffect(Expression* node); |
| 105 | 110 |
| 106 // Methods for tracking and remapping register. | 111 // Methods for tracking and remapping register. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 ContextScope* execution_context_; | 158 ContextScope* execution_context_; |
| 154 ExpressionResultScope* execution_result_; | 159 ExpressionResultScope* execution_result_; |
| 155 RegisterAllocationScope* register_allocator_; | 160 RegisterAllocationScope* register_allocator_; |
| 156 }; | 161 }; |
| 157 | 162 |
| 158 } // namespace interpreter | 163 } // namespace interpreter |
| 159 } // namespace internal | 164 } // namespace internal |
| 160 } // namespace v8 | 165 } // namespace v8 |
| 161 | 166 |
| 162 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 167 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
| OLD | NEW |