Commit 5f28e5a9 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

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

  port c8ac0d86(r36888)

  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.

BUG=

Review-Url: https://codereview.chromium.org/2080223009
Cr-Commit-Position: refs/heads/master@{#37243}
parent 2d8738ed
......@@ -3845,14 +3845,7 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
DCHECK(ToRegister(instr->result()).is(eax));
__ Move(eax, Immediate(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.
__ mov(ebx, instr->hydrogen()->site());
} else {
__ mov(ebx, isolate()->factory()->undefined_value());
}
__ mov(ebx, instr->hydrogen()->site());
ElementsKind kind = instr->hydrogen()->elements_kind();
AllocationSiteOverrideMode override_mode =
......@@ -3886,7 +3879,7 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
__ bind(&done);
} else {
ArrayNArgumentsConstructorStub stub(isolate(), kind, override_mode);
ArrayNArgumentsConstructorStub stub(isolate());
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
}
}
......
......@@ -22,52 +22,18 @@
namespace v8 {
namespace internal {
#define __ ACCESS_MASM(masm)
static void InitializeArrayConstructorDescriptor(
Isolate* isolate, CodeStubDescriptor* descriptor,
int constant_stack_parameter_count) {
// register state
// eax -- number of arguments
// edi -- function
// ebx -- allocation site with elements kind
Address deopt_handler = Runtime::FunctionForId(
Runtime::kArrayConstructor)->entry;
if (constant_stack_parameter_count == 0) {
descriptor->Initialize(deopt_handler, constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
descriptor->Initialize(eax, deopt_handler, constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
}
}
static void InitializeInternalArrayConstructorDescriptor(
Isolate* isolate, CodeStubDescriptor* descriptor,
int constant_stack_parameter_count) {
// register state
// eax -- number of arguments
// edi -- constructor function
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(eax, deopt_handler, constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
}
}
void ArrayNArgumentsConstructorStub::InitializeDescriptor(
CodeStubDescriptor* descriptor) {
InitializeArrayConstructorDescriptor(isolate(), descriptor, -1);
void ArrayNArgumentsConstructorStub::Generate(MacroAssembler* masm) {
__ pop(ecx);
__ mov(MemOperand(esp, eax, times_4, 0), edi);
__ push(edi);
__ push(ebx);
__ push(ecx);
__ add(eax, Immediate(3));
__ TailCallRuntime(Runtime::kNewArray);
}
void FastArrayPushStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
Address deopt_handler = Runtime::FunctionForId(Runtime::kArrayPush)->entry;
descriptor->Initialize(eax, deopt_handler, -1, JS_FUNCTION_STUB_MODE);
......@@ -79,15 +45,6 @@ void FastFunctionBindStub::InitializeDescriptor(
descriptor->Initialize(eax, deopt_handler, -1, JS_FUNCTION_STUB_MODE);
}
void InternalArrayNArgumentsConstructorStub::InitializeDescriptor(
CodeStubDescriptor* descriptor) {
InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, -1);
}
#define __ ACCESS_MASM(masm)
void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm,
ExternalReference miss) {
// Update the static counter each time a new code stub is generated.
......@@ -1491,7 +1448,7 @@ void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) {
StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate);
StubFailureTrampolineStub::GenerateAheadOfTime(isolate);
// It is important that the store buffer overflow stubs are generated first.
ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
CommonArrayConstructorStub::GenerateStubsAheadOfTime(isolate);
CreateAllocationSiteStub::GenerateAheadOfTime(isolate);
CreateWeakCellStub::GenerateAheadOfTime(isolate);
BinaryOpICStub::GenerateAheadOfTime(isolate);
......@@ -3950,17 +3907,14 @@ static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) {
}
}
void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) {
void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>(
isolate);
ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>(
isolate);
ArrayConstructorStubAheadOfTimeHelper<ArrayNArgumentsConstructorStub>(
isolate);
}
ArrayNArgumentsConstructorStub stub(isolate);
stub.GetCode();
void InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(
Isolate* isolate) {
ElementsKind kinds[2] = {FAST_ELEMENTS, FAST_HOLEY_ELEMENTS};
for (int i = 0; i < 2; i++) {
// For internal arrays we only need a few things
......@@ -3968,8 +3922,6 @@ void InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(
stubh1.GetCode();
InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]);
stubh2.GetCode();
InternalArrayNArgumentsConstructorStub stubh3(isolate, kinds[i]);
stubh3.GetCode();
}
}
......@@ -3987,13 +3939,15 @@ void ArrayConstructorStub::GenerateDispatchToArrayStub(
CreateArrayDispatchOneArgument(masm, mode);
__ bind(&not_one_case);
CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode);
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) {
CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode);
ArrayNArgumentsConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
} else {
UNREACHABLE();
}
......@@ -4103,7 +4057,7 @@ void InternalArrayConstructorStub::GenerateCase(MacroAssembler* masm,
__ TailCallStub(&stub1);
__ bind(&not_one_case);
InternalArrayNArgumentsConstructorStub stubN(isolate(), kind);
ArrayNArgumentsConstructorStub stubN(isolate());
__ TailCallStub(&stubN);
}
......
......@@ -270,19 +270,14 @@ void ArraySingleArgumentConstructorDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ArrayConstructorDescriptor::InitializePlatformSpecific(
void ArrayNArgumentsConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
// register state
// eax -- number of arguments
// edi -- function
// ebx -- allocation site with elements kind
Register registers[] = {edi, ebx, eax};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = {edi, eax};
data->InitializePlatformSpecific(arraysize(registers), registers);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void VarArgFunctionDescriptor::InitializePlatformSpecific(
......
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