Commit 7f6f6ad1 authored by bjaideep's avatar bjaideep Committed by Commit bot

PPC: [stubs] Remove N-argument Hydrogen-based Array constructor stub

Port c8ac0d86

Original commit message:

    Instead, always tail call to the runtime. Also, cleanup the various versions
    of the runtime call that is used for Array construction fallback. There can be
    only one.

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

BUG=chromium:608675
LOG=N

Review-Url: https://codereview.chromium.org/2057253002
Cr-Commit-Position: refs/heads/master@{#36901}
parent c7cddee6
...@@ -3920,14 +3920,8 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) { ...@@ -3920,14 +3920,8 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
DCHECK(ToRegister(instr->result()).is(r3)); DCHECK(ToRegister(instr->result()).is(r3));
__ mov(r3, Operand(instr->arity())); __ mov(r3, Operand(instr->arity()));
if (instr->arity() == 1) {
// We only need the allocation site for the case we have a length argument.
// The case may bail out to the runtime, which will determine the correct
// elements kind with the site.
__ Move(r5, instr->hydrogen()->site()); __ Move(r5, instr->hydrogen()->site());
} else {
__ LoadRoot(r5, Heap::kUndefinedValueRootIndex);
}
ElementsKind kind = instr->hydrogen()->elements_kind(); ElementsKind kind = instr->hydrogen()->elements_kind();
AllocationSiteOverrideMode override_mode = AllocationSiteOverrideMode override_mode =
(AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE)
...@@ -3959,7 +3953,7 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) { ...@@ -3959,7 +3953,7 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
__ bind(&done); __ bind(&done);
} else { } else {
ArrayNArgumentsConstructorStub stub(isolate(), kind, override_mode); ArrayNArgumentsConstructorStub stub(isolate());
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
} }
} }
......
...@@ -21,45 +21,17 @@ ...@@ -21,45 +21,17 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
#define __ ACCESS_MASM(masm)
static void InitializeArrayConstructorDescriptor( void ArrayNArgumentsConstructorStub::Generate(MacroAssembler* masm) {
Isolate* isolate, CodeStubDescriptor* descriptor, __ ShiftLeftImm(r0, r3, Operand(kPointerSizeLog2));
int constant_stack_parameter_count) { __ StorePX(r4, MemOperand(sp, r0));
Address deopt_handler = __ push(r4);
Runtime::FunctionForId(Runtime::kArrayConstructor)->entry; __ push(r5);
__ addi(r3, r3, Operand(3));
if (constant_stack_parameter_count == 0) { __ TailCallRuntime(Runtime::kNewArray);
descriptor->Initialize(deopt_handler, constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
descriptor->Initialize(r3, deopt_handler, constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
}
}
static void InitializeInternalArrayConstructorDescriptor(
Isolate* isolate, CodeStubDescriptor* descriptor,
int constant_stack_parameter_count) {
Address deopt_handler =
Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry;
if (constant_stack_parameter_count == 0) {
descriptor->Initialize(deopt_handler, constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
descriptor->Initialize(r3, deopt_handler, constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
}
}
void ArrayNArgumentsConstructorStub::InitializeDescriptor(
CodeStubDescriptor* descriptor) {
InitializeArrayConstructorDescriptor(isolate(), descriptor, -1);
} }
void FastArrayPushStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { void FastArrayPushStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
Address deopt_handler = Runtime::FunctionForId(Runtime::kArrayPush)->entry; Address deopt_handler = Runtime::FunctionForId(Runtime::kArrayPush)->entry;
descriptor->Initialize(r3, deopt_handler, -1, JS_FUNCTION_STUB_MODE); descriptor->Initialize(r3, deopt_handler, -1, JS_FUNCTION_STUB_MODE);
...@@ -71,14 +43,6 @@ void FastFunctionBindStub::InitializeDescriptor( ...@@ -71,14 +43,6 @@ void FastFunctionBindStub::InitializeDescriptor(
descriptor->Initialize(r3, deopt_handler, -1, JS_FUNCTION_STUB_MODE); descriptor->Initialize(r3, deopt_handler, -1, JS_FUNCTION_STUB_MODE);
} }
void InternalArrayNArgumentsConstructorStub::InitializeDescriptor(
CodeStubDescriptor* descriptor) {
InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, -1);
}
#define __ ACCESS_MASM(masm)
static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow,
Condition cond); Condition cond);
static void EmitSmiNonsmiComparison(MacroAssembler* masm, Register lhs, static void EmitSmiNonsmiComparison(MacroAssembler* masm, Register lhs,
...@@ -982,7 +946,7 @@ void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { ...@@ -982,7 +946,7 @@ void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) {
CEntryStub::GenerateAheadOfTime(isolate); CEntryStub::GenerateAheadOfTime(isolate);
StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate);
StubFailureTrampolineStub::GenerateAheadOfTime(isolate); StubFailureTrampolineStub::GenerateAheadOfTime(isolate);
ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); CommonArrayConstructorStub::GenerateStubsAheadOfTime(isolate);
CreateAllocationSiteStub::GenerateAheadOfTime(isolate); CreateAllocationSiteStub::GenerateAheadOfTime(isolate);
CreateWeakCellStub::GenerateAheadOfTime(isolate); CreateWeakCellStub::GenerateAheadOfTime(isolate);
BinaryOpICStub::GenerateAheadOfTime(isolate); BinaryOpICStub::GenerateAheadOfTime(isolate);
...@@ -4294,18 +4258,11 @@ static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) { ...@@ -4294,18 +4258,11 @@ static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) {
} }
void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) { void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>(
isolate); isolate);
ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( ArrayNArgumentsConstructorStub stub(isolate);
isolate); stub.GetCode();
ArrayConstructorStubAheadOfTimeHelper<ArrayNArgumentsConstructorStub>(
isolate);
}
void InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(
Isolate* isolate) {
ElementsKind kinds[2] = {FAST_ELEMENTS, FAST_HOLEY_ELEMENTS}; ElementsKind kinds[2] = {FAST_ELEMENTS, FAST_HOLEY_ELEMENTS};
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
// For internal arrays we only need a few things // For internal arrays we only need a few things
...@@ -4313,8 +4270,6 @@ void InternalArrayConstructorStubBase::GenerateStubsAheadOfTime( ...@@ -4313,8 +4270,6 @@ void InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(
stubh1.GetCode(); stubh1.GetCode();
InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]);
stubh2.GetCode(); stubh2.GetCode();
InternalArrayNArgumentsConstructorStub stubh3(isolate, kinds[i]);
stubh3.GetCode();
} }
} }
...@@ -4333,13 +4288,15 @@ void ArrayConstructorStub::GenerateDispatchToArrayStub( ...@@ -4333,13 +4288,15 @@ void ArrayConstructorStub::GenerateDispatchToArrayStub(
CreateArrayDispatchOneArgument(masm, mode); CreateArrayDispatchOneArgument(masm, mode);
__ bind(&not_one_case); __ bind(&not_one_case);
CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); ArrayNArgumentsConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
} else if (argument_count() == NONE) { } else if (argument_count() == NONE) {
CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
} else if (argument_count() == ONE) { } else if (argument_count() == ONE) {
CreateArrayDispatchOneArgument(masm, mode); CreateArrayDispatchOneArgument(masm, mode);
} else if (argument_count() == MORE_THAN_ONE) { } else if (argument_count() == MORE_THAN_ONE) {
CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); ArrayNArgumentsConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
} else { } else {
UNREACHABLE(); UNREACHABLE();
} }
...@@ -4423,7 +4380,7 @@ void InternalArrayConstructorStub::GenerateCase(MacroAssembler* masm, ...@@ -4423,7 +4380,7 @@ void InternalArrayConstructorStub::GenerateCase(MacroAssembler* masm,
InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); InternalArrayNoArgumentConstructorStub stub0(isolate(), kind);
__ TailCallStub(&stub0, lt); __ TailCallStub(&stub0, lt);
InternalArrayNArgumentsConstructorStub stubN(isolate(), kind); ArrayNArgumentsConstructorStub stubN(isolate());
__ TailCallStub(&stubN, gt); __ TailCallStub(&stubN, gt);
if (IsFastPackedElementsKind(kind)) { if (IsFastPackedElementsKind(kind)) {
......
...@@ -267,7 +267,7 @@ void ArraySingleArgumentConstructorDescriptor::InitializePlatformSpecific( ...@@ -267,7 +267,7 @@ void ArraySingleArgumentConstructorDescriptor::InitializePlatformSpecific(
} }
void ArrayConstructorDescriptor::InitializePlatformSpecific( void ArrayNArgumentsConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument) // stack param count needs (constructor pointer, and single argument)
Register registers[] = {r4, r5, r3}; Register registers[] = {r4, r5, r3};
...@@ -275,13 +275,6 @@ void ArrayConstructorDescriptor::InitializePlatformSpecific( ...@@ -275,13 +275,6 @@ void ArrayConstructorDescriptor::InitializePlatformSpecific(
} }
void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = {r4, r3};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void VarArgFunctionDescriptor::InitializePlatformSpecific( void VarArgFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
// stack param count needs (arg count) // stack param count needs (arg count)
......
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