Title: [184652] trunk/Source/_javascript_Core
- Revision
- 184652
- Author
- [email protected]
- Date
- 2015-05-20 13:30:42 -0700 (Wed, 20 May 2015)
Log Message
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:
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (184651 => 184652)
--- trunk/Source/_javascript_Core/ChangeLog 2015-05-20 20:20:09 UTC (rev 184651)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-05-20 20:30:42 UTC (rev 184652)
@@ -1,3 +1,38 @@
+2015-05-20 Andreas Kling <[email protected]>
+
+ 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-20 Youenn Fablet <[email protected]>
AudioContext resume/close/suspend should reject promises with a DOM exception in lieu of throwing exceptions
Modified: trunk/Source/_javascript_Core/heap/Heap.cpp (184651 => 184652)
--- trunk/Source/_javascript_Core/heap/Heap.cpp 2015-05-20 20:20:09 UTC (rev 184651)
+++ trunk/Source/_javascript_Core/heap/Heap.cpp 2015-05-20 20:30:42 UTC (rev 184652)
@@ -1212,9 +1212,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);
@@ -1230,13 +1233,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: trunk/Source/_javascript_Core/heap/IncrementalSweeper.cpp (184651 => 184652)
--- trunk/Source/_javascript_Core/heap/IncrementalSweeper.cpp 2015-05-20 20:20:09 UTC (rev 184651)
+++ trunk/Source/_javascript_Core/heap/IncrementalSweeper.cpp 2015-05-20 20:30:42 UTC (rev 184652)
@@ -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: trunk/Source/_javascript_Core/heap/IncrementalSweeper.h (184651 => 184652)
--- trunk/Source/_javascript_Core/heap/IncrementalSweeper.h 2015-05-20 20:20:09 UTC (rev 184651)
+++ trunk/Source/_javascript_Core/heap/IncrementalSweeper.h 2015-05-20 20:30:42 UTC (rev 184652)
@@ -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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes