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

Unified Diff: src/ia32/code-stubs-ia32.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/ia32/code-stubs-ia32.cc
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc
index 47b93d601a88ef34f1103175e3da063a868c94a7..70cad3396b61ff92e100699efbd7d4e9fad2a788 100644
--- a/src/ia32/code-stubs-ia32.cc
+++ b/src/ia32/code-stubs-ia32.cc
@@ -5678,17 +5678,13 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm,
__ jmp(&leave_exit_frame);
}
-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 -------------
// -- 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
@@ -5715,17 +5711,9 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
STATIC_ASSERT(FCA::kHolderIndex == 0);
STATIC_ASSERT(FCA::kArgsLength == 7);
- DCHECK(argc.is_immediate() || eax.is(argc.reg()));
-
- 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;
- }
+ __ pop(return_address);
+ // context save.
+ __ push(context);
// callee
__ push(callee);
@@ -5734,7 +5722,7 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
__ 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
@@ -5755,7 +5743,7 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
// push return address
__ push(return_address);
- if (!is_lazy) {
+ if (!is_lazy()) {
// load context from callee
__ mov(context, FieldOperand(callee, JSFunction::kContextOffset));
}
@@ -5774,27 +5762,13 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
// FunctionCallbackInfo::implicit_args_.
__ mov(ApiParameterOperand(2), scratch);
- 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());
- }
+ __ 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));
// v8::InvocationCallback's argument.
__ lea(scratch, ApiParameterOperand(2));
@@ -5807,7 +5781,7 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
(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;
@@ -5816,10 +5790,8 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
int stack_space = 0;
Operand is_construct_call_operand = ApiParameterOperand(5);
Operand* stack_space_operand = &is_construct_call_operand;
- if (argc.is_immediate()) {
- stack_space = argc.immediate() + FCA::kArgsLength + 1;
- stack_space_operand = nullptr;
- }
+ stack_space = argc() + FCA::kArgsLength + 1;
+ stack_space_operand = nullptr;
CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
ApiParameterOperand(1), stack_space,
stack_space_operand, return_value_operand,
@@ -5827,23 +5799,6 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
}
-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);
-}
-
-
void CallApiGetterStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- esp[0] : return address

Powered by Google App Engine
This is Rietveld 408576698