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