X87: Multiple stubs can point to the same calling convention

port r23546.

original commit message:
   Multiple stubs can point to the same calling convention

BUG=
R=weiliang.lin@intel.com

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

Patch from Chunyang Dai <chunyang.dai@intel.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23575 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
weiliang.lin@intel.com 2014-09-02 02:42:36 +00:00
parent 7260ff8138
commit b96d68c039
2 changed files with 28 additions and 190 deletions

View File

@ -18,22 +18,20 @@ const Register LoadConvention::ReceiverRegister() { return edx; }
const Register LoadConvention::NameRegister() { return ecx; }
const Register VectorLoadConvention::SlotRegister() {
DCHECK(FLAG_vector_ics);
return eax;
}
const Register VectorLoadConvention::SlotRegister() { return eax; }
const Register FullVectorLoadConvention::VectorRegister() {
DCHECK(FLAG_vector_ics);
return ebx;
}
const Register FullVectorLoadConvention::VectorRegister() { return ebx; }
const Register StoreConvention::ReceiverRegister() { return edx; }
const Register StoreConvention::NameRegister() { return ecx; }
const Register StoreConvention::ValueRegister() { return eax; }
const Register StoreConvention::MapRegister() { return ebx; }
const Register InstanceofConvention::left() { return eax; }
const Register InstanceofConvention::right() { return edx; }
}
} // namespace v8::internal

View File

@ -19,110 +19,6 @@ namespace v8 {
namespace internal {
void FastNewClosureStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, ebx };
descriptor->Initialize(
MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry);
}
void FastNewContextStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, edi };
descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
void ToNumberStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
// ToNumberStub invokes a function, and therefore needs a context.
Register registers[] = { esi, eax };
descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
void NumberToStringStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax };
descriptor->Initialize(
MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry);
}
void FastCloneShallowArrayStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax, ebx, ecx };
Representation representations[] = {
Representation::Tagged(),
Representation::Tagged(),
Representation::Smi(),
Representation::Tagged() };
descriptor->Initialize(
MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry,
representations);
}
void FastCloneShallowObjectStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax, ebx, ecx, edx };
descriptor->Initialize(
MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry);
}
void CreateAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, ebx, edx };
descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
void CallFunctionStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = {esi, edi};
descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
void CallConstructStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
// eax : number of arguments
// ebx : feedback vector
// edx : (only if ebx is not the megamorphic symbol) slot in feedback
// vector (Smi)
// edi : constructor function
// TODO(turbofan): So far we don't gather type feedback and hence skip the
// slot parameter, but ArrayConstructStub needs the vector to be undefined.
Register registers[] = {esi, eax, edi, ebx};
descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
void RegExpConstructResultStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, ecx, ebx, eax };
descriptor->Initialize(
MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry);
}
void TransitionElementsKindStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax, ebx };
descriptor->Initialize(
MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry);
}
static void InitializeArrayConstructorDescriptor(
Isolate* isolate, CodeStub::Major major,
CodeStubInterfaceDescriptor* descriptor,
@ -135,20 +31,15 @@ static void InitializeArrayConstructorDescriptor(
Runtime::kArrayConstructor)->entry;
if (constant_stack_parameter_count == 0) {
Register registers[] = { esi, edi, ebx };
descriptor->Initialize(major, arraysize(registers), registers,
deopt_handler, NULL, constant_stack_parameter_count,
CallInterfaceDescriptor* call_descriptor = isolate->call_descriptor(
CallDescriptorKey::ArrayConstructorConstantArgCountCall);
descriptor->Initialize(major, call_descriptor, deopt_handler,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = { esi, edi, ebx, eax };
Representation representations[] = {
Representation::Tagged(),
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
descriptor->Initialize(major, arraysize(registers), registers, eax,
deopt_handler, representations,
CallInterfaceDescriptor* call_descriptor =
isolate->call_descriptor(CallDescriptorKey::ArrayConstructorCall);
descriptor->Initialize(major, call_descriptor, eax, deopt_handler,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
}
@ -156,7 +47,8 @@ static void InitializeArrayConstructorDescriptor(
static void InitializeInternalArrayConstructorDescriptor(
CodeStub::Major major, CodeStubInterfaceDescriptor* descriptor,
Isolate* isolate, CodeStub::Major major,
CodeStubInterfaceDescriptor* descriptor,
int constant_stack_parameter_count) {
// register state
// eax -- number of arguments
@ -165,19 +57,15 @@ static void InitializeInternalArrayConstructorDescriptor(
Runtime::kInternalArrayConstructor)->entry;
if (constant_stack_parameter_count == 0) {
Register registers[] = { esi, edi };
descriptor->Initialize(major, arraysize(registers), registers,
deopt_handler, NULL, constant_stack_parameter_count,
CallInterfaceDescriptor* call_descriptor = isolate->call_descriptor(
CallDescriptorKey::InternalArrayConstructorConstantArgCountCall);
descriptor->Initialize(major, call_descriptor, deopt_handler,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = { esi, edi, eax };
Representation representations[] = {
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
descriptor->Initialize(major, arraysize(registers), registers, eax,
deopt_handler, representations,
CallInterfaceDescriptor* call_descriptor = isolate->call_descriptor(
CallDescriptorKey::InternalArrayConstructorCall);
descriptor->Initialize(major, call_descriptor, eax, deopt_handler,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
}
@ -204,64 +92,22 @@ void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor(
void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, 0);
InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(),
descriptor, 0);
}
void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, 1);
InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(),
descriptor, 1);
}
void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, -1);
}
void CompareNilICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax };
descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(CompareNilIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate()));
}
void ToBooleanStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax };
descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(ToBooleanIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate()));
}
void BinaryOpICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, edx, eax };
descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(BinaryOpIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate()));
}
void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, ecx, edx, eax };
descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite));
}
void StringAddStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, edx, eax };
descriptor->Initialize(MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kStringAdd)->entry);
InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(),
descriptor, -1);
}
@ -2563,12 +2409,6 @@ void InstanceofStub::Generate(MacroAssembler* masm) {
}
Register InstanceofStub::left() { return eax; }
Register InstanceofStub::right() { return edx; }
// -------------------------------------------------------------------------
// StringCharCodeAtGenerator