Changeset 202827 in webkit


Ignore:
Timestamp:
Jul 5, 2016 12:49:19 PM (8 years ago)
Author:
sbarati@apple.com
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):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r202818 r202827  
     12016-07-05  Saam Barati  <sbarati@apple.com>
     2
     3        reportAbandonedObjectGraph should report abandoned bytes based on capacity() so it works even if a GC has never happened
     4        https://bugs.webkit.org/show_bug.cgi?id=159222
     5        <rdar://problem/27001991>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        When reportAbandonedObjectGraph() was called before the first GC, it used to
     10        not indicate to the GC timers that we have memory that needs to be collected
     11        because the calculation was based on m_sizeAfterLastCollect (which was zero).
     12        This patch makes the calculation based on capacity() which is a valid number
     13        even before the first GC.
     14
     15        * heap/Heap.cpp:
     16        (JSC::Heap::reportAbandonedObjectGraph):
     17        (JSC::Heap::protect):
     18        (JSC::Heap::didAbandon): Deleted.
     19        * heap/Heap.h:
     20        (JSC::Heap::jitStubRoutines):
     21
    1222016-07-05  Csaba Osztrogonác  <ossy@webkit.org>
    223
  • trunk/Source/JavaScriptCore/heap/Heap.cpp

    r202394 r202827  
    433433    // Our clients don't know exactly how much memory they
    434434    // are abandoning so we just guess for them.
    435     double abandonedBytes = 0.1 * m_sizeAfterLastCollect;
     435    size_t abandonedBytes = static_cast<size_t>(0.1 * capacity());
    436436
    437437    // We want to accelerate the next collection. Because memory has just
     
    439439    // be more profitable. Since allocation is the trigger for collection,
    440440    // we hasten the next collection by pretending that we've allocated more memory.
    441     didAbandon(abandonedBytes);
    442 }
    443 
    444 void Heap::didAbandon(size_t bytes)
    445 {
    446441    if (m_fullActivityCallback) {
    447442        m_fullActivityCallback->didAllocate(
    448443            m_sizeAfterLastCollect - m_sizeAfterLastFullCollect + m_bytesAllocatedThisCycle + m_bytesAbandonedSinceLastFullCollect);
    449444    }
    450     m_bytesAbandonedSinceLastFullCollect += bytes;
     445    m_bytesAbandonedSinceLastFullCollect += abandonedBytes;
    451446}
    452447
  • trunk/Source/JavaScriptCore/heap/Heap.h

    r202402 r202827  
    230230
    231231    void didAllocate(size_t);
    232     void didAbandon(size_t);
    233 
    234232    bool isPagedOut(double deadline);
    235233   
Note: See TracChangeset for help on using the changeset viewer.