| Index: src/mips/code-stubs-mips.cc
|
| diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
|
| index dc224a985dc52746c5a33c633d809aa82445d2f7..1427a3bb45fe00b5fbf2a59837ccd2ce2a1d65b1 100644
|
| --- a/src/mips/code-stubs-mips.cc
|
| +++ b/src/mips/code-stubs-mips.cc
|
| @@ -2181,6 +2181,7 @@ void CallConstructStub::Generate(MacroAssembler* masm) {
|
|
|
|
|
| void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
|
| + // a0 - number of arguments - if argc_in_register() is true.
|
| // a1 - function
|
| // a3 - slot id
|
| // a2 - vector
|
| @@ -2188,8 +2189,6 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
|
| __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, at);
|
| __ Branch(miss, ne, a1, Operand(at));
|
|
|
| - __ li(a0, Operand(arg_count()));
|
| -
|
| // Increment the call count for monomorphic function calls.
|
| __ Lsa(at, a2, a3, kPointerSizeLog2 - kSmiTagSize);
|
| __ lw(a3, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize));
|
| @@ -2198,20 +2197,32 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
|
|
|
| __ mov(a2, t0);
|
| __ mov(a3, a1);
|
| - ArrayConstructorStub stub(masm->isolate(), arg_count());
|
| - __ TailCallStub(&stub);
|
| + if (argc_in_register()) {
|
| + // Pass a default ArgumentCountKey::Any since the argc is only available
|
| + // in a0. We do not have the actual count here.
|
| + ArrayConstructorStub stub(masm->isolate());
|
| + __ TailCallStub(&stub);
|
| + } else {
|
| + // arg_count() is expected in a0 if the arg_count() >= 2
|
| + // (ArgumentCountKey::MORE_THAN_ONE).
|
| + ArrayConstructorStub stub(masm->isolate(), arg_count());
|
| + __ TailCallStub(&stub);
|
| + }
|
| }
|
|
|
|
|
| void CallICStub::Generate(MacroAssembler* masm) {
|
| + // a0 - number of arguments - if argc_in_register() is true.
|
| // a1 - function
|
| // a3 - slot id (Smi)
|
| // a2 - vector
|
| Label extra_checks_or_miss, call, call_function;
|
| - int argc = arg_count();
|
| - ParameterCount actual(argc);
|
| + if (!argc_in_register()) {
|
| + int argc = arg_count();
|
| + __ li(a0, argc);
|
| + }
|
|
|
| - // The checks. First, does r1 match the recorded monomorphic target?
|
| + // The checks. First, does a1 match the recorded monomorphic target?
|
| __ Lsa(t0, a2, a3, kPointerSizeLog2 - kSmiTagSize);
|
| __ lw(t0, FieldMemOperand(t0, FixedArray::kHeaderSize));
|
|
|
| @@ -2245,9 +2256,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
|
| __ bind(&call_function);
|
| __ 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;
|
| @@ -2284,9 +2293,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
|
|
|
| __ bind(&call);
|
| __ 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);
|
|
|
| @@ -2320,9 +2327,11 @@ void CallICStub::Generate(MacroAssembler* masm) {
|
| {
|
| FrameScope scope(masm, StackFrame::INTERNAL);
|
| CreateWeakCellStub create_stub(masm->isolate());
|
| - __ Push(a1);
|
| + __ SmiTag(a0);
|
| + __ Push(a0, a1);
|
| __ CallStub(&create_stub);
|
| - __ Pop(a1);
|
| + __ Pop(a0, a1);
|
| + __ SmiUntag(a0);
|
| }
|
|
|
| __ Branch(&call_function);
|
| @@ -2339,14 +2348,19 @@ void CallICStub::Generate(MacroAssembler* masm) {
|
| void CallICStub::GenerateMiss(MacroAssembler* masm) {
|
| FrameScope scope(masm, StackFrame::INTERNAL);
|
|
|
| - // Push the receiver and the function and feedback info.
|
| - __ Push(a1, a2, a3);
|
| + __ SmiTag(a0);
|
| + // Push number of arguments, receiver, function and feedback info.
|
| + __ Push(a0, a1, a2, a3);
|
|
|
| // Call the entry.
|
| __ CallRuntime(Runtime::kCallIC_Miss);
|
|
|
| // Move result to a1 and exit the internal frame.
|
| __ mov(a1, v0);
|
| +
|
| + // Restore a0.
|
| + __ Pop(a0);
|
| + __ SmiUntag(a0);
|
| }
|
|
|
|
|
|
|