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/builtins/builtins.h" | 9 #include "src/builtins/builtins.h" |
10 #include "src/code-stub-assembler.h" | 10 #include "src/code-stub-assembler.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 compiler::Node* BytecodeOperandFlag(int operand_index); | 32 compiler::Node* BytecodeOperandFlag(int operand_index); |
33 // Returns the 32-bit zero-extended index immediate for bytecode operand | 33 // Returns the 32-bit zero-extended index immediate for bytecode operand |
34 // |operand_index| in the current bytecode. | 34 // |operand_index| in the current bytecode. |
35 compiler::Node* BytecodeOperandIdx(int operand_index); | 35 compiler::Node* BytecodeOperandIdx(int operand_index); |
36 // Returns the smi index immediate for bytecode operand |operand_index| | 36 // Returns the smi index immediate for bytecode operand |operand_index| |
37 // in the current bytecode. | 37 // in the current bytecode. |
38 compiler::Node* BytecodeOperandIdxSmi(int operand_index); | 38 compiler::Node* BytecodeOperandIdxSmi(int operand_index); |
39 // Returns the 32-bit unsigned immediate for bytecode operand |operand_index| | 39 // Returns the 32-bit unsigned immediate for bytecode operand |operand_index| |
40 // in the current bytecode. | 40 // in the current bytecode. |
41 compiler::Node* BytecodeOperandUImm(int operand_index); | 41 compiler::Node* BytecodeOperandUImm(int operand_index); |
| 42 // Returns the word-size unsigned immediate for bytecode operand |
| 43 // |operand_index| in the current bytecode. |
| 44 compiler::Node* BytecodeOperandUImmWord(int operand_index); |
42 // Returns the 32-bit signed immediate for bytecode operand |operand_index| | 45 // Returns the 32-bit signed immediate for bytecode operand |operand_index| |
43 // in the current bytecode. | 46 // in the current bytecode. |
44 compiler::Node* BytecodeOperandImm(int operand_index); | 47 compiler::Node* BytecodeOperandImm(int operand_index); |
45 // Returns the word-size signed immediate for bytecode operand |operand_index| | 48 // Returns the word-size signed immediate for bytecode operand |operand_index| |
46 // in the current bytecode. | 49 // in the current bytecode. |
47 compiler::Node* BytecodeOperandImmIntPtr(int operand_index); | 50 compiler::Node* BytecodeOperandImmIntPtr(int operand_index); |
48 // Returns the smi immediate for bytecode operand |operand_index| in the | 51 // Returns the smi immediate for bytecode operand |operand_index| in the |
49 // current bytecode. | 52 // current bytecode. |
50 compiler::Node* BytecodeOperandImmSmi(int operand_index); | 53 compiler::Node* BytecodeOperandImmSmi(int operand_index); |
51 // Returns the word-size sign-extended register index for bytecode operand | 54 // Returns the word-size sign-extended register index for bytecode operand |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 compiler::Node* first_arg, | 163 compiler::Node* first_arg, |
161 compiler::Node* arg_count); | 164 compiler::Node* arg_count); |
162 | 165 |
163 // Call runtime function with |arg_count| arguments and the first argument | 166 // Call runtime function with |arg_count| arguments and the first argument |
164 // located at |first_arg|. | 167 // located at |first_arg|. |
165 compiler::Node* CallRuntimeN(compiler::Node* function_id, | 168 compiler::Node* CallRuntimeN(compiler::Node* function_id, |
166 compiler::Node* context, | 169 compiler::Node* context, |
167 compiler::Node* first_arg, | 170 compiler::Node* first_arg, |
168 compiler::Node* arg_count, int return_size = 1); | 171 compiler::Node* arg_count, int return_size = 1); |
169 | 172 |
170 // Jump relative to the current bytecode by |jump_offset|. | 173 // Jump forward relative to the current bytecode by the |jump_offset|. |
171 compiler::Node* Jump(compiler::Node* jump_offset); | 174 compiler::Node* Jump(compiler::Node* jump_offset); |
172 | 175 |
173 // Jump relative to the current bytecode by |jump_offset| if the | 176 // Jump backward relative to the current bytecode by the |jump_offset|. |
| 177 compiler::Node* JumpBackward(compiler::Node* jump_offset); |
| 178 |
| 179 // Jump forward relative to the current bytecode by |jump_offset| if the |
174 // word values |lhs| and |rhs| are equal. | 180 // word values |lhs| and |rhs| are equal. |
175 void JumpIfWordEqual(compiler::Node* lhs, compiler::Node* rhs, | 181 void JumpIfWordEqual(compiler::Node* lhs, compiler::Node* rhs, |
176 compiler::Node* jump_offset); | 182 compiler::Node* jump_offset); |
177 | 183 |
178 // Jump relative to the current bytecode by |jump_offset| if the | 184 // Jump forward relative to the current bytecode by |jump_offset| if the |
179 // word values |lhs| and |rhs| are not equal. | 185 // word values |lhs| and |rhs| are not equal. |
180 void JumpIfWordNotEqual(compiler::Node* lhs, compiler::Node* rhs, | 186 void JumpIfWordNotEqual(compiler::Node* lhs, compiler::Node* rhs, |
181 compiler::Node* jump_offset); | 187 compiler::Node* jump_offset); |
182 | 188 |
183 // Returns true if the stack guard check triggers an interrupt. | 189 // Returns true if the stack guard check triggers an interrupt. |
184 compiler::Node* StackCheckTriggeredInterrupt(); | 190 compiler::Node* StackCheckTriggeredInterrupt(); |
185 | 191 |
186 // Updates the profiler interrupt budget for a return. | 192 // Updates the profiler interrupt budget for a return. |
187 void UpdateInterruptBudgetOnReturn(); | 193 void UpdateInterruptBudgetOnReturn(); |
188 | 194 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // frame when performing a call. | 244 // frame when performing a call. |
239 void CallPrologue(); | 245 void CallPrologue(); |
240 void CallEpilogue(); | 246 void CallEpilogue(); |
241 | 247 |
242 // Increment the dispatch counter for the (current, next) bytecode pair. | 248 // Increment the dispatch counter for the (current, next) bytecode pair. |
243 void TraceBytecodeDispatch(compiler::Node* target_index); | 249 void TraceBytecodeDispatch(compiler::Node* target_index); |
244 | 250 |
245 // Traces the current bytecode by calling |function_id|. | 251 // Traces the current bytecode by calling |function_id|. |
246 void TraceBytecode(Runtime::FunctionId function_id); | 252 void TraceBytecode(Runtime::FunctionId function_id); |
247 | 253 |
248 // Updates the bytecode array's interrupt budget by a 32-bit signed |weight| | 254 // Updates the bytecode array's interrupt budget by a 32-bit unsigned |weight| |
249 // and calls Runtime::kInterrupt if counter reaches zero. | 255 // and calls Runtime::kInterrupt if counter reaches zero. If |backward|, then |
250 void UpdateInterruptBudget(compiler::Node* weight); | 256 // the interrupt budget is decremented, otherwise it is incremented. |
| 257 void UpdateInterruptBudget(compiler::Node* weight, bool backward); |
251 | 258 |
252 // Returns the offset of register |index| relative to RegisterFilePointer(). | 259 // Returns the offset of register |index| relative to RegisterFilePointer(). |
253 compiler::Node* RegisterFrameOffset(compiler::Node* index); | 260 compiler::Node* RegisterFrameOffset(compiler::Node* index); |
254 | 261 |
255 // Returns the offset of an operand relative to the current bytecode offset. | 262 // Returns the offset of an operand relative to the current bytecode offset. |
256 compiler::Node* OperandOffset(int operand_index); | 263 compiler::Node* OperandOffset(int operand_index); |
257 | 264 |
258 // Returns a value built from an sequence of bytes in the bytecode | 265 // Returns a value built from an sequence of bytes in the bytecode |
259 // array starting at |relative_offset| from the current bytecode. | 266 // array starting at |relative_offset| from the current bytecode. |
260 // The |result_type| determines the size and signedness. of the | 267 // The |result_type| determines the size and signedness. of the |
(...skipping 10 matching lines...) Expand all Loading... |
271 compiler::Node* BytecodeOperandUnsignedQuad(int operand_index); | 278 compiler::Node* BytecodeOperandUnsignedQuad(int operand_index); |
272 compiler::Node* BytecodeOperandSignedQuad(int operand_index); | 279 compiler::Node* BytecodeOperandSignedQuad(int operand_index); |
273 | 280 |
274 // Returns zero- or sign-extended to word32 value of the operand of | 281 // Returns zero- or sign-extended to word32 value of the operand of |
275 // given size. | 282 // given size. |
276 compiler::Node* BytecodeSignedOperand(int operand_index, | 283 compiler::Node* BytecodeSignedOperand(int operand_index, |
277 OperandSize operand_size); | 284 OperandSize operand_size); |
278 compiler::Node* BytecodeUnsignedOperand(int operand_index, | 285 compiler::Node* BytecodeUnsignedOperand(int operand_index, |
279 OperandSize operand_size); | 286 OperandSize operand_size); |
280 | 287 |
281 // Jump relative to the current bytecode by |jump_offset| if the | 288 // Jump relative to the current bytecode by the |jump_offset|. If |backward|, |
| 289 // then jump backward (subtract the offset), otherwise jump forward (add the |
| 290 // offset). Helper function for Jump and JumpBackward. |
| 291 compiler::Node* Jump(compiler::Node* jump_offset, bool backward); |
| 292 |
| 293 // Jump forward relative to the current bytecode by |jump_offset| if the |
282 // |condition| is true. Helper function for JumpIfWordEqual and | 294 // |condition| is true. Helper function for JumpIfWordEqual and |
283 // JumpIfWordNotEqual. | 295 // JumpIfWordNotEqual. |
284 void JumpConditional(compiler::Node* condition, compiler::Node* jump_offset); | 296 void JumpConditional(compiler::Node* condition, compiler::Node* jump_offset); |
285 | 297 |
286 // Updates and returns BytecodeOffset() advanced by the current bytecode's | 298 // Updates and returns BytecodeOffset() advanced by the current bytecode's |
287 // size. Traces the exit of the current bytecode. | 299 // size. Traces the exit of the current bytecode. |
288 compiler::Node* Advance(); | 300 compiler::Node* Advance(); |
289 | 301 |
290 // Updates and returns BytecodeOffset() advanced by delta bytecodes. | 302 // Updates and returns BytecodeOffset() advanced by delta bytecodes. |
291 // Traces the exit of the current bytecode. | 303 // Traces the exit of the current bytecode. |
292 compiler::Node* Advance(int delta); | 304 compiler::Node* Advance(int delta); |
293 compiler::Node* Advance(compiler::Node* delta); | 305 compiler::Node* Advance(compiler::Node* delta, bool backward = false); |
294 | 306 |
295 // Load the bytecode at |bytecode_offset|. | 307 // Load the bytecode at |bytecode_offset|. |
296 compiler::Node* LoadBytecode(compiler::Node* bytecode_offset); | 308 compiler::Node* LoadBytecode(compiler::Node* bytecode_offset); |
297 | 309 |
298 // Look ahead for Star and inline it in a branch. Returns a new target | 310 // Look ahead for Star and inline it in a branch. Returns a new target |
299 // bytecode node for dispatch. | 311 // bytecode node for dispatch. |
300 compiler::Node* StarDispatchLookahead(compiler::Node* target_bytecode); | 312 compiler::Node* StarDispatchLookahead(compiler::Node* target_bytecode); |
301 | 313 |
302 // Build code for Star at the current BytecodeOffset() and Advance() to the | 314 // Build code for Star at the current BytecodeOffset() and Advance() to the |
303 // next dispatch offset. | 315 // next dispatch offset. |
(...skipping 26 matching lines...) Expand all Loading... |
330 compiler::Node* stack_pointer_before_call_; | 342 compiler::Node* stack_pointer_before_call_; |
331 | 343 |
332 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); | 344 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); |
333 }; | 345 }; |
334 | 346 |
335 } // namespace interpreter | 347 } // namespace interpreter |
336 } // namespace internal | 348 } // namespace internal |
337 } // namespace v8 | 349 } // namespace v8 |
338 | 350 |
339 #endif // V8_INTERPRETER_INTERPRETER_ASSEMBLER_H_ | 351 #endif // V8_INTERPRETER_INTERPRETER_ASSEMBLER_H_ |
OLD | NEW |