Title: [115092] trunk/Source/_javascript_Core
- Revision
- 115092
- Author
- [email protected]
- Date
- 2012-04-24 12:11:12 -0700 (Tue, 24 Apr 2012)
Log Message
"GlobalHandle" HandleHeap (now WeakSet) allocations grow but do not shrink
https://bugs.webkit.org/show_bug.cgi?id=84740
<rdar://problem/9917638>
Reviewed by Gavin Barraclough.
Shrink!
* heap/Heap.cpp:
(JSC::Heap::destroy): Be more specific about what's shrinking, since we
can also shrink the WeakSet, but we don't do so here.
(JSC::Heap::collect): If we're going to shrink the heap, shrink the
WeakSet too. Otherwise, its footprint is permanent.
* heap/Heap.h:
(Heap): Removed shrink() as a public interface, since it's vague about
which parts of the heap it affects, and it's really an internal detail.
* heap/WeakSet.cpp:
(JSC::WeakSet::shrink): Nix any free blocks. We assume that sweep() has
already taken place, since that's the convention for shrink() in the heap.
* heap/WeakSet.h:
(WeakSet): New function!
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (115091 => 115092)
--- trunk/Source/_javascript_Core/ChangeLog 2012-04-24 19:03:44 UTC (rev 115091)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-04-24 19:11:12 UTC (rev 115092)
@@ -1,3 +1,31 @@
+2012-04-24 Geoffrey Garen <[email protected]>
+
+ "GlobalHandle" HandleHeap (now WeakSet) allocations grow but do not shrink
+ https://bugs.webkit.org/show_bug.cgi?id=84740
+ <rdar://problem/9917638>
+
+ Reviewed by Gavin Barraclough.
+
+ Shrink!
+
+ * heap/Heap.cpp:
+ (JSC::Heap::destroy): Be more specific about what's shrinking, since we
+ can also shrink the WeakSet, but we don't do so here.
+
+ (JSC::Heap::collect): If we're going to shrink the heap, shrink the
+ WeakSet too. Otherwise, its footprint is permanent.
+
+ * heap/Heap.h:
+ (Heap): Removed shrink() as a public interface, since it's vague about
+ which parts of the heap it affects, and it's really an internal detail.
+
+ * heap/WeakSet.cpp:
+ (JSC::WeakSet::shrink): Nix any free blocks. We assume that sweep() has
+ already taken place, since that's the convention for shrink() in the heap.
+
+ * heap/WeakSet.h:
+ (WeakSet): New function!
+
2012-04-24 Adam Klein <[email protected]>
Fix includes in StrongInlines.h and ScriptValue.h
Modified: trunk/Source/_javascript_Core/heap/Heap.cpp (115091 => 115092)
--- trunk/Source/_javascript_Core/heap/Heap.cpp 2012-04-24 19:03:44 UTC (rev 115091)
+++ trunk/Source/_javascript_Core/heap/Heap.cpp 2012-04-24 19:11:12 UTC (rev 115092)
@@ -378,7 +378,7 @@
m_weakSet.finalizeAll();
m_globalData->smallStrings.finalizeSmallStrings();
- shrink();
+ m_objectSpace.shrink();
m_storageSpace.destroy();
ASSERT(!size());
@@ -850,7 +850,8 @@
SamplingRegion samplingRegion("Garbage Collection: Sweeping");
GCPHASE(Sweeping);
sweep();
- shrink();
+ m_objectSpace.shrink();
+ m_weakSet.shrink();
}
// To avoid pathological GC churn in large heaps, we set the new allocation
@@ -915,11 +916,6 @@
m_objectSpace.freeBlocks(head);
}
-void Heap::shrink()
-{
- m_objectSpace.shrink();
-}
-
void Heap::releaseFreeBlocks()
{
while (true) {
Modified: trunk/Source/_javascript_Core/heap/Heap.h (115091 => 115092)
--- trunk/Source/_javascript_Core/heap/Heap.h 2012-04-24 19:03:44 UTC (rev 115091)
+++ trunk/Source/_javascript_Core/heap/Heap.h 2012-04-24 19:11:12 UTC (rev 115092)
@@ -191,7 +191,6 @@
void harvestWeakReferences();
void finalizeUnconditionalFinalizers();
- void shrink();
void releaseFreeBlocks();
void sweep();
Modified: trunk/Source/_javascript_Core/heap/WeakSet.cpp (115091 => 115092)
--- trunk/Source/_javascript_Core/heap/WeakSet.cpp 2012-04-24 19:03:44 UTC (rev 115091)
+++ trunk/Source/_javascript_Core/heap/WeakSet.cpp 2012-04-24 19:11:12 UTC (rev 115092)
@@ -73,6 +73,17 @@
}
}
+void WeakSet::shrink()
+{
+ WeakBlock* next;
+ for (WeakBlock* block = static_cast<WeakBlock*>(m_blocks.head()); block; block = next) {
+ next = static_cast<WeakBlock*>(block->next());
+
+ if (!block->sweepResult().isNull() && block->sweepResult().blockIsFree)
+ removeAllocator(block);
+ }
+}
+
void WeakSet::resetAllocator()
{
m_allocator = 0;
Modified: trunk/Source/_javascript_Core/heap/WeakSet.h (115091 => 115092)
--- trunk/Source/_javascript_Core/heap/WeakSet.h 2012-04-24 19:03:44 UTC (rev 115091)
+++ trunk/Source/_javascript_Core/heap/WeakSet.h 2012-04-24 19:11:12 UTC (rev 115092)
@@ -48,6 +48,8 @@
void sweep();
void resetAllocator();
+ void shrink();
+
private:
JS_EXPORT_PRIVATE WeakBlock::FreeCell* findAllocator();
WeakBlock::FreeCell* tryFindAllocator();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes