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

Unified Diff: src/s390/code-stubs-s390.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/ppc/interface-descriptors-ppc.cc ('k') | src/s390/interface-descriptors-s390.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/s390/code-stubs-s390.cc
diff --git a/src/s390/code-stubs-s390.cc b/src/s390/code-stubs-s390.cc
index 9a570ffaf5d14ac1b1d980e8517c31b0c6871c28..10c9a01c311c86faa39c7385908fb564b8b930a1 100644
--- a/src/s390/code-stubs-s390.cc
+++ b/src/s390/code-stubs-s390.cc
@@ -5543,12 +5543,16 @@
__ b(&leave_exit_frame, Label::kNear);
}
-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 -------------
// -- r2 : callee
// -- r6 : call_data
// -- r4 : holder
// -- r3 : api_function_address
+ // -- r5 : number of arguments if argc is a register
// -- cp : context
// --
// -- sp[0] : last argument
@@ -5574,6 +5578,8 @@
STATIC_ASSERT(FCA::kHolderIndex == 0);
STATIC_ASSERT(FCA::kArgsLength == 7);
+ DCHECK(argc.is_immediate() || r2.is(argc.reg()));
+
// context save
__ push(context);
if (!is_lazy) {
@@ -5588,7 +5594,7 @@
__ push(call_data);
Register scratch = call_data;
- if (!call_data_undefined()) {
+ if (!call_data_undefined) {
__ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
}
// return value
@@ -5624,15 +5630,28 @@
__ AddP(r2, sp, Operand(kFunctionCallbackInfoOffset));
// FunctionCallbackInfo::implicit_args_
__ StoreP(scratch, MemOperand(r2, 0 * kPointerSize));
- // FunctionCallbackInfo::values_
- __ AddP(ip, scratch, Operand((FCA::kArgsLength - 1 + argc()) * kPointerSize));
- __ StoreP(ip, MemOperand(r2, 1 * kPointerSize));
- // FunctionCallbackInfo::length_ = argc
- __ LoadImmP(ip, Operand(argc()));
- __ StoreW(ip, MemOperand(r2, 2 * kPointerSize));
- // FunctionCallbackInfo::is_construct_call_ = 0
- __ LoadImmP(ip, Operand::Zero());
- __ StoreW(ip, MemOperand(r2, 2 * kPointerSize + kIntSize));
+ if (argc.is_immediate()) {
+ // FunctionCallbackInfo::values_
+ __ AddP(ip, scratch,
+ Operand((FCA::kArgsLength - 1 + argc.immediate()) * kPointerSize));
+ __ StoreP(ip, MemOperand(r2, 1 * kPointerSize));
+ // FunctionCallbackInfo::length_ = argc
+ __ LoadImmP(ip, Operand(argc.immediate()));
+ __ StoreW(ip, MemOperand(r2, 2 * kPointerSize));
+ // FunctionCallbackInfo::is_construct_call_ = 0
+ __ LoadImmP(ip, Operand::Zero());
+ __ StoreW(ip, MemOperand(r2, 2 * kPointerSize + kIntSize));
+ } else {
+ __ ShiftLeftP(ip, argc.reg(), Operand(kPointerSizeLog2));
+ __ AddP(ip, ip, Operand((FCA::kArgsLength - 1) * kPointerSize));
+ // FunctionCallbackInfo::values_
+ __ AddP(r0, scratch, ip);
+ __ StoreP(r0, MemOperand(r2, 1 * kPointerSize));
+ // FunctionCallbackInfo::length_ = argc
+ __ StoreW(argc.reg(), MemOperand(r2, 2 * kPointerSize));
+ // FunctionCallbackInfo::is_construct_call_
+ __ StoreW(ip, MemOperand(r2, 2 * kPointerSize + kIntSize));
+ }
ExternalReference thunk_ref =
ExternalReference::invoke_function_callback(masm->isolate());
@@ -5642,7 +5661,7 @@
fp, (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;
@@ -5652,11 +5671,28 @@
MemOperand is_construct_call_operand =
MemOperand(sp, kFunctionCallbackInfoOffset + 2 * kPointerSize + kIntSize);
MemOperand* stack_space_operand = &is_construct_call_operand;
- stack_space = argc() + FCA::kArgsLength + 1;
- stack_space_operand = NULL;
+ if (argc.is_immediate()) {
+ stack_space = argc.immediate() + FCA::kArgsLength + 1;
+ stack_space_operand = NULL;
+ }
CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 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(r6), 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);
}
void CallApiGetterStub::Generate(MacroAssembler* masm) {
« no previous file with comments | « src/ppc/interface-descriptors-ppc.cc ('k') | src/s390/interface-descriptors-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698