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_BYTECODE_ARRAY_BUILDER_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
7 | 7 |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/interpreter/bytecode-register-allocator.h" | 9 #include "src/interpreter/bytecode-register-allocator.h" |
10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 // Pop the current context and replace with |context|. | 157 // Pop the current context and replace with |context|. |
158 BytecodeArrayBuilder& PopContext(Register context); | 158 BytecodeArrayBuilder& PopContext(Register context); |
159 | 159 |
160 // Call a JS function. The JSFunction or Callable to be called should be in | 160 // Call a JS function. The JSFunction or Callable to be called should be in |
161 // |callable|, the receiver should be in |receiver_args| and all subsequent | 161 // |callable|, the receiver should be in |receiver_args| and all subsequent |
162 // arguments should be in registers <receiver_args + 1> to | 162 // arguments should be in registers <receiver_args + 1> to |
163 // <receiver_args + receiver_arg_count - 1>. | 163 // <receiver_args + receiver_arg_count - 1>. |
164 BytecodeArrayBuilder& Call( | 164 BytecodeArrayBuilder& Call( |
165 Register callable, Register receiver_args, size_t receiver_arg_count, | 165 Register callable, Register receiver_args, size_t receiver_arg_count, |
166 TailCallMode tail_call_mode = TailCallMode::kDisallow); | 166 int feedback_slot, TailCallMode tail_call_mode = TailCallMode::kDisallow); |
167 | 167 |
168 BytecodeArrayBuilder& TailCall(Register callable, Register receiver_args, | 168 BytecodeArrayBuilder& TailCall(Register callable, Register receiver_args, |
169 size_t receiver_arg_count) { | 169 size_t receiver_arg_count, int feedback_slot) { |
170 return Call(callable, receiver_args, receiver_arg_count, | 170 return Call(callable, receiver_args, receiver_arg_count, feedback_slot, |
171 TailCallMode::kAllow); | 171 TailCallMode::kAllow); |
172 } | 172 } |
173 | 173 |
174 // Call a JS function. The JSFunction or Callable to be called should be in | |
175 // |callable|, the receiver should be in |receiver_args| and all subsequent | |
176 // arguments should be in registers <receiver_args + 1> to | |
177 // <receiver_args + receiver_arg_count - 1>. | |
178 // Call through CallICStub to get Typefeedback. | |
179 BytecodeArrayBuilder& CallIC(Register callable, Register receiver_args, | |
180 size_t receiver_arg_count, int feedback_slot, | |
181 TailCallMode tail_call_mode); | |
182 | |
183 // Call the new operator. The accumulator holds the |new_target|. | 174 // Call the new operator. The accumulator holds the |new_target|. |
184 // The |constructor| is in a register followed by |arg_count| | 175 // The |constructor| is in a register followed by |arg_count| |
185 // consecutive arguments starting at |first_arg| for the constuctor | 176 // consecutive arguments starting at |first_arg| for the constuctor |
186 // invocation. | 177 // invocation. |
187 | |
188 BytecodeArrayBuilder& New(Register constructor, Register first_arg, | 178 BytecodeArrayBuilder& New(Register constructor, Register first_arg, |
189 size_t arg_count); | 179 size_t arg_count); |
190 | 180 |
191 // Call the runtime function with |function_id|. The first argument should be | 181 // Call the runtime function with |function_id|. The first argument should be |
192 // in |first_arg| and all subsequent arguments should be in registers | 182 // in |first_arg| and all subsequent arguments should be in registers |
193 // <first_arg + 1> to <first_arg + arg_count - 1>. | 183 // <first_arg + 1> to <first_arg + arg_count - 1>. |
194 BytecodeArrayBuilder& CallRuntime(Runtime::FunctionId function_id, | 184 BytecodeArrayBuilder& CallRuntime(Runtime::FunctionId function_id, |
195 Register first_arg, size_t arg_count); | 185 Register first_arg, size_t arg_count); |
196 | 186 |
197 // Call the runtime function with |function_id| that returns a pair of values. | 187 // Call the runtime function with |function_id| that returns a pair of values. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 static Bytecode BytecodeForCompareOperation(Token::Value op); | 281 static Bytecode BytecodeForCompareOperation(Token::Value op); |
292 static Bytecode BytecodeForWideOperands(Bytecode bytecode); | 282 static Bytecode BytecodeForWideOperands(Bytecode bytecode); |
293 static Bytecode BytecodeForStoreIC(LanguageMode language_mode); | 283 static Bytecode BytecodeForStoreIC(LanguageMode language_mode); |
294 static Bytecode BytecodeForKeyedStoreIC(LanguageMode language_mode); | 284 static Bytecode BytecodeForKeyedStoreIC(LanguageMode language_mode); |
295 static Bytecode BytecodeForLoadGlobal(TypeofMode typeof_mode); | 285 static Bytecode BytecodeForLoadGlobal(TypeofMode typeof_mode); |
296 static Bytecode BytecodeForStoreGlobal(LanguageMode language_mode); | 286 static Bytecode BytecodeForStoreGlobal(LanguageMode language_mode); |
297 static Bytecode BytecodeForStoreLookupSlot(LanguageMode language_mode); | 287 static Bytecode BytecodeForStoreLookupSlot(LanguageMode language_mode); |
298 static Bytecode BytecodeForCreateArguments(CreateArgumentsType type); | 288 static Bytecode BytecodeForCreateArguments(CreateArgumentsType type); |
299 static Bytecode BytecodeForDelete(LanguageMode language_mode); | 289 static Bytecode BytecodeForDelete(LanguageMode language_mode); |
300 static Bytecode BytecodeForCall(TailCallMode tail_call_mode); | 290 static Bytecode BytecodeForCall(TailCallMode tail_call_mode); |
301 static Bytecode BytecodeForCallIC(TailCallMode tail_call_mode); | |
302 | 291 |
303 static bool FitsInIdx8Operand(int value); | 292 static bool FitsInIdx8Operand(int value); |
304 static bool FitsInIdx8Operand(size_t value); | 293 static bool FitsInIdx8Operand(size_t value); |
305 static bool FitsInImm8Operand(int value); | 294 static bool FitsInImm8Operand(int value); |
306 static bool FitsInIdx16Operand(int value); | 295 static bool FitsInIdx16Operand(int value); |
307 static bool FitsInIdx16Operand(size_t value); | 296 static bool FitsInIdx16Operand(size_t value); |
308 static bool FitsInReg8Operand(Register value); | 297 static bool FitsInReg8Operand(Register value); |
309 static bool FitsInReg8OperandUntranslated(Register value); | 298 static bool FitsInReg8OperandUntranslated(Register value); |
310 static bool FitsInReg16Operand(Register value); | 299 static bool FitsInReg16Operand(Register value); |
311 static bool FitsInReg16OperandUntranslated(Register value); | 300 static bool FitsInReg16OperandUntranslated(Register value); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 size_t offset_; | 414 size_t offset_; |
426 | 415 |
427 friend class BytecodeArrayBuilder; | 416 friend class BytecodeArrayBuilder; |
428 }; | 417 }; |
429 | 418 |
430 } // namespace interpreter | 419 } // namespace interpreter |
431 } // namespace internal | 420 } // namespace internal |
432 } // namespace v8 | 421 } // namespace v8 |
433 | 422 |
434 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 423 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
OLD | NEW |