Reviewers: Mads Ager, Message: We need to make sure that the GC does not touch the space allocated for parameters in the exit frame in WIN64, because they could be anything in the C function. Also, the _arguments array of the Arguments object must be safe from relocation - is this true?
http://codereview.chromium.org/182027/diff/1/2 File src/x64/macro-assembler-x64.cc (right): http://codereview.chromium.org/182027/diff/1/2#newcode1029 Line 1029: ASSERT(kFrameAlignment <= 0x10); // Change the padding if needed. Needs to == 0x10, so the structure is aligned, and the stack is aligned. Description: X64: Obey WIN64 ABI more exactly, in WIN64 build. Please review this at http://codereview.chromium.org/182027 SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/ Affected files: M src/x64/codegen-x64.cc M src/x64/macro-assembler-x64.cc Index: src/x64/macro-assembler-x64.cc =================================================================== --- src/x64/macro-assembler-x64.cc (revision 2783) +++ src/x64/macro-assembler-x64.cc (working copy) @@ -1010,12 +1010,6 @@ } #endif - // Reserve space for the Arguments object. The Windows 64-bit ABI - // requires us to pass this structure as a pointer to its location on - // the stack. We also need backing space for the pointer, even though - // it is passed in a register. - subq(rsp, Immediate(3 * kPointerSize)); - // Get the required frame alignment for the OS. static const int kFrameAlignment = OS::ActivationFrameAlignment(); if (kFrameAlignment > 0) { @@ -1024,6 +1018,17 @@ and_(rsp, kScratchRegister); } +#ifdef _WIN64 + // Reserve space for the Arguments object. The Windows 64-bit ABI + // requires us to pass this structure as a pointer to its location on + // the stack. + // The structure on the stack must be 16-byte aligned. + // We also need backing space for 4 parameters, even though + // we only pass one parameter, and it is in a register. + subq(rsp, Immediate(0x30)); // 2 pointer structure, plus 4 parameters. + ASSERT(kFrameAlignment <= 0x10); // Change the padding if needed. +#endif + // Patch the saved entry sp. movq(Operand(rbp, ExitFrameConstants::kSPOffset), rsp); } Index: src/x64/codegen-x64.cc =================================================================== --- src/x64/codegen-x64.cc (revision 2783) +++ src/x64/codegen-x64.cc (working copy) @@ -6953,11 +6953,11 @@ // Call C function. #ifdef _WIN64 // Windows 64-bit ABI passes arguments in rcx, rdx, r8, r9 - // Store Arguments object on stack - __ movq(Operand(rsp, 1 * kPointerSize), r14); // argc. - __ movq(Operand(rsp, 2 * kPointerSize), r15); // argv. + // Store Arguments object on stack, below the 4 WIN64 ABI parameter slots. + __ movq(Operand(rsp, 4 * kPointerSize), r14); // argc. + __ movq(Operand(rsp, 5 * kPointerSize), r15); // argv. // Pass a pointer to the Arguments object as the first argument. - __ lea(rcx, Operand(rsp, 1 * kPointerSize)); + __ lea(rcx, Operand(rsp, 4 * kPointerSize)); #else // ! defined(_WIN64) // GCC passes arguments in rdi, rsi, rdx, rcx, r8, r9. __ movq(rdi, r14); // argc. --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
