Title: [221143] trunk/Source/_javascript_Core
Revision
221143
Author
sbar...@apple.com
Date
2017-08-24 09:59:00 -0700 (Thu, 24 Aug 2017)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (221142 => 221143)


--- trunk/Source/_javascript_Core/ChangeLog	2017-08-24 16:53:31 UTC (rev 221142)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-08-24 16:59:00 UTC (rev 221143)
@@ -1,3 +1,17 @@
+2017-08-24  Saam Barati  <sbar...@apple.com>
+
+        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):
+
 2017-08-23  Keith Miller  <keith_mil...@apple.com>
 
         Fix Titzer bench on iOS.

Modified: trunk/Source/_javascript_Core/dfg/DFGJITCode.cpp (221142 => 221143)


--- trunk/Source/_javascript_Core/dfg/DFGJITCode.cpp	2017-08-24 16:53:31 UTC (rev 221142)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCode.cpp	2017-08-24 16:59:00 UTC (rev 221143)
@@ -238,6 +238,24 @@
     return std::nullopt;
 }
 
+void JITCode::finalizeOSREntrypoints()
+{
+    auto comparator = [] (const auto& a, const auto& b) {
+        return a.m_bytecodeIndex < b.m_bytecodeIndex;
+    };
+    std::sort(catchEntrypoints.begin(), catchEntrypoints.end(), comparator);
+    std::sort(osrEntry.begin(), osrEntry.end(), comparator);
+
+#if !ASSERT_DISABLED
+    auto verifyIsSorted = [&] (auto& osrVector) {
+        for (unsigned i = 0; i + 1 < osrVector.size(); ++i)
+            ASSERT(osrVector[i].m_bytecodeIndex <= osrVector[i + 1].m_bytecodeIndex);
+    };
+    verifyIsSorted(catchEntrypoints);
+    verifyIsSorted(osrEntry);
+#endif
+}
+
 } } // namespace JSC::DFG
 
 #endif // ENABLE(DFG_JIT)

Modified: trunk/Source/_javascript_Core/dfg/DFGJITCode.h (221142 => 221143)


--- trunk/Source/_javascript_Core/dfg/DFGJITCode.h	2017-08-24 16:53:31 UTC (rev 221142)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCode.h	2017-08-24 16:59:00 UTC (rev 221143)
@@ -77,19 +77,7 @@
             [] (const CatchEntrypointData* item) { return item->m_bytecodeIndex; });
     }
 
-    void finalizeCatchOSREntrypoints()
-    {
-        std::sort(catchEntrypoints.begin(), catchEntrypoints.end(), [] (const CatchEntrypointData& a, const CatchEntrypointData& b) {
-            return a.m_bytecodeIndex < b.m_bytecodeIndex;
-        });
-#if !ASSERT_DISABLED
-        unsigned previousIndex = 0;
-        for (const CatchEntrypointData& entrypoint : catchEntrypoints) {
-            ASSERT(previousIndex < entrypoint.m_bytecodeIndex);
-            previousIndex = entrypoint.m_bytecodeIndex;
-        }
-#endif
-    }
+    void finalizeOSREntrypoints();
 
     void appendCatchEntrypoint(unsigned bytecodeIndex, unsigned machineCodeOffset, Vector<FlushFormat>&& argumentFormats)
     {

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (221142 => 221143)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2017-08-24 16:53:31 UTC (rev 221142)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2017-08-24 16:59:00 UTC (rev 221143)
@@ -1930,7 +1930,7 @@
         }
     }
 
-    m_jit.jitCode()->finalizeCatchOSREntrypoints();
+    m_jit.jitCode()->finalizeOSREntrypoints();
 
     ASSERT(osrEntryIndex == m_osrEntryHeads.size());
     
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to