Changeset 196251 in webkit


Ignore:
Timestamp:
Feb 8, 2016 8:25:22 AM (8 years ago)
Author:
akling@apple.com
Message:

Visiting a WeakBlock should report bytes visited, since we reported them allocated.
<https://webkit.org/b/153978>

Reviewed by Darin Adler.

When creating a WeakBlock, we tell Heap that we've allocated 1 KB (WeakBlock::blockSize)
of memory. Consequently, when visiting a WeakBlock, we should also report 1 KB of memory
visited. Otherwise Heap will think that those 1 KB already went away.

This was causing us to underestimate heap size, which affects collection scheduling.

  • heap/SlotVisitor.h:

(JSC::SlotVisitor::reportMemoryVisited):

  • heap/WeakBlock.cpp:

(JSC::WeakBlock::visit):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r196243 r196251  
     12016-02-08  Andreas Kling  <akling@apple.com>
     2
     3        Visiting a WeakBlock should report bytes visited, since we reported them allocated.
     4        <https://webkit.org/b/153978>
     5
     6        Reviewed by Darin Adler.
     7
     8        When creating a WeakBlock, we tell Heap that we've allocated 1 KB (WeakBlock::blockSize)
     9        of memory. Consequently, when visiting a WeakBlock, we should also report 1 KB of memory
     10        visited. Otherwise Heap will think that those 1 KB already went away.
     11
     12        This was causing us to underestimate heap size, which affects collection scheduling.
     13
     14        * heap/SlotVisitor.h:
     15        (JSC::SlotVisitor::reportMemoryVisited):
     16        * heap/WeakBlock.cpp:
     17        (JSC::WeakBlock::visit):
     18
    1192016-02-07  Saam barati  <sbarati@apple.com>
    220
  • trunk/Source/JavaScriptCore/heap/SlotVisitor.h

    r190569 r196251  
    106106   
    107107    void reportExtraMemoryVisited(size_t);
     108    void reportMemoryVisited(size_t bytes) { m_bytesVisited += bytes; }
    108109   
    109110    void addWeakReferenceHarvester(WeakReferenceHarvester*);
  • trunk/Source/JavaScriptCore/heap/WeakBlock.cpp

    r191849 r196251  
    110110    SlotVisitor& visitor = heapRootVisitor.visitor();
    111111
     112    visitor.reportMemoryVisited(WeakBlock::blockSize);
     113
    112114    for (size_t i = 0; i < weakImplCount(); ++i) {
    113115        WeakImpl* weakImpl = &weakImpls()[i];
Note: See TracChangeset for help on using the changeset viewer.