Commit 82b10341 authored by bjaideep's avatar bjaideep Committed by Commit bot

PPC/s390: [stubs] Simplify the ArrayConstructorStub.

Port 9192db20

Original commit message:

    Remove the special side channel from the CallICStub to the
    ArrayConstructorStub and make the CallICStub always use the
    general entry point.

R=bmeurer@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com

BUG=
LOG=N

Review-Url: https://codereview.chromium.org/2410183002
Cr-Commit-Position: refs/heads/master@{#40183}
parent 73683ef8
......@@ -1881,14 +1881,13 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
__ cmp(r4, r8);
__ bne(miss);
__ mov(r3, Operand(arg_count()));
// Increment the call count for monomorphic function calls.
IncrementCallCount(masm, r5, r6, r0);
__ mr(r5, r7);
__ mr(r6, r4);
ArrayConstructorStub stub(masm->isolate(), arg_count());
__ mov(r3, Operand(arg_count()));
ArrayConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
}
......@@ -3862,30 +3861,19 @@ void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
void ArrayConstructorStub::GenerateDispatchToArrayStub(
MacroAssembler* masm, AllocationSiteOverrideMode mode) {
if (argument_count() == ANY) {
Label not_zero_case, not_one_case;
__ cmpi(r3, Operand::Zero());
__ bne(&not_zero_case);
CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
Label not_zero_case, not_one_case;
__ cmpi(r3, Operand::Zero());
__ bne(&not_zero_case);
CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
__ bind(&not_zero_case);
__ cmpi(r3, Operand(1));
__ bgt(&not_one_case);
CreateArrayDispatchOneArgument(masm, mode);
__ bind(&not_zero_case);
__ cmpi(r3, Operand(1));
__ bgt(&not_one_case);
CreateArrayDispatchOneArgument(masm, mode);
__ bind(&not_one_case);
ArrayNArgumentsConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
} else if (argument_count() == NONE) {
CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
} else if (argument_count() == ONE) {
CreateArrayDispatchOneArgument(masm, mode);
} else if (argument_count() == MORE_THAN_ONE) {
ArrayNArgumentsConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
} else {
UNREACHABLE();
}
__ bind(&not_one_case);
ArrayNArgumentsConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
}
......@@ -3937,23 +3925,9 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
__ bind(&subclassing);
switch (argument_count()) {
case ANY:
case MORE_THAN_ONE:
__ ShiftLeftImm(r0, r3, Operand(kPointerSizeLog2));
__ StorePX(r4, MemOperand(sp, r0));
__ addi(r3, r3, Operand(3));
break;
case NONE:
__ StoreP(r4, MemOperand(sp, 0 * kPointerSize));
__ li(r3, Operand(3));
break;
case ONE:
__ StoreP(r4, MemOperand(sp, 1 * kPointerSize));
__ li(r3, Operand(4));
break;
}
__ ShiftLeftImm(r0, r3, Operand(kPointerSizeLog2));
__ StorePX(r4, MemOperand(sp, r0));
__ addi(r3, r3, Operand(3));
__ Push(r6, r5);
__ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate()));
}
......
......@@ -1882,14 +1882,13 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
__ CmpP(r3, r7);
__ bne(miss);
__ mov(r2, Operand(arg_count()));
// Increment the call count for monomorphic function calls.
IncrementCallCount(masm, r4, r5, r1);
__ LoadRR(r4, r6);
__ LoadRR(r5, r3);
ArrayConstructorStub stub(masm->isolate(), arg_count());
__ mov(r2, Operand(arg_count()));
ArrayConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
}
......@@ -3795,30 +3794,19 @@ void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
void ArrayConstructorStub::GenerateDispatchToArrayStub(
MacroAssembler* masm, AllocationSiteOverrideMode mode) {
if (argument_count() == ANY) {
Label not_zero_case, not_one_case;
__ CmpP(r2, Operand::Zero());
__ bne(&not_zero_case);
CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
Label not_zero_case, not_one_case;
__ CmpP(r2, Operand::Zero());
__ bne(&not_zero_case);
CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
__ bind(&not_zero_case);
__ CmpP(r2, Operand(1));
__ bgt(&not_one_case);
CreateArrayDispatchOneArgument(masm, mode);
__ bind(&not_zero_case);
__ CmpP(r2, Operand(1));
__ bgt(&not_one_case);
CreateArrayDispatchOneArgument(masm, mode);
__ bind(&not_one_case);
ArrayNArgumentsConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
} else if (argument_count() == NONE) {
CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
} else if (argument_count() == ONE) {
CreateArrayDispatchOneArgument(masm, mode);
} else if (argument_count() == MORE_THAN_ONE) {
ArrayNArgumentsConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
} else {
UNREACHABLE();
}
__ bind(&not_one_case);
ArrayNArgumentsConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
}
void ArrayConstructorStub::Generate(MacroAssembler* masm) {
......@@ -3869,23 +3857,9 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
__ bind(&subclassing);
switch (argument_count()) {
case ANY:
case MORE_THAN_ONE:
__ ShiftLeftP(r1, r2, Operand(kPointerSizeLog2));
__ StoreP(r3, MemOperand(sp, r1));
__ AddP(r2, r2, Operand(3));
break;
case NONE:
__ StoreP(r3, MemOperand(sp, 0 * kPointerSize));
__ LoadImmP(r2, Operand(3));
break;
case ONE:
__ StoreP(r3, MemOperand(sp, 1 * kPointerSize));
__ LoadImmP(r2, Operand(4));
break;
}
__ ShiftLeftP(r1, r2, Operand(kPointerSizeLog2));
__ StoreP(r3, MemOperand(sp, r1));
__ AddP(r2, r2, Operand(3));
__ Push(r5, r4);
__ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate()));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment