Reviewers: Weiliang,
Message:
PTAL.
thanks
Description:
X87: fix performance regression on intel call api stubs
port b18ad510798d3a5e75f6b68656d8f8826571e782 (r26291)
original commit message:
additionally, make the interface match the JSFunction interface
BUG=
Please review this at https://codereview.chromium.org/906743002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+20, -13 lines):
M src/ic/x87/handler-compiler-x87.cc
M src/x87/code-stubs-x87.cc
M src/x87/interface-descriptors-x87.cc
Index: src/ic/x87/handler-compiler-x87.cc
diff --git a/src/ic/x87/handler-compiler-x87.cc
b/src/ic/x87/handler-compiler-x87.cc
index
1718c1997755829092ea8a68bb2d167052651ec8..105e49af4ae61df119583f1a170baa9ae5377989
100644
--- a/src/ic/x87/handler-compiler-x87.cc
+++ b/src/ic/x87/handler-compiler-x87.cc
@@ -163,7 +163,7 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
DCHECK(optimization.is_simple_api_call());
// Abi for CallApiFunctionStub.
- Register callee = eax;
+ Register callee = edi;
Register data = ebx;
Register holder = ecx;
Register api_function_address = edx;
Index: src/x87/code-stubs-x87.cc
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc
index
28baf49fabc314eab7ba8d389d82c1cde94a60fe..c2bf5e97b8e8b41e0fb34b75d8e648e38308081e
100644
--- a/src/x87/code-stubs-x87.cc
+++ b/src/x87/code-stubs-x87.cc
@@ -4543,12 +4543,12 @@ static void
CallApiFunctionStubHelper(MacroAssembler* masm,
bool return_first_arg,
bool call_data_undefined) {
// ----------- S t a t e -------------
- // -- eax : callee
+ // -- edi : callee
// -- ebx : call_data
// -- ecx : holder
// -- edx : api_function_address
// -- 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[4] : last argument
@@ -4557,11 +4557,12 @@ static void
CallApiFunctionStubHelper(MacroAssembler* masm,
// -- esp[(argc + 1) * 4] : receiver
// -----------------------------------
- Register callee = eax;
+ Register callee = edi;
Register call_data = ebx;
Register holder = ecx;
Register api_function_address = edx;
Register context = esi;
+ Register return_address = eax;
typedef FunctionCallbackArguments FCA;
@@ -4574,10 +4575,17 @@ static void
CallApiFunctionStubHelper(MacroAssembler* masm,
STATIC_ASSERT(FCA::kHolderIndex == 0);
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
- __ xchg(context, Operand(esp, 0));
+ if (argc.is_immediate()) {
+ __ pop(return_address);
+ // context save.
+ __ push(context);
+ } else {
+ // pop return address and save context
+ __ xchg(context, Operand(esp, 0));
+ return_address = context;
+ }
// callee
__ push(callee);
@@ -4605,7 +4613,7 @@ static void CallApiFunctionStubHelper(MacroAssembler*
masm,
__ mov(scratch, esp);
// push return address
- __ push(context);
+ __ push(return_address);
// load context from callee
__ mov(context, FieldOperand(callee, JSFunction::kContextOffset));
@@ -4678,9 +4686,8 @@ static void CallApiFunctionStubHelper(MacroAssembler*
masm,
void CallApiFunctionStub::Generate(MacroAssembler* masm) {
- // TODO(dcarney): make eax contain the function address.
bool call_data_undefined = this->call_data_undefined();
- CallApiFunctionStubHelper(masm, ParameterCount(edi), false,
+ CallApiFunctionStubHelper(masm, ParameterCount(eax), false,
call_data_undefined);
}
Index: src/x87/interface-descriptors-x87.cc
diff --git a/src/x87/interface-descriptors-x87.cc
b/src/x87/interface-descriptors-x87.cc
index
9ab630f85fe093ea3f4b49e3f26c53f9c228a07f..45a12794408abaa2514fbfa848820e7d2a7f5554
100644
--- a/src/x87/interface-descriptors-x87.cc
+++ b/src/x87/interface-descriptors-x87.cc
@@ -306,11 +306,11 @@ void
ArgumentAdaptorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
Register registers[] = {
esi, // context
- eax, // callee
+ edi, // callee
ebx, // call_data
ecx, // holder
edx, // api_function_address
- edi, // actual number of arguments
+ eax, // actual number of arguments
};
Representation representations[] = {
Representation::Tagged(), // context
@@ -327,7 +327,7 @@ void
ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
Register registers[] = {
esi, // context
- eax, // callee
+ edi, // callee
ebx, // call_data
ecx, // holder
edx, // api_function_address
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.