| 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_INTERPRETER_ASSEMBLER_H_ | 5 #ifndef V8_INTERPRETER_INTERPRETER_ASSEMBLER_H_ |
| 6 #define V8_INTERPRETER_INTERPRETER_ASSEMBLER_H_ | 6 #define V8_INTERPRETER_INTERPRETER_ASSEMBLER_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/base/smart-pointers.h" | 9 #include "src/base/smart-pointers.h" |
| 10 #include "src/builtins.h" | 10 #include "src/builtins.h" |
| 11 #include "src/compiler/code-stub-assembler.h" | 11 #include "src/compiler/code-stub-assembler.h" |
| 12 #include "src/frames.h" | 12 #include "src/frames.h" |
| 13 #include "src/interpreter/bytecodes.h" | 13 #include "src/interpreter/bytecodes.h" |
| 14 #include "src/runtime/runtime.h" | 14 #include "src/runtime/runtime.h" |
| 15 | 15 |
| 16 namespace v8 { | 16 namespace v8 { |
| 17 namespace internal { | 17 namespace internal { |
| 18 namespace interpreter { | 18 namespace interpreter { |
| 19 | 19 |
| 20 class InterpreterAssembler : public compiler::CodeStubAssembler { | 20 class InterpreterAssembler : public compiler::CodeStubAssembler { |
| 21 public: | 21 public: |
| 22 InterpreterAssembler(Isolate* isolate, Zone* zone, Bytecode bytecode); | 22 InterpreterAssembler(Isolate* isolate, Zone* zone, Bytecode bytecode, |
| 23 int operand_scale); |
| 24 // Constructor for illegal bytecode codepoints. |
| 25 InterpreterAssembler(Isolate* isolate, Zone* zone); |
| 23 virtual ~InterpreterAssembler(); | 26 virtual ~InterpreterAssembler(); |
| 24 | 27 |
| 25 // Returns the count immediate for bytecode operand |operand_index| in the | 28 // Returns the count immediate for bytecode operand |operand_index| in the |
| 26 // current bytecode. | 29 // current bytecode. |
| 27 compiler::Node* BytecodeOperandCount(int operand_index); | 30 compiler::Node* BytecodeOperandCount(int operand_index); |
| 31 // Returns the 8-bit flag for bytecode operand |operand_index| in the |
| 32 // current bytecode. |
| 33 compiler::Node* BytecodeOperandFlag(int operand_index); |
| 28 // Returns the index immediate for bytecode operand |operand_index| in the | 34 // Returns the index immediate for bytecode operand |operand_index| in the |
| 29 // current bytecode. | 35 // current bytecode. |
| 30 compiler::Node* BytecodeOperandIdx(int operand_index); | 36 compiler::Node* BytecodeOperandIdx(int operand_index); |
| 31 // Returns the Imm8 immediate for bytecode operand |operand_index| in the | 37 // Returns the Imm8 immediate for bytecode operand |operand_index| in the |
| 32 // current bytecode. | 38 // current bytecode. |
| 33 compiler::Node* BytecodeOperandImm(int operand_index); | 39 compiler::Node* BytecodeOperandImm(int operand_index); |
| 34 // Returns the register index for bytecode operand |operand_index| in the | 40 // Returns the register index for bytecode operand |operand_index| in the |
| 35 // current bytecode. | 41 // current bytecode. |
| 36 compiler::Node* BytecodeOperandReg(int operand_index); | 42 compiler::Node* BytecodeOperandReg(int operand_index); |
| 43 // Returns the runtime id immediate for bytecode operand |
| 44 // |operand_index| in the current bytecode. |
| 45 compiler::Node* BytecodeOperandRuntimeId(int operand_index); |
| 37 | 46 |
| 38 // Accumulator. | 47 // Accumulator. |
| 39 compiler::Node* GetAccumulator(); | 48 compiler::Node* GetAccumulator(); |
| 40 void SetAccumulator(compiler::Node* value); | 49 void SetAccumulator(compiler::Node* value); |
| 41 | 50 |
| 42 // Context. | 51 // Context. |
| 43 compiler::Node* GetContext(); | 52 compiler::Node* GetContext(); |
| 44 void SetContext(compiler::Node* value); | 53 void SetContext(compiler::Node* value); |
| 45 | 54 |
| 46 // Loads from and stores to the interpreter register file. | 55 // Loads from and stores to the interpreter register file. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // Dispatch to the bytecode. | 138 // Dispatch to the bytecode. |
| 130 void Dispatch(); | 139 void Dispatch(); |
| 131 | 140 |
| 132 // Dispatch to bytecode handler. | 141 // Dispatch to bytecode handler. |
| 133 void DispatchToBytecodeHandler(compiler::Node* handler, | 142 void DispatchToBytecodeHandler(compiler::Node* handler, |
| 134 compiler::Node* bytecode_offset); | 143 compiler::Node* bytecode_offset); |
| 135 void DispatchToBytecodeHandler(compiler::Node* handler) { | 144 void DispatchToBytecodeHandler(compiler::Node* handler) { |
| 136 DispatchToBytecodeHandler(handler, BytecodeOffset()); | 145 DispatchToBytecodeHandler(handler, BytecodeOffset()); |
| 137 } | 146 } |
| 138 | 147 |
| 148 // Dispatch bytecode as wide operand variant. |
| 149 void RedispatchWide(); |
| 150 |
| 139 // Abort with the given bailout reason. | 151 // Abort with the given bailout reason. |
| 140 void Abort(BailoutReason bailout_reason); | 152 void Abort(BailoutReason bailout_reason); |
| 141 | 153 |
| 142 protected: | 154 protected: |
| 143 static bool TargetSupportsUnalignedAccess(); | 155 static bool TargetSupportsUnalignedAccess(); |
| 144 | 156 |
| 145 private: | 157 private: |
| 146 // Returns a raw pointer to start of the register file on the stack. | 158 // Returns a raw pointer to start of the register file on the stack. |
| 147 compiler::Node* RegisterFileRawPointer(); | 159 compiler::Node* RegisterFileRawPointer(); |
| 148 // Returns a tagged pointer to the current function's BytecodeArray object. | 160 // Returns a tagged pointer to the current function's BytecodeArray object. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 164 // Runtime::kInterrupt if counter reaches zero. | 176 // Runtime::kInterrupt if counter reaches zero. |
| 165 void UpdateInterruptBudget(compiler::Node* weight); | 177 void UpdateInterruptBudget(compiler::Node* weight); |
| 166 | 178 |
| 167 // Returns the offset of register |index| relative to RegisterFilePointer(). | 179 // Returns the offset of register |index| relative to RegisterFilePointer(). |
| 168 compiler::Node* RegisterFrameOffset(compiler::Node* index); | 180 compiler::Node* RegisterFrameOffset(compiler::Node* index); |
| 169 | 181 |
| 170 compiler::Node* BytecodeOperand(int operand_index); | 182 compiler::Node* BytecodeOperand(int operand_index); |
| 171 compiler::Node* BytecodeOperandSignExtended(int operand_index); | 183 compiler::Node* BytecodeOperandSignExtended(int operand_index); |
| 172 compiler::Node* BytecodeOperandShort(int operand_index); | 184 compiler::Node* BytecodeOperandShort(int operand_index); |
| 173 compiler::Node* BytecodeOperandShortSignExtended(int operand_index); | 185 compiler::Node* BytecodeOperandShortSignExtended(int operand_index); |
| 186 compiler::Node* BytecodeOperandQuad(int operand_index); |
| 187 compiler::Node* BytecodeOperandQuadSignExtended(int operand_index); |
| 188 |
| 189 compiler::Node* BytecodeSignedOperand(int operand_index, |
| 190 OperandSize operand_size); |
| 191 compiler::Node* BytecodeUnsignedOperand(int operand_index, |
| 192 OperandSize operand_size); |
| 174 | 193 |
| 175 // Returns BytecodeOffset() advanced by delta bytecodes. Note: this does not | 194 // Returns BytecodeOffset() advanced by delta bytecodes. Note: this does not |
| 176 // update BytecodeOffset() itself. | 195 // update BytecodeOffset() itself. |
| 177 compiler::Node* Advance(int delta); | 196 compiler::Node* Advance(int delta); |
| 178 compiler::Node* Advance(compiler::Node* delta); | 197 compiler::Node* Advance(compiler::Node* delta); |
| 179 | 198 |
| 180 // Starts next instruction dispatch at |new_bytecode_offset|. | 199 // Starts next instruction dispatch at |new_bytecode_offset|. |
| 181 void DispatchTo(compiler::Node* new_bytecode_offset); | 200 void DispatchTo(compiler::Node* new_bytecode_offset); |
| 182 | 201 |
| 183 // Abort operations for debug code. | 202 // Abort operations for debug code. |
| 184 void AbortIfWordNotEqual(compiler::Node* lhs, compiler::Node* rhs, | 203 void AbortIfWordNotEqual(compiler::Node* lhs, compiler::Node* rhs, |
| 185 BailoutReason bailout_reason); | 204 BailoutReason bailout_reason); |
| 186 | 205 |
| 206 int operand_scale() const { return operand_scale_; } |
| 207 |
| 187 Bytecode bytecode_; | 208 Bytecode bytecode_; |
| 209 int operand_scale_; |
| 188 CodeStubAssembler::Variable accumulator_; | 210 CodeStubAssembler::Variable accumulator_; |
| 189 CodeStubAssembler::Variable context_; | 211 CodeStubAssembler::Variable context_; |
| 190 CodeStubAssembler::Variable bytecode_array_; | 212 CodeStubAssembler::Variable bytecode_array_; |
| 191 | 213 |
| 192 bool disable_stack_check_across_call_; | 214 bool disable_stack_check_across_call_; |
| 193 compiler::Node* stack_pointer_before_call_; | 215 compiler::Node* stack_pointer_before_call_; |
| 194 | 216 |
| 195 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); | 217 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); |
| 196 }; | 218 }; |
| 197 | 219 |
| 198 } // namespace interpreter | 220 } // namespace interpreter |
| 199 } // namespace internal | 221 } // namespace internal |
| 200 } // namespace v8 | 222 } // namespace v8 |
| 201 | 223 |
| 202 #endif // V8_INTERPRETER_INTERPRETER_ASSEMBLER_H_ | 224 #endif // V8_INTERPRETER_INTERPRETER_ASSEMBLER_H_ |
| OLD | NEW |