MIPS: Get CallInterfaceDescriptor directly from CodeStub.

Port r23778 (c2dcfb1)

BUG=
R=paul.lind@imgtec.com

Review URL: https://codereview.chromium.org/554023002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23783 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
balazs.kilvady@imgtec.com 2014-09-08 19:09:21 +00:00
parent 3d4f63be68
commit fa91f81411
6 changed files with 60 additions and 84 deletions

View File

@ -21,83 +21,70 @@ namespace internal {
static void InitializeArrayConstructorDescriptor( static void InitializeArrayConstructorDescriptor(
Isolate* isolate, CodeStub::Major major, Isolate* isolate, CodeStubDescriptor* descriptor,
CodeStubInterfaceDescriptor* descriptor,
int constant_stack_parameter_count) { int constant_stack_parameter_count) {
Address deopt_handler = Runtime::FunctionForId( Address deopt_handler = Runtime::FunctionForId(
Runtime::kArrayConstructor)->entry; Runtime::kArrayConstructor)->entry;
if (constant_stack_parameter_count == 0) { if (constant_stack_parameter_count == 0) {
ArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); descriptor->Initialize(deopt_handler, constant_stack_parameter_count,
descriptor->Initialize(major, call_descriptor, deopt_handler,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE); JS_FUNCTION_STUB_MODE);
} else { } else {
ArrayConstructorDescriptor call_descriptor(isolate); descriptor->Initialize(a0, deopt_handler, constant_stack_parameter_count,
descriptor->Initialize(major, call_descriptor, a0, deopt_handler,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
} }
} }
static void InitializeInternalArrayConstructorDescriptor( static void InitializeInternalArrayConstructorDescriptor(
Isolate* isolate, CodeStub::Major major, Isolate* isolate, CodeStubDescriptor* descriptor,
CodeStubInterfaceDescriptor* descriptor,
int constant_stack_parameter_count) { int constant_stack_parameter_count) {
Address deopt_handler = Runtime::FunctionForId( Address deopt_handler = Runtime::FunctionForId(
Runtime::kInternalArrayConstructor)->entry; Runtime::kInternalArrayConstructor)->entry;
if (constant_stack_parameter_count == 0) { if (constant_stack_parameter_count == 0) {
InternalArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); descriptor->Initialize(deopt_handler, constant_stack_parameter_count,
descriptor->Initialize(major, call_descriptor, deopt_handler,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE); JS_FUNCTION_STUB_MODE);
} else { } else {
InternalArrayConstructorDescriptor call_descriptor(isolate); descriptor->Initialize(a0, deopt_handler, constant_stack_parameter_count,
descriptor->Initialize(major, call_descriptor, a0, deopt_handler,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
} }
} }
void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( void ArrayNoArgumentConstructorStub::InitializeDescriptor(
CodeStubInterfaceDescriptor* descriptor) { CodeStubDescriptor* descriptor) {
InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 0); InitializeArrayConstructorDescriptor(isolate(), descriptor, 0);
} }
void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( void ArraySingleArgumentConstructorStub::InitializeDescriptor(
CodeStubInterfaceDescriptor* descriptor) { CodeStubDescriptor* descriptor) {
InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 1); InitializeArrayConstructorDescriptor(isolate(), descriptor, 1);
} }
void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( void ArrayNArgumentsConstructorStub::InitializeDescriptor(
CodeStubInterfaceDescriptor* descriptor) { CodeStubDescriptor* descriptor) {
InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, -1); InitializeArrayConstructorDescriptor(isolate(), descriptor, -1);
} }
void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( void InternalArrayNoArgumentConstructorStub::InitializeDescriptor(
CodeStubInterfaceDescriptor* descriptor) { CodeStubDescriptor* descriptor) {
InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, 0);
descriptor, 0);
} }
void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( void InternalArraySingleArgumentConstructorStub::InitializeDescriptor(
CodeStubInterfaceDescriptor* descriptor) { CodeStubDescriptor* descriptor) {
InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, 1);
descriptor, 1);
} }
void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( void InternalArrayNArgumentsConstructorStub::InitializeDescriptor(
CodeStubInterfaceDescriptor* descriptor) { CodeStubDescriptor* descriptor) {
InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, -1);
descriptor, -1);
} }
@ -118,11 +105,12 @@ static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm,
Register rhs); Register rhs);
void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm,
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.
isolate()->counters()->code_stubs()->Increment(); isolate()->counters()->code_stubs()->Increment();
CodeStubInterfaceDescriptor descriptor(this); CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor();
int param_count = descriptor.GetEnvironmentParameterCount(); int param_count = descriptor.GetEnvironmentParameterCount();
{ {
// Call the runtime system in a fresh internal frame. // Call the runtime system in a fresh internal frame.
@ -136,7 +124,6 @@ void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) {
__ sw(descriptor.GetEnvironmentParameterRegister(i), __ sw(descriptor.GetEnvironmentParameterRegister(i),
MemOperand(sp, (param_count - 1 - i) * kPointerSize)); MemOperand(sp, (param_count - 1 - i) * kPointerSize));
} }
ExternalReference miss = descriptor.miss_handler();
__ CallExternalReference(miss, param_count); __ CallExternalReference(miss, param_count);
} }

View File

@ -97,7 +97,7 @@ void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) {
void Deoptimizer::SetPlatformCompiledStubRegisters( void Deoptimizer::SetPlatformCompiledStubRegisters(
FrameDescription* output_frame, CodeStubInterfaceDescriptor* descriptor) { FrameDescription* output_frame, CodeStubDescriptor* descriptor) {
ApiFunction function(descriptor->deoptimization_handler()); ApiFunction function(descriptor->deoptimization_handler());
ExternalReference xref(&function, ExternalReference::BUILTIN_CALL, isolate_); ExternalReference xref(&function, ExternalReference::BUILTIN_CALL, isolate_);
intptr_t handler = reinterpret_cast<intptr_t>(xref.address()); intptr_t handler = reinterpret_cast<intptr_t>(xref.address());

View File

@ -2405,7 +2405,8 @@ LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
return DefineAsSpilled(result, spill_index); return DefineAsSpilled(result, spill_index);
} else { } else {
DCHECK(info()->IsStub()); DCHECK(info()->IsStub());
CodeStubInterfaceDescriptor descriptor(info()->code_stub()); CallInterfaceDescriptor descriptor =
info()->code_stub()->GetCallInterfaceDescriptor();
int index = static_cast<int>(instr->index()); int index = static_cast<int>(instr->index());
Register reg = descriptor.GetEnvironmentParameterRegister(index); Register reg = descriptor.GetEnvironmentParameterRegister(index);
return DefineFixed(result, reg); return DefineFixed(result, reg);

View File

@ -20,83 +20,70 @@ namespace internal {
static void InitializeArrayConstructorDescriptor( static void InitializeArrayConstructorDescriptor(
Isolate* isolate, CodeStub::Major major, Isolate* isolate, CodeStubDescriptor* descriptor,
CodeStubInterfaceDescriptor* descriptor,
int constant_stack_parameter_count) { int constant_stack_parameter_count) {
Address deopt_handler = Runtime::FunctionForId( Address deopt_handler = Runtime::FunctionForId(
Runtime::kArrayConstructor)->entry; Runtime::kArrayConstructor)->entry;
if (constant_stack_parameter_count == 0) { if (constant_stack_parameter_count == 0) {
ArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); descriptor->Initialize(deopt_handler, constant_stack_parameter_count,
descriptor->Initialize(major, call_descriptor, deopt_handler,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE); JS_FUNCTION_STUB_MODE);
} else { } else {
ArrayConstructorDescriptor call_descriptor(isolate); descriptor->Initialize(a0, deopt_handler, constant_stack_parameter_count,
descriptor->Initialize(major, call_descriptor, a0, deopt_handler,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
} }
} }
static void InitializeInternalArrayConstructorDescriptor( static void InitializeInternalArrayConstructorDescriptor(
Isolate* isolate, CodeStub::Major major, Isolate* isolate, CodeStubDescriptor* descriptor,
CodeStubInterfaceDescriptor* descriptor,
int constant_stack_parameter_count) { int constant_stack_parameter_count) {
Address deopt_handler = Runtime::FunctionForId( Address deopt_handler = Runtime::FunctionForId(
Runtime::kInternalArrayConstructor)->entry; Runtime::kInternalArrayConstructor)->entry;
if (constant_stack_parameter_count == 0) { if (constant_stack_parameter_count == 0) {
InternalArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); descriptor->Initialize(deopt_handler, constant_stack_parameter_count,
descriptor->Initialize(major, call_descriptor, deopt_handler,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE); JS_FUNCTION_STUB_MODE);
} else { } else {
InternalArrayConstructorDescriptor call_descriptor(isolate); descriptor->Initialize(a0, deopt_handler, constant_stack_parameter_count,
descriptor->Initialize(major, call_descriptor, a0, deopt_handler,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
} }
} }
void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( void ArrayNoArgumentConstructorStub::InitializeDescriptor(
CodeStubInterfaceDescriptor* descriptor) { CodeStubDescriptor* descriptor) {
InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 0); InitializeArrayConstructorDescriptor(isolate(), descriptor, 0);
} }
void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( void ArraySingleArgumentConstructorStub::InitializeDescriptor(
CodeStubInterfaceDescriptor* descriptor) { CodeStubDescriptor* descriptor) {
InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 1); InitializeArrayConstructorDescriptor(isolate(), descriptor, 1);
} }
void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( void ArrayNArgumentsConstructorStub::InitializeDescriptor(
CodeStubInterfaceDescriptor* descriptor) { CodeStubDescriptor* descriptor) {
InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, -1); InitializeArrayConstructorDescriptor(isolate(), descriptor, -1);
} }
void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( void InternalArrayNoArgumentConstructorStub::InitializeDescriptor(
CodeStubInterfaceDescriptor* descriptor) { CodeStubDescriptor* descriptor) {
InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, 0);
descriptor, 0);
} }
void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( void InternalArraySingleArgumentConstructorStub::InitializeDescriptor(
CodeStubInterfaceDescriptor* descriptor) { CodeStubDescriptor* descriptor) {
InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, 1);
descriptor, 1);
} }
void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( void InternalArrayNArgumentsConstructorStub::InitializeDescriptor(
CodeStubInterfaceDescriptor* descriptor) { CodeStubDescriptor* descriptor) {
InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, -1);
descriptor, -1);
} }
@ -117,11 +104,12 @@ static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm,
Register rhs); Register rhs);
void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm,
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.
isolate()->counters()->code_stubs()->Increment(); isolate()->counters()->code_stubs()->Increment();
CodeStubInterfaceDescriptor descriptor(this); CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor();
int param_count = descriptor.GetEnvironmentParameterCount(); int param_count = descriptor.GetEnvironmentParameterCount();
{ {
// Call the runtime system in a fresh internal frame. // Call the runtime system in a fresh internal frame.
@ -135,7 +123,6 @@ void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) {
__ sd(descriptor.GetEnvironmentParameterRegister(i), __ sd(descriptor.GetEnvironmentParameterRegister(i),
MemOperand(sp, (param_count - 1 - i) * kPointerSize)); MemOperand(sp, (param_count - 1 - i) * kPointerSize));
} }
ExternalReference miss = descriptor.miss_handler();
__ CallExternalReference(miss, param_count); __ CallExternalReference(miss, param_count);
} }

View File

@ -96,7 +96,7 @@ void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) {
void Deoptimizer::SetPlatformCompiledStubRegisters( void Deoptimizer::SetPlatformCompiledStubRegisters(
FrameDescription* output_frame, CodeStubInterfaceDescriptor* descriptor) { FrameDescription* output_frame, CodeStubDescriptor* descriptor) {
ApiFunction function(descriptor->deoptimization_handler()); ApiFunction function(descriptor->deoptimization_handler());
ExternalReference xref(&function, ExternalReference::BUILTIN_CALL, isolate_); ExternalReference xref(&function, ExternalReference::BUILTIN_CALL, isolate_);
intptr_t handler = reinterpret_cast<intptr_t>(xref.address()); intptr_t handler = reinterpret_cast<intptr_t>(xref.address());

View File

@ -2405,7 +2405,8 @@ LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
return DefineAsSpilled(result, spill_index); return DefineAsSpilled(result, spill_index);
} else { } else {
DCHECK(info()->IsStub()); DCHECK(info()->IsStub());
CodeStubInterfaceDescriptor descriptor(info()->code_stub()); CallInterfaceDescriptor descriptor =
info()->code_stub()->GetCallInterfaceDescriptor();
int index = static_cast<int>(instr->index()); int index = static_cast<int>(instr->index());
Register reg = descriptor.GetEnvironmentParameterRegister(index); Register reg = descriptor.GetEnvironmentParameterRegister(index);
return DefineFixed(result, reg); return DefineFixed(result, reg);