Title: [120841] trunk/Source/_javascript_Core
- Revision
- 120841
- Author
- [email protected]
- Date
- 2012-06-20 11:24:02 -0700 (Wed, 20 Jun 2012)
Log Message
Made the incremental sweeper more aggressive
https://bugs.webkit.org/show_bug.cgi?id=89527
Reviewed by Oliver Hunt.
This is a pre-requisite to getting rid of "berzerker GC" because we need
the sweeper to reclaim memory in a timely fashion, or we'll see a memory
footprint regression.
* heap/IncrementalSweeper.h:
* heap/IncrementalSweeper.cpp:
(JSC::IncrementalSweeper::scheduleTimer): Since the time slice is predictable,
no need to use a data member to record it.
(JSC::IncrementalSweeper::doSweep): Sweep as many blocks as we can in a
small time slice. This is better than sweeping only one block per timer
fire because that strategy has a heavy timer overhead, and artificially
delays memory reclamation.
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (120840 => 120841)
--- trunk/Source/_javascript_Core/ChangeLog 2012-06-20 18:22:37 UTC (rev 120840)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-06-20 18:24:02 UTC (rev 120841)
@@ -1,3 +1,24 @@
+2012-06-19 Geoffrey Garen <[email protected]>
+
+ Made the incremental sweeper more aggressive
+ https://bugs.webkit.org/show_bug.cgi?id=89527
+
+ Reviewed by Oliver Hunt.
+
+ This is a pre-requisite to getting rid of "berzerker GC" because we need
+ the sweeper to reclaim memory in a timely fashion, or we'll see a memory
+ footprint regression.
+
+ * heap/IncrementalSweeper.h:
+ * heap/IncrementalSweeper.cpp:
+ (JSC::IncrementalSweeper::scheduleTimer): Since the time slice is predictable,
+ no need to use a data member to record it.
+
+ (JSC::IncrementalSweeper::doSweep): Sweep as many blocks as we can in a
+ small time slice. This is better than sweeping only one block per timer
+ fire because that strategy has a heavy timer overhead, and artificially
+ delays memory reclamation.
+
2012-06-20 Filip Pizlo <[email protected]>
DFG should be able to print disassembly interleaved with the IR
Modified: trunk/Source/_javascript_Core/heap/IncrementalSweeper.cpp (120840 => 120841)
--- trunk/Source/_javascript_Core/heap/IncrementalSweeper.cpp 2012-06-20 18:22:37 UTC (rev 120840)
+++ trunk/Source/_javascript_Core/heap/IncrementalSweeper.cpp 2012-06-20 18:24:02 UTC (rev 120841)
@@ -14,9 +14,10 @@
#if USE(CF)
-static const CFTimeInterval sweepTimeSlicePerBlock = 0.01;
-static const CFTimeInterval sweepTimeMultiplier = 1.0 / sweepTimeSlicePerBlock;
-
+static const CFTimeInterval sweepTimeSlice = .01; // seconds
+static const CFTimeInterval sweepTimeTotal = .10;
+static const CFTimeInterval sweepTimeMultiplier = 1.0 / sweepTimeTotal;
+
void IncrementalSweeper::doWork()
{
APIEntryShim shim(m_globalData);
@@ -26,7 +27,6 @@
IncrementalSweeper::IncrementalSweeper(Heap* heap, CFRunLoopRef runLoop)
: HeapTimer(heap->globalData(), runLoop)
, m_currentBlockToSweepIndex(0)
- , m_lengthOfLastSweepIncrement(0.0)
{
}
@@ -37,7 +37,7 @@
void IncrementalSweeper::scheduleTimer()
{
- CFRunLoopTimerSetNextFireDate(m_timer.get(), CFAbsoluteTimeGetCurrent() + (m_lengthOfLastSweepIncrement * sweepTimeMultiplier));
+ CFRunLoopTimerSetNextFireDate(m_timer.get(), CFAbsoluteTimeGetCurrent() + (sweepTimeSlice * sweepTimeMultiplier));
}
void IncrementalSweeper::cancelTimer()
@@ -47,14 +47,17 @@
void IncrementalSweeper::doSweep(double sweepBeginTime)
{
- for (; m_currentBlockToSweepIndex < m_blocksToSweep.size(); m_currentBlockToSweepIndex++) {
- MarkedBlock* nextBlock = m_blocksToSweep[m_currentBlockToSweepIndex];
- if (!nextBlock->needsSweeping())
+ while (m_currentBlockToSweepIndex < m_blocksToSweep.size()) {
+ MarkedBlock* block = m_blocksToSweep[m_currentBlockToSweepIndex++];
+ if (!block->needsSweeping())
continue;
- nextBlock->sweep();
- m_blocksToSweep[m_currentBlockToSweepIndex++] = 0;
- m_lengthOfLastSweepIncrement = WTF::monotonicallyIncreasingTime() - sweepBeginTime;
+ block->sweep();
+
+ CFTimeInterval elapsedTime = WTF::monotonicallyIncreasingTime() - sweepBeginTime;
+ if (elapsedTime < sweepTimeSlice)
+ continue;
+
scheduleTimer();
return;
}
Modified: trunk/Source/_javascript_Core/heap/IncrementalSweeper.h (120840 => 120841)
--- trunk/Source/_javascript_Core/heap/IncrementalSweeper.h 2012-06-20 18:22:37 UTC (rev 120840)
+++ trunk/Source/_javascript_Core/heap/IncrementalSweeper.h 2012-06-20 18:24:02 UTC (rev 120841)
@@ -27,7 +27,6 @@
void cancelTimer();
unsigned m_currentBlockToSweepIndex;
- double m_lengthOfLastSweepIncrement;
Vector<MarkedBlock*> m_blocksToSweep;
#else
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes