Changeset 245017 in webkit


Ignore:
Timestamp:
May 7, 2019 10:41:42 AM (5 years ago)
Author:
sbarati@apple.com
Message:

Don't OSR enter into an FTL CodeBlock that has been jettisoned
https://bugs.webkit.org/show_bug.cgi?id=197531
<rdar://problem/50162379>

Reviewed by Yusuke Suzuki.

JSTests:

  • stress/dont-osr-enter-into-jettisoned-ftl-code-block.js: Added.

Source/JavaScriptCore:

Sometimes we make silly mistakes. This is one of those times. It's invalid to OSR
enter into an FTL OSR entry code block that has been jettisoned already.

  • dfg/DFGJITCode.cpp:

(JSC::DFG::JITCode::clearOSREntryBlockAndResetThresholds):

  • dfg/DFGJITCode.h:

(JSC::DFG::JITCode::clearOSREntryBlock): Deleted.

  • dfg/DFGOSREntry.cpp:

(JSC::DFG::prepareOSREntry):
(JSC::DFG::prepareCatchOSREntry):

  • dfg/DFGOperations.cpp:
  • ftl/FTLOSREntry.cpp:

(JSC::FTL::prepareOSREntry):

Location:
trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r245001 r245017  
     12019-05-07  Saam Barati  <sbarati@apple.com>
     2
     3        Don't OSR enter into an FTL CodeBlock that has been jettisoned
     4        https://bugs.webkit.org/show_bug.cgi?id=197531
     5        <rdar://problem/50162379>
     6
     7        Reviewed by Yusuke Suzuki.
     8
     9        * stress/dont-osr-enter-into-jettisoned-ftl-code-block.js: Added.
     10
    1112019-05-06  Dean Jackson  <dino@apple.com>
    212
  • trunk/Source/JavaScriptCore/ChangeLog

    r244999 r245017  
     12019-05-07  Saam Barati  <sbarati@apple.com>
     2
     3        Don't OSR enter into an FTL CodeBlock that has been jettisoned
     4        https://bugs.webkit.org/show_bug.cgi?id=197531
     5        <rdar://problem/50162379>
     6
     7        Reviewed by Yusuke Suzuki.
     8
     9        Sometimes we make silly mistakes. This is one of those times. It's invalid to OSR
     10        enter into an FTL OSR entry code block that has been jettisoned already.
     11
     12        * dfg/DFGJITCode.cpp:
     13        (JSC::DFG::JITCode::clearOSREntryBlockAndResetThresholds):
     14        * dfg/DFGJITCode.h:
     15        (JSC::DFG::JITCode::clearOSREntryBlock): Deleted.
     16        * dfg/DFGOSREntry.cpp:
     17        (JSC::DFG::prepareOSREntry):
     18        (JSC::DFG::prepareCatchOSREntry):
     19        * dfg/DFGOperations.cpp:
     20        * ftl/FTLOSREntry.cpp:
     21        (JSC::FTL::prepareOSREntry):
     22
    1232019-05-06  Keith Miller  <keith_miller@apple.com>
    224
  • trunk/Source/JavaScriptCore/dfg/DFGJITCode.cpp

    r244764 r245017  
    212212    m_osrEntryBlock.set(vm, owner, osrEntryBlock);
    213213}
     214
     215void JITCode::clearOSREntryBlockAndResetThresholds(CodeBlock *dfgCodeBlock)
     216{
     217    ASSERT(m_osrEntryBlock);
     218
     219    unsigned osrEntryBytecode = m_osrEntryBlock->jitCode()->ftlForOSREntry()->bytecodeIndex();
     220    m_osrEntryBlock.clear();
     221    osrEntryRetry = 0;
     222    tierUpEntryTriggers.set(osrEntryBytecode, JITCode::TriggerReason::DontTrigger);
     223    setOptimizationThresholdBasedOnCompilationResult(dfgCodeBlock, CompilationDeferred);
     224}
    214225#endif // ENABLE(FTL_JIT)
    215226
  • trunk/Source/JavaScriptCore/dfg/DFGJITCode.h

    r242192 r245017  
    122122    CodeBlock* osrEntryBlock() { return m_osrEntryBlock.get(); }
    123123    void setOSREntryBlock(VM&, const JSCell* owner, CodeBlock* osrEntryBlock);
    124     void clearOSREntryBlock() { m_osrEntryBlock.clear(); }
     124    void clearOSREntryBlockAndResetThresholds(CodeBlock* dfgCodeBlock);
    125125#endif
    126126
  • trunk/Source/JavaScriptCore/dfg/DFGOSREntry.cpp

    r244764 r245017  
    9999    ASSERT(codeBlock->alternative()->jitType() == JITType::BaselineJIT);
    100100    ASSERT(!codeBlock->jitCodeMap());
     101    ASSERT(codeBlock->jitCode()->dfgCommon()->isStillValid);
    101102
    102103    if (!Options::useOSREntryToDFG())
     
    343344{
    344345    ASSERT(codeBlock->jitType() == JITType::DFGJIT || codeBlock->jitType() == JITType::FTLJIT);
     346    ASSERT(codeBlock->jitCode()->dfgCommon()->isStillValid);
    345347
    346348    if (!Options::useOSREntryToDFG() && codeBlock->jitCode()->jitType() == JITType::DFGJIT)
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp

    r244996 r245017  
    33203320        // without exponential backoff and we only do this for the entry code block.
    33213321        CODEBLOCK_LOG_EVENT(codeBlock, "delayFTLCompile", ("OSR entry failed too many times"));
    3322         unsigned osrEntryBytecode = entryBlock->jitCode()->ftlForOSREntry()->bytecodeIndex();
    3323         jitCode->clearOSREntryBlock();
    3324         jitCode->osrEntryRetry = 0;
    3325         jitCode->tierUpEntryTriggers.set(osrEntryBytecode, JITCode::TriggerReason::DontTrigger);
    3326         jitCode->setOptimizationThresholdBasedOnCompilationResult(
    3327             codeBlock, CompilationDeferred);
     3322        jitCode->clearOSREntryBlockAndResetThresholds(codeBlock);
    33283323        return nullptr;
    33293324    }
  • trunk/Source/JavaScriptCore/ftl/FTLOSREntry.cpp

    r242192 r245017  
    4949    DFG::JITCode* dfgCode = dfgCodeBlock->jitCode()->dfg();
    5050    ForOSREntryJITCode* entryCode = entryCodeBlock->jitCode()->ftlForOSREntry();
     51
     52    if (!entryCode->dfgCommon()->isStillValid) {
     53        dfgCode->clearOSREntryBlockAndResetThresholds(dfgCodeBlock);
     54        return 0;
     55    }
    5156   
    5257    if (Options::verboseOSR()) {
Note: See TracChangeset for help on using the changeset viewer.