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 18 matching lines...) Expand all Loading... | |
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 class ControlScopeForSwitch; | 34 class ControlScopeForSwitch; |
35 class ExpressionResultScope; | 35 class ExpressionResultScope; |
36 class EffectResultScope; | 36 class EffectResultScope; |
37 class AccumulatorResultScope; | 37 class AccumulatorResultScope; |
38 class RegisterResultScope; | 38 class RegisterResultScope; |
39 class AssignmentHazardScope; | |
39 | 40 |
40 void MakeBytecodeBody(); | 41 void MakeBytecodeBody(); |
41 Register NextContextRegister() const; | 42 Register NextContextRegister() const; |
42 | 43 |
43 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 44 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
44 | 45 |
45 // Dispatched from VisitBinaryOperation. | 46 // Dispatched from VisitBinaryOperation. |
46 void VisitArithmeticExpression(BinaryOperation* binop); | 47 void VisitArithmeticExpression(BinaryOperation* binop); |
47 void VisitCommaExpression(BinaryOperation* binop); | 48 void VisitCommaExpression(BinaryOperation* binop); |
48 void VisitLogicalOrExpression(BinaryOperation* binop); | 49 void VisitLogicalOrExpression(BinaryOperation* binop); |
49 void VisitLogicalAndExpression(BinaryOperation* binop); | 50 void VisitLogicalAndExpression(BinaryOperation* binop); |
50 | 51 |
51 // Dispatched from VisitUnaryOperation. | 52 // Dispatched from VisitUnaryOperation. |
52 void VisitVoid(UnaryOperation* expr); | 53 void VisitVoid(UnaryOperation* expr); |
53 void VisitTypeOf(UnaryOperation* expr); | 54 void VisitTypeOf(UnaryOperation* expr); |
54 void VisitNot(UnaryOperation* expr); | 55 void VisitNot(UnaryOperation* expr); |
55 void VisitDelete(UnaryOperation* expr); | 56 void VisitDelete(UnaryOperation* expr); |
56 | 57 |
58 // Used by flow control routines to evaluate loop condition. | |
59 void VisitCondition(Expression* expr); | |
rmcilroy
2015/11/05 16:34:51
Remove - no longer used.
| |
60 | |
57 // Helper visitors which perform common operations. | 61 // Helper visitors which perform common operations. |
58 Register VisitArguments(ZoneList<Expression*>* arguments); | 62 Register VisitArguments(ZoneList<Expression*>* arguments); |
59 | 63 |
60 void VisitPropertyLoad(Register obj, Property* expr); | 64 void VisitPropertyLoad(Register obj, Property* expr); |
61 void VisitPropertyLoadForAccumulator(Register obj, Property* expr); | 65 void VisitPropertyLoadForAccumulator(Register obj, Property* expr); |
62 | 66 |
63 void VisitVariableLoad(Variable* variable, FeedbackVectorSlot slot, | 67 void VisitVariableLoad(Variable* variable, FeedbackVectorSlot slot, |
64 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); | 68 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); |
65 void VisitVariableLoadForAccumulatorValue( | 69 void VisitVariableLoadForAccumulatorValue( |
66 Variable* variable, FeedbackVectorSlot slot, | 70 Variable* variable, FeedbackVectorSlot slot, |
(...skipping 10 matching lines...) Expand all Loading... | |
77 void VisitBuildLocalActivationContext(); | 81 void VisitBuildLocalActivationContext(); |
78 void VisitNewLocalBlockContext(Scope* scope); | 82 void VisitNewLocalBlockContext(Scope* scope); |
79 void VisitFunctionClosureForContext(); | 83 void VisitFunctionClosureForContext(); |
80 void VisitSetHomeObject(Register value, Register home_object, | 84 void VisitSetHomeObject(Register value, Register home_object, |
81 ObjectLiteralProperty* property, int slot_number = 0); | 85 ObjectLiteralProperty* property, int slot_number = 0); |
82 void VisitObjectLiteralAccessor(Register home_object, | 86 void VisitObjectLiteralAccessor(Register home_object, |
83 ObjectLiteralProperty* property, | 87 ObjectLiteralProperty* property, |
84 Register value_out); | 88 Register value_out); |
85 void VisitForInAssignment(Expression* expr, FeedbackVectorSlot slot); | 89 void VisitForInAssignment(Expression* expr, FeedbackVectorSlot slot); |
86 | 90 |
87 | |
88 // Visitors for obtaining expression result in the accumulator, in a | 91 // Visitors for obtaining expression result in the accumulator, in a |
89 // register, or just getting the effect. | 92 // register, or just getting the effect. |
90 void VisitForAccumulatorValue(Expression* expression); | 93 void VisitForAccumulatorValue(Expression* expression); |
91 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expression); | 94 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expression); |
92 void VisitForEffect(Expression* node); | 95 void VisitForEffect(Expression* node); |
93 | 96 |
94 // Methods marking the start and end of binary expressions. | |
95 void PrepareForBinaryExpression(); | |
96 void CompleteBinaryExpression(); | |
97 | |
98 // Methods for tracking and remapping register. | 97 // Methods for tracking and remapping register. |
99 void RecordStoreToRegister(Register reg); | 98 void RecordStoreToRegister(Register reg); |
100 Register LoadFromAliasedRegister(Register reg); | 99 Register LoadFromAliasedRegister(Register reg); |
101 | 100 |
102 inline BytecodeArrayBuilder* builder() { return &builder_; } | 101 inline BytecodeArrayBuilder* builder() { return &builder_; } |
103 | 102 |
104 inline Isolate* isolate() const { return isolate_; } | 103 inline Isolate* isolate() const { return isolate_; } |
105 inline Zone* zone() const { return zone_; } | 104 inline Zone* zone() const { return zone_; } |
106 | 105 |
107 inline Scope* scope() const { return scope_; } | 106 inline Scope* scope() const { return scope_; } |
108 inline void set_scope(Scope* scope) { scope_ = scope; } | 107 inline void set_scope(Scope* scope) { scope_ = scope; } |
109 inline CompilationInfo* info() const { return info_; } | 108 inline CompilationInfo* info() const { return info_; } |
110 inline void set_info(CompilationInfo* info) { info_ = info; } | 109 inline void set_info(CompilationInfo* info) { info_ = info; } |
111 | 110 |
112 inline ControlScope* execution_control() const { return execution_control_; } | 111 inline ControlScope* execution_control() const { return execution_control_; } |
113 inline void set_execution_control(ControlScope* scope) { | 112 inline void set_execution_control(ControlScope* scope) { |
114 execution_control_ = scope; | 113 execution_control_ = scope; |
115 } | 114 } |
116 inline ContextScope* execution_context() const { return execution_context_; } | 115 inline ContextScope* execution_context() const { return execution_context_; } |
117 inline void set_execution_context(ContextScope* context) { | 116 inline void set_execution_context(ContextScope* context) { |
118 execution_context_ = context; | 117 execution_context_ = context; |
119 } | 118 } |
120 inline void set_execution_result(ExpressionResultScope* execution_result) { | 119 inline void set_execution_result(ExpressionResultScope* execution_result) { |
121 execution_result_ = execution_result; | 120 execution_result_ = execution_result; |
122 } | 121 } |
123 ExpressionResultScope* execution_result() const { return execution_result_; } | 122 ExpressionResultScope* execution_result() const { return execution_result_; } |
124 | 123 |
124 inline void set_assignment_hazard_scope( | |
125 AssignmentHazardScope* assignment_hazard_scope) { | |
126 assignment_hazard_scope_ = assignment_hazard_scope; | |
127 } | |
128 inline AssignmentHazardScope* assignment_hazard_scope() const { | |
129 return assignment_hazard_scope_; | |
130 } | |
131 | |
125 ZoneVector<Handle<Object>>* globals() { return &globals_; } | 132 ZoneVector<Handle<Object>>* globals() { return &globals_; } |
126 inline LanguageMode language_mode() const; | 133 inline LanguageMode language_mode() const; |
127 Strength language_mode_strength() const; | 134 Strength language_mode_strength() const; |
128 int feedback_index(FeedbackVectorSlot slot) const; | 135 int feedback_index(FeedbackVectorSlot slot) const; |
129 | 136 |
130 Isolate* isolate_; | 137 Isolate* isolate_; |
131 Zone* zone_; | 138 Zone* zone_; |
132 BytecodeArrayBuilder builder_; | 139 BytecodeArrayBuilder builder_; |
133 CompilationInfo* info_; | 140 CompilationInfo* info_; |
134 Scope* scope_; | 141 Scope* scope_; |
135 ZoneVector<Handle<Object>> globals_; | 142 ZoneVector<Handle<Object>> globals_; |
136 ControlScope* execution_control_; | 143 ControlScope* execution_control_; |
137 ContextScope* execution_context_; | 144 ContextScope* execution_context_; |
138 ExpressionResultScope* execution_result_; | 145 ExpressionResultScope* execution_result_; |
139 | 146 AssignmentHazardScope* assignment_hazard_scope_; |
140 int binary_expression_depth_; | |
141 ZoneSet<int> binary_expression_hazard_set_; | |
142 }; | 147 }; |
143 | 148 |
144 } // namespace interpreter | 149 } // namespace interpreter |
145 } // namespace internal | 150 } // namespace internal |
146 } // namespace v8 | 151 } // namespace v8 |
147 | 152 |
148 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 153 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
OLD | NEW |