Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(652)

Unified Diff: src/x87/code-stubs-x87.cc

Issue 1775933005: Revert of Rework CallApi*Stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/interface-descriptors-x64.cc ('k') | src/x87/interface-descriptors-x87.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x87/code-stubs-x87.cc
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc
index a62f1d2117deb68d8375adfe97e8a1dc76a28d85..fd2c8924bca422ba842029715d78d12aa59a55cf 100644
--- a/src/x87/code-stubs-x87.cc
+++ b/src/x87/code-stubs-x87.cc
@@ -5346,13 +5346,17 @@
__ jmp(&leave_exit_frame);
}
-void CallApiCallbackStub::Generate(MacroAssembler* masm) {
+static void CallApiFunctionStubHelper(MacroAssembler* masm,
+ const ParameterCount& argc,
+ bool return_first_arg,
+ bool call_data_undefined, bool is_lazy) {
// ----------- S t a t e -------------
// -- edi : callee
// -- ebx : call_data
// -- ecx : holder
// -- edx : api_function_address
// -- esi : context
+ // -- eax : number of arguments if argc is a register
// --
// -- esp[0] : return address
// -- esp[4] : last argument
@@ -5381,9 +5385,15 @@
DCHECK(argc.is_immediate() || eax.is(argc.reg()));
- __ pop(return_address);
- // context save.
- __ push(context);
+ 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);
@@ -5392,7 +5402,7 @@
__ push(call_data);
Register scratch = call_data;
- if (!call_data_undefined()) {
+ if (!call_data_undefined) {
// return value
__ push(Immediate(masm->isolate()->factory()->undefined_value()));
// return value default
@@ -5413,7 +5423,7 @@
// push return address
__ push(return_address);
- if (!is_lazy()) {
+ if (!is_lazy) {
// load context from callee
__ mov(context, FieldOperand(callee, JSFunction::kContextOffset));
}
@@ -5432,13 +5442,27 @@
// FunctionCallbackInfo::implicit_args_.
__ mov(ApiParameterOperand(2), scratch);
- __ add(scratch, Immediate((argc() + FCA::kArgsLength - 1) * kPointerSize));
- // FunctionCallbackInfo::values_.
- __ mov(ApiParameterOperand(3), scratch);
- // FunctionCallbackInfo::length_.
- __ Move(ApiParameterOperand(4), Immediate(argc));
- // FunctionCallbackInfo::is_construct_call_.
- __ Move(ApiParameterOperand(5), Immediate(0));
+ if (argc.is_immediate()) {
+ __ add(scratch,
+ Immediate((argc.immediate() + FCA::kArgsLength - 1) * kPointerSize));
+ // FunctionCallbackInfo::values_.
+ __ mov(ApiParameterOperand(3), scratch);
+ // FunctionCallbackInfo::length_.
+ __ Move(ApiParameterOperand(4), Immediate(argc.immediate()));
+ // FunctionCallbackInfo::is_construct_call_.
+ __ Move(ApiParameterOperand(5), Immediate(0));
+ } else {
+ __ lea(scratch, Operand(scratch, argc.reg(), times_pointer_size,
+ (FCA::kArgsLength - 1) * kPointerSize));
+ // FunctionCallbackInfo::values_.
+ __ mov(ApiParameterOperand(3), scratch);
+ // FunctionCallbackInfo::length_.
+ __ mov(ApiParameterOperand(4), argc.reg());
+ // FunctionCallbackInfo::is_construct_call_.
+ __ lea(argc.reg(), Operand(argc.reg(), times_pointer_size,
+ (FCA::kArgsLength + 1) * kPointerSize));
+ __ mov(ApiParameterOperand(5), argc.reg());
+ }
// v8::InvocationCallback's argument.
__ lea(scratch, ApiParameterOperand(2));
@@ -5451,7 +5475,7 @@
(2 + FCA::kContextSaveIndex) * kPointerSize);
// Stores return the first js argument
int return_value_offset = 0;
- if (is_store()) {
+ if (return_first_arg) {
return_value_offset = 2 + FCA::kArgsLength;
} else {
return_value_offset = 2 + FCA::kReturnValueOffset;
@@ -5460,12 +5484,31 @@
int stack_space = 0;
Operand is_construct_call_operand = ApiParameterOperand(5);
Operand* stack_space_operand = &is_construct_call_operand;
- stack_space = argc() + FCA::kArgsLength + 1;
- stack_space_operand = nullptr;
+ if (argc.is_immediate()) {
+ stack_space = argc.immediate() + FCA::kArgsLength + 1;
+ stack_space_operand = nullptr;
+ }
CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
ApiParameterOperand(1), stack_space,
stack_space_operand, return_value_operand,
&context_restore_operand);
+}
+
+
+void CallApiFunctionStub::Generate(MacroAssembler* masm) {
+ bool call_data_undefined = this->call_data_undefined();
+ CallApiFunctionStubHelper(masm, ParameterCount(eax), false,
+ call_data_undefined, false);
+}
+
+
+void CallApiAccessorStub::Generate(MacroAssembler* masm) {
+ bool is_store = this->is_store();
+ int argc = this->argc();
+ bool call_data_undefined = this->call_data_undefined();
+ bool is_lazy = this->is_lazy();
+ CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store,
+ call_data_undefined, is_lazy);
}
« no previous file with comments | « src/x64/interface-descriptors-x64.cc ('k') | src/x87/interface-descriptors-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698