Changeset 164397 in webkit


Ignore:
Timestamp:
Feb 19, 2014 3:41:21 PM (10 years ago)
Author:
mark.lam@apple.com
Message:

Need to align sp before calling operationLoadVarargs on 32-bit platforms.
<https://webkit.org/b/129056>

Reviewed by Michael Saboff.

In JIT::compileLoadVarargs(), we'll call operationSizeFrameForVarargs()
to compute the amount of stack space we need for the varargs, adjust the
stack pointer to make room for those varargs, and then call
operationLoadVarargs() to fill in the varargs. Currently, the stack
pointer adjustment takes care of allocating space for the varargs, but
does not align the stack pointer for the call to operationLoadVarargs().
The fix is to align the stack pointer there.

Note: The stack pointer adjustment is based on the new CallFrame pointer
value returned by operationSizeFrameForVarargs(). On 64-bit platforms,
both the stack pointer and call frame pointer are similarly aligned
(i.e. low nibbles are 0). Hence, no additional adjustment is needed.
Only the 32-bit code needs the fix.

Note: The LLINT also works this way i.e. aligns the stack pointer before
calling llint_slow_path_call_varargs().

  • jit/JITCall32_64.cpp:

(JSC::JIT::compileLoadVarargs):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r164396 r164397  
     12014-02-19  Mark Lam  <mark.lam@apple.com>
     2
     3        Need to align sp before calling operationLoadVarargs on 32-bit platforms.
     4        <https://webkit.org/b/129056>
     5
     6        Reviewed by Michael Saboff.
     7
     8        In JIT::compileLoadVarargs(), we'll call operationSizeFrameForVarargs()
     9        to compute the amount of stack space we need for the varargs, adjust the
     10        stack pointer to make room for those varargs, and then call
     11        operationLoadVarargs() to fill in the varargs. Currently, the stack
     12        pointer adjustment takes care of allocating space for the varargs, but
     13        does not align the stack pointer for the call to operationLoadVarargs().
     14        The fix is to align the stack pointer there.
     15
     16        Note: The stack pointer adjustment is based on the new CallFrame pointer
     17        value returned by operationSizeFrameForVarargs(). On 64-bit platforms,
     18        both the stack pointer and call frame pointer are similarly aligned
     19        (i.e. low nibbles are 0). Hence, no additional adjustment is needed.
     20        Only the 32-bit code needs the fix.
     21
     22        Note: The LLINT also works this way i.e. aligns the stack pointer before
     23        calling llint_slow_path_call_varargs().
     24
     25        * jit/JITCall32_64.cpp:
     26        (JSC::JIT::compileLoadVarargs):
     27
    1282014-02-19  Sam Weinig  <sam@webkit.org>
    229
  • trunk/Source/JavaScriptCore/jit/JITCall32_64.cpp

    r163844 r164397  
    187187    emitLoad(arguments, regT1, regT0);
    188188    callOperation(operationSizeFrameForVarargs, regT1, regT0, firstFreeRegister);
    189     move(returnValueGPR, stackPointerRegister);
     189    addPtr(TrustedImm32(-sizeof(CallerFrameAndPC)), returnValueGPR, stackPointerRegister);
    190190    emitLoad(thisValue, regT1, regT4);
    191191    emitLoad(arguments, regT3, regT2);
Note: See TracChangeset for help on using the changeset viewer.