From: dcarney@chromium.org Date: Tue, 27 Aug 2013 13:41:44 +0000 (+0000) Subject: cleanup api callbacks now that handles are never returned directly X-Git-Tag: upstream/4.7.83~12804 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f55ba6b70ac217d877aaf9e253ba9b256bf91744;p=platform%2Fupstream%2Fv8.git cleanup api callbacks now that handles are never returned directly R=svenpanne@chromium.org BUG= Review URL: https://codereview.chromium.org/23588002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16360 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc index 16ba89c..7628f23 100644 --- a/src/arm/macro-assembler-arm.cc +++ b/src/arm/macro-assembler-arm.cc @@ -2285,7 +2285,6 @@ void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function, ExternalReference thunk_ref, Register thunk_last_arg, int stack_space, - bool returns_handle, int return_value_offset) { ExternalReference next_address = ExternalReference::handle_scope_next_address(isolate()); @@ -2354,15 +2353,6 @@ void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function, Label leave_exit_frame; Label return_value_loaded; - if (returns_handle) { - Label load_return_value; - cmp(r0, Operand::Zero()); - b(eq, &load_return_value); - // derefernce returned value - ldr(r0, MemOperand(r0)); - b(&return_value_loaded); - bind(&load_return_value); - } // load value from ReturnValue ldr(r0, MemOperand(fp, return_value_offset*kPointerSize)); bind(&return_value_loaded); diff --git a/src/arm/macro-assembler-arm.h b/src/arm/macro-assembler-arm.h index f3716c2..cff9ac7 100644 --- a/src/arm/macro-assembler-arm.h +++ b/src/arm/macro-assembler-arm.h @@ -1111,7 +1111,6 @@ class MacroAssembler: public Assembler { ExternalReference thunk_ref, Register thunk_last_arg, int stack_space, - bool returns_handle, int return_value_offset_from_fp); // Jump to a runtime routine. diff --git a/src/arm/simulator-arm.cc b/src/arm/simulator-arm.cc index c9e3616..def1818 100644 --- a/src/arm/simulator-arm.cc +++ b/src/arm/simulator-arm.cc @@ -1686,20 +1686,12 @@ typedef double (*SimulatorRuntimeFPIntCall)(double darg0, int32_t arg0); // This signature supports direct call in to API function native callback // (refer to InvocationCallback in v8.h). -typedef v8::Handle (*SimulatorRuntimeDirectApiCall)(int32_t arg0); -typedef void (*SimulatorRuntimeDirectApiCallNew)(int32_t arg0); -typedef v8::Handle (*SimulatorRuntimeProfilingApiCall)( - int32_t arg0, int32_t arg1); -typedef void (*SimulatorRuntimeProfilingApiCallNew)(int32_t arg0, int32_t arg1); +typedef void (*SimulatorRuntimeDirectApiCall)(int32_t arg0); +typedef void (*SimulatorRuntimeProfilingApiCall)(int32_t arg0, int32_t arg1); // This signature supports direct call to accessor getter callback. -typedef v8::Handle (*SimulatorRuntimeDirectGetterCall)(int32_t arg0, - int32_t arg1); -typedef void (*SimulatorRuntimeDirectGetterCallNew)(int32_t arg0, - int32_t arg1); -typedef v8::Handle (*SimulatorRuntimeProfilingGetterCall)( - int32_t arg0, int32_t arg1, int32_t arg2); -typedef void (*SimulatorRuntimeProfilingGetterCallNew)( +typedef void (*SimulatorRuntimeDirectGetterCall)(int32_t arg0, int32_t arg1); +typedef void (*SimulatorRuntimeProfilingGetterCall)( int32_t arg0, int32_t arg1, int32_t arg2); // Software interrupt instructions are used by the simulator to call into the @@ -1839,9 +1831,7 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { break; } } - } else if ( - redirection->type() == ExternalReference::DIRECT_API_CALL || - redirection->type() == ExternalReference::DIRECT_API_CALL_NEW) { + } else if (redirection->type() == ExternalReference::DIRECT_API_CALL) { if (::v8::internal::FLAG_trace_sim || !stack_aligned) { PrintF("Call to host function at %p args %08x", reinterpret_cast(external), arg0); @@ -1851,22 +1841,11 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { PrintF("\n"); } CHECK(stack_aligned); - if (redirection->type() == ExternalReference::DIRECT_API_CALL) { - SimulatorRuntimeDirectApiCall target = - reinterpret_cast(external); - v8::Handle result = target(arg0); - if (::v8::internal::FLAG_trace_sim) { - PrintF("Returned %p\n", reinterpret_cast(*result)); - } - set_register(r0, reinterpret_cast(*result)); - } else { - SimulatorRuntimeDirectApiCallNew target = - reinterpret_cast(external); - target(arg0); - } + SimulatorRuntimeDirectApiCall target = + reinterpret_cast(external); + target(arg0); } else if ( - redirection->type() == ExternalReference::PROFILING_API_CALL || - redirection->type() == ExternalReference::PROFILING_API_CALL_NEW) { + redirection->type() == ExternalReference::PROFILING_API_CALL) { if (::v8::internal::FLAG_trace_sim || !stack_aligned) { PrintF("Call to host function at %p args %08x %08x", reinterpret_cast(external), arg0, arg1); @@ -1876,22 +1855,11 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { PrintF("\n"); } CHECK(stack_aligned); - if (redirection->type() == ExternalReference::PROFILING_API_CALL) { - SimulatorRuntimeProfilingApiCall target = - reinterpret_cast(external); - v8::Handle result = target(arg0, arg1); - if (::v8::internal::FLAG_trace_sim) { - PrintF("Returned %p\n", reinterpret_cast(*result)); - } - set_register(r0, reinterpret_cast(*result)); - } else { - SimulatorRuntimeProfilingApiCallNew target = - reinterpret_cast(external); - target(arg0, arg1); - } + SimulatorRuntimeProfilingApiCall target = + reinterpret_cast(external); + target(arg0, arg1); } else if ( - redirection->type() == ExternalReference::DIRECT_GETTER_CALL || - redirection->type() == ExternalReference::DIRECT_GETTER_CALL_NEW) { + redirection->type() == ExternalReference::DIRECT_GETTER_CALL) { if (::v8::internal::FLAG_trace_sim || !stack_aligned) { PrintF("Call to host function at %p args %08x %08x", reinterpret_cast(external), arg0, arg1); @@ -1901,22 +1869,11 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { PrintF("\n"); } CHECK(stack_aligned); - if (redirection->type() == ExternalReference::DIRECT_GETTER_CALL) { - SimulatorRuntimeDirectGetterCall target = - reinterpret_cast(external); - v8::Handle result = target(arg0, arg1); - if (::v8::internal::FLAG_trace_sim) { - PrintF("Returned %p\n", reinterpret_cast(*result)); - } - set_register(r0, reinterpret_cast(*result)); - } else { - SimulatorRuntimeDirectGetterCallNew target = - reinterpret_cast(external); - target(arg0, arg1); - } + SimulatorRuntimeDirectGetterCall target = + reinterpret_cast(external); + target(arg0, arg1); } else if ( - redirection->type() == ExternalReference::PROFILING_GETTER_CALL || - redirection->type() == ExternalReference::PROFILING_GETTER_CALL_NEW) { + redirection->type() == ExternalReference::PROFILING_GETTER_CALL) { if (::v8::internal::FLAG_trace_sim || !stack_aligned) { PrintF("Call to host function at %p args %08x %08x %08x", reinterpret_cast(external), arg0, arg1, arg2); @@ -1926,20 +1883,10 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { PrintF("\n"); } CHECK(stack_aligned); - if (redirection->type() == ExternalReference::PROFILING_GETTER_CALL) { - SimulatorRuntimeProfilingGetterCall target = - reinterpret_cast(external); - v8::Handle result = target(arg0, arg1, arg2); - if (::v8::internal::FLAG_trace_sim) { - PrintF("Returned %p\n", reinterpret_cast(*result)); - } - set_register(r0, reinterpret_cast(*result)); - } else { - SimulatorRuntimeProfilingGetterCallNew target = - reinterpret_cast( - external); - target(arg0, arg1, arg2); - } + SimulatorRuntimeProfilingGetterCall target = + reinterpret_cast( + external); + target(arg0, arg1, arg2); } else { // builtin call. ASSERT(redirection->type() == ExternalReference::BUILTIN_CALL); diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc index 7db00c6..7605525 100644 --- a/src/arm/stub-cache-arm.cc +++ b/src/arm/stub-cache-arm.cc @@ -903,21 +903,13 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm, const int kStackUnwindSpace = argc + kFastApiCallArguments + 1; Address function_address = v8::ToCData
(api_call_info->callback()); - // TODO(dcarney): fix signatures using returns_handle - const bool returns_handle = false; ApiFunction fun(function_address); - ExternalReference::Type type = - returns_handle ? - ExternalReference::DIRECT_API_CALL : - ExternalReference::DIRECT_API_CALL_NEW; + ExternalReference::Type type = ExternalReference::DIRECT_API_CALL; ExternalReference ref = ExternalReference(&fun, type, masm->isolate()); Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); - ExternalReference::Type thunk_type = - returns_handle ? - ExternalReference::PROFILING_API_CALL : - ExternalReference::PROFILING_API_CALL_NEW; + ExternalReference::Type thunk_type = ExternalReference::PROFILING_API_CALL; ApiFunction thunk_fun(thunk_address); ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, masm->isolate()); @@ -928,7 +920,6 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm, thunk_ref, r1, kStackUnwindSpace, - returns_handle, kFastApiCallArguments + 1); } @@ -1422,19 +1413,14 @@ void BaseLoadStubCompiler::GenerateLoadCallback( const int kStackUnwindSpace = kFastApiCallArguments + 1; Address getter_address = v8::ToCData
(callback->getter()); - // TODO(dcarney): fix signatures using returns_handle - const bool returns_handle = false; ApiFunction fun(getter_address); - ExternalReference::Type type = - returns_handle ? - ExternalReference::DIRECT_GETTER_CALL : - ExternalReference::DIRECT_GETTER_CALL_NEW; + ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; ExternalReference ref = ExternalReference(&fun, type, isolate()); Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); ExternalReference::Type thunk_type = - ExternalReference::PROFILING_GETTER_CALL_NEW; + ExternalReference::PROFILING_GETTER_CALL; ApiFunction thunk_fun(thunk_address); ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, isolate()); @@ -1443,7 +1429,6 @@ void BaseLoadStubCompiler::GenerateLoadCallback( thunk_ref, r2, kStackUnwindSpace, - returns_handle, 5); } diff --git a/src/assembler.h b/src/assembler.h index d70d5aa..b358136 100644 --- a/src/assembler.h +++ b/src/assembler.h @@ -644,38 +644,21 @@ class ExternalReference BASE_EMBEDDED { BUILTIN_FP_INT_CALL, // Direct call to API function callback. - // Handle f(v8::Arguments&) + // void f(v8::FunctionCallbackInfo&) DIRECT_API_CALL, - // Call to invocation callback via InvokeInvocationCallback. - // Handle f(v8::Arguments&, v8::InvocationCallback) - PROFILING_API_CALL, - - // Direct call to API function callback. - // void f(v8::Arguments&) - DIRECT_API_CALL_NEW, - // Call to function callback via InvokeFunctionCallback. - // void f(v8::Arguments&, v8::FunctionCallback) - PROFILING_API_CALL_NEW, + // void f(v8::FunctionCallbackInfo&, v8::FunctionCallback) + PROFILING_API_CALL, // Direct call to accessor getter callback. - // Handle f(Local property, AccessorInfo& info) + // void f(Local property, PropertyCallbackInfo& info) DIRECT_GETTER_CALL, - // Call to accessor getter callback via InvokeAccessorGetter. - // Handle f(Local property, AccessorInfo& info, - // AccessorGetter getter) - PROFILING_GETTER_CALL, - - // Direct call to accessor getter callback. - // void f(Local property, AccessorInfo& info) - DIRECT_GETTER_CALL_NEW, - // Call to accessor getter callback via InvokeAccessorGetterCallback. - // void f(Local property, AccessorInfo& info, + // void f(Local property, PropertyCallbackInfo& info, // AccessorGetterCallback callback) - PROFILING_GETTER_CALL_NEW + PROFILING_GETTER_CALL }; static void SetUp(); diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc index bf785df..aaacbd9 100644 --- a/src/ia32/macro-assembler-ia32.cc +++ b/src/ia32/macro-assembler-ia32.cc @@ -1977,50 +1977,15 @@ void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid, } -// If true, a Handle returned by value from a function with cdecl calling -// convention will be returned directly as a value of location_ field in a -// register eax. -// If false, it is returned as a pointer to a preallocated by caller memory -// region. Pointer to this region should be passed to a function as an -// implicit first argument. -#if defined(USING_BSD_ABI) || defined(__MINGW32__) || defined(__CYGWIN__) -static const bool kReturnHandlesDirectly = true; -#else -static const bool kReturnHandlesDirectly = false; -#endif - - -Operand ApiParameterOperand(int index, bool returns_handle) { - int offset = (index +(kReturnHandlesDirectly || !returns_handle ? 0 : 1)); - return Operand(esp, offset * kPointerSize); +Operand ApiParameterOperand(int index) { + return Operand(esp, index * kPointerSize); } -void MacroAssembler::PrepareCallApiFunction(int argc, bool returns_handle) { - if (kReturnHandlesDirectly || !returns_handle) { - EnterApiExitFrame(argc); - // When handles are returned directly we don't have to allocate extra - // space for and pass an out parameter. - if (emit_debug_code()) { - mov(esi, Immediate(BitCast(kZapValue))); - } - } else { - // We allocate two additional slots: return value and pointer to it. - EnterApiExitFrame(argc + 2); - - // The argument slots are filled as follows: - // - // n + 1: output slot - // n: arg n - // ... - // 1: arg1 - // 0: pointer to the output slot - - lea(esi, Operand(esp, (argc + 1) * kPointerSize)); - mov(Operand(esp, 0 * kPointerSize), esi); - if (emit_debug_code()) { - mov(Operand(esi, 0), Immediate(0)); - } +void MacroAssembler::PrepareCallApiFunction(int argc) { + EnterApiExitFrame(argc); + if (emit_debug_code()) { + mov(esi, Immediate(BitCast(kZapValue))); } } @@ -2029,7 +1994,6 @@ void MacroAssembler::CallApiFunctionAndReturn(Address function_address, Address thunk_address, Operand thunk_last_arg, int stack_space, - bool returns_handle, int return_value_offset) { ExternalReference next_address = ExternalReference::handle_scope_next_address(isolate()); @@ -2085,21 +2049,6 @@ void MacroAssembler::CallApiFunctionAndReturn(Address function_address, } Label prologue; - if (returns_handle) { - if (!kReturnHandlesDirectly) { - // PrepareCallApiFunction saved pointer to the output slot into - // callee-save register esi. - mov(eax, Operand(esi, 0)); - } - Label empty_handle; - // Check if the result handle holds 0. - test(eax, eax); - j(zero, &empty_handle); - // It was non-zero. Dereference to get the result value. - mov(eax, Operand(eax, 0)); - jmp(&prologue); - bind(&empty_handle); - } // Load the value from ReturnValue mov(eax, Operand(ebp, return_value_offset * kPointerSize)); diff --git a/src/ia32/macro-assembler-ia32.h b/src/ia32/macro-assembler-ia32.h index d537b0b..4d9ebad 100644 --- a/src/ia32/macro-assembler-ia32.h +++ b/src/ia32/macro-assembler-ia32.h @@ -782,7 +782,7 @@ class MacroAssembler: public Assembler { // Arguments must be stored in ApiParameterOperand(0), ApiParameterOperand(1) // etc. Saves context (esi). If space was reserved for return value then // stores the pointer to the reserved slot into esi. - void PrepareCallApiFunction(int argc, bool returns_handle); + void PrepareCallApiFunction(int argc); // Calls an API function. Allocates HandleScope, extracts returned value // from handle and propagates exceptions. Clobbers ebx, edi and @@ -792,7 +792,6 @@ class MacroAssembler: public Assembler { Address thunk_address, Operand thunk_last_arg, int stack_space, - bool returns_handle, int return_value_offset_from_ebp); // Jump to a runtime routine. @@ -1039,7 +1038,7 @@ inline Operand GlobalObjectOperand() { // Generates an Operand for saving parameters after PrepareCallApiFunction. -Operand ApiParameterOperand(int index, bool returns_handle); +Operand ApiParameterOperand(int index); #ifdef GENERATED_CODE_COVERAGE diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc index 2cceecb..9aa7bae 100644 --- a/src/ia32/stub-cache-ia32.cc +++ b/src/ia32/stub-cache-ia32.cc @@ -516,31 +516,28 @@ static void GenerateFastApiCall(MacroAssembler* masm, // Function address is a foreign pointer outside V8's heap. Address function_address = v8::ToCData
(api_call_info->callback()); - // TODO(dcarney): fix signatures using returns_handle - const bool returns_handle = false; - __ PrepareCallApiFunction(kApiArgc + kApiStackSpace, returns_handle); + __ PrepareCallApiFunction(kApiArgc + kApiStackSpace); // v8::Arguments::implicit_args_. - __ mov(ApiParameterOperand(2, returns_handle), eax); + __ mov(ApiParameterOperand(2), eax); __ add(eax, Immediate(argc * kPointerSize)); // v8::Arguments::values_. - __ mov(ApiParameterOperand(3, returns_handle), eax); + __ mov(ApiParameterOperand(3), eax); // v8::Arguments::length_. - __ Set(ApiParameterOperand(4, returns_handle), Immediate(argc)); + __ Set(ApiParameterOperand(4), Immediate(argc)); // v8::Arguments::is_construct_call_. - __ Set(ApiParameterOperand(5, returns_handle), Immediate(0)); + __ Set(ApiParameterOperand(5), Immediate(0)); // v8::InvocationCallback's argument. - __ lea(eax, ApiParameterOperand(2, returns_handle)); - __ mov(ApiParameterOperand(0, returns_handle), eax); + __ lea(eax, ApiParameterOperand(2)); + __ mov(ApiParameterOperand(0), eax); Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); __ CallApiFunctionAndReturn(function_address, thunk_address, - ApiParameterOperand(1, returns_handle), + ApiParameterOperand(1), argc + kFastApiCallArguments + 1, - returns_handle, kFastApiCallArguments + 1); } @@ -1397,12 +1394,10 @@ void BaseLoadStubCompiler::GenerateLoadCallback( const int kApiArgc = 2 + 1; Address getter_address = v8::ToCData
(callback->getter()); - // TODO(dcarney): fix signatures using returns_handle - const bool returns_handle = false; - __ PrepareCallApiFunction(kApiArgc, returns_handle); - __ mov(ApiParameterOperand(0, returns_handle), ebx); // name. + __ PrepareCallApiFunction(kApiArgc); + __ mov(ApiParameterOperand(0), ebx); // name. __ add(ebx, Immediate(kPointerSize)); - __ mov(ApiParameterOperand(1, returns_handle), ebx); // arguments pointer. + __ mov(ApiParameterOperand(1), ebx); // arguments pointer. // Emitting a stub call may try to allocate (if the code is not // already generated). Do not allow the assembler to perform a @@ -1413,9 +1408,8 @@ void BaseLoadStubCompiler::GenerateLoadCallback( __ CallApiFunctionAndReturn(getter_address, thunk_address, - ApiParameterOperand(2, returns_handle), + ApiParameterOperand(2), kStackSpace, - returns_handle, 6); } diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc index 5180e6b..4ff4cea 100644 --- a/src/x64/macro-assembler-x64.cc +++ b/src/x64/macro-assembler-x64.cc @@ -685,22 +685,8 @@ static int Offset(ExternalReference ref0, ExternalReference ref1) { } -void MacroAssembler::PrepareCallApiFunction(int arg_stack_space, - bool returns_handle) { -#if defined(_WIN64) && !defined(__MINGW64__) - if (!returns_handle) { - EnterApiExitFrame(arg_stack_space); - return; - } - // We need to prepare a slot for result handle on stack and put - // a pointer to it into 1st arg register. - EnterApiExitFrame(arg_stack_space + 1); - - // rcx must be used to pass the pointer to the return value slot. - lea(rcx, StackSpaceOperand(arg_stack_space)); -#else +void MacroAssembler::PrepareCallApiFunction(int arg_stack_space) { EnterApiExitFrame(arg_stack_space); -#endif } @@ -708,7 +694,6 @@ void MacroAssembler::CallApiFunctionAndReturn(Address function_address, Address thunk_address, Register thunk_last_arg, int stack_space, - bool returns_handle, int return_value_offset) { Label prologue; Label promote_scheduled_exception; @@ -781,23 +766,6 @@ void MacroAssembler::CallApiFunctionAndReturn(Address function_address, PopSafepointRegisters(); } - // Can skip the result check for new-style callbacks - // TODO(dcarney): may need to pass this information down - // as some function_addresses might not have been registered - if (returns_handle) { - Label empty_result; -#if defined(_WIN64) && !defined(__MINGW64__) - // rax keeps a pointer to v8::Handle, unpack it. - movq(rax, Operand(rax, 0)); -#endif - // Check if the result handle holds 0. - testq(rax, rax); - j(zero, &empty_result); - // It was non-zero. Dereference to get the result value. - movq(rax, Operand(rax, 0)); - jmp(&prologue); - bind(&empty_result); - } // Load the value from ReturnValue movq(rax, Operand(rbp, return_value_offset * kPointerSize)); bind(&prologue); diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h index 61abc20..dcbf6ae 100644 --- a/src/x64/macro-assembler-x64.h +++ b/src/x64/macro-assembler-x64.h @@ -1242,7 +1242,7 @@ class MacroAssembler: public Assembler { // rcx (rcx must be preserverd until CallApiFunctionAndReturn). Saves // context (rsi). Clobbers rax. Allocates arg_stack_space * kPointerSize // inside the exit frame (not GCed) accessible via StackSpaceOperand. - void PrepareCallApiFunction(int arg_stack_space, bool returns_handle); + void PrepareCallApiFunction(int arg_stack_space); // Calls an API function. Allocates HandleScope, extracts returned value // from handle and propagates exceptions. Clobbers r14, r15, rbx and @@ -1252,7 +1252,6 @@ class MacroAssembler: public Assembler { Address thunk_address, Register thunk_last_arg, int stack_space, - bool returns_handle, int return_value_offset_from_rbp); // Before calling a C-function from generated code, align arguments on stack. diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc index 696e5db..55e4a9b 100644 --- a/src/x64/stub-cache-x64.cc +++ b/src/x64/stub-cache-x64.cc @@ -493,16 +493,10 @@ static void GenerateFastApiCall(MacroAssembler* masm, // Function address is a foreign pointer outside V8's heap. Address function_address = v8::ToCData
(api_call_info->callback()); - // TODO(dcarney): fix signatures using returns_handle - const bool returns_handle = false; -#if defined(__MINGW64__) +#if defined(__MINGW64__) || defined(_WIN64) Register arguments_arg = rcx; Register callback_arg = rdx; -#elif defined(_WIN64) - // Win64 uses first register--rcx--for returned value. - Register arguments_arg = returns_handle ? rdx : rcx; - Register callback_arg = returns_handle ? r8 : rdx; #else Register arguments_arg = rdi; Register callback_arg = rsi; @@ -512,7 +506,7 @@ static void GenerateFastApiCall(MacroAssembler* masm, // it's not controlled by GC. const int kApiStackSpace = 4; - __ PrepareCallApiFunction(kApiStackSpace, returns_handle); + __ PrepareCallApiFunction(kApiStackSpace); __ movq(StackSpaceOperand(0), rbx); // v8::Arguments::implicit_args_. __ addq(rbx, Immediate(argc * kPointerSize)); @@ -530,7 +524,6 @@ static void GenerateFastApiCall(MacroAssembler* masm, thunk_address, callback_arg, api_call_argc + 1, - returns_handle, kFastApiCallArguments + 1); } @@ -1307,18 +1300,11 @@ void BaseLoadStubCompiler::GenerateLoadCallback( // passed as the const ExecutableAccessorInfo& to the C++ callback. Address getter_address = v8::ToCData
(callback->getter()); - // TODO(dcarney): fix signatures using returns_handle - const bool returns_handle = false; -#if defined(__MINGW64__) +#if defined(__MINGW64__) || defined(_WIN64) Register getter_arg = r8; Register accessor_info_arg = rdx; Register name_arg = rcx; -#elif defined(_WIN64) - // Win64 uses first register--rcx--for returned value. - Register getter_arg = returns_handle ? r9 : r8; - Register accessor_info_arg = returns_handle ? r8 : rdx; - Register name_arg = returns_handle ? rdx : rcx; #else Register getter_arg = rdx; Register accessor_info_arg = rsi; @@ -1335,7 +1321,7 @@ void BaseLoadStubCompiler::GenerateLoadCallback( // Allocate v8::AccessorInfo in non-GCed stack space. const int kArgStackSpace = 1; - __ PrepareCallApiFunction(kArgStackSpace, returns_handle); + __ PrepareCallApiFunction(kArgStackSpace); STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); __ lea(rax, Operand(name_arg, 6 * kPointerSize)); @@ -1352,7 +1338,6 @@ void BaseLoadStubCompiler::GenerateLoadCallback( thunk_address, getter_arg, kStackSpace, - returns_handle, 5); }