Commit 267879e9 authored by ulan@chromium.org's avatar ulan@chromium.org

Fix fast API call for MinGW-w64

MinGW-w64 uses the rcx register for the first argument. Unlike MSVC, it does not require preparing a slot for the result handle on the stack and putting a pointer to it in the rcx register.

BUGS=v8:2026
TEST=cctest/test-api

Review URL: https://chromiumcodereview.appspot.com/9959050
Patch from Jonathan Liu <net147@gmail.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11325 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 68e680bf
...@@ -657,7 +657,7 @@ static int Offset(ExternalReference ref0, ExternalReference ref1) { ...@@ -657,7 +657,7 @@ static int Offset(ExternalReference ref0, ExternalReference ref1) {
void MacroAssembler::PrepareCallApiFunction(int arg_stack_space) { void MacroAssembler::PrepareCallApiFunction(int arg_stack_space) {
#ifdef _WIN64 #if defined(_WIN64) && !defined(__MINGW64__)
// We need to prepare a slot for result handle on stack and put // We need to prepare a slot for result handle on stack and put
// a pointer to it into 1st arg register. // a pointer to it into 1st arg register.
EnterApiExitFrame(arg_stack_space + 1); EnterApiExitFrame(arg_stack_space + 1);
...@@ -705,7 +705,7 @@ void MacroAssembler::CallApiFunctionAndReturn(Address function_address, ...@@ -705,7 +705,7 @@ void MacroAssembler::CallApiFunctionAndReturn(Address function_address,
RelocInfo::RUNTIME_ENTRY); RelocInfo::RUNTIME_ENTRY);
call(rax); call(rax);
#ifdef _WIN64 #if defined(_WIN64) && !defined(__MINGW64__)
// rax keeps a pointer to v8::Handle, unpack it. // rax keeps a pointer to v8::Handle, unpack it.
movq(rax, Operand(rax, 0)); movq(rax, Operand(rax, 0));
#endif #endif
......
...@@ -482,7 +482,9 @@ static void GenerateFastApiCall(MacroAssembler* masm, ...@@ -482,7 +482,9 @@ static void GenerateFastApiCall(MacroAssembler* masm,
// Prepare arguments. // Prepare arguments.
__ lea(rbx, Operand(rsp, 4 * kPointerSize)); __ lea(rbx, Operand(rsp, 4 * kPointerSize));
#ifdef _WIN64 #if defined(__MINGW64__)
Register arguments_arg = rcx;
#elif defined(_WIN64)
// Win64 uses first register--rcx--for returned value. // Win64 uses first register--rcx--for returned value.
Register arguments_arg = rdx; Register arguments_arg = rdx;
#else #else
...@@ -1016,7 +1018,10 @@ void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, ...@@ -1016,7 +1018,10 @@ void StubCompiler::GenerateLoadCallback(Handle<JSObject> object,
// Save a pointer to where we pushed the arguments pointer. // Save a pointer to where we pushed the arguments pointer.
// This will be passed as the const AccessorInfo& to the C++ callback. // This will be passed as the const AccessorInfo& to the C++ callback.
#ifdef _WIN64 #if defined(__MINGW64__)
Register accessor_info_arg = rdx;
Register name_arg = rcx;
#elif defined(_WIN64)
// Win64 uses first register--rcx--for returned value. // Win64 uses first register--rcx--for returned value.
Register accessor_info_arg = r8; Register accessor_info_arg = r8;
Register name_arg = rdx; Register name_arg = rdx;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment