| 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/bytecode-label.h" | 10 #include "src/interpreter/bytecode-label.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 // Dispatched from VisitUnaryOperation. | 66 // Dispatched from VisitUnaryOperation. |
| 67 void VisitVoid(UnaryOperation* expr); | 67 void VisitVoid(UnaryOperation* expr); |
| 68 void VisitTypeOf(UnaryOperation* expr); | 68 void VisitTypeOf(UnaryOperation* expr); |
| 69 void VisitNot(UnaryOperation* expr); | 69 void VisitNot(UnaryOperation* expr); |
| 70 void VisitDelete(UnaryOperation* expr); | 70 void VisitDelete(UnaryOperation* expr); |
| 71 | 71 |
| 72 // Used by flow control routines to evaluate loop condition. | 72 // Used by flow control routines to evaluate loop condition. |
| 73 void VisitCondition(Expression* expr); | 73 void VisitCondition(Expression* expr); |
| 74 | 74 |
| 75 // Visit the arguments expressions in |args| and store them in |args_regs| | 75 // Visit the arguments expressions in |args| and store them in |args_regs|, |
| 76 // starting at register |first_argument_register| in the list. | 76 // growing |args_regs| for each argument visited. |
| 77 void VisitArguments(ZoneList<Expression*>* args, RegisterList arg_regs, | 77 void VisitArguments(ZoneList<Expression*>* args, RegisterList* arg_regs); |
| 78 size_t first_argument_register = 0); | |
| 79 | 78 |
| 80 // Visit a keyed super property load. The optional | 79 // Visit a keyed super property load. The optional |
| 81 // |opt_receiver_out| register will have the receiver stored to it | 80 // |opt_receiver_out| register will have the receiver stored to it |
| 82 // if it's a valid register. The loaded value is placed in the | 81 // if it's a valid register. The loaded value is placed in the |
| 83 // accumulator. | 82 // accumulator. |
| 84 void VisitKeyedSuperPropertyLoad(Property* property, | 83 void VisitKeyedSuperPropertyLoad(Property* property, |
| 85 Register opt_receiver_out); | 84 Register opt_receiver_out); |
| 86 | 85 |
| 87 // Visit a named super property load. The optional | 86 // Visit a named super property load. The optional |
| 88 // |opt_receiver_out| register will have the receiver stored to it | 87 // |opt_receiver_out| register will have the receiver stored to it |
| 89 // if it's a valid register. The loaded value is placed in the | 88 // if it's a valid register. The loaded value is placed in the |
| 90 // accumulator. | 89 // accumulator. |
| 91 void VisitNamedSuperPropertyLoad(Property* property, | 90 void VisitNamedSuperPropertyLoad(Property* property, |
| 92 Register opt_receiver_out); | 91 Register opt_receiver_out); |
| 93 | 92 |
| 94 void VisitPropertyLoad(Register obj, Property* expr); | 93 void VisitPropertyLoad(Register obj, Property* expr); |
| 95 void VisitPropertyLoadForAccumulator(Register obj, Property* expr); | 94 void VisitPropertyLoadForRegister(Register obj, Property* expr, |
| 95 Register destination); |
| 96 | 96 |
| 97 void BuildVariableLoad(Variable* variable, FeedbackVectorSlot slot, | 97 void BuildVariableLoad(Variable* variable, FeedbackVectorSlot slot, |
| 98 HoleCheckMode hole_check_mode, | 98 HoleCheckMode hole_check_mode, |
| 99 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); | 99 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); |
| 100 void BuildVariableLoadForAccumulatorValue( | 100 void BuildVariableLoadForAccumulatorValue( |
| 101 Variable* variable, FeedbackVectorSlot slot, | 101 Variable* variable, FeedbackVectorSlot slot, |
| 102 HoleCheckMode hole_check_mode, | 102 HoleCheckMode hole_check_mode, |
| 103 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); | 103 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); |
| 104 void BuildVariableAssignment(Variable* variable, Token::Value op, | 104 void BuildVariableAssignment(Variable* variable, Token::Value op, |
| 105 FeedbackVectorSlot slot, | 105 FeedbackVectorSlot slot, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 void VisitModuleNamespaceImports(); | 145 void VisitModuleNamespaceImports(); |
| 146 | 146 |
| 147 // Visit the header/body of a loop iteration. | 147 // Visit the header/body of a loop iteration. |
| 148 void VisitIterationHeader(IterationStatement* stmt, | 148 void VisitIterationHeader(IterationStatement* stmt, |
| 149 LoopBuilder* loop_builder); | 149 LoopBuilder* loop_builder); |
| 150 void VisitIterationBody(IterationStatement* stmt, LoopBuilder* loop_builder); | 150 void VisitIterationBody(IterationStatement* stmt, LoopBuilder* loop_builder); |
| 151 | 151 |
| 152 // Visit a statement and switch scopes, the context is in the accumulator. | 152 // Visit a statement and switch scopes, the context is in the accumulator. |
| 153 void VisitInScope(Statement* stmt, Scope* scope); | 153 void VisitInScope(Statement* stmt, Scope* scope); |
| 154 | 154 |
| 155 void BuildPushUndefinedIntoRegisterList(RegisterList* reg_list); |
| 156 |
| 155 // Visitors for obtaining expression result in the accumulator, in a | 157 // Visitors for obtaining expression result in the accumulator, in a |
| 156 // register, or just getting the effect. | 158 // register, or just getting the effect. |
| 157 void VisitForAccumulatorValue(Expression* expr); | 159 void VisitForAccumulatorValue(Expression* expr); |
| 158 void VisitForAccumulatorValueOrTheHole(Expression* expr); | 160 void VisitForAccumulatorValueOrTheHole(Expression* expr); |
| 159 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expr); | 161 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expr); |
| 160 void VisitForRegisterValue(Expression* expr, Register destination); | 162 void VisitForRegisterValue(Expression* expr, Register destination); |
| 163 void VisitAndPushIntoRegisterList(Expression* expr, RegisterList* reg_list); |
| 161 void VisitForEffect(Expression* expr); | 164 void VisitForEffect(Expression* expr); |
| 162 void VisitForTest(Expression* expr, BytecodeLabels* then_labels, | 165 void VisitForTest(Expression* expr, BytecodeLabels* then_labels, |
| 163 BytecodeLabels* else_labels, TestFallthrough fallthrough); | 166 BytecodeLabels* else_labels, TestFallthrough fallthrough); |
| 164 | 167 |
| 165 // Returns the runtime function id for a store to super for the function's | 168 // Returns the runtime function id for a store to super for the function's |
| 166 // language mode. | 169 // language mode. |
| 167 inline Runtime::FunctionId StoreToSuperRuntimeId(); | 170 inline Runtime::FunctionId StoreToSuperRuntimeId(); |
| 168 inline Runtime::FunctionId StoreKeyedToSuperRuntimeId(); | 171 inline Runtime::FunctionId StoreKeyedToSuperRuntimeId(); |
| 169 | 172 |
| 170 inline BytecodeArrayBuilder* builder() const { return builder_; } | 173 inline BytecodeArrayBuilder* builder() const { return builder_; } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 Handle<Name> home_object_symbol_; | 221 Handle<Name> home_object_symbol_; |
| 219 Handle<Name> prototype_string_; | 222 Handle<Name> prototype_string_; |
| 220 Handle<FixedArray> empty_fixed_array_; | 223 Handle<FixedArray> empty_fixed_array_; |
| 221 }; | 224 }; |
| 222 | 225 |
| 223 } // namespace interpreter | 226 } // namespace interpreter |
| 224 } // namespace internal | 227 } // namespace internal |
| 225 } // namespace v8 | 228 } // namespace v8 |
| 226 | 229 |
| 227 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 230 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
| OLD | NEW |