| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 void BuildKeyedSuperPropertyLoad(Register receiver, Register home_object, | 102 void BuildKeyedSuperPropertyLoad(Register receiver, Register home_object, |
| 103 Register key); | 103 Register key); |
| 104 | 104 |
| 105 void BuildThrowIfHole(Handle<String> name); | 105 void BuildThrowIfHole(Handle<String> name); |
| 106 void BuildThrowIfNotHole(Handle<String> name); | 106 void BuildThrowIfNotHole(Handle<String> name); |
| 107 void BuildThrowReassignConstant(Handle<String> name); | 107 void BuildThrowReassignConstant(Handle<String> name); |
| 108 void BuildThrowReferenceError(Handle<String> name); | 108 void BuildThrowReferenceError(Handle<String> name); |
| 109 void BuildHoleCheckForVariableLoad(VariableMode mode, Handle<String> name); | 109 void BuildHoleCheckForVariableLoad(VariableMode mode, Handle<String> name); |
| 110 void BuildHoleCheckForVariableAssignment(Variable* variable, Token::Value op); | 110 void BuildHoleCheckForVariableAssignment(Variable* variable, Token::Value op); |
| 111 | 111 |
| 112 // Build jump to targets[value], where |
| 113 // start_index <= value < start_index + size. |
| 114 void BuildIndexedJump(Register value, size_t start_index, size_t size, |
| 115 ZoneVector<BytecodeLabel>& targets); |
| 116 |
| 112 void VisitGeneratorPrologue(); | 117 void VisitGeneratorPrologue(); |
| 113 | 118 |
| 114 void VisitArgumentsObject(Variable* variable); | 119 void VisitArgumentsObject(Variable* variable); |
| 115 void VisitRestArgumentsArray(Variable* rest); | 120 void VisitRestArgumentsArray(Variable* rest); |
| 116 void VisitCallSuper(Call* call); | 121 void VisitCallSuper(Call* call); |
| 117 void VisitClassLiteralContents(ClassLiteral* expr); | 122 void VisitClassLiteralContents(ClassLiteral* expr); |
| 118 void VisitClassLiteralForRuntimeDefinition(ClassLiteral* expr); | 123 void VisitClassLiteralForRuntimeDefinition(ClassLiteral* expr); |
| 119 void VisitClassLiteralProperties(ClassLiteral* expr, Register literal, | 124 void VisitClassLiteralProperties(ClassLiteral* expr, Register literal, |
| 120 Register prototype); | 125 Register prototype); |
| 121 void VisitClassLiteralStaticPrototypeWithComputedName(Register name); | 126 void VisitClassLiteralStaticPrototypeWithComputedName(Register name); |
| 122 void VisitThisFunctionVariable(Variable* variable); | 127 void VisitThisFunctionVariable(Variable* variable); |
| 123 void VisitNewTargetVariable(Variable* variable); | 128 void VisitNewTargetVariable(Variable* variable); |
| 124 void VisitNewLocalFunctionContext(); | 129 void VisitNewLocalFunctionContext(); |
| 125 void VisitBuildLocalActivationContext(); | 130 void VisitBuildLocalActivationContext(); |
| 126 void VisitBlockDeclarationsAndStatements(Block* stmt); | 131 void VisitBlockDeclarationsAndStatements(Block* stmt); |
| 127 void VisitNewLocalBlockContext(Scope* scope); | 132 void VisitNewLocalBlockContext(Scope* scope); |
| 128 void VisitNewLocalCatchContext(Variable* variable); | 133 void VisitNewLocalCatchContext(Variable* variable); |
| 129 void VisitNewLocalWithContext(); | 134 void VisitNewLocalWithContext(); |
| 130 void VisitFunctionClosureForContext(); | 135 void VisitFunctionClosureForContext(); |
| 131 void VisitSetHomeObject(Register value, Register home_object, | 136 void VisitSetHomeObject(Register value, Register home_object, |
| 132 ObjectLiteralProperty* property, int slot_number = 0); | 137 ObjectLiteralProperty* property, int slot_number = 0); |
| 133 void VisitObjectLiteralAccessor(Register home_object, | 138 void VisitObjectLiteralAccessor(Register home_object, |
| 134 ObjectLiteralProperty* property, | 139 ObjectLiteralProperty* property, |
| 135 Register value_out); | 140 Register value_out); |
| 136 void VisitForInAssignment(Expression* expr, FeedbackVectorSlot slot); | 141 void VisitForInAssignment(Expression* expr, FeedbackVectorSlot slot); |
| 137 | 142 |
| 138 // Visit the body of a loop iteration. | 143 // Visit the header/body of a loop iteration. |
| 144 void VisitIterationHeader(IterationStatement* stmt, |
| 145 LoopBuilder* loop_builder); |
| 139 void VisitIterationBody(IterationStatement* stmt, LoopBuilder* loop_builder); | 146 void VisitIterationBody(IterationStatement* stmt, LoopBuilder* loop_builder); |
| 140 | 147 |
| 141 // Visit a statement and switch scopes, the context is in the accumulator. | 148 // Visit a statement and switch scopes, the context is in the accumulator. |
| 142 void VisitInScope(Statement* stmt, Scope* scope); | 149 void VisitInScope(Statement* stmt, Scope* scope); |
| 143 | 150 |
| 144 // Visitors for obtaining expression result in the accumulator, in a | 151 // Visitors for obtaining expression result in the accumulator, in a |
| 145 // register, or just getting the effect. | 152 // register, or just getting the effect. |
| 146 void VisitForAccumulatorValue(Expression* expr); | 153 void VisitForAccumulatorValue(Expression* expr); |
| 147 void VisitForAccumulatorValueOrTheHole(Expression* expr); | 154 void VisitForAccumulatorValueOrTheHole(Expression* expr); |
| 148 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expr); | 155 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expr); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 Zone* zone_; | 202 Zone* zone_; |
| 196 BytecodeArrayBuilder* builder_; | 203 BytecodeArrayBuilder* builder_; |
| 197 CompilationInfo* info_; | 204 CompilationInfo* info_; |
| 198 Scope* scope_; | 205 Scope* scope_; |
| 199 ZoneVector<Handle<Object>> globals_; | 206 ZoneVector<Handle<Object>> globals_; |
| 200 ControlScope* execution_control_; | 207 ControlScope* execution_control_; |
| 201 ContextScope* execution_context_; | 208 ContextScope* execution_context_; |
| 202 ExpressionResultScope* execution_result_; | 209 ExpressionResultScope* execution_result_; |
| 203 RegisterAllocationScope* register_allocator_; | 210 RegisterAllocationScope* register_allocator_; |
| 204 ZoneVector<BytecodeLabel> generator_resume_points_; | 211 ZoneVector<BytecodeLabel> generator_resume_points_; |
| 212 Register generator_state_; |
| 213 size_t generator_yields_seen_; |
| 205 int try_catch_nesting_level_; | 214 int try_catch_nesting_level_; |
| 206 int try_finally_nesting_level_; | 215 int try_finally_nesting_level_; |
| 207 int generator_yields_seen_; | |
| 208 }; | 216 }; |
| 209 | 217 |
| 210 } // namespace interpreter | 218 } // namespace interpreter |
| 211 } // namespace internal | 219 } // namespace internal |
| 212 } // namespace v8 | 220 } // namespace v8 |
| 213 | 221 |
| 214 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 222 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
| OLD | NEW |