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.h" | 8 #include "src/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" |
(...skipping 15 matching lines...) Expand all Loading... | |
26 | 26 |
27 // Visiting function for declarations list is overridden. | 27 // Visiting function for declarations list is overridden. |
28 void VisitDeclarations(ZoneList<Declaration*>* declarations) override; | 28 void VisitDeclarations(ZoneList<Declaration*>* declarations) override; |
29 | 29 |
30 private: | 30 private: |
31 class ContextScope; | 31 class ContextScope; |
32 class ControlScope; | 32 class ControlScope; |
33 class ControlScopeForIteration; | 33 class ControlScopeForIteration; |
34 | 34 |
35 void MakeBytecodeBody(); | 35 void MakeBytecodeBody(); |
36 Register NextContextRegister() const; | |
36 | 37 |
37 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 38 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
38 | 39 |
39 void VisitArithmeticExpression(BinaryOperation* binop); | 40 void VisitArithmeticExpression(BinaryOperation* binop); |
40 void VisitCommaExpression(BinaryOperation* binop); | 41 void VisitCommaExpression(BinaryOperation* binop); |
41 void VisitLogicalOrExpression(BinaryOperation* binop); | 42 void VisitLogicalOrExpression(BinaryOperation* binop); |
42 void VisitLogicalAndExpression(BinaryOperation* binop); | 43 void VisitLogicalAndExpression(BinaryOperation* binop); |
43 void VisitPropertyLoad(Register obj, Property* expr); | 44 void VisitPropertyLoad(Register obj, Property* expr); |
44 void VisitVariableLoad(Variable* variable, FeedbackVectorSlot slot); | 45 void VisitVariableLoad(Variable* variable, FeedbackVectorSlot slot); |
45 void VisitVariableAssignment(Variable* variable, FeedbackVectorSlot slot); | 46 void VisitVariableAssignment(Variable* variable, FeedbackVectorSlot slot); |
46 void VisitNewLocalFunctionContext(); | 47 void VisitNewLocalFunctionContext(); |
48 void VisitNewLocalBlockContext(Scope* scope); | |
47 void VisitSetHomeObject(Register value, Register home_object, | 49 void VisitSetHomeObject(Register value, Register home_object, |
48 ObjectLiteralProperty* property, int slot_number = 0); | 50 ObjectLiteralProperty* property, int slot_number = 0); |
49 void VisitObjectLiteralAccessor(Register home_object, | 51 void VisitObjectLiteralAccessor(Register home_object, |
50 ObjectLiteralProperty* property, | 52 ObjectLiteralProperty* property, |
51 Register value_out); | 53 Register value_out); |
52 | 54 |
53 // Dispatched from VisitUnaryOperation. | 55 // Dispatched from VisitUnaryOperation. |
54 void VisitVoid(UnaryOperation* expr); | 56 void VisitVoid(UnaryOperation* expr); |
55 void VisitTypeOf(UnaryOperation* expr); | 57 void VisitTypeOf(UnaryOperation* expr); |
56 void VisitNot(UnaryOperation* expr); | 58 void VisitNot(UnaryOperation* expr); |
57 | 59 |
58 inline BytecodeArrayBuilder* builder() { return &builder_; } | 60 inline BytecodeArrayBuilder* builder() { return &builder_; } |
59 | 61 |
60 inline Isolate* isolate() const { return isolate_; } | 62 inline Isolate* isolate() const { return isolate_; } |
61 inline Zone* zone() const { return zone_; } | 63 inline Zone* zone() const { return zone_; } |
62 | 64 |
63 inline Scope* scope() const { return scope_; } | 65 inline Scope* scope() const { return scope_; } |
64 inline void set_scope(Scope* scope) { scope_ = scope; } | 66 inline void set_scope(Scope* scope) { scope_ = scope; } |
65 inline CompilationInfo* info() const { return info_; } | 67 inline CompilationInfo* info() const { return info_; } |
66 inline void set_info(CompilationInfo* info) { info_ = info; } | 68 inline void set_info(CompilationInfo* info) { info_ = info; } |
67 | 69 |
68 inline ControlScope* control_scope() const { return control_scope_; } | 70 inline ControlScope* execution_control() const { return execution_control_; } |
oth
2015/10/16 09:30:43
Previously the name gave a hint to the likely type
rmcilroy
2015/10/16 11:19:04
I was going with consistency with AstGraphBuilder
| |
69 inline void set_control_scope(ControlScope* scope) { control_scope_ = scope; } | 71 inline void set_execution_control(ControlScope* scope) { |
70 inline Register current_context() const { return current_context_; } | 72 execution_control_ = scope; |
71 inline void set_current_context(Register context) { | 73 } |
72 current_context_ = context; | 74 inline ContextScope* execution_context() const { return execution_context_; } |
75 inline void set_execution_context(ContextScope* context) { | |
76 execution_context_ = context; | |
73 } | 77 } |
74 | 78 |
75 ZoneVector<Handle<Object>>* globals() { return &globals_; } | 79 ZoneVector<Handle<Object>>* globals() { return &globals_; } |
76 inline LanguageMode language_mode() const; | 80 inline LanguageMode language_mode() const; |
77 Strength language_mode_strength() const; | 81 Strength language_mode_strength() const; |
78 int feedback_index(FeedbackVectorSlot slot) const; | 82 int feedback_index(FeedbackVectorSlot slot) const; |
79 | 83 |
80 Isolate* isolate_; | 84 Isolate* isolate_; |
81 Zone* zone_; | 85 Zone* zone_; |
82 BytecodeArrayBuilder builder_; | 86 BytecodeArrayBuilder builder_; |
83 CompilationInfo* info_; | 87 CompilationInfo* info_; |
84 Scope* scope_; | 88 Scope* scope_; |
85 ZoneVector<Handle<Object>> globals_; | 89 ZoneVector<Handle<Object>> globals_; |
86 ControlScope* control_scope_; | 90 ControlScope* execution_control_; |
87 | 91 ContextScope* execution_context_; |
88 Register current_context_; | |
89 }; | 92 }; |
90 | 93 |
91 } // namespace interpreter | 94 } // namespace interpreter |
92 } // namespace internal | 95 } // namespace internal |
93 } // namespace v8 | 96 } // namespace v8 |
94 | 97 |
95 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 98 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
OLD | NEW |