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

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

Issue 1748123003: Rework CallApi*Stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Minor fixes and make Win compiler happy. 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
Index: src/s390/code-stubs-s390.cc
diff --git a/src/s390/code-stubs-s390.cc b/src/s390/code-stubs-s390.cc
index 10c9a01c311c86faa39c7385908fb564b8b930a1..9a570ffaf5d14ac1b1d980e8517c31b0c6871c28 100644
--- a/src/s390/code-stubs-s390.cc
+++ b/src/s390/code-stubs-s390.cc
@@ -5543,16 +5543,12 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm,
__ b(&leave_exit_frame, Label::kNear);
}
-static void CallApiFunctionStubHelper(MacroAssembler* masm,
- const ParameterCount& argc,
- bool return_first_arg,
- bool call_data_undefined, bool is_lazy) {
+void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// ----------- 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
@@ -5578,8 +5574,6 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
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) {
@@ -5594,7 +5588,7 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
__ push(call_data);
Register scratch = call_data;
- if (!call_data_undefined) {
+ if (!call_data_undefined()) {
__ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
}
// return value
@@ -5630,28 +5624,15 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
__ AddP(r2, sp, Operand(kFunctionCallbackInfoOffset));
// FunctionCallbackInfo::implicit_args_
__ StoreP(scratch, MemOperand(r2, 0 * kPointerSize));
- 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));
- }
+ // 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));
ExternalReference thunk_ref =
ExternalReference::invoke_function_callback(masm->isolate());
@@ -5661,7 +5642,7 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
fp, (2 + FCA::kContextSaveIndex) * kPointerSize);
// Stores return the first js argument
int return_value_offset = 0;
- if (return_first_arg) {
+ if (is_store()) {
return_value_offset = 2 + FCA::kArgsLength;
} else {
return_value_offset = 2 + FCA::kReturnValueOffset;
@@ -5671,30 +5652,13 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
MemOperand is_construct_call_operand =
MemOperand(sp, kFunctionCallbackInfoOffset + 2 * kPointerSize + kIntSize);
MemOperand* stack_space_operand = &is_construct_call_operand;
- if (argc.is_immediate()) {
- stack_space = argc.immediate() + FCA::kArgsLength + 1;
- stack_space_operand = NULL;
- }
+ stack_space = argc() + 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) {
// ----------- S t a t e -------------
// -- sp[0] : name

Powered by Google App Engine
This is Rietveld 408576698