Ignore:
Timestamp:
Aug 24, 2017, 9:59:00 AM (8 years ago)
Author:
[email protected]
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):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.