Chromium Code Reviews| 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. | |
|
rmcilroy
2016/03/10 16:45:37
Could we just add a kIllegal bytecode to avoid hav
oth
2016/03/11 16:26:12
Done.
| |
| 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); |
| 37 | 43 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 // Dispatch to the bytecode. | 135 // Dispatch to the bytecode. |
| 130 void Dispatch(); | 136 void Dispatch(); |
| 131 | 137 |
| 132 // Dispatch to bytecode handler. | 138 // Dispatch to bytecode handler. |
| 133 void DispatchToBytecodeHandler(compiler::Node* handler, | 139 void DispatchToBytecodeHandler(compiler::Node* handler, |
| 134 compiler::Node* bytecode_offset); | 140 compiler::Node* bytecode_offset); |
| 135 void DispatchToBytecodeHandler(compiler::Node* handler) { | 141 void DispatchToBytecodeHandler(compiler::Node* handler) { |
| 136 DispatchToBytecodeHandler(handler, BytecodeOffset()); | 142 DispatchToBytecodeHandler(handler, BytecodeOffset()); |
| 137 } | 143 } |
| 138 | 144 |
| 145 // Dispatch bytecode as wide operand variant. | |
| 146 void RedispatchWide(); | |
|
rmcilroy
2016/03/10 16:45:37
Could we do the logic for this in interpreter.cc a
oth
2016/03/11 16:26:12
No problem moving this, but it seems very similar
oth
2016/03/15 09:58:28
Looking into this, more of the interpreter assembl
rmcilroy
2016/03/16 11:55:54
Ok that's fine. Please rename as DispatchWide thou
oth
2016/03/17 13:48:38
Done.
| |
| 147 | |
| 139 // Abort with the given bailout reason. | 148 // Abort with the given bailout reason. |
| 140 void Abort(BailoutReason bailout_reason); | 149 void Abort(BailoutReason bailout_reason); |
| 141 | 150 |
| 142 protected: | 151 protected: |
| 143 static bool TargetSupportsUnalignedAccess(); | 152 static bool TargetSupportsUnalignedAccess(); |
| 144 | 153 |
| 145 private: | 154 private: |
| 146 // Returns a raw pointer to start of the register file on the stack. | 155 // Returns a raw pointer to start of the register file on the stack. |
| 147 compiler::Node* RegisterFileRawPointer(); | 156 compiler::Node* RegisterFileRawPointer(); |
| 148 // Returns a tagged pointer to the current function's BytecodeArray object. | 157 // 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. | 173 // Runtime::kInterrupt if counter reaches zero. |
| 165 void UpdateInterruptBudget(compiler::Node* weight); | 174 void UpdateInterruptBudget(compiler::Node* weight); |
| 166 | 175 |
| 167 // Returns the offset of register |index| relative to RegisterFilePointer(). | 176 // Returns the offset of register |index| relative to RegisterFilePointer(). |
| 168 compiler::Node* RegisterFrameOffset(compiler::Node* index); | 177 compiler::Node* RegisterFrameOffset(compiler::Node* index); |
| 169 | 178 |
| 170 compiler::Node* BytecodeOperand(int operand_index); | 179 compiler::Node* BytecodeOperand(int operand_index); |
| 171 compiler::Node* BytecodeOperandSignExtended(int operand_index); | 180 compiler::Node* BytecodeOperandSignExtended(int operand_index); |
| 172 compiler::Node* BytecodeOperandShort(int operand_index); | 181 compiler::Node* BytecodeOperandShort(int operand_index); |
| 173 compiler::Node* BytecodeOperandShortSignExtended(int operand_index); | 182 compiler::Node* BytecodeOperandShortSignExtended(int operand_index); |
| 183 compiler::Node* BytecodeOperandQuad(int operand_index); | |
| 184 compiler::Node* BytecodeOperandQuadSignExtended(int operand_index); | |
| 174 | 185 |
| 175 // Returns BytecodeOffset() advanced by delta bytecodes. Note: this does not | 186 // Returns BytecodeOffset() advanced by delta bytecodes. Note: this does not |
| 176 // update BytecodeOffset() itself. | 187 // update BytecodeOffset() itself. |
| 177 compiler::Node* Advance(int delta); | 188 compiler::Node* Advance(int delta); |
| 178 compiler::Node* Advance(compiler::Node* delta); | 189 compiler::Node* Advance(compiler::Node* delta); |
| 179 | 190 |
| 180 // Starts next instruction dispatch at |new_bytecode_offset|. | 191 // Starts next instruction dispatch at |new_bytecode_offset|. |
| 181 void DispatchTo(compiler::Node* new_bytecode_offset); | 192 void DispatchTo(compiler::Node* new_bytecode_offset); |
| 182 | 193 |
| 183 // Abort operations for debug code. | 194 // Abort operations for debug code. |
| 184 void AbortIfWordNotEqual(compiler::Node* lhs, compiler::Node* rhs, | 195 void AbortIfWordNotEqual(compiler::Node* lhs, compiler::Node* rhs, |
| 185 BailoutReason bailout_reason); | 196 BailoutReason bailout_reason); |
| 186 | 197 |
| 198 int operand_scale() const { return operand_scale_; } | |
| 199 | |
| 187 Bytecode bytecode_; | 200 Bytecode bytecode_; |
| 201 int operand_scale_; | |
| 188 CodeStubAssembler::Variable accumulator_; | 202 CodeStubAssembler::Variable accumulator_; |
| 189 CodeStubAssembler::Variable context_; | 203 CodeStubAssembler::Variable context_; |
| 190 CodeStubAssembler::Variable bytecode_array_; | 204 CodeStubAssembler::Variable bytecode_array_; |
| 191 | 205 |
| 192 bool disable_stack_check_across_call_; | 206 bool disable_stack_check_across_call_; |
| 193 compiler::Node* stack_pointer_before_call_; | 207 compiler::Node* stack_pointer_before_call_; |
| 194 | 208 |
| 195 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); | 209 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); |
| 196 }; | 210 }; |
| 197 | 211 |
| 198 } // namespace interpreter | 212 } // namespace interpreter |
| 199 } // namespace internal | 213 } // namespace internal |
| 200 } // namespace v8 | 214 } // namespace v8 |
| 201 | 215 |
| 202 #endif // V8_INTERPRETER_INTERPRETER_ASSEMBLER_H_ | 216 #endif // V8_INTERPRETER_INTERPRETER_ASSEMBLER_H_ |
| OLD | NEW |