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" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 compiler::Node* arg_count); | 101 compiler::Node* arg_count); |
102 | 102 |
103 // Call runtime function with |arg_count| arguments and the first argument | 103 // Call runtime function with |arg_count| arguments and the first argument |
104 // located at |first_arg|. | 104 // located at |first_arg|. |
105 compiler::Node* CallRuntimeN(compiler::Node* function_id, | 105 compiler::Node* CallRuntimeN(compiler::Node* function_id, |
106 compiler::Node* context, | 106 compiler::Node* context, |
107 compiler::Node* first_arg, | 107 compiler::Node* first_arg, |
108 compiler::Node* arg_count, int return_size = 1); | 108 compiler::Node* arg_count, int return_size = 1); |
109 | 109 |
110 // Jump relative to the current bytecode by |jump_offset|. | 110 // Jump relative to the current bytecode by |jump_offset|. |
111 void Jump(compiler::Node* jump_offset); | 111 compiler::Node* Jump(compiler::Node* jump_offset); |
112 | 112 |
113 // Jump relative to the current bytecode by |jump_offset| if the | 113 // Jump relative to the current bytecode by |jump_offset| if the |
114 // |condition| is true. Helper function for JumpIfWordEqual and | 114 // |condition| is true. Helper function for JumpIfWordEqual and |
115 // JumpIfWordNotEqual. | 115 // JumpIfWordNotEqual. |
116 void JumpConditional(compiler::Node* condition, compiler::Node* jump_offset); | 116 void JumpConditional(compiler::Node* condition, compiler::Node* jump_offset); |
117 | 117 |
118 // Jump relative to the current bytecode by |jump_offset| if the | 118 // Jump relative to the current bytecode by |jump_offset| if the |
119 // word values |lhs| and |rhs| are equal. | 119 // word values |lhs| and |rhs| are equal. |
120 void JumpIfWordEqual(compiler::Node* lhs, compiler::Node* rhs, | 120 void JumpIfWordEqual(compiler::Node* lhs, compiler::Node* rhs, |
121 compiler::Node* jump_offset); | 121 compiler::Node* jump_offset); |
122 | 122 |
123 // Jump relative to the current bytecode by |jump_offset| if the | 123 // Jump relative to the current bytecode by |jump_offset| if the |
124 // word values |lhs| and |rhs| are not equal. | 124 // word values |lhs| and |rhs| are not equal. |
125 void JumpIfWordNotEqual(compiler::Node* lhs, compiler::Node* rhs, | 125 void JumpIfWordNotEqual(compiler::Node* lhs, compiler::Node* rhs, |
126 compiler::Node* jump_offset); | 126 compiler::Node* jump_offset); |
127 | 127 |
128 // Perform a stack guard check. | 128 // Perform a stack guard check. |
129 void StackCheck(); | 129 void StackCheck(); |
130 | 130 |
131 // Returns from the function. | 131 // Returns from the function. |
132 void InterpreterReturn(); | 132 compiler::Node* InterpreterReturn(); |
133 | 133 |
134 // Dispatch to the bytecode. | 134 // Dispatch to the bytecode. |
135 void Dispatch(); | 135 compiler::Node* Dispatch(); |
136 | 136 |
137 // Dispatch to bytecode handler. | 137 // Dispatch to bytecode handler. |
138 void DispatchToBytecodeHandler(compiler::Node* handler) { | 138 compiler::Node* DispatchToBytecodeHandler(compiler::Node* handler) { |
139 DispatchToBytecodeHandler(handler, BytecodeOffset()); | 139 return DispatchToBytecodeHandler(handler, BytecodeOffset()); |
140 } | 140 } |
141 | 141 |
142 // Dispatch bytecode as wide operand variant. | 142 // Dispatch bytecode as wide operand variant. |
143 void DispatchWide(OperandScale operand_scale); | 143 void DispatchWide(OperandScale operand_scale); |
144 | 144 |
145 // Abort with the given bailout reason. | 145 // Abort with the given bailout reason. |
146 void Abort(BailoutReason bailout_reason); | 146 void Abort(BailoutReason bailout_reason); |
147 | 147 |
148 protected: | 148 protected: |
149 Bytecode bytecode() const { return bytecode_; } | 149 Bytecode bytecode() const { return bytecode_; } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 OperandSize operand_size); | 202 OperandSize operand_size); |
203 compiler::Node* BytecodeUnsignedOperand(int operand_index, | 203 compiler::Node* BytecodeUnsignedOperand(int operand_index, |
204 OperandSize operand_size); | 204 OperandSize operand_size); |
205 | 205 |
206 // Returns BytecodeOffset() advanced by delta bytecodes. Note: this does not | 206 // Returns BytecodeOffset() advanced by delta bytecodes. Note: this does not |
207 // update BytecodeOffset() itself. | 207 // update BytecodeOffset() itself. |
208 compiler::Node* Advance(int delta); | 208 compiler::Node* Advance(int delta); |
209 compiler::Node* Advance(compiler::Node* delta); | 209 compiler::Node* Advance(compiler::Node* delta); |
210 | 210 |
211 // Starts next instruction dispatch at |new_bytecode_offset|. | 211 // Starts next instruction dispatch at |new_bytecode_offset|. |
212 void DispatchTo(compiler::Node* new_bytecode_offset); | 212 compiler::Node* DispatchTo(compiler::Node* new_bytecode_offset); |
213 | 213 |
214 // Dispatch to the bytecode handler with code offset |handler|. | 214 // Dispatch to the bytecode handler with code offset |handler|. |
215 void DispatchToBytecodeHandler(compiler::Node* handler, | 215 compiler::Node* DispatchToBytecodeHandler(compiler::Node* handler, |
216 compiler::Node* bytecode_offset); | 216 compiler::Node* bytecode_offset); |
217 | 217 |
218 // Dispatch to the bytecode handler with code entry point |handler_entry|. | 218 // Dispatch to the bytecode handler with code entry point |handler_entry|. |
219 void DispatchToBytecodeHandlerEntry(compiler::Node* handler_entry, | 219 compiler::Node* DispatchToBytecodeHandlerEntry( |
220 compiler::Node* bytecode_offset); | 220 compiler::Node* handler_entry, compiler::Node* bytecode_offset); |
221 | 221 |
222 // Abort operations for debug code. | 222 // Abort operations for debug code. |
223 void AbortIfWordNotEqual(compiler::Node* lhs, compiler::Node* rhs, | 223 void AbortIfWordNotEqual(compiler::Node* lhs, compiler::Node* rhs, |
224 BailoutReason bailout_reason); | 224 BailoutReason bailout_reason); |
225 | 225 |
226 OperandScale operand_scale() const { return operand_scale_; } | 226 OperandScale operand_scale() const { return operand_scale_; } |
227 | 227 |
228 Bytecode bytecode_; | 228 Bytecode bytecode_; |
229 OperandScale operand_scale_; | 229 OperandScale operand_scale_; |
230 CodeStubAssembler::Variable accumulator_; | 230 CodeStubAssembler::Variable accumulator_; |
231 AccumulatorUse accumulator_use_; | 231 AccumulatorUse accumulator_use_; |
232 bool made_call_; | 232 bool made_call_; |
233 | 233 |
234 bool disable_stack_check_across_call_; | 234 bool disable_stack_check_across_call_; |
235 compiler::Node* stack_pointer_before_call_; | 235 compiler::Node* stack_pointer_before_call_; |
236 | 236 |
237 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); | 237 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); |
238 }; | 238 }; |
239 | 239 |
240 } // namespace interpreter | 240 } // namespace interpreter |
241 } // namespace internal | 241 } // namespace internal |
242 } // namespace v8 | 242 } // namespace v8 |
243 | 243 |
244 #endif // V8_INTERPRETER_INTERPRETER_ASSEMBLER_H_ | 244 #endif // V8_INTERPRETER_INTERPRETER_ASSEMBLER_H_ |
OLD | NEW |