Changeset 221143 in webkit


Ignore:
Timestamp:
Aug 24, 2017 9:59:00 AM (7 years ago)
Author:
sbarati@apple.com
Message:

DFG::JITCode::osrEntry should get sorted since we perform a binary search on it
https://bugs.webkit.org/show_bug.cgi?id=175893

Reviewed by Mark Lam.

  • dfg/DFGJITCode.cpp:

(JSC::DFG::JITCode::finalizeOSREntrypoints):

  • dfg/DFGJITCode.h:

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

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::linkOSREntries):

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r221126 r221143  
     12017-08-24  Saam Barati  <sbarati@apple.com>
     2
     3        DFG::JITCode::osrEntry should get sorted since we perform a binary search on it
     4        https://bugs.webkit.org/show_bug.cgi?id=175893
     5
     6        Reviewed by Mark Lam.
     7
     8        * dfg/DFGJITCode.cpp:
     9        (JSC::DFG::JITCode::finalizeOSREntrypoints):
     10        * dfg/DFGJITCode.h:
     11        (JSC::DFG::JITCode::finalizeCatchOSREntrypoints): Deleted.
     12        * dfg/DFGSpeculativeJIT.cpp:
     13        (JSC::DFG::SpeculativeJIT::linkOSREntries):
     14
    1152017-08-23  Keith Miller  <keith_miller@apple.com>
    216
  • trunk/Source/JavaScriptCore/dfg/DFGJITCode.cpp

    r221119 r221143  
    239239}
    240240
     241void JITCode::finalizeOSREntrypoints()
     242{
     243    auto comparator = [] (const auto& a, const auto& b) {
     244        return a.m_bytecodeIndex < b.m_bytecodeIndex;
     245    };
     246    std::sort(catchEntrypoints.begin(), catchEntrypoints.end(), comparator);
     247    std::sort(osrEntry.begin(), osrEntry.end(), comparator);
     248
     249#if !ASSERT_DISABLED
     250    auto verifyIsSorted = [&] (auto& osrVector) {
     251        for (unsigned i = 0; i + 1 < osrVector.size(); ++i)
     252            ASSERT(osrVector[i].m_bytecodeIndex <= osrVector[i + 1].m_bytecodeIndex);
     253    };
     254    verifyIsSorted(catchEntrypoints);
     255    verifyIsSorted(osrEntry);
     256#endif
     257}
     258
    241259} } // namespace JSC::DFG
    242260
  • trunk/Source/JavaScriptCore/dfg/DFGJITCode.h

    r221119 r221143  
    7878    }
    7979
    80     void finalizeCatchOSREntrypoints()
    81     {
    82         std::sort(catchEntrypoints.begin(), catchEntrypoints.end(), [] (const CatchEntrypointData& a, const CatchEntrypointData& b) {
    83             return a.m_bytecodeIndex < b.m_bytecodeIndex;
    84         });
    85 #if !ASSERT_DISABLED
    86         unsigned previousIndex = 0;
    87         for (const CatchEntrypointData& entrypoint : catchEntrypoints) {
    88             ASSERT(previousIndex < entrypoint.m_bytecodeIndex);
    89             previousIndex = entrypoint.m_bytecodeIndex;
    90         }
    91 #endif
    92     }
     80    void finalizeOSREntrypoints();
    9381
    9482    void appendCatchEntrypoint(unsigned bytecodeIndex, unsigned machineCodeOffset, Vector<FlushFormat>&& argumentFormats)
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r221119 r221143  
    19311931    }
    19321932
    1933     m_jit.jitCode()->finalizeCatchOSREntrypoints();
     1933    m_jit.jitCode()->finalizeOSREntrypoints();
    19341934
    19351935    ASSERT(osrEntryIndex == m_osrEntryHeads.size());
Note: See TracChangeset for help on using the changeset viewer.