Revision: 11325
Author:   [email protected]
Date:     Mon Apr 16 02:22:12 2012
Log:      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 <[email protected]>.
http://code.google.com/p/v8/source/detail?r=11325

Modified:
 /branches/bleeding_edge/src/x64/macro-assembler-x64.cc
 /branches/bleeding_edge/src/x64/stub-cache-x64.cc

=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Mon Mar 12 06:56:56 2012 +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Mon Apr 16 02:22:12 2012
@@ -657,7 +657,7 @@


 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
   // a pointer to it into 1st arg register.
   EnterApiExitFrame(arg_stack_space + 1);
@@ -705,7 +705,7 @@
        RelocInfo::RUNTIME_ENTRY);
   call(rax);

-#ifdef _WIN64
+#if defined(_WIN64) && !defined(__MINGW64__)
   // rax keeps a pointer to v8::Handle, unpack it.
   movq(rax, Operand(rax, 0));
 #endif
=======================================
--- /branches/bleeding_edge/src/x64/stub-cache-x64.cc Fri Apr 13 04:25:13 2012 +++ /branches/bleeding_edge/src/x64/stub-cache-x64.cc Mon Apr 16 02:22:12 2012
@@ -482,7 +482,9 @@
   // Prepare arguments.
   __ 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.
   Register arguments_arg = rdx;
 #else
@@ -1016,7 +1018,10 @@
   // Save a pointer to where we pushed the arguments pointer.
   // 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.
   Register accessor_info_arg = r8;
   Register name_arg = rdx;

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to