Title: [184706] branches/safari-601.1.32.2-branch/Source/_javascript_Core
- Revision
- 184706
- Author
- matthew_han...@apple.com
- Date
- 2015-05-20 23:39:35 -0700 (Wed, 20 May 2015)
Log Message
Merge r184652. rdar://problem/21002666
Modified Paths
Diff
Modified: branches/safari-601.1.32.2-branch/Source/_javascript_Core/ChangeLog (184705 => 184706)
--- branches/safari-601.1.32.2-branch/Source/_javascript_Core/ChangeLog 2015-05-21 06:39:32 UTC (rev 184705)
+++ branches/safari-601.1.32.2-branch/Source/_javascript_Core/ChangeLog 2015-05-21 06:39:35 UTC (rev 184706)
@@ -1,3 +1,42 @@
+2015-05-20 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r184652. rdar://problem/21002666
+
+ 2015-05-20 Andreas Kling <akl...@apple.com>
+
+ Eden collections should extend the IncrementalSweeper work list, not replace it.
+ <https://webkit.org/b/145213>
+ <rdar://problem/21002666>
+
+ Reviewed by Geoffrey Garen.
+
+ After an eden collection, the garbage collector was adding all MarkedBlocks containing
+ new objects to the IncrementalSweeper's work list, to make sure they didn't have to
+ wait until the next full collection before getting swept.
+
+ Or at least, that's what it thought it was doing. It turns out that IncrementalSweeper's
+ internal work list is really just a reference to Heap::m_blockSnapshot. I didn't realize
+ this when writing the post-eden sweep code, and instead made eden collections cancel
+ all pending sweeps and *replace* them with the list of blocks with new objects.
+
+ This made it so that rapidly occurring eden collections could prevent large numbers of
+ heap blocks from ever getting swept. This would manifest as accumulation of MarkedBlocks
+ when a system under heavy load was also allocating short lived objects at a high rate.
+ Things would eventually get cleaned up when there was a lull and a full collection was
+ allowed to run its heap sweep to completion.
+
+ Fix this by moving all management of the block snapshot to Heap. snapshotMarkedSpace()
+ now handles eden collections by merging the list of blocks with new objects into the
+ existing block snapshot.
+
+ * heap/Heap.cpp:
+ (JSC::Heap::snapshotMarkedSpace):
+ (JSC::Heap::notifyIncrementalSweeper):
+ * heap/IncrementalSweeper.cpp:
+ (JSC::IncrementalSweeper::startSweeping):
+ (JSC::IncrementalSweeper::addBlocksAndContinueSweeping): Deleted.
+ * heap/IncrementalSweeper.h:
+
2015-05-18 Matthew Hanson <matthew_han...@apple.com>
Merge r184510. rdar://problem/21004989
Modified: branches/safari-601.1.32.2-branch/Source/_javascript_Core/heap/Heap.cpp (184705 => 184706)
--- branches/safari-601.1.32.2-branch/Source/_javascript_Core/heap/Heap.cpp 2015-05-21 06:39:32 UTC (rev 184705)
+++ branches/safari-601.1.32.2-branch/Source/_javascript_Core/heap/Heap.cpp 2015-05-21 06:39:35 UTC (rev 184706)
@@ -1207,9 +1207,12 @@
{
GCPHASE(SnapshotMarkedSpace);
- if (m_operationInProgress == EdenCollection)
- m_blockSnapshot = m_objectSpace.blocksWithNewObjects();
- else {
+ if (m_operationInProgress == EdenCollection) {
+ m_blockSnapshot.appendVector(m_objectSpace.blocksWithNewObjects());
+ // Sort and deduplicate the block snapshot since we might be appending to an unfinished work list.
+ std::sort(m_blockSnapshot.begin(), m_blockSnapshot.end());
+ m_blockSnapshot.shrink(std::unique(m_blockSnapshot.begin(), m_blockSnapshot.end()) - m_blockSnapshot.begin());
+ } else {
m_blockSnapshot.resizeToFit(m_objectSpace.blocks().set().size());
MarkedBlockSnapshotFunctor functor(m_blockSnapshot);
m_objectSpace.forEachBlock(functor);
@@ -1225,13 +1228,13 @@
void Heap::notifyIncrementalSweeper()
{
GCPHASE(NotifyIncrementalSweeper);
- if (m_operationInProgress == EdenCollection)
- m_sweeper->addBlocksAndContinueSweeping(WTF::move(m_blockSnapshot));
- else {
+
+ if (m_operationInProgress == FullCollection) {
if (!m_logicallyEmptyWeakBlocks.isEmpty())
m_indexOfNextLogicallyEmptyWeakBlockToSweep = 0;
- m_sweeper->startSweeping(WTF::move(m_blockSnapshot));
}
+
+ m_sweeper->startSweeping();
}
void Heap::rememberCurrentlyExecutingCodeBlocks()
Modified: branches/safari-601.1.32.2-branch/Source/_javascript_Core/heap/IncrementalSweeper.cpp (184705 => 184706)
--- branches/safari-601.1.32.2-branch/Source/_javascript_Core/heap/IncrementalSweeper.cpp 2015-05-21 06:39:32 UTC (rev 184705)
+++ branches/safari-601.1.32.2-branch/Source/_javascript_Core/heap/IncrementalSweeper.cpp 2015-05-21 06:39:35 UTC (rev 184706)
@@ -101,21 +101,11 @@
return m_vm->heap.sweepNextLogicallyEmptyWeakBlock();
}
-void IncrementalSweeper::startSweeping(Vector<MarkedBlock*>&& blockSnapshot)
+void IncrementalSweeper::startSweeping()
{
- m_blocksToSweep = WTF::move(blockSnapshot);
scheduleTimer();
}
-void IncrementalSweeper::addBlocksAndContinueSweeping(Vector<MarkedBlock*>&& blockSnapshot)
-{
- Vector<MarkedBlock*> blocks = WTF::move(blockSnapshot);
- m_blocksToSweep.appendVector(blocks);
- std::sort(m_blocksToSweep.begin(), m_blocksToSweep.end());
- m_blocksToSweep.shrink(std::unique(m_blocksToSweep.begin(), m_blocksToSweep.end()) - m_blocksToSweep.begin());
- scheduleTimer();
-}
-
void IncrementalSweeper::willFinishSweeping()
{
m_blocksToSweep.clear();
@@ -134,14 +124,10 @@
{
}
-void IncrementalSweeper::startSweeping(Vector<MarkedBlock*>&&)
+void IncrementalSweeper::startSweeping()
{
}
-void IncrementalSweeper::addBlocksAndContinueSweeping(Vector<MarkedBlock*>&&)
-{
-}
-
void IncrementalSweeper::willFinishSweeping()
{
}
Modified: branches/safari-601.1.32.2-branch/Source/_javascript_Core/heap/IncrementalSweeper.h (184705 => 184706)
--- branches/safari-601.1.32.2-branch/Source/_javascript_Core/heap/IncrementalSweeper.h 2015-05-21 06:39:32 UTC (rev 184705)
+++ branches/safari-601.1.32.2-branch/Source/_javascript_Core/heap/IncrementalSweeper.h 2015-05-21 06:39:35 UTC (rev 184706)
@@ -44,8 +44,7 @@
explicit IncrementalSweeper(VM*);
#endif
- void startSweeping(Vector<MarkedBlock*>&&);
- void addBlocksAndContinueSweeping(Vector<MarkedBlock*>&&);
+ void startSweeping();
JS_EXPORT_PRIVATE virtual void doWork() override;
bool sweepNextBlock();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes