Ignore:
Timestamp:
Dec 12, 2016, 1:46:45 PM (9 years ago)
Author:
[email protected]
Message:

REGRESSION(r209653): speedometer crashes making virtual slow path tailcalls
https://bugs.webkit.org/show_bug.cgi?id=165748

Reviewed by Filip Pizlo.

JSTests:

New regression test.

  • stress/regress-165748.js: Added.

(sum1):
(sum2):
(sum3):
(sum4):
(sum5):
(sum6):
(tailCaller):
(test):

Source/JavaScriptCore:

The virtual slow path for tailcalls always passes arguments on the stack.
The fix here is to link to the stack argument entrypoint instead of a register
argument entrypoint.

While fixing this bug, I found that we weren't clearing the code origin when
shuffling the call frame for a register argument tailcall.

Also rolling back in r209653, r209654, r209663, and r209673.

  • jit/CallFrameShuffler.cpp:

(JSC::CallFrameShuffler::prepareAny):

  • jit/ThunkGenerators.cpp:

(JSC::virtualThunkFor):

Source/WTF:

Rolling back in r209653, r209654, r209663, and r209673.

  • wtf/Platform.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/JITCode.cpp

    r209678 r209725  
    7676    if (!function || !protoCallFrame->needArityCheck()) {
    7777        ASSERT(!protoCallFrame->needArityCheck());
    78         entryAddress = executableAddress();
     78        entryAddress = addressForCall(StackArgsArityCheckNotRequired).executableAddress();
    7979    } else
    80         entryAddress = addressForCall(MustCheckArity).executableAddress();
     80        entryAddress = addressForCall(StackArgsMustCheckArity).executableAddress();
    8181    JSValue result = JSValue::decode(vmEntryToJavaScript(entryAddress, vm, protoCallFrame));
    8282    return scope.exception() ? jsNull() : result;
     
    163163}
    164164
    165 DirectJITCode::DirectJITCode(JITCode::CodeRef ref, JITCode::CodePtr withArityCheck, JITType jitType)
    166     : JITCodeWithCodeRef(ref, jitType)
    167     , m_withArityCheck(withArityCheck)
     165DirectJITCode::DirectJITCode(JITEntryPointsWithRef entries, JITType jitType)
     166    : JITCodeWithCodeRef(entries.codeRef(), jitType)
     167    , m_entryPoints(entries)
    168168{
    169169}
     
    173173}
    174174
    175 void DirectJITCode::initializeCodeRef(JITCode::CodeRef ref, JITCode::CodePtr withArityCheck)
     175void DirectJITCode::initializeEntryPoints(JITEntryPointsWithRef entries)
    176176{
    177177    RELEASE_ASSERT(!m_ref);
    178     m_ref = ref;
    179     m_withArityCheck = withArityCheck;
    180 }
    181 
    182 JITCode::CodePtr DirectJITCode::addressForCall(ArityCheckMode arity)
    183 {
    184     switch (arity) {
    185     case ArityCheckNotRequired:
    186         RELEASE_ASSERT(m_ref);
    187         return m_ref.code();
    188     case MustCheckArity:
    189         RELEASE_ASSERT(m_withArityCheck);
    190         return m_withArityCheck;
    191     }
    192     RELEASE_ASSERT_NOT_REACHED();
    193     return CodePtr();
     178    m_ref = entries.codeRef();
     179    m_entryPoints = entries;
     180}
     181
     182JITCode::CodePtr DirectJITCode::addressForCall(EntryPointType type)
     183{
     184    return m_entryPoints.entryFor(type);
    194185}
    195186
     
    214205}
    215206
    216 JITCode::CodePtr NativeJITCode::addressForCall(ArityCheckMode)
     207JITCode::CodePtr NativeJITCode::addressForCall(EntryPointType)
    217208{
    218209    RELEASE_ASSERT(!!m_ref);
Note: See TracChangeset for help on using the changeset viewer.