Changeset 173282 in webkit


Ignore:
Timestamp:
Sep 4, 2014 2:23:38 PM (10 years ago)
Author:
msaboff@apple.com
Message:

REGRESSION(r173031): crashes during run-layout-jsc on x86/Linux
https://bugs.webkit.org/show_bug.cgi?id=136436

Reviewed by Geoffrey Garen.

Instead of trying to calculate a stack pointer that allows for possible
stacked argument space, just use the "home" stack pointer location.
That stack pointer provides space for the worst case number of stacked
arguments on architectures that use stacked arguments. It also provides
stack space so that the return PC and caller frame pointer that are stored
as part of making the call to operationCallEval will not override any part
of the callee frame created on the stack.

Changed compileCallEval() to use the stackPointer value of the calling
function. That stack pointer is calculated to have enough space for
outgoing stacked arguments. By moving the stack pointer to its "home"
position, the caller frame and return PC are not set as part of making
the call to operationCallEval(). Moved the explicit setting of the
callerFrame field of the callee CallFrame from operationCallEval() to
compileCallEval() since it has been the artifact of making a call for
most architectures. Simplified the exception logic in compileCallEval()
as a result of the change. To be compliant with the stack state
expected by virtualCallThunkGenerator(), moved the stack pointer to
point above the CallerFrameAndPC of the callee CallFrame.

  • jit/JIT.h: Changed callOperationNoExceptionCheck(J_JITOperation_EE, ...)

to callOperation(J_JITOperation_EE, ...) as it now can do a typical exception
check.

  • jit/JITCall.cpp & jit/JITCall32_64.cpp:

(JSC::JIT::compileCallEval): Use the home stack pointer when making the call
to operationCallEval. Since the stack pointer adjustment no longer needs
to be done after making the call to operationCallEval(), the exception check
logic can be simplified.
(JSC::JIT::compileCallEvalSlowCase): Restored the stack pointer to point
to above the calleeFrame as this is what the generated thunk expects.

  • jit/JITInlines.h:

(JSC::JIT::callOperation): Refactor of callOperationNoExceptionCheck
with the addition of a standard exception check.
(JSC::JIT::callOperationNoExceptionCheck): Deleted.

  • jit/JITOperations.cpp:

(JSC::operationCallEval): Eliminated the explicit setting of caller frame
as that is now done in the code generated by compileCallEval().

Location:
trunk/Source/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r173279 r173282  
     12014-09-04  Michael Saboff  <msaboff@apple.com>
     2
     3        REGRESSION(r173031): crashes during run-layout-jsc on x86/Linux
     4        https://bugs.webkit.org/show_bug.cgi?id=136436
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Instead of trying to calculate a stack pointer that allows for possible
     9        stacked argument space, just use the "home" stack pointer location.
     10        That stack pointer provides space for the worst case number of stacked
     11        arguments on architectures that use stacked arguments.  It also provides
     12        stack space so that the return PC and caller frame pointer that are stored
     13        as part of making the call to operationCallEval will not override any part
     14        of the callee frame created on the stack.
     15
     16        Changed compileCallEval() to use the stackPointer value of the calling
     17        function.  That stack pointer is calculated to have enough space for
     18        outgoing stacked arguments.  By moving the stack pointer to its "home"
     19        position, the caller frame and return PC are not set as part of making
     20        the call to operationCallEval().  Moved the explicit setting of the
     21        callerFrame field of the callee CallFrame from operationCallEval() to
     22        compileCallEval() since it has been the artifact of making a call for
     23        most architectures.  Simplified the exception logic in compileCallEval()
     24        as a result of the change.  To be compliant with the stack state
     25        expected by virtualCallThunkGenerator(), moved the stack pointer to
     26        point above the CallerFrameAndPC of the callee CallFrame.
     27
     28        * jit/JIT.h: Changed callOperationNoExceptionCheck(J_JITOperation_EE, ...)
     29        to callOperation(J_JITOperation_EE, ...) as it now can do a typical exception
     30        check.
     31        * jit/JITCall.cpp & jit/JITCall32_64.cpp:
     32        (JSC::JIT::compileCallEval): Use the home stack pointer when making the call
     33        to operationCallEval.  Since the stack pointer adjustment no longer needs
     34        to be done after making the call to operationCallEval(), the exception check
     35        logic can be simplified.
     36        (JSC::JIT::compileCallEvalSlowCase): Restored the stack pointer to point
     37        to above the calleeFrame as this is what the generated thunk expects.
     38        * jit/JITInlines.h:
     39        (JSC::JIT::callOperation): Refactor of callOperationNoExceptionCheck
     40        with the addition of a standard exception check.
     41        (JSC::JIT::callOperationNoExceptionCheck): Deleted.
     42        * jit/JITOperations.cpp:
     43        (JSC::operationCallEval): Eliminated the explicit setting of caller frame
     44        as that is now done in the code generated by compileCallEval().
     45
    1462014-09-03  Filip Pizlo  <fpizlo@apple.com>
    247
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r173199 r173282  
    719719        MacroAssembler::Call callOperation(V_JITOperation_ECC, RegisterID, RegisterID);
    720720        MacroAssembler::Call callOperation(V_JITOperation_ECICC, RegisterID, const Identifier*, RegisterID, RegisterID);
     721        MacroAssembler::Call callOperation(J_JITOperation_EE, RegisterID);
    721722        MacroAssembler::Call callOperation(V_JITOperation_EIdJZ, const Identifier*, RegisterID, int32_t);
    722723        MacroAssembler::Call callOperation(V_JITOperation_EJ, RegisterID);
     
    739740        MacroAssembler::Call callOperation(V_JITOperation_EZ, int32_t);
    740741        MacroAssembler::Call callOperationWithCallFrameRollbackOnException(J_JITOperation_E);
    741         MacroAssembler::Call callOperationNoExceptionCheck(J_JITOperation_EE, RegisterID);
    742742        MacroAssembler::Call callOperationWithCallFrameRollbackOnException(V_JITOperation_ECb, CodeBlock*);
    743743        MacroAssembler::Call callOperationWithCallFrameRollbackOnException(Z_JITOperation_E);
  • trunk/Source/JavaScriptCore/jit/JITCall.cpp

    r173069 r173282  
    137137{
    138138    addPtr(TrustedImm32(-static_cast<ptrdiff_t>(sizeof(CallerFrameAndPC))), stackPointerRegister, regT1);
    139     callOperationNoExceptionCheck(operationCallEval, regT1);
    140 
    141     Jump noException = emitExceptionCheck(InvertedExceptionCheck);
    142     addPtr(TrustedImm32(stackPointerOffsetFor(m_codeBlock) * sizeof(Register)), callFrameRegister, stackPointerRegister);   
    143     exceptionCheck(jump());
    144 
    145     noException.link(this);
    146     addSlowCase(branch64(Equal, regT0, TrustedImm64(JSValue::encode(JSValue()))));
     139    storePtr(callFrameRegister, Address(regT1, CallFrame::callerFrameOffset()));
    147140
    148141    addPtr(TrustedImm32(stackPointerOffsetFor(m_codeBlock) * sizeof(Register)), callFrameRegister, stackPointerRegister);
    149142    checkStackPointerAlignment();
    150143
     144    callOperation(operationCallEval, regT1);
     145
     146    addSlowCase(branch64(Equal, regT0, TrustedImm64(JSValue::encode(JSValue()))));
     147
    151148    sampleCodeBlock(m_codeBlock);
    152149   
     
    157154{
    158155    linkSlowCase(iter);
     156    int registerOffset = -instruction[4].u.operand;
     157
     158    addPtr(TrustedImm32(registerOffset * sizeof(Register) + sizeof(CallerFrameAndPC)), callFrameRegister, stackPointerRegister);
    159159
    160160    load64(Address(stackPointerRegister, sizeof(Register) * JSStack::Callee - sizeof(CallerFrameAndPC)), regT0);
  • trunk/Source/JavaScriptCore/jit/JITCall32_64.cpp

    r173069 r173282  
    221221{
    222222    addPtr(TrustedImm32(-static_cast<ptrdiff_t>(sizeof(CallerFrameAndPC))), stackPointerRegister, regT1);
    223 
    224     callOperationNoExceptionCheck(operationCallEval, regT1);
    225 
    226     Jump noException = emitExceptionCheck(InvertedExceptionCheck);
     223    storePtr(callFrameRegister, Address(regT1, CallFrame::callerFrameOffset()));
     224
    227225    addPtr(TrustedImm32(stackPointerOffsetFor(m_codeBlock) * sizeof(Register)), callFrameRegister, stackPointerRegister);
    228     exceptionCheck(jump());
    229 
    230     noException.link(this);
     226
     227    callOperation(operationCallEval, regT1);
     228
    231229    addSlowCase(branch32(Equal, regT1, TrustedImm32(JSValue::EmptyValueTag)));
    232230
    233     addPtr(TrustedImm32(stackPointerOffsetFor(m_codeBlock) * sizeof(Register)), callFrameRegister, stackPointerRegister);
    234     checkStackPointerAlignment();
    235 
    236231    sampleCodeBlock(m_codeBlock);
    237232   
     
    242237{
    243238    linkSlowCase(iter);
     239
     240    int registerOffset = -instruction[4].u.operand;
     241
     242    addPtr(TrustedImm32(registerOffset * sizeof(Register) + sizeof(CallerFrameAndPC)), callFrameRegister, stackPointerRegister);
    244243
    245244    loadPtr(Address(stackPointerRegister, sizeof(Register) * JSStack::Callee - sizeof(CallerFrameAndPC)), regT0);
  • trunk/Source/JavaScriptCore/jit/JITInlines.h

    r172189 r173282  
    318318}
    319319
     320ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EE operation, RegisterID regOp)
     321{
     322    setupArgumentsWithExecState(regOp);
     323    updateTopCallFrame();
     324    return appendCallWithExceptionCheck(operation);
     325}
     326
    320327ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EPc operation, Instruction* bytecodePC)
    321328{
     
    334341    setupArgumentsExecState();
    335342    return appendCallWithCallFrameRollbackOnException(operation);
    336 }
    337 
    338 ALWAYS_INLINE MacroAssembler::Call JIT::callOperationNoExceptionCheck(J_JITOperation_EE operation, RegisterID regOp)
    339 {
    340     setupArgumentsWithExecState(regOp);
    341     updateTopCallFrame();
    342     return appendCall(operation);
    343343}
    344344
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r173199 r173282  
    613613    execCallee->setScope(exec->scope());
    614614    execCallee->setCodeBlock(0);
    615     execCallee->setCallerFrame(exec);
    616615
    617616    if (!isHostFunction(execCallee->calleeAsValue(), globalFuncEval))
Note: See TracChangeset for help on using the changeset viewer.