From 0ada8cfe032e33957da2e126ae5062ac1c21167e Mon Sep 17 00:00:00 2001 From: "weiliang.lin@intel.com" Date: Fri, 12 Sep 2014 07:51:39 +0000 Subject: [PATCH] X87: Added CallInterfaceDescriptors to all code stubs. port r23854. original commit message: Added CallInterfaceDescriptors to all code stubs. A handful of code stubs are too complex to be described this way, and they are encoded with the macro DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(). Along the way: * allowed inheritance of CallInterfaceDescriptors. * Defined static Register methods for some of the new CallInterfaceDescriptors. We could go a lot further here, but it doesn't have to be done immediately. * Added Representation arrays to some CallInterfaceDescriptors, especially where future hydrogen versions of the stubs could benefit from this knowledge. BUG= R=weiliang.lin@intel.com Review URL: https://codereview.chromium.org/566843004 Patch from Jing Bao . git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23898 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/ic/x87/handler-compiler-x87.cc | 2 +- src/x87/code-stubs-x87.cc | 3 ++ src/x87/code-stubs-x87.h | 3 ++ src/x87/interface-descriptors-x87.cc | 53 +++++++++++++++++++++--------------- 4 files changed, 38 insertions(+), 23 deletions(-) diff --git a/src/ic/x87/handler-compiler-x87.cc b/src/ic/x87/handler-compiler-x87.cc index ce5657b..c40da81 100644 --- a/src/ic/x87/handler-compiler-x87.cc +++ b/src/ic/x87/handler-compiler-x87.cc @@ -667,7 +667,7 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback( __ push(scratch3()); // Restore return address. // Abi for CallApiGetter - Register getter_address = edx; + Register getter_address = ApiGetterDescriptor::function_address(); Address function_address = v8::ToCData
(callback->getter()); __ mov(getter_address, Immediate(function_address)); diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc index fe14b8a..cc3d6ce 100644 --- a/src/x87/code-stubs-x87.cc +++ b/src/x87/code-stubs-x87.cc @@ -332,6 +332,8 @@ void FunctionPrototypeStub::Generate(MacroAssembler* masm) { void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { // The key is in edx and the parameter count is in eax. + DCHECK(edx.is(ArgumentsAccessReadDescriptor::index())); + DCHECK(eax.is(ArgumentsAccessReadDescriptor::parameter_count())); // The displacement is used for skipping the frame pointer on the // stack. It is the offset of the last parameter (if any) relative @@ -4283,6 +4285,7 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) { // -- ... // -- edx : api_function_address // ----------------------------------- + DCHECK(edx.is(ApiGetterDescriptor::function_address())); // array for v8::Arguments::values_, handler for name and pointer // to the values (it considered as smi in GC). diff --git a/src/x87/code-stubs-x87.h b/src/x87/code-stubs-x87.h index b8fef1f..49462bc 100644 --- a/src/x87/code-stubs-x87.h +++ b/src/x87/code-stubs-x87.h @@ -109,6 +109,7 @@ class NameDictionaryLookupStub: public PlatformCodeStub { class IndexBits: public BitField {}; class LookupModeBits: public BitField {}; + DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); DEFINE_PLATFORM_CODE_STUB(NameDictionaryLookup, PlatformCodeStub); }; @@ -188,6 +189,8 @@ class RecordWriteStub: public PlatformCodeStub { CpuFeatures::FlushICache(stub->instruction_start(), 7); } + DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); + private: // This is a helper class for freeing up 3 scratch registers, where the third // is always ecx (needed for shift operations). The input is two registers diff --git a/src/x87/interface-descriptors-x87.cc b/src/x87/interface-descriptors-x87.cc index 8620751..8dfad36 100644 --- a/src/x87/interface-descriptors-x87.cc +++ b/src/x87/interface-descriptors-x87.cc @@ -18,17 +18,9 @@ const Register LoadDescriptor::ReceiverRegister() { return edx; } const Register LoadDescriptor::NameRegister() { return ecx; } -const Register VectorLoadICDescriptor::ReceiverRegister() { - return LoadDescriptor::ReceiverRegister(); -} - - -const Register VectorLoadICDescriptor::NameRegister() { - return LoadDescriptor::NameRegister(); -} +const Register VectorLoadICTrampolineDescriptor::SlotRegister() { return eax; } -const Register VectorLoadICDescriptor::SlotRegister() { return eax; } const Register VectorLoadICDescriptor::VectorRegister() { return ebx; } @@ -37,28 +29,28 @@ const Register StoreDescriptor::NameRegister() { return ecx; } const Register StoreDescriptor::ValueRegister() { return eax; } -const Register ElementTransitionAndStoreDescriptor::ReceiverRegister() { - return StoreDescriptor::ReceiverRegister(); +const Register ElementTransitionAndStoreDescriptor::MapRegister() { + return ebx; } -const Register ElementTransitionAndStoreDescriptor::NameRegister() { - return StoreDescriptor::NameRegister(); -} +const Register InstanceofDescriptor::left() { return eax; } +const Register InstanceofDescriptor::right() { return edx; } -const Register ElementTransitionAndStoreDescriptor::ValueRegister() { - return StoreDescriptor::ValueRegister(); -} +const Register ArgumentsAccessReadDescriptor::index() { return edx; } +const Register ArgumentsAccessReadDescriptor::parameter_count() { return eax; } -const Register ElementTransitionAndStoreDescriptor::MapRegister() { - return ebx; -} +const Register ApiGetterDescriptor::function_address() { return edx; } -const Register InstanceofDescriptor::left() { return eax; } -const Register InstanceofDescriptor::right() { return edx; } +const Register MathPowTaggedDescriptor::exponent() { return eax; } + + +const Register MathPowIntegerDescriptor::exponent() { + return MathPowTaggedDescriptor::exponent(); +} void FastNewClosureDescriptor::Initialize(CallInterfaceDescriptorData* data) { @@ -110,12 +102,29 @@ void CreateAllocationSiteDescriptor::Initialize( } +void StoreArrayLiteralElementDescriptor::Initialize( + CallInterfaceDescriptorData* data) { + Register registers[] = {esi, ecx, eax}; + data->Initialize(arraysize(registers), registers, NULL); +} + + void CallFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) { Register registers[] = {esi, edi}; data->Initialize(arraysize(registers), registers, NULL); } +void CallFunctionWithFeedbackDescriptor::Initialize( + CallInterfaceDescriptorData* data) { + Register registers[] = {esi, edi, edx}; + Representation representations[] = {Representation::Tagged(), + Representation::Tagged(), + Representation::Smi()}; + data->Initialize(arraysize(registers), registers, representations); +} + + void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) { // eax : number of arguments // ebx : feedback vector -- 2.7.4