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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 void VisitNewLocalBlockContext(Scope* scope); | 87 void VisitNewLocalBlockContext(Scope* scope); |
86 void VisitNewLocalCatchContext(Variable* variable); | 88 void VisitNewLocalCatchContext(Variable* variable); |
87 void VisitFunctionClosureForContext(); | 89 void VisitFunctionClosureForContext(); |
88 void VisitSetHomeObject(Register value, Register home_object, | 90 void VisitSetHomeObject(Register value, Register home_object, |
89 ObjectLiteralProperty* property, int slot_number = 0); | 91 ObjectLiteralProperty* property, int slot_number = 0); |
90 void VisitObjectLiteralAccessor(Register home_object, | 92 void VisitObjectLiteralAccessor(Register home_object, |
91 ObjectLiteralProperty* property, | 93 ObjectLiteralProperty* property, |
92 Register value_out); | 94 Register value_out); |
93 void VisitForInAssignment(Expression* expr, FeedbackVectorSlot slot); | 95 void VisitForInAssignment(Expression* expr, FeedbackVectorSlot slot); |
94 | 96 |
| 97 // Visit the body of a loop iteration. |
| 98 void VisitIterationBody(IterationStatement* stmt, LoopBuilder* loop_builder); |
| 99 |
95 // Visit a statement and switch scopes, the context is in the accumulator. | 100 // Visit a statement and switch scopes, the context is in the accumulator. |
96 void VisitInScope(Statement* stmt, Scope* scope); | 101 void VisitInScope(Statement* stmt, Scope* scope); |
97 | 102 |
98 // Visitors for obtaining expression result in the accumulator, in a | 103 // Visitors for obtaining expression result in the accumulator, in a |
99 // register, or just getting the effect. | 104 // register, or just getting the effect. |
100 void VisitForAccumulatorValue(Expression* expression); | 105 void VisitForAccumulatorValue(Expression* expression); |
101 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expression); | 106 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expression); |
102 void VisitForEffect(Expression* node); | 107 void VisitForEffect(Expression* node); |
103 | 108 |
104 // Methods for tracking and remapping register. | 109 // Methods for tracking and remapping register. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 ContextScope* execution_context_; | 156 ContextScope* execution_context_; |
152 ExpressionResultScope* execution_result_; | 157 ExpressionResultScope* execution_result_; |
153 RegisterAllocationScope* register_allocator_; | 158 RegisterAllocationScope* register_allocator_; |
154 }; | 159 }; |
155 | 160 |
156 } // namespace interpreter | 161 } // namespace interpreter |
157 } // namespace internal | 162 } // namespace internal |
158 } // namespace v8 | 163 } // namespace v8 |
159 | 164 |
160 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 165 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
OLD | NEW |