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) { ...@@ -3845,14 +3845,7 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
DCHECK(ToRegister(instr->result()).is(eax)); DCHECK(ToRegister(instr->result()).is(eax));
__ Move(eax, Immediate(instr->arity())); __ Move(eax, Immediate(instr->arity()));
if (instr->arity() == 1) { __ mov(ebx, instr->hydrogen()->site());
// 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());
}
ElementsKind kind = instr->hydrogen()->elements_kind(); ElementsKind kind = instr->hydrogen()->elements_kind();
AllocationSiteOverrideMode override_mode = AllocationSiteOverrideMode override_mode =
...@@ -3886,7 +3879,7 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) { ...@@ -3886,7 +3879,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);
} }
} }
......
...@@ -22,52 +22,18 @@ ...@@ -22,52 +22,18 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
#define __ ACCESS_MASM(masm)
static void InitializeArrayConstructorDescriptor( void ArrayNArgumentsConstructorStub::Generate(MacroAssembler* masm) {
Isolate* isolate, CodeStubDescriptor* descriptor, __ pop(ecx);
int constant_stack_parameter_count) { __ mov(MemOperand(esp, eax, times_4, 0), edi);
// register state __ push(edi);
// eax -- number of arguments __ push(ebx);
// edi -- function __ push(ecx);
// ebx -- allocation site with elements kind __ add(eax, Immediate(3));
Address deopt_handler = Runtime::FunctionForId( __ TailCallRuntime(Runtime::kNewArray);
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 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(eax, deopt_handler, -1, JS_FUNCTION_STUB_MODE); descriptor->Initialize(eax, deopt_handler, -1, JS_FUNCTION_STUB_MODE);
...@@ -79,15 +45,6 @@ void FastFunctionBindStub::InitializeDescriptor( ...@@ -79,15 +45,6 @@ void FastFunctionBindStub::InitializeDescriptor(
descriptor->Initialize(eax, deopt_handler, -1, JS_FUNCTION_STUB_MODE); 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, void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm,
ExternalReference miss) { ExternalReference miss) {
// Update the static counter each time a new code stub is generated. // Update the static counter each time a new code stub is generated.
...@@ -1491,7 +1448,7 @@ void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { ...@@ -1491,7 +1448,7 @@ void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) {
StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate);
StubFailureTrampolineStub::GenerateAheadOfTime(isolate); StubFailureTrampolineStub::GenerateAheadOfTime(isolate);
// It is important that the store buffer overflow stubs are generated first. // It is important that the store buffer overflow stubs are generated first.
ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); CommonArrayConstructorStub::GenerateStubsAheadOfTime(isolate);
CreateAllocationSiteStub::GenerateAheadOfTime(isolate); CreateAllocationSiteStub::GenerateAheadOfTime(isolate);
CreateWeakCellStub::GenerateAheadOfTime(isolate); CreateWeakCellStub::GenerateAheadOfTime(isolate);
BinaryOpICStub::GenerateAheadOfTime(isolate); BinaryOpICStub::GenerateAheadOfTime(isolate);
...@@ -3950,17 +3907,14 @@ static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) { ...@@ -3950,17 +3907,14 @@ static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) {
} }
} }
void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) { void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>(
isolate); isolate);
ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>(
isolate); isolate);
ArrayConstructorStubAheadOfTimeHelper<ArrayNArgumentsConstructorStub>( ArrayNArgumentsConstructorStub stub(isolate);
isolate); stub.GetCode();
}
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
...@@ -3968,8 +3922,6 @@ void InternalArrayConstructorStubBase::GenerateStubsAheadOfTime( ...@@ -3968,8 +3922,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();
} }
} }
...@@ -3987,13 +3939,15 @@ void ArrayConstructorStub::GenerateDispatchToArrayStub( ...@@ -3987,13 +3939,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();
} }
...@@ -4103,7 +4057,7 @@ void InternalArrayConstructorStub::GenerateCase(MacroAssembler* masm, ...@@ -4103,7 +4057,7 @@ void InternalArrayConstructorStub::GenerateCase(MacroAssembler* masm,
__ TailCallStub(&stub1); __ TailCallStub(&stub1);
__ bind(&not_one_case); __ bind(&not_one_case);
InternalArrayNArgumentsConstructorStub stubN(isolate(), kind); ArrayNArgumentsConstructorStub stubN(isolate());
__ TailCallStub(&stubN); __ TailCallStub(&stubN);
} }
......
...@@ -270,19 +270,14 @@ void ArraySingleArgumentConstructorDescriptor::InitializePlatformSpecific( ...@@ -270,19 +270,14 @@ void ArraySingleArgumentConstructorDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers, NULL); data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
} }
void ArrayConstructorDescriptor::InitializePlatformSpecific( void ArrayNArgumentsConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { 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}; Register registers[] = {edi, ebx, eax};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = {edi, eax};
data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void VarArgFunctionDescriptor::InitializePlatformSpecific( 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