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_COMPILER_INTERPRETER_ASSEMBLER_H_ | 5 #ifndef V8_COMPILER_INTERPRETER_ASSEMBLER_H_ |
6 #define V8_COMPILER_INTERPRETER_ASSEMBLER_H_ | 6 #define V8_COMPILER_INTERPRETER_ASSEMBLER_H_ |
7 | 7 |
8 // Clients of this interface shouldn't depend on lots of compiler internals. | 8 // Clients of this interface shouldn't depend on lots of compiler internals. |
9 // Do not include anything from src/compiler here! | 9 // Do not include anything from src/compiler here! |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 class InterpreterAssembler { | 34 class InterpreterAssembler { |
35 public: | 35 public: |
36 InterpreterAssembler(Isolate* isolate, Zone* zone, | 36 InterpreterAssembler(Isolate* isolate, Zone* zone, |
37 interpreter::Bytecode bytecode); | 37 interpreter::Bytecode bytecode); |
38 virtual ~InterpreterAssembler(); | 38 virtual ~InterpreterAssembler(); |
39 | 39 |
40 Handle<Code> GenerateCode(); | 40 Handle<Code> GenerateCode(); |
41 | 41 |
42 // Returns the count immediate for bytecode operand |operand_index| in the | 42 // Returns the count immediate for bytecode operand |operand_index| in the |
43 // current bytecode. | 43 // current bytecode. |
44 Node* BytecodeOperandCount(int operand_index); | 44 Node* BytecodeOperandCount8(int operand_index); |
45 // Returns the index immediate for bytecode operand |operand_index| in the | 45 // Returns the index immediate for bytecode operand |operand_index| in the |
46 // current bytecode. | 46 // current bytecode. |
47 Node* BytecodeOperandIdx(int operand_index); | 47 Node* BytecodeOperandIdx8(int operand_index); |
48 // Returns the Imm8 immediate for bytecode operand |operand_index| in the | 48 // Returns the Imm8 immediate for bytecode operand |operand_index| in the |
49 // current bytecode. | 49 // current bytecode. |
50 Node* BytecodeOperandImm8(int operand_index); | 50 Node* BytecodeOperandImm8(int operand_index); |
51 // Returns the register index for bytecode operand |operand_index| in the | 51 // Returns the register index for bytecode operand |operand_index| in the |
52 // current bytecode. | 52 // current bytecode. |
53 Node* BytecodeOperandReg(int operand_index); | 53 Node* BytecodeOperandReg8(int operand_index); |
| 54 |
| 55 // Returns the index immediate for the short (16 bit) bytecode operand |
| 56 // |operand_index| in the current bytecode. |
| 57 Node* BytecodeOperandIdx16(int operand_index); |
54 | 58 |
55 // Accumulator. | 59 // Accumulator. |
56 Node* GetAccumulator(); | 60 Node* GetAccumulator(); |
57 void SetAccumulator(Node* value); | 61 void SetAccumulator(Node* value); |
58 | 62 |
59 // Loads from and stores to the interpreter register file. | 63 // Loads from and stores to the interpreter register file. |
60 Node* LoadRegister(Node* reg_index); | 64 Node* LoadRegister(Node* reg_index); |
61 Node* StoreRegister(Node* value, Node* reg_index); | 65 Node* StoreRegister(Node* value, Node* reg_index); |
62 | 66 |
63 // Returns the location in memory of the register |reg_index| in the | 67 // Returns the location in memory of the register |reg_index| in the |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // Returns from the function. | 123 // Returns from the function. |
120 void Return(); | 124 void Return(); |
121 | 125 |
122 // Dispatch to the bytecode. | 126 // Dispatch to the bytecode. |
123 void Dispatch(); | 127 void Dispatch(); |
124 | 128 |
125 protected: | 129 protected: |
126 // Close the graph. | 130 // Close the graph. |
127 void End(); | 131 void End(); |
128 | 132 |
| 133 static bool TargetSupportsUnalignedAccess(); |
| 134 |
129 // Protected helpers (for testing) which delegate to RawMachineAssembler. | 135 // Protected helpers (for testing) which delegate to RawMachineAssembler. |
130 CallDescriptor* call_descriptor() const; | 136 CallDescriptor* call_descriptor() const; |
131 Graph* graph(); | 137 Graph* graph(); |
132 | 138 |
133 private: | 139 private: |
134 // Returns a raw pointer to start of the register file on the stack. | 140 // Returns a raw pointer to start of the register file on the stack. |
135 Node* RegisterFileRawPointer(); | 141 Node* RegisterFileRawPointer(); |
136 // Returns a tagged pointer to the current function's BytecodeArray object. | 142 // Returns a tagged pointer to the current function's BytecodeArray object. |
137 Node* BytecodeArrayTaggedPointer(); | 143 Node* BytecodeArrayTaggedPointer(); |
138 // Returns the offset from the BytecodeArrayPointer of the current bytecode. | 144 // Returns the offset from the BytecodeArrayPointer of the current bytecode. |
139 Node* BytecodeOffset(); | 145 Node* BytecodeOffset(); |
140 // Returns a raw pointer to first entry in the interpreter dispatch table. | 146 // Returns a raw pointer to first entry in the interpreter dispatch table. |
141 Node* DispatchTableRawPointer(); | 147 Node* DispatchTableRawPointer(); |
142 // Returns a tagged pointer to the current context. | 148 // Returns a tagged pointer to the current context. |
143 Node* ContextTaggedPointer(); | 149 Node* ContextTaggedPointer(); |
144 | 150 |
145 // Returns the offset of register |index| relative to RegisterFilePointer(). | 151 // Returns the offset of register |index| relative to RegisterFilePointer(). |
146 Node* RegisterFrameOffset(Node* index); | 152 Node* RegisterFrameOffset(Node* index); |
147 | 153 |
148 Node* SmiShiftBitsConstant(); | 154 Node* SmiShiftBitsConstant(); |
149 Node* BytecodeOperand(int operand_index); | 155 Node* BytecodeOperand(int operand_index); |
150 Node* BytecodeOperandSignExtended(int operand_index); | 156 Node* BytecodeOperandSignExtended(int operand_index); |
| 157 Node* BytecodeOperandShort(int operand_index); |
151 | 158 |
152 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node** args); | 159 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node** args); |
153 Node* CallJSBuiltin(int context_index, Node* receiver, Node** js_args, | 160 Node* CallJSBuiltin(int context_index, Node* receiver, Node** js_args, |
154 int js_arg_count); | 161 int js_arg_count); |
155 | 162 |
156 // Returns BytecodeOffset() advanced by delta bytecodes. Note: this does not | 163 // Returns BytecodeOffset() advanced by delta bytecodes. Note: this does not |
157 // update BytecodeOffset() itself. | 164 // update BytecodeOffset() itself. |
158 Node* Advance(int delta); | 165 Node* Advance(int delta); |
159 Node* Advance(Node* delta); | 166 Node* Advance(Node* delta); |
160 | 167 |
(...skipping 15 matching lines...) Expand all Loading... |
176 bool code_generated_; | 183 bool code_generated_; |
177 | 184 |
178 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); | 185 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); |
179 }; | 186 }; |
180 | 187 |
181 } // namespace compiler | 188 } // namespace compiler |
182 } // namespace internal | 189 } // namespace internal |
183 } // namespace v8 | 190 } // namespace v8 |
184 | 191 |
185 #endif // V8_COMPILER_INTERPRETER_ASSEMBLER_H_ | 192 #endif // V8_COMPILER_INTERPRETER_ASSEMBLER_H_ |
OLD | NEW |