Title: [226010] trunk/Source/_javascript_Core
Revision
226010
Author
[email protected]
Date
2017-12-17 02:53:51 -0800 (Sun, 17 Dec 2017)

Log Message

[JSC] Number of SlotVisitors can increase after setting up m_visitCounters
https://bugs.webkit.org/show_bug.cgi?id=180906

Reviewed by Filip Pizlo.

The number of SlotVisitors can increase after setting up m_visitCounters.
If it happens, our m_visitCounters misses the visit count of newly added
SlotVisitors. It accidentally decides that constraints are converged.
This leads to random assertion hits in Linux environment.

In this patch, we compare the number of SlotVisitors in didVisitSomething().
If the number of SlotVisitors is changed, we conservatively say we did
visit something.

* heap/Heap.h:
* heap/HeapInlines.h:
(JSC::Heap::numberOfSlotVisitors):
* heap/MarkingConstraintSet.h:
* heap/MarkingConstraintSolver.cpp:
(JSC::MarkingConstraintSolver::didVisitSomething const):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (226009 => 226010)


--- trunk/Source/_javascript_Core/ChangeLog	2017-12-17 02:54:13 UTC (rev 226009)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-12-17 10:53:51 UTC (rev 226010)
@@ -1,3 +1,26 @@
+2017-12-16  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Number of SlotVisitors can increase after setting up m_visitCounters
+        https://bugs.webkit.org/show_bug.cgi?id=180906
+
+        Reviewed by Filip Pizlo.
+
+        The number of SlotVisitors can increase after setting up m_visitCounters.
+        If it happens, our m_visitCounters misses the visit count of newly added
+        SlotVisitors. It accidentally decides that constraints are converged.
+        This leads to random assertion hits in Linux environment.
+
+        In this patch, we compare the number of SlotVisitors in didVisitSomething().
+        If the number of SlotVisitors is changed, we conservatively say we did
+        visit something.
+
+        * heap/Heap.h:
+        * heap/HeapInlines.h:
+        (JSC::Heap::numberOfSlotVisitors):
+        * heap/MarkingConstraintSet.h:
+        * heap/MarkingConstraintSolver.cpp:
+        (JSC::MarkingConstraintSolver::didVisitSomething const):
+
 2017-12-16  Keith Miller  <[email protected]>
 
         Indexing should only be computed when the new structure has an indexing header.

Modified: trunk/Source/_javascript_Core/heap/Heap.h (226009 => 226010)


--- trunk/Source/_javascript_Core/heap/Heap.h	2017-12-17 02:54:13 UTC (rev 226009)
+++ trunk/Source/_javascript_Core/heap/Heap.h	2017-12-17 10:53:51 UTC (rev 226010)
@@ -372,6 +372,7 @@
 
     template<typename Func>
     void forEachSlotVisitor(const Func&);
+    unsigned numberOfSlotVisitors();
 
 private:
     friend class AllocatingScope;

Modified: trunk/Source/_javascript_Core/heap/HeapInlines.h (226009 => 226010)


--- trunk/Source/_javascript_Core/heap/HeapInlines.h	2017-12-17 02:54:13 UTC (rev 226009)
+++ trunk/Source/_javascript_Core/heap/HeapInlines.h	2017-12-17 10:53:51 UTC (rev 226010)
@@ -269,4 +269,10 @@
         func(*slotVisitor);
 }
 
+inline unsigned Heap::numberOfSlotVisitors()
+{
+    auto locker = holdLock(m_parallelSlotVisitorLock);
+    return m_parallelSlotVisitors.size() + 2; // m_collectorSlotVisitor and m_mutatorSlotVisitor
+}
+
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/heap/MarkingConstraintSet.h (226009 => 226010)


--- trunk/Source/_javascript_Core/heap/MarkingConstraintSet.h	2017-12-17 02:54:13 UTC (rev 226009)
+++ trunk/Source/_javascript_Core/heap/MarkingConstraintSet.h	2017-12-17 10:53:51 UTC (rev 226010)
@@ -67,8 +67,6 @@
     
     bool executeConvergenceImpl(SlotVisitor&);
     
-    bool drain(SlotVisitor&, BitVector& unexecuted, BitVector& executed, bool& didVisitSomething);
-    
     Heap& m_heap;
     BitVector m_unexecutedRoots;
     BitVector m_unexecutedOutgrowths;

Modified: trunk/Source/_javascript_Core/heap/MarkingConstraintSolver.cpp (226009 => 226010)


--- trunk/Source/_javascript_Core/heap/MarkingConstraintSolver.cpp	2017-12-17 02:54:13 UTC (rev 226009)
+++ trunk/Source/_javascript_Core/heap/MarkingConstraintSolver.cpp	2017-12-17 10:53:51 UTC (rev 226010)
@@ -51,6 +51,10 @@
         if (visitCounter.visitCount())
             return true;
     }
+    // If the number of SlotVisitors increases after creating m_visitCounters,
+    // we conservatively say there could be something visited by added SlotVisitors.
+    if (m_heap.numberOfSlotVisitors() > m_visitCounters.size())
+        return true;
     return false;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to