Title: [124352] trunk/Source/_javascript_Core
Revision
124352
Author
[email protected]
Date
2012-08-01 11:55:03 -0700 (Wed, 01 Aug 2012)

Log Message

MarkedBlock::sweep() should sweep another block if it can't sweep a Structure block
https://bugs.webkit.org/show_bug.cgi?id=92819

Reviewed by Geoffrey Garen.

If we are forced to allocate a new block for Structures because we are unable to safely 
sweep our pre-existing Structure blocks, we should sweep another random block so that we 
can start sweeping Structure blocks sooner.

* heap/IncrementalSweeper.cpp:
(JSC::IncrementalSweeper::doSweep): Change to use sweepNextBlock.
(JSC):
(JSC::IncrementalSweeper::sweepNextBlock): 
* heap/IncrementalSweeper.h:
(IncrementalSweeper):
* heap/MarkedAllocator.cpp:
(JSC::MarkedAllocator::tryAllocateHelper): When we can't safely sweep 
our Structure blocks, call sweepNextBlock instead.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (124351 => 124352)


--- trunk/Source/_javascript_Core/ChangeLog	2012-08-01 18:45:12 UTC (rev 124351)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-08-01 18:55:03 UTC (rev 124352)
@@ -1,3 +1,24 @@
+2012-07-31  Mark Hahnenberg  <[email protected]>
+
+        MarkedBlock::sweep() should sweep another block if it can't sweep a Structure block
+        https://bugs.webkit.org/show_bug.cgi?id=92819
+
+        Reviewed by Geoffrey Garen.
+
+        If we are forced to allocate a new block for Structures because we are unable to safely 
+        sweep our pre-existing Structure blocks, we should sweep another random block so that we 
+        can start sweeping Structure blocks sooner.
+
+        * heap/IncrementalSweeper.cpp:
+        (JSC::IncrementalSweeper::doSweep): Change to use sweepNextBlock.
+        (JSC):
+        (JSC::IncrementalSweeper::sweepNextBlock): 
+        * heap/IncrementalSweeper.h:
+        (IncrementalSweeper):
+        * heap/MarkedAllocator.cpp:
+        (JSC::MarkedAllocator::tryAllocateHelper): When we can't safely sweep 
+        our Structure blocks, call sweepNextBlock instead.
+
 2012-07-31  Sam Weinig  <[email protected]>
 
         Fix the Windows build.

Modified: trunk/Source/_javascript_Core/heap/IncrementalSweeper.cpp (124351 => 124352)


--- trunk/Source/_javascript_Core/heap/IncrementalSweeper.cpp	2012-08-01 18:45:12 UTC (rev 124351)
+++ trunk/Source/_javascript_Core/heap/IncrementalSweeper.cpp	2012-08-01 18:55:03 UTC (rev 124352)
@@ -73,6 +73,23 @@
 void IncrementalSweeper::doSweep(double sweepBeginTime)
 {
     while (m_currentBlockToSweepIndex < m_blocksToSweep.size()) {
+        sweepNextBlock();
+
+        CFTimeInterval elapsedTime = WTF::monotonicallyIncreasingTime() - sweepBeginTime;
+        if (elapsedTime < sweepTimeSlice)
+            continue;
+
+        scheduleTimer();
+        return;
+    }
+
+    m_blocksToSweep.clear();
+    cancelTimer();
+}
+
+void IncrementalSweeper::sweepNextBlock()
+{
+    while (m_currentBlockToSweepIndex < m_blocksToSweep.size()) {
         MarkedBlock* block = m_blocksToSweep[m_currentBlockToSweepIndex++];
         if (block->onlyContainsStructures())
             m_structuresCanBeSwept = true;
@@ -84,17 +101,8 @@
 
         block->sweep();
         m_globalData->heap.objectSpace().freeOrShrinkBlock(block);
-
-        CFTimeInterval elapsedTime = WTF::monotonicallyIncreasingTime() - sweepBeginTime;
-        if (elapsedTime < sweepTimeSlice)
-            continue;
-
-        scheduleTimer();
         return;
     }
-
-    m_blocksToSweep.clear();
-    cancelTimer();
 }
 
 void IncrementalSweeper::startSweeping(const HashSet<MarkedBlock*>& blockSnapshot)
@@ -143,6 +151,10 @@
     m_structuresCanBeSwept = true;
 }
 
+void IncrementalSweeper::sweepNextBlock()
+{
+}
+
 #endif
 
 bool IncrementalSweeper::structuresCanBeSwept()

Modified: trunk/Source/_javascript_Core/heap/IncrementalSweeper.h (124351 => 124352)


--- trunk/Source/_javascript_Core/heap/IncrementalSweeper.h	2012-08-01 18:45:12 UTC (rev 124351)
+++ trunk/Source/_javascript_Core/heap/IncrementalSweeper.h	2012-08-01 18:55:03 UTC (rev 124352)
@@ -55,6 +55,7 @@
     static IncrementalSweeper* create(Heap*);
     void startSweeping(const HashSet<MarkedBlock*>& blockSnapshot);
     virtual void doWork();
+    void sweepNextBlock();
     bool structuresCanBeSwept();
     void willFinishSweeping();
 

Modified: trunk/Source/_javascript_Core/heap/MarkedAllocator.cpp (124351 => 124352)


--- trunk/Source/_javascript_Core/heap/MarkedAllocator.cpp	2012-08-01 18:45:12 UTC (rev 124351)
+++ trunk/Source/_javascript_Core/heap/MarkedAllocator.cpp	2012-08-01 18:55:03 UTC (rev 124352)
@@ -35,6 +35,9 @@
                 m_currentBlock->didConsumeFreeList();
                 m_currentBlock = 0;
             }
+            // We sweep another random block here so that we can make progress
+            // toward being able to sweep Structures.
+            m_heap->sweeper()->sweepNextBlock();
             return 0;
         }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to