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 VisitBuildLocalActivationContext(); |
| 49 void VisitNewLocalBlockContext(Scope* scope); |
| 50 void VisitFunctionClosureForContext(); |
47 void VisitSetHomeObject(Register value, Register home_object, | 51 void VisitSetHomeObject(Register value, Register home_object, |
48 ObjectLiteralProperty* property, int slot_number = 0); | 52 ObjectLiteralProperty* property, int slot_number = 0); |
49 void VisitObjectLiteralAccessor(Register home_object, | 53 void VisitObjectLiteralAccessor(Register home_object, |
50 ObjectLiteralProperty* property, | 54 ObjectLiteralProperty* property, |
51 Register value_out); | 55 Register value_out); |
52 | 56 |
53 // Dispatched from VisitUnaryOperation. | 57 // Dispatched from VisitUnaryOperation. |
54 void VisitVoid(UnaryOperation* expr); | 58 void VisitVoid(UnaryOperation* expr); |
55 void VisitTypeOf(UnaryOperation* expr); | 59 void VisitTypeOf(UnaryOperation* expr); |
56 void VisitNot(UnaryOperation* expr); | 60 void VisitNot(UnaryOperation* expr); |
57 | 61 |
58 inline BytecodeArrayBuilder* builder() { return &builder_; } | 62 inline BytecodeArrayBuilder* builder() { return &builder_; } |
59 | 63 |
60 inline Isolate* isolate() const { return isolate_; } | 64 inline Isolate* isolate() const { return isolate_; } |
61 inline Zone* zone() const { return zone_; } | 65 inline Zone* zone() const { return zone_; } |
62 | 66 |
63 inline Scope* scope() const { return scope_; } | 67 inline Scope* scope() const { return scope_; } |
64 inline void set_scope(Scope* scope) { scope_ = scope; } | 68 inline void set_scope(Scope* scope) { scope_ = scope; } |
65 inline CompilationInfo* info() const { return info_; } | 69 inline CompilationInfo* info() const { return info_; } |
66 inline void set_info(CompilationInfo* info) { info_ = info; } | 70 inline void set_info(CompilationInfo* info) { info_ = info; } |
67 | 71 |
68 inline ControlScope* control_scope() const { return control_scope_; } | 72 inline ControlScope* execution_control() const { return execution_control_; } |
69 inline void set_control_scope(ControlScope* scope) { control_scope_ = scope; } | 73 inline void set_execution_control(ControlScope* scope) { |
70 inline Register current_context() const { return current_context_; } | 74 execution_control_ = scope; |
71 inline void set_current_context(Register context) { | 75 } |
72 current_context_ = context; | 76 inline ContextScope* execution_context() const { return execution_context_; } |
| 77 inline void set_execution_context(ContextScope* context) { |
| 78 execution_context_ = context; |
73 } | 79 } |
74 | 80 |
75 ZoneVector<Handle<Object>>* globals() { return &globals_; } | 81 ZoneVector<Handle<Object>>* globals() { return &globals_; } |
76 inline LanguageMode language_mode() const; | 82 inline LanguageMode language_mode() const; |
77 Strength language_mode_strength() const; | 83 Strength language_mode_strength() const; |
78 int feedback_index(FeedbackVectorSlot slot) const; | 84 int feedback_index(FeedbackVectorSlot slot) const; |
79 | 85 |
80 Isolate* isolate_; | 86 Isolate* isolate_; |
81 Zone* zone_; | 87 Zone* zone_; |
82 BytecodeArrayBuilder builder_; | 88 BytecodeArrayBuilder builder_; |
83 CompilationInfo* info_; | 89 CompilationInfo* info_; |
84 Scope* scope_; | 90 Scope* scope_; |
85 ZoneVector<Handle<Object>> globals_; | 91 ZoneVector<Handle<Object>> globals_; |
86 ControlScope* control_scope_; | 92 ControlScope* execution_control_; |
87 | 93 ContextScope* execution_context_; |
88 Register current_context_; | |
89 }; | 94 }; |
90 | 95 |
91 } // namespace interpreter | 96 } // namespace interpreter |
92 } // namespace internal | 97 } // namespace internal |
93 } // namespace v8 | 98 } // namespace v8 |
94 | 99 |
95 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 100 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
OLD | NEW |