Index: src/interpreter/bytecode-array-builder.cc |
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc |
index 7103c7217812395ff47fbcd78f3212d3ad10d355..6b764bf60ba343cd4cc9ea9ac2014aa804e0753a 100644 |
--- a/src/interpreter/bytecode-array-builder.cc |
+++ b/src/interpreter/bytecode-array-builder.cc |
@@ -1059,12 +1059,10 @@ void BytecodeArrayBuilder::EnsureReturn(FunctionLiteral* literal) { |
} |
} |
-BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable, |
- Register receiver_args, |
- size_t receiver_args_count, |
- int feedback_slot, |
- TailCallMode tail_call_mode) { |
- Bytecode bytecode = BytecodeForCall(tail_call_mode); |
+BytecodeArrayBuilder& BytecodeArrayBuilder::CallIC( |
+ Register callable, Register receiver_args, size_t receiver_args_count, |
+ int feedback_slot, TailCallMode tail_call_mode) { |
+ Bytecode bytecode = BytecodeForCallIC(tail_call_mode); |
if (FitsInReg8Operand(callable) && FitsInReg8Operand(receiver_args) && |
FitsInIdx8Operand(receiver_args_count) && |
FitsInIdx8Operand(feedback_slot)) { |
@@ -1085,6 +1083,26 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable, |
return *this; |
} |
+BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable, |
+ Register receiver_args, |
+ size_t receiver_args_count, |
+ TailCallMode tail_call_mode) { |
+ Bytecode bytecode = BytecodeForCall(tail_call_mode); |
+ if (FitsInReg8Operand(callable) && FitsInReg8Operand(receiver_args) && |
+ FitsInIdx8Operand(receiver_args_count)) { |
+ Output(bytecode, callable.ToRawOperand(), receiver_args.ToRawOperand(), |
+ static_cast<uint8_t>(receiver_args_count)); |
+ } else if (FitsInReg16Operand(callable) && |
+ FitsInReg16Operand(receiver_args) && |
+ FitsInIdx16Operand(receiver_args_count)) { |
+ bytecode = BytecodeForWideOperands(bytecode); |
+ Output(bytecode, callable.ToRawOperand(), receiver_args.ToRawOperand(), |
+ static_cast<uint16_t>(receiver_args_count)); |
+ } else { |
+ UNIMPLEMENTED(); |
+ } |
+ return *this; |
+} |
BytecodeArrayBuilder& BytecodeArrayBuilder::New(Register constructor, |
Register first_arg, |
size_t arg_count) { |
@@ -1426,6 +1444,10 @@ Bytecode BytecodeArrayBuilder::BytecodeForCompareOperation(Token::Value op) { |
// static |
Bytecode BytecodeArrayBuilder::BytecodeForWideOperands(Bytecode bytecode) { |
switch (bytecode) { |
+ case Bytecode::kCallIC: |
+ return Bytecode::kCallICWide; |
+ case Bytecode::kTailCallIC: |
+ return Bytecode::kTailCallICWide; |
case Bytecode::kCall: |
return Bytecode::kCallWide; |
case Bytecode::kTailCall: |
@@ -1570,6 +1592,19 @@ Bytecode BytecodeArrayBuilder::BytecodeForDelete(LanguageMode language_mode) { |
} |
// static |
+Bytecode BytecodeArrayBuilder::BytecodeForCallIC(TailCallMode tail_call_mode) { |
+ switch (tail_call_mode) { |
+ case TailCallMode::kDisallow: |
+ return Bytecode::kCallIC; |
+ case TailCallMode::kAllow: |
+ return Bytecode::kTailCallIC; |
+ default: |
+ UNREACHABLE(); |
+ } |
+ return static_cast<Bytecode>(-1); |
+} |
+ |
+// static |
Bytecode BytecodeArrayBuilder::BytecodeForCall(TailCallMode tail_call_mode) { |
switch (tail_call_mode) { |
case TailCallMode::kDisallow: |