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" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 void VisitTypeOf(UnaryOperation* expr); | 58 void VisitTypeOf(UnaryOperation* expr); |
59 void VisitNot(UnaryOperation* expr); | 59 void VisitNot(UnaryOperation* expr); |
60 void VisitDelete(UnaryOperation* expr); | 60 void VisitDelete(UnaryOperation* expr); |
61 | 61 |
62 // Used by flow control routines to evaluate loop condition. | 62 // Used by flow control routines to evaluate loop condition. |
63 void VisitCondition(Expression* expr); | 63 void VisitCondition(Expression* expr); |
64 | 64 |
65 // Helper visitors which perform common operations. | 65 // Helper visitors which perform common operations. |
66 Register VisitArguments(ZoneList<Expression*>* arguments); | 66 Register VisitArguments(ZoneList<Expression*>* arguments); |
67 | 67 |
68 // Visit a keyed super property load. The optional | |
69 // |opt_receiver_out| register will have the receiver stored to | |
70 // it. The loaded value is placed in the accumulator. | |
rmcilroy
2016/02/12 14:56:42
s/it./it if it's a valid register./
oth
2016/02/12 16:50:33
Done.
| |
71 void VisitKeyedSuperPropertyLoad(Property* property, | |
72 Register opt_receiver_out); | |
73 | |
74 // Visit a named super property load. The optional | |
75 // |opt_receiver_out| register will have the receiver stored to | |
76 // it. The loaded value is placed in the accumulator. | |
rmcilroy
2016/02/12 14:56:42
ditto
oth
2016/02/12 16:50:33
Done.
| |
77 void VisitNamedSuperPropertyLoad(Property* property, | |
78 Register opt_receiver_out); | |
79 | |
68 void VisitPropertyLoad(Register obj, Property* expr); | 80 void VisitPropertyLoad(Register obj, Property* expr); |
69 void VisitPropertyLoadForAccumulator(Register obj, Property* expr); | 81 void VisitPropertyLoadForAccumulator(Register obj, Property* expr); |
70 | |
rmcilroy
2016/02/12 14:56:42
nit - add back whitespace
oth
2016/02/12 16:50:33
Done.
| |
71 void VisitVariableLoad(Variable* variable, FeedbackVectorSlot slot, | 82 void VisitVariableLoad(Variable* variable, FeedbackVectorSlot slot, |
72 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); | 83 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); |
73 void VisitVariableLoadForAccumulatorValue( | 84 void VisitVariableLoadForAccumulatorValue( |
74 Variable* variable, FeedbackVectorSlot slot, | 85 Variable* variable, FeedbackVectorSlot slot, |
75 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); | 86 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); |
76 MUST_USE_RESULT Register | 87 MUST_USE_RESULT Register |
77 VisitVariableLoadForRegisterValue(Variable* variable, FeedbackVectorSlot slot, | 88 VisitVariableLoadForRegisterValue(Variable* variable, FeedbackVectorSlot slot, |
78 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); | 89 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); |
79 void VisitVariableAssignment(Variable* variable, Token::Value op, | 90 void VisitVariableAssignment(Variable* variable, Token::Value op, |
80 FeedbackVectorSlot slot); | 91 FeedbackVectorSlot slot); |
92 | |
93 MUST_USE_RESULT Register PrepareNamedSuperPropertyArguments( | |
94 SuperPropertyReference* super_property, Handle<Name> name); | |
95 MUST_USE_RESULT Register PrepareKeyedSuperPropertyArguments( | |
96 SuperPropertyReference* super_property, Expression* key); | |
97 void BuildNamedSuperPropertyLoad(Register receiver); | |
98 void BuildKeyedSuperPropertyLoad(Register receiver); | |
99 void BuildNamedSuperPropertyStore(Register receiver); | |
100 void BuildKeyedSuperPropertyStore(Register receiver); | |
101 | |
81 void BuildThrowIfHole(Handle<String> name); | 102 void BuildThrowIfHole(Handle<String> name); |
82 void BuildThrowIfNotHole(Handle<String> name); | 103 void BuildThrowIfNotHole(Handle<String> name); |
83 void BuildThrowReassignConstant(Handle<String> name); | 104 void BuildThrowReassignConstant(Handle<String> name); |
84 void BuildHoleCheckForVariableLoad(VariableMode mode, Handle<String> name); | 105 void BuildHoleCheckForVariableLoad(VariableMode mode, Handle<String> name); |
85 void BuildHoleCheckForVariableAssignment(Variable* variable, Token::Value op); | 106 void BuildHoleCheckForVariableAssignment(Variable* variable, Token::Value op); |
86 | 107 |
87 void VisitArgumentsObject(Variable* variable); | 108 void VisitArgumentsObject(Variable* variable); |
88 void VisitRestArgumentsArray(Variable* rest); | 109 void VisitRestArgumentsArray(Variable* rest); |
110 void VisitCallSuper(Call* call); | |
89 void VisitClassLiteralContents(ClassLiteral* expr); | 111 void VisitClassLiteralContents(ClassLiteral* expr); |
90 void VisitClassLiteralForRuntimeDefinition(ClassLiteral* expr); | 112 void VisitClassLiteralForRuntimeDefinition(ClassLiteral* expr); |
91 void VisitClassLiteralProperties(ClassLiteral* expr, Register literal, | 113 void VisitClassLiteralProperties(ClassLiteral* expr, Register literal, |
92 Register prototype); | 114 Register prototype); |
93 void VisitClassLiteralStaticPrototypeWithComputedName(Register name); | 115 void VisitClassLiteralStaticPrototypeWithComputedName(Register name); |
94 void VisitThisFunctionVariable(Variable* variable); | 116 void VisitThisFunctionVariable(Variable* variable); |
95 void VisitNewTargetVariable(Variable* variable); | 117 void VisitNewTargetVariable(Variable* variable); |
96 void VisitNewLocalFunctionContext(); | 118 void VisitNewLocalFunctionContext(); |
97 void VisitBuildLocalActivationContext(); | 119 void VisitBuildLocalActivationContext(); |
98 void VisitBlockDeclarationsAndStatements(Block* stmt); | 120 void VisitBlockDeclarationsAndStatements(Block* stmt); |
(...skipping 22 matching lines...) Expand all Loading... | |
121 void VisitForEffect(Expression* expr); | 143 void VisitForEffect(Expression* expr); |
122 | 144 |
123 // Methods for tracking and remapping register. | 145 // Methods for tracking and remapping register. |
124 void RecordStoreToRegister(Register reg); | 146 void RecordStoreToRegister(Register reg); |
125 Register LoadFromAliasedRegister(Register reg); | 147 Register LoadFromAliasedRegister(Register reg); |
126 | 148 |
127 // Methods for tracking try-block nesting. | 149 // Methods for tracking try-block nesting. |
128 bool IsInsideTryCatch() const { return try_catch_nesting_level_ > 0; } | 150 bool IsInsideTryCatch() const { return try_catch_nesting_level_ > 0; } |
129 bool IsInsideTryFinally() const { return try_finally_nesting_level_ > 0; } | 151 bool IsInsideTryFinally() const { return try_finally_nesting_level_ > 0; } |
130 | 152 |
153 // Initialize an array of temporary registers with consecutive registers. | |
154 template <size_t N> | |
155 void InitializeWithConsecutiveRegisters(Register (®isters)[N]); | |
rmcilroy
2016/02/12 14:56:42
This should probably live in the register allocato
oth
2016/02/12 16:50:33
Done.
| |
156 | |
131 inline void set_builder(BytecodeArrayBuilder* builder) { builder_ = builder; } | 157 inline void set_builder(BytecodeArrayBuilder* builder) { builder_ = builder; } |
132 inline BytecodeArrayBuilder* builder() const { return builder_; } | 158 inline BytecodeArrayBuilder* builder() const { return builder_; } |
133 | 159 |
134 inline Isolate* isolate() const { return isolate_; } | 160 inline Isolate* isolate() const { return isolate_; } |
135 inline Zone* zone() const { return zone_; } | 161 inline Zone* zone() const { return zone_; } |
136 | 162 |
137 inline Scope* scope() const { return scope_; } | 163 inline Scope* scope() const { return scope_; } |
138 inline void set_scope(Scope* scope) { scope_ = scope; } | 164 inline void set_scope(Scope* scope) { scope_ = scope; } |
139 inline CompilationInfo* info() const { return info_; } | 165 inline CompilationInfo* info() const { return info_; } |
140 inline void set_info(CompilationInfo* info) { info_ = info; } | 166 inline void set_info(CompilationInfo* info) { info_ = info; } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 RegisterAllocationScope* register_allocator_; | 202 RegisterAllocationScope* register_allocator_; |
177 int try_catch_nesting_level_; | 203 int try_catch_nesting_level_; |
178 int try_finally_nesting_level_; | 204 int try_finally_nesting_level_; |
179 }; | 205 }; |
180 | 206 |
181 } // namespace interpreter | 207 } // namespace interpreter |
182 } // namespace internal | 208 } // namespace internal |
183 } // namespace v8 | 209 } // namespace v8 |
184 | 210 |
185 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 211 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
OLD | NEW |