Title: [202827] trunk/Source/_javascript_Core
Revision
202827
Author
sbar...@apple.com
Date
2016-07-05 12:49:19 -0700 (Tue, 05 Jul 2016)

Log Message

reportAbandonedObjectGraph should report abandoned bytes based on capacity() so it works even if a GC has never happened
https://bugs.webkit.org/show_bug.cgi?id=159222
<rdar://problem/27001991>

Reviewed by Geoffrey Garen.

When reportAbandonedObjectGraph() was called before the first GC, it used to
not indicate to the GC timers that we have memory that needs to be collected
because the calculation was based on m_sizeAfterLastCollect (which was zero).
This patch makes the calculation based on capacity() which is a valid number
even before the first GC.

* heap/Heap.cpp:
(JSC::Heap::reportAbandonedObjectGraph):
(JSC::Heap::protect):
(JSC::Heap::didAbandon): Deleted.
* heap/Heap.h:
(JSC::Heap::jitStubRoutines):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (202826 => 202827)


--- trunk/Source/_javascript_Core/ChangeLog	2016-07-05 18:59:05 UTC (rev 202826)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-07-05 19:49:19 UTC (rev 202827)
@@ -1,3 +1,24 @@
+2016-07-05  Saam Barati  <sbar...@apple.com>
+
+        reportAbandonedObjectGraph should report abandoned bytes based on capacity() so it works even if a GC has never happened
+        https://bugs.webkit.org/show_bug.cgi?id=159222
+        <rdar://problem/27001991>
+
+        Reviewed by Geoffrey Garen.
+
+        When reportAbandonedObjectGraph() was called before the first GC, it used to
+        not indicate to the GC timers that we have memory that needs to be collected
+        because the calculation was based on m_sizeAfterLastCollect (which was zero).
+        This patch makes the calculation based on capacity() which is a valid number
+        even before the first GC.
+
+        * heap/Heap.cpp:
+        (JSC::Heap::reportAbandonedObjectGraph):
+        (JSC::Heap::protect):
+        (JSC::Heap::didAbandon): Deleted.
+        * heap/Heap.h:
+        (JSC::Heap::jitStubRoutines):
+
 2016-07-05  Csaba Osztrogonác  <o...@webkit.org>
 
         Typo fix after r202214

Modified: trunk/Source/_javascript_Core/heap/Heap.cpp (202826 => 202827)


--- trunk/Source/_javascript_Core/heap/Heap.cpp	2016-07-05 18:59:05 UTC (rev 202826)
+++ trunk/Source/_javascript_Core/heap/Heap.cpp	2016-07-05 19:49:19 UTC (rev 202827)
@@ -432,22 +432,17 @@
 {
     // Our clients don't know exactly how much memory they
     // are abandoning so we just guess for them.
-    double abandonedBytes = 0.1 * m_sizeAfterLastCollect;
+    size_t abandonedBytes = static_cast<size_t>(0.1 * capacity());
 
     // We want to accelerate the next collection. Because memory has just 
     // been abandoned, the next collection has the potential to 
     // be more profitable. Since allocation is the trigger for collection, 
     // we hasten the next collection by pretending that we've allocated more memory. 
-    didAbandon(abandonedBytes);
-}
-
-void Heap::didAbandon(size_t bytes)
-{
     if (m_fullActivityCallback) {
         m_fullActivityCallback->didAllocate(
             m_sizeAfterLastCollect - m_sizeAfterLastFullCollect + m_bytesAllocatedThisCycle + m_bytesAbandonedSinceLastFullCollect);
     }
-    m_bytesAbandonedSinceLastFullCollect += bytes;
+    m_bytesAbandonedSinceLastFullCollect += abandonedBytes;
 }
 
 void Heap::protect(JSValue k)

Modified: trunk/Source/_javascript_Core/heap/Heap.h (202826 => 202827)


--- trunk/Source/_javascript_Core/heap/Heap.h	2016-07-05 18:59:05 UTC (rev 202826)
+++ trunk/Source/_javascript_Core/heap/Heap.h	2016-07-05 19:49:19 UTC (rev 202827)
@@ -229,8 +229,6 @@
     void deleteAllUnlinkedCodeBlocks();
 
     void didAllocate(size_t);
-    void didAbandon(size_t);
-
     bool isPagedOut(double deadline);
     
     const JITStubRoutineSet& jitStubRoutines() { return m_jitStubRoutines; }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to