Commit db379e19 authored by chunyang.dai's avatar chunyang.dai Committed by Commit bot

X87: fix performance regression on intel call api stubs

port b18ad510 (r26291)

original commit message:

  additionally, make the interface match the JSFunction interface

BUG=

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

Cr-Commit-Position: refs/heads/master@{#26503}
parent 27361ec6
...@@ -163,7 +163,7 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall( ...@@ -163,7 +163,7 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
DCHECK(optimization.is_simple_api_call()); DCHECK(optimization.is_simple_api_call());
// Abi for CallApiFunctionStub. // Abi for CallApiFunctionStub.
Register callee = eax; Register callee = edi;
Register data = ebx; Register data = ebx;
Register holder = ecx; Register holder = ecx;
Register api_function_address = edx; Register api_function_address = edx;
......
...@@ -4543,12 +4543,12 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm, ...@@ -4543,12 +4543,12 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
bool return_first_arg, bool return_first_arg,
bool call_data_undefined) { bool call_data_undefined) {
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- eax : callee // -- edi : callee
// -- ebx : call_data // -- ebx : call_data
// -- ecx : holder // -- ecx : holder
// -- edx : api_function_address // -- edx : api_function_address
// -- esi : context // -- esi : context
// -- edi : number of arguments if argc is a register // -- eax : number of arguments if argc is a register
// -- // --
// -- esp[0] : return address // -- esp[0] : return address
// -- esp[4] : last argument // -- esp[4] : last argument
...@@ -4557,11 +4557,12 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm, ...@@ -4557,11 +4557,12 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
// -- esp[(argc + 1) * 4] : receiver // -- esp[(argc + 1) * 4] : receiver
// ----------------------------------- // -----------------------------------
Register callee = eax; Register callee = edi;
Register call_data = ebx; Register call_data = ebx;
Register holder = ecx; Register holder = ecx;
Register api_function_address = edx; Register api_function_address = edx;
Register context = esi; Register context = esi;
Register return_address = eax;
typedef FunctionCallbackArguments FCA; typedef FunctionCallbackArguments FCA;
...@@ -4574,10 +4575,17 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm, ...@@ -4574,10 +4575,17 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
STATIC_ASSERT(FCA::kHolderIndex == 0); STATIC_ASSERT(FCA::kHolderIndex == 0);
STATIC_ASSERT(FCA::kArgsLength == 7); STATIC_ASSERT(FCA::kArgsLength == 7);
DCHECK(argc.is_immediate() || edi.is(argc.reg())); DCHECK(argc.is_immediate() || eax.is(argc.reg()));
// pop return address and save context if (argc.is_immediate()) {
__ xchg(context, Operand(esp, 0)); __ pop(return_address);
// context save.
__ push(context);
} else {
// pop return address and save context
__ xchg(context, Operand(esp, 0));
return_address = context;
}
// callee // callee
__ push(callee); __ push(callee);
...@@ -4605,7 +4613,7 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm, ...@@ -4605,7 +4613,7 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
__ mov(scratch, esp); __ mov(scratch, esp);
// push return address // push return address
__ push(context); __ push(return_address);
// load context from callee // load context from callee
__ mov(context, FieldOperand(callee, JSFunction::kContextOffset)); __ mov(context, FieldOperand(callee, JSFunction::kContextOffset));
...@@ -4678,9 +4686,8 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm, ...@@ -4678,9 +4686,8 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
void CallApiFunctionStub::Generate(MacroAssembler* masm) { void CallApiFunctionStub::Generate(MacroAssembler* masm) {
// TODO(dcarney): make eax contain the function address.
bool call_data_undefined = this->call_data_undefined(); bool call_data_undefined = this->call_data_undefined();
CallApiFunctionStubHelper(masm, ParameterCount(edi), false, CallApiFunctionStubHelper(masm, ParameterCount(eax), false,
call_data_undefined); call_data_undefined);
} }
......
...@@ -306,11 +306,11 @@ void ArgumentAdaptorDescriptor::Initialize(CallInterfaceDescriptorData* data) { ...@@ -306,11 +306,11 @@ void ArgumentAdaptorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) { void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
Register registers[] = { Register registers[] = {
esi, // context esi, // context
eax, // callee edi, // callee
ebx, // call_data ebx, // call_data
ecx, // holder ecx, // holder
edx, // api_function_address edx, // api_function_address
edi, // actual number of arguments eax, // actual number of arguments
}; };
Representation representations[] = { Representation representations[] = {
Representation::Tagged(), // context Representation::Tagged(), // context
...@@ -327,7 +327,7 @@ void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) { ...@@ -327,7 +327,7 @@ void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) { void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
Register registers[] = { Register registers[] = {
esi, // context esi, // context
eax, // callee edi, // callee
ebx, // call_data ebx, // call_data
ecx, // holder ecx, // holder
edx, // api_function_address edx, // api_function_address
......
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