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

Unified Diff: src/x64/code-stubs-x64.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/s390/interface-descriptors-s390.cc ('k') | src/x64/interface-descriptors-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/code-stubs-x64.cc
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
index 589a594c150c342377f5317cc686f6a6f92cd9c1..b7923a7fbc6248332140def34eafbad7955f0de3 100644
--- a/src/x64/code-stubs-x64.cc
+++ b/src/x64/code-stubs-x64.cc
@@ -5396,7 +5396,10 @@
__ 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 -------------
// -- rdi : callee
// -- rbx : call_data
@@ -5429,6 +5432,8 @@
STATIC_ASSERT(FCA::kHolderIndex == 0);
STATIC_ASSERT(FCA::kArgsLength == 7);
+ DCHECK(argc.is_immediate() || rax.is(argc.reg()));
+
__ PopReturnAddressTo(return_address);
// context save
@@ -5440,7 +5445,7 @@
// call data
__ Push(call_data);
Register scratch = call_data;
- if (!this->call_data_undefined()) {
+ if (!call_data_undefined) {
__ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
}
// return value
@@ -5457,7 +5462,7 @@
// Push return address back on stack.
__ PushReturnAddressFrom(return_address);
- if (!this->is_lazy()) {
+ if (!is_lazy) {
// load context from callee
__ movp(context, FieldOperand(callee, JSFunction::kContextOffset));
}
@@ -5469,15 +5474,28 @@
PrepareCallApiFunction(masm, kApiStackSpace);
// FunctionCallbackInfo::implicit_args_.
- int argc = this->argc();
__ movp(StackSpaceOperand(0), scratch);
- __ addp(scratch, Immediate((argc + FCA::kArgsLength - 1) * kPointerSize));
- // FunctionCallbackInfo::values_.
- __ movp(StackSpaceOperand(1), scratch);
- // FunctionCallbackInfo::length_.
- __ Set(StackSpaceOperand(2), argc);
- // FunctionCallbackInfo::is_construct_call_.
- __ Set(StackSpaceOperand(3), 0);
+ if (argc.is_immediate()) {
+ __ addp(scratch, Immediate((argc.immediate() + FCA::kArgsLength - 1) *
+ kPointerSize));
+ // FunctionCallbackInfo::values_.
+ __ movp(StackSpaceOperand(1), scratch);
+ // FunctionCallbackInfo::length_.
+ __ Set(StackSpaceOperand(2), argc.immediate());
+ // FunctionCallbackInfo::is_construct_call_.
+ __ Set(StackSpaceOperand(3), 0);
+ } else {
+ __ leap(scratch, Operand(scratch, argc.reg(), times_pointer_size,
+ (FCA::kArgsLength - 1) * kPointerSize));
+ // FunctionCallbackInfo::values_.
+ __ movp(StackSpaceOperand(1), scratch);
+ // FunctionCallbackInfo::length_.
+ __ movp(StackSpaceOperand(2), argc.reg());
+ // FunctionCallbackInfo::is_construct_call_.
+ __ leap(argc.reg(), Operand(argc.reg(), times_pointer_size,
+ (FCA::kArgsLength + 1) * kPointerSize));
+ __ movp(StackSpaceOperand(3), argc.reg());
+ }
#if defined(__MINGW64__) || defined(_WIN64)
Register arguments_arg = rcx;
@@ -5504,14 +5522,33 @@
FCA::kArgsLength - FCA::kContextSaveIndex);
Operand is_construct_call_operand = StackSpaceOperand(3);
Operand return_value_operand = args_from_rbp.GetArgumentOperand(
- this->is_store() ? 0 : FCA::kArgsLength - FCA::kReturnValueOffset);
+ return_first_arg ? 0 : FCA::kArgsLength - FCA::kReturnValueOffset);
int stack_space = 0;
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, callback_arg,
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(rax), 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/s390/interface-descriptors-s390.cc ('k') | src/x64/interface-descriptors-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698