Skip to content
  • oliver@apple.com's avatar
    fourthTier: Count external memory usage towards heap footprint · 8cebf376
    oliver@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=117948
    
    Reviewed by Geoffrey Garen.
    
    Source/JavaScriptCore:
    
    Currently just count strings. Strings get counted in such a way that we won't re-count strings
    that are aliased, by dividing by the reference count. This then ups the GC footprint and allows
    the collector to appropriately amortize itself.
    
    * heap/Heap.cpp:
    (JSC::Heap::Heap):
    (JSC::Heap::size):
    (JSC::Heap::collect):
    * heap/Heap.h:
    (Heap):
    * heap/SlotVisitor.h:
    * heap/SlotVisitorInlines.h:
    (JSC::SlotVisitor::reportExtraMemoryUsage):
    (JSC):
    * runtime/JSString.cpp:
    (JSC::JSString::visitChildren):
    
    Source/WTF:
    
    Expose some functionality needed for properly measuring StringImpl footprint.
    
    * wtf/Atomics.h:
    (WTF::weakCompareAndSwapSize):
    (WTF):
    * wtf/MathExtras.h:
    (divideRoundedUp):
    * wtf/text/StringImpl.h:
    (WTF::StringImpl::cost):
    (StringImpl):
    (WTF::StringImpl::costDuringGC):
    (WTF::StringImpl::refCount):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153247 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    8cebf376