[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

ggaren at apple.com ggaren at apple.com
Mon Feb 21 00:24:04 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 7ddf61bca76824bd3638ce1cd528f8f5165664c5
Author: ggaren at apple.com <ggaren at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Jan 30 23:07:11 2011 +0000

    2011-01-30  Geoffrey Garen  <ggaren at apple.com>
    
            Reviewed by Oliver Hunt.
    
            Filter all Heap collection through a common reset function, in
            preparation for adding features triggered by collection.
            https://bugs.webkit.org/show_bug.cgi?id=53396
    
            SunSpider reports no change.
    
            * runtime/Heap.cpp:
            (JSC::Heap::reportExtraMemoryCostSlowCase): When we're over the extraCost
            limit, just call collectAllGarbage() instead of rolling our own special
            way of resetting the heap. In theory, this may be slower in some cases,
            but it also fixes cases of pathological heap growth that we've seen,
            where the only objects being allocated are temporary and huge
            (<rdar://problem/8885843>).
    
            (JSC::Heap::allocate):
            (JSC::Heap::collectAllGarbage): Use the shared reset function.
    
            (JSC::Heap::reset):
            * runtime/Heap.h: Carved a new shared reset function out of the old
            collectAllGarbage.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77094 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index c030556..2c7949e 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,28 @@
+2011-01-30  Geoffrey Garen  <ggaren at apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        Filter all Heap collection through a common reset function, in
+        preparation for adding features triggered by collection.
+        https://bugs.webkit.org/show_bug.cgi?id=53396
+        
+        SunSpider reports no change.
+
+        * runtime/Heap.cpp:
+        (JSC::Heap::reportExtraMemoryCostSlowCase): When we're over the extraCost
+        limit, just call collectAllGarbage() instead of rolling our own special
+        way of resetting the heap. In theory, this may be slower in some cases,
+        but it also fixes cases of pathological heap growth that we've seen,
+        where the only objects being allocated are temporary and huge
+        (<rdar://problem/8885843>).
+
+        (JSC::Heap::allocate):
+        (JSC::Heap::collectAllGarbage): Use the shared reset function.
+
+        (JSC::Heap::reset):
+        * runtime/Heap.h: Carved a new shared reset function out of the old
+        collectAllGarbage.
+
 2011-01-30  Sheriff Bot  <webkit.review.bot at gmail.com>
 
         Unreviewed, rolling out r77025.
diff --git a/Source/JavaScriptCore/runtime/Heap.cpp b/Source/JavaScriptCore/runtime/Heap.cpp
index bdde63d..fbc2145 100644
--- a/Source/JavaScriptCore/runtime/Heap.cpp
+++ b/Source/JavaScriptCore/runtime/Heap.cpp
@@ -90,20 +90,8 @@ void Heap::reportExtraMemoryCostSlowCase(size_t cost)
     // if a large value survives one garbage collection, there is not much point to
     // collecting more frequently as long as it stays alive.
 
-    if (m_extraCost > maxExtraCost && m_extraCost > m_markedSpace.capacity() / 2) {
-        JAVASCRIPTCORE_GC_BEGIN();
-
-        markRoots();
-
-        JAVASCRIPTCORE_GC_MARKED();
-
-        m_markedSpace.reset();
-        m_extraCost = 0;
-
-        JAVASCRIPTCORE_GC_END();
-
-        (*m_activityCallback)();
-    }
+    if (m_extraCost > maxExtraCost && m_extraCost > m_markedSpace.capacity() / 2)
+        collectAllGarbage();
     m_extraCost += cost;
 }
 
@@ -123,25 +111,14 @@ void* Heap::allocate(size_t s)
     m_operationInProgress = Allocation;
     void* result = m_markedSpace.allocate(s);
     m_operationInProgress = NoOperation;
-
     if (!result) {
-        JAVASCRIPTCORE_GC_BEGIN();
-
-        markRoots();
-
-        JAVASCRIPTCORE_GC_MARKED();
-
-        m_markedSpace.reset();
-        m_extraCost = 0;
-
-        JAVASCRIPTCORE_GC_END();
-
-        (*m_activityCallback)();
+        reset(DoNotSweep);
 
         m_operationInProgress = Allocation;
         result = m_markedSpace.allocate(s);
         m_operationInProgress = NoOperation;
     }
+
     ASSERT(result);
     return result;
 }
@@ -389,6 +366,11 @@ bool Heap::isBusy()
 
 void Heap::collectAllGarbage()
 {
+    reset(DoSweep);
+}
+
+void Heap::reset(SweepToggle sweepToggle)
+{
     ASSERT(globalData()->identifierTable == wtfThreadData().currentIdentifierTable());
     JAVASCRIPTCORE_GC_BEGIN();
 
@@ -397,9 +379,11 @@ void Heap::collectAllGarbage()
     JAVASCRIPTCORE_GC_MARKED();
 
     m_markedSpace.reset();
-    m_markedSpace.sweep();
     m_extraCost = 0;
 
+    if (sweepToggle == DoSweep)
+        m_markedSpace.sweep();
+
     JAVASCRIPTCORE_GC_END();
 
     (*m_activityCallback)();
diff --git a/Source/JavaScriptCore/runtime/Heap.h b/Source/JavaScriptCore/runtime/Heap.h
index 42b5030..91a7e88 100644
--- a/Source/JavaScriptCore/runtime/Heap.h
+++ b/Source/JavaScriptCore/runtime/Heap.h
@@ -113,6 +113,9 @@ namespace JSC {
 
         void updateWeakGCHandles();
         WeakGCHandlePool* weakGCHandlePool(size_t index);
+        
+        enum SweepToggle { DoNotSweep, DoSweep };
+        void reset(SweepToggle);
 
         RegisterFile& registerFile();
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list