Index: src/mips/code-stubs-mips.cc |
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc |
index 52734fc76c174c851874d7835b3b7538926bca7e..b21916c0530df31ee0d22611ec94ad51cd78ea3d 100644 |
--- a/src/mips/code-stubs-mips.cc |
+++ b/src/mips/code-stubs-mips.cc |
@@ -1917,6 +1917,7 @@ static void IncrementCallCount(MacroAssembler* masm, Register feedback_vector, |
} |
void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
+ // a0 - number of arguments |
// a1 - function |
// a3 - slot id |
// a2 - vector |
@@ -1929,19 +1930,17 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
__ mov(a2, t0); |
__ mov(a3, a1); |
- __ li(a0, Operand(arg_count())); |
ArrayConstructorStub stub(masm->isolate()); |
__ TailCallStub(&stub); |
} |
void CallICStub::Generate(MacroAssembler* masm) { |
+ // a0 - number of arguments |
// a1 - function |
// a3 - slot id (Smi) |
// a2 - vector |
Label extra_checks_or_miss, call, call_function, call_count_incremented; |
- int argc = arg_count(); |
- ParameterCount actual(argc); |
// The checks. First, does r1 match the recorded monomorphic target? |
__ Lsa(t0, a2, a3, kPointerSizeLog2 - kSmiTagSize); |
@@ -1975,9 +1974,7 @@ void CallICStub::Generate(MacroAssembler* masm) { |
__ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), |
tail_call_mode()), |
- RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg), |
- USE_DELAY_SLOT); |
- __ li(a0, Operand(argc)); // In delay slot. |
+ RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg)); |
__ bind(&extra_checks_or_miss); |
Label uninitialized, miss, not_allocation_site; |
@@ -2018,9 +2015,7 @@ void CallICStub::Generate(MacroAssembler* masm) { |
__ bind(&call_count_incremented); |
__ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()), |
- RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg), |
- USE_DELAY_SLOT); |
- __ li(a0, Operand(argc)); // In delay slot. |
+ RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg)); |
__ bind(&uninitialized); |
@@ -2049,11 +2044,15 @@ void CallICStub::Generate(MacroAssembler* masm) { |
{ |
FrameScope scope(masm, StackFrame::INTERNAL); |
CreateWeakCellStub create_stub(masm->isolate()); |
+ __ SmiTag(a0); |
+ __ Push(a0); |
__ Push(a2, a3); |
__ Push(cp, a1); |
__ CallStub(&create_stub); |
__ Pop(cp, a1); |
__ Pop(a2, a3); |
+ __ Pop(a0); |
+ __ SmiUntag(a0); |
} |
__ Branch(&call_function); |
@@ -2070,6 +2069,10 @@ void CallICStub::Generate(MacroAssembler* masm) { |
void CallICStub::GenerateMiss(MacroAssembler* masm) { |
FrameScope scope(masm, StackFrame::INTERNAL); |
+ // Preserve the number of arguments as Smi. |
+ __ SmiTag(a0); |
+ __ Push(a0); |
+ |
// Push the receiver and the function and feedback info. |
__ Push(a1, a2, a3); |
@@ -2078,6 +2081,10 @@ void CallICStub::GenerateMiss(MacroAssembler* masm) { |
// Move result to a1 and exit the internal frame. |
__ mov(a1, v0); |
+ |
+ // Restore number of arguments. |
+ __ Pop(a0); |
+ __ SmiUntag(a0); |
} |