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/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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 compiler::Node* slot_id, | 145 compiler::Node* slot_id, |
| 143 compiler::Node* type_feedback_vector); | 146 compiler::Node* type_feedback_vector); |
| 144 | 147 |
| 145 // Call runtime function with |arg_count| arguments and the first argument | 148 // Call runtime function with |arg_count| arguments and the first argument |
| 146 // located at |first_arg|. | 149 // located at |first_arg|. |
| 147 compiler::Node* CallRuntimeN(compiler::Node* function_id, | 150 compiler::Node* CallRuntimeN(compiler::Node* function_id, |
| 148 compiler::Node* context, | 151 compiler::Node* context, |
| 149 compiler::Node* first_arg, | 152 compiler::Node* first_arg, |
| 150 compiler::Node* arg_count, int return_size = 1); | 153 compiler::Node* arg_count, int return_size = 1); |
| 151 | 154 |
| 152 // Jump relative to the current bytecode by |jump_offset|. | 155 // Jump relative to the current bytecode by the unsigned |jump_offset|. If |
| 153 compiler::Node* Jump(compiler::Node* jump_offset); | 156 // |backwards|, then jump backwards, otherwise jump forwards. |
| 157 compiler::Node* Jump(compiler::Node* jump_offset, bool backwards = false); | |
|
rmcilroy
2017/01/19 09:22:38
Nit, could you just make this a seperate JumpBackw
Leszek Swirski
2017/01/19 10:52:59
Done, though this function still exists (private)
| |
| 154 | 158 |
| 155 // Jump relative to the current bytecode by |jump_offset| if the | 159 // Jump forward relative to the current bytecode by |jump_offset| if the |
| 156 // word values |lhs| and |rhs| are equal. | 160 // word values |lhs| and |rhs| are equal. |
| 157 void JumpIfWordEqual(compiler::Node* lhs, compiler::Node* rhs, | 161 void JumpIfWordEqual(compiler::Node* lhs, compiler::Node* rhs, |
| 158 compiler::Node* jump_offset); | 162 compiler::Node* jump_offset); |
| 159 | 163 |
| 160 // Jump relative to the current bytecode by |jump_offset| if the | 164 // Jump forward relative to the current bytecode by |jump_offset| if the |
| 161 // word values |lhs| and |rhs| are not equal. | 165 // word values |lhs| and |rhs| are not equal. |
| 162 void JumpIfWordNotEqual(compiler::Node* lhs, compiler::Node* rhs, | 166 void JumpIfWordNotEqual(compiler::Node* lhs, compiler::Node* rhs, |
| 163 compiler::Node* jump_offset); | 167 compiler::Node* jump_offset); |
| 164 | 168 |
| 165 // Returns true if the stack guard check triggers an interrupt. | 169 // Returns true if the stack guard check triggers an interrupt. |
| 166 compiler::Node* StackCheckTriggeredInterrupt(); | 170 compiler::Node* StackCheckTriggeredInterrupt(); |
| 167 | 171 |
| 168 // Updates the profiler interrupt budget for a return. | 172 // Updates the profiler interrupt budget for a return. |
| 169 void UpdateInterruptBudgetOnReturn(); | 173 void UpdateInterruptBudgetOnReturn(); |
| 170 | 174 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 // frame when performing a call. | 224 // frame when performing a call. |
| 221 void CallPrologue(); | 225 void CallPrologue(); |
| 222 void CallEpilogue(); | 226 void CallEpilogue(); |
| 223 | 227 |
| 224 // Increment the dispatch counter for the (current, next) bytecode pair. | 228 // Increment the dispatch counter for the (current, next) bytecode pair. |
| 225 void TraceBytecodeDispatch(compiler::Node* target_index); | 229 void TraceBytecodeDispatch(compiler::Node* target_index); |
| 226 | 230 |
| 227 // Traces the current bytecode by calling |function_id|. | 231 // Traces the current bytecode by calling |function_id|. |
| 228 void TraceBytecode(Runtime::FunctionId function_id); | 232 void TraceBytecode(Runtime::FunctionId function_id); |
| 229 | 233 |
| 230 // Updates the bytecode array's interrupt budget by a 32-bit signed |weight| | 234 // Updates the bytecode array's interrupt budget by a 32-bit unsigned |weight| |
| 231 // and calls Runtime::kInterrupt if counter reaches zero. | 235 // and calls Runtime::kInterrupt if counter reaches zero. If |backwards|, then |
| 232 void UpdateInterruptBudget(compiler::Node* weight); | 236 // the interrupt budget is decremented, otherwise it is incremented. |
| 237 void UpdateInterruptBudget(compiler::Node* weight, bool backwards); | |
| 233 | 238 |
| 234 // Returns the offset of register |index| relative to RegisterFilePointer(). | 239 // Returns the offset of register |index| relative to RegisterFilePointer(). |
| 235 compiler::Node* RegisterFrameOffset(compiler::Node* index); | 240 compiler::Node* RegisterFrameOffset(compiler::Node* index); |
| 236 | 241 |
| 237 // Returns the offset of an operand relative to the current bytecode offset. | 242 // Returns the offset of an operand relative to the current bytecode offset. |
| 238 compiler::Node* OperandOffset(int operand_index); | 243 compiler::Node* OperandOffset(int operand_index); |
| 239 | 244 |
| 240 // Returns a value built from an sequence of bytes in the bytecode | 245 // Returns a value built from an sequence of bytes in the bytecode |
| 241 // array starting at |relative_offset| from the current bytecode. | 246 // array starting at |relative_offset| from the current bytecode. |
| 242 // The |result_type| determines the size and signedness. of the | 247 // The |result_type| determines the size and signedness. of the |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 253 compiler::Node* BytecodeOperandUnsignedQuad(int operand_index); | 258 compiler::Node* BytecodeOperandUnsignedQuad(int operand_index); |
| 254 compiler::Node* BytecodeOperandSignedQuad(int operand_index); | 259 compiler::Node* BytecodeOperandSignedQuad(int operand_index); |
| 255 | 260 |
| 256 // Returns zero- or sign-extended to word32 value of the operand of | 261 // Returns zero- or sign-extended to word32 value of the operand of |
| 257 // given size. | 262 // given size. |
| 258 compiler::Node* BytecodeSignedOperand(int operand_index, | 263 compiler::Node* BytecodeSignedOperand(int operand_index, |
| 259 OperandSize operand_size); | 264 OperandSize operand_size); |
| 260 compiler::Node* BytecodeUnsignedOperand(int operand_index, | 265 compiler::Node* BytecodeUnsignedOperand(int operand_index, |
| 261 OperandSize operand_size); | 266 OperandSize operand_size); |
| 262 | 267 |
| 263 // Jump relative to the current bytecode by |jump_offset| if the | 268 // Jump forward relative to the current bytecode by |jump_offset| if the |
| 264 // |condition| is true. Helper function for JumpIfWordEqual and | 269 // |condition| is true. Helper function for JumpIfWordEqual and |
| 265 // JumpIfWordNotEqual. | 270 // JumpIfWordNotEqual. |
| 266 void JumpConditional(compiler::Node* condition, compiler::Node* jump_offset); | 271 void JumpConditional(compiler::Node* condition, compiler::Node* jump_offset); |
| 267 | 272 |
| 268 // Updates and returns BytecodeOffset() advanced by the current bytecode's | 273 // Updates and returns BytecodeOffset() advanced by the current bytecode's |
| 269 // size. Traces the exit of the current bytecode. | 274 // size. Traces the exit of the current bytecode. |
| 270 compiler::Node* Advance(); | 275 compiler::Node* Advance(); |
| 271 | 276 |
| 272 // Updates and returns BytecodeOffset() advanced by delta bytecodes. | 277 // Updates and returns BytecodeOffset() advanced by delta bytecodes. |
| 273 // Traces the exit of the current bytecode. | 278 // Traces the exit of the current bytecode. |
| 274 compiler::Node* Advance(int delta); | 279 compiler::Node* Advance(int delta); |
| 275 compiler::Node* Advance(compiler::Node* delta); | 280 compiler::Node* Advance(compiler::Node* delta, bool backwards = false); |
| 276 | 281 |
| 277 // Load the bytecode at |bytecode_offset|. | 282 // Load the bytecode at |bytecode_offset|. |
| 278 compiler::Node* LoadBytecode(compiler::Node* bytecode_offset); | 283 compiler::Node* LoadBytecode(compiler::Node* bytecode_offset); |
| 279 | 284 |
| 280 // Look ahead for Star and inline it in a branch. Returns a new target | 285 // Look ahead for Star and inline it in a branch. Returns a new target |
| 281 // bytecode node for dispatch. | 286 // bytecode node for dispatch. |
| 282 compiler::Node* StarDispatchLookahead(compiler::Node* target_bytecode); | 287 compiler::Node* StarDispatchLookahead(compiler::Node* target_bytecode); |
| 283 | 288 |
| 284 // Build code for Star at the current BytecodeOffset() and Advance() to the | 289 // Build code for Star at the current BytecodeOffset() and Advance() to the |
| 285 // next dispatch offset. | 290 // next dispatch offset. |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 312 compiler::Node* stack_pointer_before_call_; | 317 compiler::Node* stack_pointer_before_call_; |
| 313 | 318 |
| 314 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); | 319 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); |
| 315 }; | 320 }; |
| 316 | 321 |
| 317 } // namespace interpreter | 322 } // namespace interpreter |
| 318 } // namespace internal | 323 } // namespace internal |
| 319 } // namespace v8 | 324 } // namespace v8 |
| 320 | 325 |
| 321 #endif // V8_INTERPRETER_INTERPRETER_ASSEMBLER_H_ | 326 #endif // V8_INTERPRETER_INTERPRETER_ASSEMBLER_H_ |
| OLD | NEW |