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" |
11 #include "src/interpreter/bytecodes.h" | 11 #include "src/interpreter/bytecodes.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 class CompilationInfo; | 16 class CompilationInfo; |
17 | 17 |
18 namespace interpreter { | 18 namespace interpreter { |
19 | 19 |
20 class LoopBuilder; | 20 class LoopBuilder; |
21 | 21 |
22 class BytecodeGenerator final : public AstVisitor { | 22 class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> { |
23 public: | 23 public: |
24 explicit BytecodeGenerator(CompilationInfo* info); | 24 explicit BytecodeGenerator(CompilationInfo* info); |
25 | 25 |
26 Handle<BytecodeArray> MakeBytecode(); | 26 Handle<BytecodeArray> MakeBytecode(); |
27 | 27 |
28 #define DECLARE_VISIT(type) void Visit##type(type* node) override; | 28 #define DECLARE_VISIT(type) void Visit##type(type* node); |
29 AST_NODE_LIST(DECLARE_VISIT) | 29 AST_NODE_LIST(DECLARE_VISIT) |
30 #undef DECLARE_VISIT | 30 #undef DECLARE_VISIT |
31 | 31 |
32 // Visiting function for declarations list and statements are overridden. | 32 // Visiting function for declarations list and statements are overridden. |
33 void VisitDeclarations(ZoneList<Declaration*>* declarations) override; | 33 void VisitDeclarations(ZoneList<Declaration*>* declarations); |
34 void VisitStatements(ZoneList<Statement*>* statments) override; | 34 void VisitStatements(ZoneList<Statement*>* statments); |
35 | 35 |
36 private: | 36 private: |
37 class ContextScope; | 37 class ContextScope; |
38 class ControlScope; | 38 class ControlScope; |
39 class ControlScopeForBreakable; | 39 class ControlScopeForBreakable; |
40 class ControlScopeForIteration; | 40 class ControlScopeForIteration; |
41 class ControlScopeForTopLevel; | 41 class ControlScopeForTopLevel; |
42 class ControlScopeForTryCatch; | 42 class ControlScopeForTryCatch; |
43 class ControlScopeForTryFinally; | 43 class ControlScopeForTryFinally; |
44 class ExpressionResultScope; | 44 class ExpressionResultScope; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 RegisterAllocationScope* register_allocator_; | 211 RegisterAllocationScope* register_allocator_; |
212 ZoneVector<BytecodeLabel> generator_resume_points_; | 212 ZoneVector<BytecodeLabel> generator_resume_points_; |
213 Register generator_state_; | 213 Register generator_state_; |
214 }; | 214 }; |
215 | 215 |
216 } // namespace interpreter | 216 } // namespace interpreter |
217 } // namespace internal | 217 } // namespace internal |
218 } // namespace v8 | 218 } // namespace v8 |
219 | 219 |
220 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 220 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
OLD | NEW |