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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // |context|. | 154 // |context|. |
155 BytecodeArrayBuilder& PushContext(Register context); | 155 BytecodeArrayBuilder& PushContext(Register context); |
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(Register callable, Register receiver_args, | 164 BytecodeArrayBuilder& Call( |
165 size_t receiver_arg_count, int feedback_slot); | 165 Register callable, Register receiver_args, size_t receiver_arg_count, |
| 166 int feedback_slot, TailCallMode tail_call_mode = TailCallMode::kDisallow); |
| 167 |
| 168 BytecodeArrayBuilder& TailCall(Register callable, Register receiver_args, |
| 169 size_t receiver_arg_count, int feedback_slot) { |
| 170 return Call(callable, receiver_args, receiver_arg_count, feedback_slot, |
| 171 TailCallMode::kAllow); |
| 172 } |
166 | 173 |
167 // Call the new operator. The accumulator holds the |new_target|. | 174 // Call the new operator. The accumulator holds the |new_target|. |
168 // The |constructor| is in a register followed by |arg_count| | 175 // The |constructor| is in a register followed by |arg_count| |
169 // consecutive arguments starting at |first_arg| for the constuctor | 176 // consecutive arguments starting at |first_arg| for the constuctor |
170 // invocation. | 177 // invocation. |
171 BytecodeArrayBuilder& New(Register constructor, Register first_arg, | 178 BytecodeArrayBuilder& New(Register constructor, Register first_arg, |
172 size_t arg_count); | 179 size_t arg_count); |
173 | 180 |
174 // 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 |
175 // in |first_arg| and all subsequent arguments should be in registers | 182 // in |first_arg| and all subsequent arguments should be in registers |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 static Bytecode BytecodeForCountOperation(Token::Value op); | 280 static Bytecode BytecodeForCountOperation(Token::Value op); |
274 static Bytecode BytecodeForCompareOperation(Token::Value op); | 281 static Bytecode BytecodeForCompareOperation(Token::Value op); |
275 static Bytecode BytecodeForWideOperands(Bytecode bytecode); | 282 static Bytecode BytecodeForWideOperands(Bytecode bytecode); |
276 static Bytecode BytecodeForStoreIC(LanguageMode language_mode); | 283 static Bytecode BytecodeForStoreIC(LanguageMode language_mode); |
277 static Bytecode BytecodeForKeyedStoreIC(LanguageMode language_mode); | 284 static Bytecode BytecodeForKeyedStoreIC(LanguageMode language_mode); |
278 static Bytecode BytecodeForLoadGlobal(TypeofMode typeof_mode); | 285 static Bytecode BytecodeForLoadGlobal(TypeofMode typeof_mode); |
279 static Bytecode BytecodeForStoreGlobal(LanguageMode language_mode); | 286 static Bytecode BytecodeForStoreGlobal(LanguageMode language_mode); |
280 static Bytecode BytecodeForStoreLookupSlot(LanguageMode language_mode); | 287 static Bytecode BytecodeForStoreLookupSlot(LanguageMode language_mode); |
281 static Bytecode BytecodeForCreateArguments(CreateArgumentsType type); | 288 static Bytecode BytecodeForCreateArguments(CreateArgumentsType type); |
282 static Bytecode BytecodeForDelete(LanguageMode language_mode); | 289 static Bytecode BytecodeForDelete(LanguageMode language_mode); |
| 290 static Bytecode BytecodeForCall(TailCallMode tail_call_mode); |
283 | 291 |
284 static bool FitsInIdx8Operand(int value); | 292 static bool FitsInIdx8Operand(int value); |
285 static bool FitsInIdx8Operand(size_t value); | 293 static bool FitsInIdx8Operand(size_t value); |
286 static bool FitsInImm8Operand(int value); | 294 static bool FitsInImm8Operand(int value); |
287 static bool FitsInIdx16Operand(int value); | 295 static bool FitsInIdx16Operand(int value); |
288 static bool FitsInIdx16Operand(size_t value); | 296 static bool FitsInIdx16Operand(size_t value); |
289 static bool FitsInReg8Operand(Register value); | 297 static bool FitsInReg8Operand(Register value); |
290 static bool FitsInReg8OperandUntranslated(Register value); | 298 static bool FitsInReg8OperandUntranslated(Register value); |
291 static bool FitsInReg16Operand(Register value); | 299 static bool FitsInReg16Operand(Register value); |
292 static bool FitsInReg16OperandUntranslated(Register value); | 300 static bool FitsInReg16OperandUntranslated(Register value); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 size_t offset_; | 414 size_t offset_; |
407 | 415 |
408 friend class BytecodeArrayBuilder; | 416 friend class BytecodeArrayBuilder; |
409 }; | 417 }; |
410 | 418 |
411 } // namespace interpreter | 419 } // namespace interpreter |
412 } // namespace internal | 420 } // namespace internal |
413 } // namespace v8 | 421 } // namespace v8 |
414 | 422 |
415 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 423 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
OLD | NEW |