Title: [109956] trunk/Source/_javascript_Core
Revision
109956
Author
[email protected]
Date
2012-03-06 13:32:24 -0800 (Tue, 06 Mar 2012)

Log Message

GCActivityCallback timer should vary with the length of the previous GC
https://bugs.webkit.org/show_bug.cgi?id=80344

Reviewed by Geoffrey Garen.

* heap/Heap.cpp: Gave Heap the ability to keep track of the length of its last 
GC length so that the GC Activity Callback can use it.
(JSC::Heap::Heap):
(JSC::Heap::collect):
* heap/Heap.h:
(JSC::Heap::lastGCLength):
(Heap):
* runtime/GCActivityCallbackCF.cpp:
(JSC):
(JSC::DefaultGCActivityCallback::operator()): Use the length of the Heap's last 
GC to determine the length of our timer trigger (currently set at 100x the duration 
of the last GC).

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (109955 => 109956)


--- trunk/Source/_javascript_Core/ChangeLog	2012-03-06 21:32:03 UTC (rev 109955)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-03-06 21:32:24 UTC (rev 109956)
@@ -1,3 +1,23 @@
+2012-03-06  Mark Hahnenberg  <[email protected]>
+
+        GCActivityCallback timer should vary with the length of the previous GC
+        https://bugs.webkit.org/show_bug.cgi?id=80344
+
+        Reviewed by Geoffrey Garen.
+
+        * heap/Heap.cpp: Gave Heap the ability to keep track of the length of its last 
+        GC length so that the GC Activity Callback can use it.
+        (JSC::Heap::Heap):
+        (JSC::Heap::collect):
+        * heap/Heap.h:
+        (JSC::Heap::lastGCLength):
+        (Heap):
+        * runtime/GCActivityCallbackCF.cpp:
+        (JSC):
+        (JSC::DefaultGCActivityCallback::operator()): Use the length of the Heap's last 
+        GC to determine the length of our timer trigger (currently set at 100x the duration 
+        of the last GC).
+
 2012-03-06  Rob Buis  <[email protected]>
 
         BlackBerry] Fix cast-align gcc warnings when compiling JSC

Modified: trunk/Source/_javascript_Core/heap/Heap.cpp (109955 => 109956)


--- trunk/Source/_javascript_Core/heap/Heap.cpp	2012-03-06 21:32:03 UTC (rev 109955)
+++ trunk/Source/_javascript_Core/heap/Heap.cpp	2012-03-06 21:32:24 UTC (rev 109956)
@@ -328,6 +328,7 @@
     , m_handleHeap(globalData)
     , m_isSafeToCollect(false)
     , m_globalData(globalData)
+    , m_lastGCLength(0)
 {
     (*m_activityCallback)();
     m_numberOfFreeBlocks = 0;
@@ -781,6 +782,7 @@
     ASSERT(globalData()->identifierTable == wtfThreadData().currentIdentifierTable());
     ASSERT(m_isSafeToCollect);
     _javascript_CORE_GC_BEGIN();
+    double lastGCStartTime = WTF::currentTime();
 #if ENABLE(GGC)
     bool fullGC = sweepToggle == DoSweep;
     if (!fullGC)
@@ -835,6 +837,8 @@
         m_lastFullGCSize = newSize;
         setHighWaterMark(max(proportionalBytes, m_minBytesPerCycle));
     }
+    double lastGCEndTime = WTF::currentTime();
+    m_lastGCLength = lastGCEndTime - lastGCStartTime;
     _javascript_CORE_GC_END();
 
     (*m_activityCallback)();

Modified: trunk/Source/_javascript_Core/heap/Heap.h (109955 => 109956)


--- trunk/Source/_javascript_Core/heap/Heap.h	2012-03-06 21:32:03 UTC (rev 109955)
+++ trunk/Source/_javascript_Core/heap/Heap.h	2012-03-06 21:32:24 UTC (rev 109956)
@@ -138,6 +138,8 @@
 
         void getConservativeRegisterRoots(HashSet<JSCell*>& roots);
 
+        double lastGCLength() { return m_lastGCLength; }
+
     private:
         friend class CodeBlock;
         friend class LLIntOffsetsExtractor;
@@ -236,6 +238,7 @@
         bool m_isSafeToCollect;
 
         JSGlobalData* m_globalData;
+        double m_lastGCLength;
     };
 
     bool Heap::isBusy()

Modified: trunk/Source/_javascript_Core/runtime/GCActivityCallbackCF.cpp (109955 => 109956)


--- trunk/Source/_javascript_Core/runtime/GCActivityCallbackCF.cpp	2012-03-06 21:32:03 UTC (rev 109955)
+++ trunk/Source/_javascript_Core/runtime/GCActivityCallbackCF.cpp	2012-03-06 21:32:24 UTC (rev 109956)
@@ -53,7 +53,6 @@
 };
 
 const CFTimeInterval decade = 60 * 60 * 24 * 365 * 10;
-const CFTimeInterval triggerInterval = 2; // seconds
 
 void DefaultGCActivityCallbackPlatformData::trigger(CFRunLoopTimerRef timer, void *info)
 {
@@ -95,6 +94,7 @@
 
 void DefaultGCActivityCallback::operator()()
 {
+    CFTimeInterval triggerInterval = static_cast<Heap*>(d->context.info)->lastGCLength() * 100.0; 
     CFRunLoopTimerSetNextFireDate(d->timer.get(), CFAbsoluteTimeGetCurrent() + triggerInterval);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to