⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 181407 in webkit


Ignore:
Timestamp:
Mar 11, 2015, 2:29:57 PM (11 years ago)
Author:
ggaren@apple.com
Message:

Refactored the JSC::Heap extra cost API for clarity and to make some known bugs more obvious
https://bugs.webkit.org/show_bug.cgi?id=142589

Reviewed by Andreas Kling.

Source/JavaScriptCore:

  • API/JSBase.cpp:

(JSReportExtraMemoryCost): Added a FIXME to annotate a known bug.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::CodeBlock):
(JSC::CodeBlock::visitAggregate):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::setJITCode): Updated for rename.

  • heap/Heap.cpp:

(JSC::Heap::Heap):
(JSC::Heap::reportExtraMemoryAllocatedSlowCase):
(JSC::Heap::deprecatedReportExtraMemorySlowCase): Renamed our reporting
APIs to clarify their relationship to each other: One must report extra
memory at the time of allocation, and at the time the GC visits it.

(JSC::Heap::extraMemorySize):
(JSC::Heap::size):
(JSC::Heap::capacity):
(JSC::Heap::sizeAfterCollect):
(JSC::Heap::willStartCollection): Updated for renames. Added explicit
API for deprecated users who can't use our best API.

(JSC::Heap::reportExtraMemoryCostSlowCase): Deleted.
(JSC::Heap::extraSize): Deleted.

  • heap/Heap.h:
  • heap/HeapInlines.h:

(JSC::Heap::reportExtraMemoryAllocated):
(JSC::Heap::reportExtraMemoryVisited):
(JSC::Heap::deprecatedReportExtraMemory):
(JSC::Heap::reportExtraMemoryCost): Deleted. Ditto.

  • heap/SlotVisitor.h:
  • heap/SlotVisitorInlines.h:

(JSC::SlotVisitor::reportExtraMemoryVisited):
(JSC::SlotVisitor::reportExtraMemoryUsage): Deleted. Moved this
functionality into the Heap since it's pretty detailed in its access
to the heap.

  • runtime/JSArrayBufferView.cpp:

(JSC::JSArrayBufferView::ConstructionContext::ConstructionContext):

  • runtime/JSGenericTypedArrayViewInlines.h:

(JSC::JSGenericTypedArrayView<Adaptor>::visitChildren): Updated for
renames.

  • runtime/JSString.cpp:

(JSC::JSString::visitChildren):
(JSC::JSRopeString::resolveRopeToAtomicString):
(JSC::JSRopeString::resolveRope):

  • runtime/JSString.h:

(JSC::JSString::finishCreation): Updated for renames.

  • runtime/SparseArrayValueMap.cpp:

(JSC::SparseArrayValueMap::add): Added FIXME.

  • runtime/WeakMapData.cpp:

(JSC::WeakMapData::visitChildren): Updated for rename.

Source/WebCore:

Updated for renames to JSC extra cost APIs.

Added FIXMEs to our 10 use cases that are currently wrong, including
canvas, which is the cause of https://bugs.webkit.org/show_bug.cgi?id=142457.

  • Modules/mediasource/SourceBuffer.cpp:

(WebCore::SourceBuffer::appendBufferInternal):
(WebCore::SourceBuffer::sourceBufferPrivateAppendComplete):
(WebCore::SourceBuffer::reportExtraMemoryAllocated):
(WebCore::SourceBuffer::reportExtraMemoryCost): Deleted.

  • Modules/mediasource/SourceBuffer.h:
  • bindings/js/JSDocumentCustom.cpp:

(WebCore::toJS):

  • bindings/js/JSImageDataCustom.cpp:

(WebCore::toJS):

  • bindings/js/JSNodeListCustom.cpp:

(WebCore::createWrapper):

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateImplementation):

  • dom/CollectionIndexCache.cpp:

(WebCore::reportExtraMemoryAllocatedForCollectionIndexCache):
(WebCore::reportExtraMemoryCostForCollectionIndexCache): Deleted.

  • dom/CollectionIndexCache.h:

(WebCore::Iterator>::computeNodeCountUpdatingListCache):

  • html/HTMLCanvasElement.cpp:

(WebCore::HTMLCanvasElement::createImageBuffer):

  • html/HTMLCollection.h:

(WebCore::CollectionNamedElementCache::didPopulate):

  • html/HTMLImageLoader.cpp:

(WebCore::HTMLImageLoader::imageChanged):

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::parseAttribute):

  • xml/XMLHttpRequest.cpp:

(WebCore::XMLHttpRequest::dropProtection):

Location:
trunk/Source
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSBase.cpp

    r181215 r181407  
    140140    ExecState* exec = toJS(ctx);
    141141    JSLockHolder locker(exec);
    142     exec->vm().heap.reportExtraMemoryCost(size);
     142
     143    // FIXME: switch to deprecatedReportExtraMemory.
     144    // https://bugs.webkit.org/show_bug.cgi?id=142593
     145    exec->vm().heap.reportExtraMemoryAllocated(size);
    143146}
    144147
  • trunk/Source/JavaScriptCore/ChangeLog

    r181404 r181407  
     12015-03-11  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Refactored the JSC::Heap extra cost API for clarity and to make some known bugs more obvious
     4        https://bugs.webkit.org/show_bug.cgi?id=142589
     5
     6        Reviewed by Andreas Kling.
     7
     8        * API/JSBase.cpp:
     9        (JSReportExtraMemoryCost): Added a FIXME to annotate a known bug.
     10
     11        * bytecode/CodeBlock.cpp:
     12        (JSC::CodeBlock::CodeBlock):
     13        (JSC::CodeBlock::visitAggregate):
     14        * bytecode/CodeBlock.h:
     15        (JSC::CodeBlock::setJITCode): Updated for rename.
     16
     17        * heap/Heap.cpp:
     18        (JSC::Heap::Heap):
     19        (JSC::Heap::reportExtraMemoryAllocatedSlowCase):
     20        (JSC::Heap::deprecatedReportExtraMemorySlowCase): Renamed our reporting
     21        APIs to clarify their relationship to each other: One must report extra
     22        memory at the time of allocation, and at the time the GC visits it.
     23
     24        (JSC::Heap::extraMemorySize):
     25        (JSC::Heap::size):
     26        (JSC::Heap::capacity):
     27        (JSC::Heap::sizeAfterCollect):
     28        (JSC::Heap::willStartCollection): Updated for renames. Added explicit
     29        API for deprecated users who can't use our best API.
     30 
     31        (JSC::Heap::reportExtraMemoryCostSlowCase): Deleted.
     32        (JSC::Heap::extraSize): Deleted.
     33
     34        * heap/Heap.h:
     35        * heap/HeapInlines.h:
     36        (JSC::Heap::reportExtraMemoryAllocated):
     37        (JSC::Heap::reportExtraMemoryVisited):
     38        (JSC::Heap::deprecatedReportExtraMemory):
     39        (JSC::Heap::reportExtraMemoryCost): Deleted. Ditto.
     40
     41        * heap/SlotVisitor.h:
     42        * heap/SlotVisitorInlines.h:
     43        (JSC::SlotVisitor::reportExtraMemoryVisited):
     44        (JSC::SlotVisitor::reportExtraMemoryUsage): Deleted. Moved this
     45        functionality into the Heap since it's pretty detailed in its access
     46        to the heap.
     47
     48        * runtime/JSArrayBufferView.cpp:
     49        (JSC::JSArrayBufferView::ConstructionContext::ConstructionContext):
     50        * runtime/JSGenericTypedArrayViewInlines.h:
     51        (JSC::JSGenericTypedArrayView<Adaptor>::visitChildren): Updated for
     52        renames.
     53
     54        * runtime/JSString.cpp:
     55        (JSC::JSString::visitChildren):
     56        (JSC::JSRopeString::resolveRopeToAtomicString):
     57        (JSC::JSRopeString::resolveRope):
     58        * runtime/JSString.h:
     59        (JSC::JSString::finishCreation): Updated for renames.
     60
     61        * runtime/SparseArrayValueMap.cpp:
     62        (JSC::SparseArrayValueMap::add): Added FIXME.
     63
     64        * runtime/WeakMapData.cpp:
     65        (JSC::WeakMapData::visitChildren): Updated for rename.
     66
    1672015-03-11  Ryosuke Niwa  <rniwa@webkit.org>
    268
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r181334 r181407  
    16781678   
    16791679    m_heap->m_codeBlocks.add(this);
    1680     m_heap->reportExtraMemoryCost(sizeof(CodeBlock));
     1680    m_heap->reportExtraMemoryAllocated(sizeof(CodeBlock));
    16811681}
    16821682
     
    21322132   
    21332133    m_heap->m_codeBlocks.add(this);
    2134     m_heap->reportExtraMemoryCost(sizeof(CodeBlock) + m_instructions.size() * sizeof(Instruction));
     2134    m_heap->reportExtraMemoryAllocated(sizeof(CodeBlock) + m_instructions.size() * sizeof(Instruction));
    21352135}
    21362136
     
    22242224        otherBlock->visitAggregate(visitor);
    22252225
    2226     visitor.reportExtraMemoryUsage(ownerExecutable(), sizeof(CodeBlock));
     2226    visitor.reportExtraMemoryVisited(ownerExecutable(), sizeof(CodeBlock));
    22272227    if (m_jitCode)
    2228         visitor.reportExtraMemoryUsage(ownerExecutable(), m_jitCode->size());
     2228        visitor.reportExtraMemoryVisited(ownerExecutable(), m_jitCode->size());
    22292229    if (m_instructions.size()) {
    22302230        // Divide by refCount() because m_instructions points to something that is shared
     
    22322232        // Having each CodeBlock report only its proportional share of the size is one way
    22332233        // of accomplishing this.
    2234         visitor.reportExtraMemoryUsage(ownerExecutable(), m_instructions.size() * sizeof(Instruction) / m_instructions.refCount());
     2234        visitor.reportExtraMemoryVisited(ownerExecutable(), m_instructions.size() * sizeof(Instruction) / m_instructions.refCount());
    22352235    }
    22362236
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.h

    r180993 r181407  
    274274    {
    275275        ASSERT(m_heap->isDeferred());
    276         m_heap->reportExtraMemoryCost(code->size());
     276        m_heap->reportExtraMemoryAllocated(code->size());
    277277        ConcurrentJITLocker locker(m_lock);
    278278        WTF::storeStoreFence(); // This is probably not needed because the lock will also do something similar, but it's good to be paranoid.
  • trunk/Source/JavaScriptCore/heap/Heap.cpp

    r181350 r181407  
    310310    , m_objectSpace(this)
    311311    , m_storageSpace(this)
    312     , m_extraMemoryUsage(0)
     312    , m_extraMemorySize(0)
     313    , m_deprecatedExtraMemorySize(0)
    313314    , m_machineThreads(this)
    314315    , m_sharedData(vm)
     
    393394}
    394395
    395 void Heap::reportExtraMemoryCostSlowCase(size_t cost)
    396 {
    397     // Our frequency of garbage collection tries to balance memory use against speed
    398     // by collecting based on the number of newly created values. However, for values
    399     // that hold on to a great deal of memory that's not in the form of other JS values,
    400     // that is not good enough - in some cases a lot of those objects can pile up and
    401     // use crazy amounts of memory without a GC happening. So we track these extra
    402     // memory costs. Only unusually large objects are noted, and we only keep track
    403     // of this extra cost until the next GC. In garbage collected languages, most values
    404     // are either very short lived temporaries, or have extremely long lifetimes. So
    405     // if a large value survives one garbage collection, there is not much point to
    406     // collecting more frequently as long as it stays alive.
    407 
    408     didAllocate(cost);
     396void Heap::reportExtraMemoryAllocatedSlowCase(size_t size)
     397{
     398    didAllocate(size);
    409399    collectIfNecessaryOrDefer();
     400}
     401
     402void Heap::deprecatedReportExtraMemorySlowCase(size_t size)
     403{
     404    m_deprecatedExtraMemorySize += size;
     405    reportExtraMemoryAllocatedSlowCase(size);
    410406}
    411407
     
    855851}
    856852
    857 size_t Heap::extraSize()
    858 {
    859     return m_extraMemoryUsage + m_arrayBuffers.size();
     853size_t Heap::extraMemorySize()
     854{
     855    return m_extraMemorySize + m_deprecatedExtraMemorySize + m_arrayBuffers.size();
    860856}
    861857
    862858size_t Heap::size()
    863859{
    864     return m_objectSpace.size() + m_storageSpace.size() + extraSize();
     860    return m_objectSpace.size() + m_storageSpace.size() + extraMemorySize();
    865861}
    866862
    867863size_t Heap::capacity()
    868864{
    869     return m_objectSpace.capacity() + m_storageSpace.capacity() + extraSize();
     865    return m_objectSpace.capacity() + m_storageSpace.capacity() + extraMemorySize();
    870866}
    871867
     
    877873    // always the case that m_totalBytesCopied <= m_storageSpace.size().
    878874    ASSERT(m_totalBytesCopied <= m_storageSpace.size());
    879     return m_totalBytesVisited + m_totalBytesCopied + extraSize();
     875    return m_totalBytesVisited + m_totalBytesCopied + extraMemorySize();
    880876}
    881877
     
    11251121    if (m_operationInProgress == FullCollection) {
    11261122        m_sizeBeforeLastFullCollect = m_sizeAfterLastCollect + m_bytesAllocatedThisCycle;
    1127         m_extraMemoryUsage = 0;
     1123        m_extraMemorySize = 0;
     1124        m_deprecatedExtraMemorySize = 0;
    11281125
    11291126        if (m_fullActivityCallback)
  • trunk/Source/JavaScriptCore/heap/Heap.h

    r181297 r181407  
    162162    bool collectIfNecessaryOrDefer(); // Returns true if it did collect.
    163163
    164     void reportExtraMemoryCost(size_t cost);
     164    // Use this API to report non-GC memory referenced by GC objects. Be sure to
     165    // call both of these functions: Calling only one may trigger catastropic
     166    // memory growth.
     167    void reportExtraMemoryAllocated(size_t);
     168    void reportExtraMemoryVisited(JSCell*, size_t);
     169
     170    // Use this API to report non-GC memory if you can't use the better API above.
     171    void deprecatedReportExtraMemory(size_t);
     172
    165173    JS_EXPORT_PRIVATE void reportAbandonedObjectGraph();
    166174
     
    168176    JS_EXPORT_PRIVATE bool unprotect(JSValue); // True when the protect count drops to 0.
    169177   
    170     size_t extraSize(); // extra memory usage outside of pages allocated by the heap
     178    size_t extraMemorySize(); // Non-GC memory referenced by GC objects.
    171179    JS_EXPORT_PRIVATE size_t size();
    172180    JS_EXPORT_PRIVATE size_t capacity();
     
    262270    template<typename ClassType> void* allocateObjectOfType(size_t); // Chooses one of the methods above based on type.
    263271
    264     static const size_t minExtraCost = 256;
    265     static const size_t maxExtraCost = 1024 * 1024;
     272    static const size_t minExtraMemory = 256;
    266273   
    267274    class FinalizerOwner : public WeakHandleOwner {
     
    270277
    271278    JS_EXPORT_PRIVATE bool isValidAllocation(size_t);
    272     JS_EXPORT_PRIVATE void reportExtraMemoryCostSlowCase(size_t);
     279    JS_EXPORT_PRIVATE void reportExtraMemoryAllocatedSlowCase(size_t);
     280    JS_EXPORT_PRIVATE void deprecatedReportExtraMemorySlowCase(size_t);
    273281
    274282    void collectImpl(HeapOperation, void* stackOrigin, void* stackTop, MachineThreads::RegisterState&);
     
    354362    CopiedSpace m_storageSpace;
    355363    GCIncomingRefCountedSet<ArrayBuffer> m_arrayBuffers;
    356     size_t m_extraMemoryUsage;
     364    size_t m_extraMemorySize;
     365    size_t m_deprecatedExtraMemorySize;
    357366
    358367    HashSet<const JSCell*> m_copyingRememberedSet;
  • trunk/Source/JavaScriptCore/heap/HeapInlines.h

    r181297 r181407  
    153153}
    154154
    155 inline void Heap::reportExtraMemoryCost(size_t cost)
    156 {
    157     if (cost > minExtraCost)
    158         reportExtraMemoryCostSlowCase(cost);
     155inline void Heap::reportExtraMemoryAllocated(size_t size)
     156{
     157    if (size > minExtraMemory)
     158        reportExtraMemoryAllocatedSlowCase(size);
     159}
     160
     161inline void Heap::reportExtraMemoryVisited(JSCell* owner, size_t size)
     162{
     163#if ENABLE(GGC)
     164    // We don't want to double-count the extra memory that was reported in previous collections.
     165    if (operationInProgress() == EdenCollection && Heap::isRemembered(owner))
     166        return;
     167#else
     168    UNUSED_PARAM(owner);
     169#endif
     170
     171    size_t* counter = &m_extraMemorySize;
     172   
     173#if ENABLE(COMPARE_AND_SWAP)
     174    for (;;) {
     175        size_t oldSize = *counter;
     176        if (WTF::weakCompareAndSwapSize(counter, oldSize, oldSize + size))
     177            return;
     178    }
     179#else
     180    (*counter) += size;
     181#endif
     182}
     183
     184inline void Heap::deprecatedReportExtraMemory(size_t size)
     185{
     186    if (size > minExtraMemory)
     187        deprecatedReportExtraMemorySlowCase(size);
    159188}
    160189
  • trunk/Source/JavaScriptCore/heap/SlotVisitor.h

    r167326 r181407  
    106106    void copyLater(JSCell*, CopyToken, void*, size_t);
    107107   
    108     void reportExtraMemoryUsage(JSCell* owner, size_t);
     108    void reportExtraMemoryVisited(JSCell* owner, size_t);
    109109   
    110110    void addWeakReferenceHarvester(WeakReferenceHarvester*);
  • trunk/Source/JavaScriptCore/heap/SlotVisitorInlines.h

    r167326 r181407  
    253253}
    254254   
    255 inline void SlotVisitor::reportExtraMemoryUsage(JSCell* owner, size_t size)
    256 {
    257 #if ENABLE(GGC)
    258     // We don't want to double-count the extra memory that was reported in previous collections.
    259     if (heap()->operationInProgress() == EdenCollection && Heap::isRemembered(owner))
    260         return;
    261 #else
    262     UNUSED_PARAM(owner);
    263 #endif
    264 
    265     size_t* counter = &m_shared.m_vm->heap.m_extraMemoryUsage;
    266    
    267 #if ENABLE(COMPARE_AND_SWAP)
    268     for (;;) {
    269         size_t oldSize = *counter;
    270         if (WTF::weakCompareAndSwapSize(counter, oldSize, oldSize + size))
    271             return;
    272     }
    273 #else
    274     (*counter) += size;
    275 #endif
     255inline void SlotVisitor::reportExtraMemoryVisited(JSCell* owner, size_t size)
     256{
     257    heap()->reportExtraMemoryVisited(owner, size);
    276258}
    277259
  • trunk/Source/JavaScriptCore/runtime/JSArrayBufferView.cpp

    r172176 r181407  
    7979    }
    8080   
    81     vm.heap.reportExtraMemoryCost(static_cast<size_t>(length) * elementSize);
     81    vm.heap.reportExtraMemoryAllocated(static_cast<size_t>(length) * elementSize);
    8282   
    8383    m_structure = structure;
  • trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h

    r178928 r181407  
    447447       
    448448    case OversizeTypedArray: {
    449         visitor.reportExtraMemoryUsage(thisObject, thisObject->byteSize());
     449        visitor.reportExtraMemoryVisited(thisObject, thisObject->byteSize());
    450450        break;
    451451    }
  • trunk/Source/JavaScriptCore/runtime/JSString.cpp

    r181297 r181407  
    7878        StringImpl* impl = thisObject->m_value.impl();
    7979        ASSERT(impl);
    80         visitor.reportExtraMemoryUsage(thisObject, impl->costDuringGC());
     80        visitor.reportExtraMemoryVisited(thisObject, impl->costDuringGC());
    8181    }
    8282}
     
    182182    // If we resolved a string that didn't previously exist, notify the heap that we've grown.
    183183    if (m_value.impl()->hasOneRef())
    184         Heap::heap(this)->reportExtraMemoryCost(m_value.impl()->cost());
     184        Heap::heap(this)->reportExtraMemoryAllocated(m_value.impl()->cost());
    185185}
    186186
     
    241241        LChar* buffer;
    242242        if (RefPtr<StringImpl> newImpl = StringImpl::tryCreateUninitialized(m_length, buffer)) {
    243             Heap::heap(this)->reportExtraMemoryCost(newImpl->cost());
     243            Heap::heap(this)->reportExtraMemoryAllocated(newImpl->cost());
    244244            m_value = newImpl.release();
    245245        } else {
     
    255255    UChar* buffer;
    256256    if (RefPtr<StringImpl> newImpl = StringImpl::tryCreateUninitialized(m_length, buffer)) {
    257         Heap::heap(this)->reportExtraMemoryCost(newImpl->cost());
     257        Heap::heap(this)->reportExtraMemoryAllocated(newImpl->cost());
    258258        m_value = newImpl.release();
    259259    } else {
  • trunk/Source/JavaScriptCore/runtime/JSString.h

    r178928 r181407  
    108108        m_length = length;
    109109        setIs8Bit(m_value.impl()->is8Bit());
    110         Heap::heap(this)->reportExtraMemoryCost(cost);
     110        Heap::heap(this)->reportExtraMemoryAllocated(cost);
    111111        vm.m_newStringsSinceLastHashCons++;
    112112    }
  • trunk/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp

    r171824 r181407  
    8181    size_t capacity = m_map.capacity();
    8282    if (capacity != m_reportedCapacity) {
    83         Heap::heap(array)->reportExtraMemoryCost((capacity - m_reportedCapacity) * (sizeof(unsigned) + sizeof(WriteBarrier<Unknown>)));
     83        // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
     84        // https://bugs.webkit.org/show_bug.cgi?id=142593
     85        Heap::heap(array)->reportExtraMemoryAllocated((capacity - m_reportedCapacity) * (sizeof(unsigned) + sizeof(WriteBarrier<Unknown>)));
    8486        m_reportedCapacity = capacity;
    8587    }
  • trunk/Source/JavaScriptCore/runtime/WeakMapData.cpp

    r171824 r181407  
    6565    // This isn't exact, but it is close enough, and proportional to the actual
    6666    // external mermory usage.
    67     visitor.reportExtraMemoryUsage(thisObj, thisObj->m_map.capacity() * (sizeof(JSObject*) + sizeof(WriteBarrier<Unknown>)));
     67    visitor.reportExtraMemoryVisited(thisObj, thisObj->m_map.capacity() * (sizeof(JSObject*) + sizeof(WriteBarrier<Unknown>)));
    6868}
    6969
  • trunk/Source/WebCore/ChangeLog

    r181405 r181407  
     12015-03-11  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Refactored the JSC::Heap extra cost API for clarity and to make some known bugs more obvious
     4        https://bugs.webkit.org/show_bug.cgi?id=142589
     5
     6        Reviewed by Andreas Kling.
     7
     8        Updated for renames to JSC extra cost APIs.
     9
     10        Added FIXMEs to our 10 use cases that are currently wrong, including
     11        canvas, which is the cause of https://bugs.webkit.org/show_bug.cgi?id=142457.
     12
     13        * Modules/mediasource/SourceBuffer.cpp:
     14        (WebCore::SourceBuffer::appendBufferInternal):
     15        (WebCore::SourceBuffer::sourceBufferPrivateAppendComplete):
     16        (WebCore::SourceBuffer::reportExtraMemoryAllocated):
     17        (WebCore::SourceBuffer::reportExtraMemoryCost): Deleted.
     18        * Modules/mediasource/SourceBuffer.h:
     19        * bindings/js/JSDocumentCustom.cpp:
     20        (WebCore::toJS):
     21        * bindings/js/JSImageDataCustom.cpp:
     22        (WebCore::toJS):
     23        * bindings/js/JSNodeListCustom.cpp:
     24        (WebCore::createWrapper):
     25        * bindings/scripts/CodeGeneratorJS.pm:
     26        (GenerateImplementation):
     27        * dom/CollectionIndexCache.cpp:
     28        (WebCore::reportExtraMemoryAllocatedForCollectionIndexCache):
     29        (WebCore::reportExtraMemoryCostForCollectionIndexCache): Deleted.
     30        * dom/CollectionIndexCache.h:
     31        (WebCore::Iterator>::computeNodeCountUpdatingListCache):
     32        * html/HTMLCanvasElement.cpp:
     33        (WebCore::HTMLCanvasElement::createImageBuffer):
     34        * html/HTMLCollection.h:
     35        (WebCore::CollectionNamedElementCache::didPopulate):
     36        * html/HTMLImageLoader.cpp:
     37        (WebCore::HTMLImageLoader::imageChanged):
     38        * html/HTMLMediaElement.cpp:
     39        (WebCore::HTMLMediaElement::parseAttribute):
     40        * xml/XMLHttpRequest.cpp:
     41        (WebCore::XMLHttpRequest::dropProtection):
     42
    1432015-03-11  Benjamin Poulain  <bpoulain@apple.com>
    244
  • trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp

    r180801 r181407  
    582582    m_appendBufferTimer.startOneShot(0);
    583583
    584     reportExtraMemoryCost();
     584    reportExtraMemoryAllocated();
    585585}
    586586
     
    668668    }
    669669
    670     reportExtraMemoryCost();
     670    reportExtraMemoryAllocated();
    671671    if (extraMemoryCost() > this->maximumBufferSize())
    672672        m_bufferFull = true;
     
    19891989}
    19901990
    1991 void SourceBuffer::reportExtraMemoryCost()
     1991void SourceBuffer::reportExtraMemoryAllocated()
    19921992{
    19931993    size_t extraMemoryCost = this->extraMemoryCost();
     
    19991999
    20002000    JSC::JSLockHolder lock(scriptExecutionContext()->vm());
    2001     if (extraMemoryCostDelta > 0)
    2002         scriptExecutionContext()->vm().heap.reportExtraMemoryCost(extraMemoryCostDelta);
     2001    if (extraMemoryCostDelta > 0) {
     2002        // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
     2003        // https://bugs.webkit.org/show_bug.cgi?id=142593
     2004        scriptExecutionContext()->vm().heap.reportExtraMemoryAllocated(extraMemoryCostDelta);
     2005    }
    20032006}
    20042007
  • trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h

    r180801 r181407  
    193193
    194194    size_t extraMemoryCost() const;
    195     void reportExtraMemoryCost();
     195    void reportExtraMemoryAllocated();
    196196
    197197    std::unique_ptr<PlatformTimeRanges> bufferedAccountingForEndOfStream() const;
  • trunk/Source/WebCore/bindings/js/JSDocumentCustom.cpp

    r179353 r181407  
    110110            nodeCount++;
    111111       
    112         exec->heap()->reportExtraMemoryCost(nodeCount * sizeof(Node));
     112        // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
     113        // https://bugs.webkit.org/show_bug.cgi?id=142593
     114        exec->heap()->reportExtraMemoryAllocated(nodeCount * sizeof(Node));
    113115    }
    114116
  • trunk/Source/WebCore/bindings/js/JSImageDataCustom.cpp

    r170167 r181407  
    4848    Identifier dataName(exec, "data");
    4949    wrapper->putDirect(exec->vm(), dataName, toJS(exec, globalObject, imageData->data()), DontDelete | ReadOnly);
    50     exec->heap()->reportExtraMemoryCost(imageData->data()->length());
     50    // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
     51    // https://bugs.webkit.org/show_bug.cgi?id=142593
     52    exec->heap()->reportExtraMemoryAllocated(imageData->data()->length());
    5153   
    5254    return wrapper;
  • trunk/Source/WebCore/bindings/js/JSNodeListCustom.cpp

    r166520 r181407  
    6363JSC::JSValue createWrapper(JSDOMGlobalObject& globalObject, NodeList& nodeList)
    6464{
    65     globalObject.vm().heap.reportExtraMemoryCost(nodeList.memoryCost());
     65    // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
     66    // https://bugs.webkit.org/show_bug.cgi?id=142593
     67    globalObject.vm().heap.reportExtraMemoryAllocated(nodeList.memoryCost());
    6668    return createNewWrapper<JSNodeList>(&globalObject, &nodeList);
    6769}
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r181358 r181407  
    28662866        push(@implContent, "    thisObject->visitAdditionalChildren(visitor);\n") if $interface->extendedAttributes->{"JSCustomMarkFunction"};
    28672867        if ($interface->extendedAttributes->{"ReportExtraMemoryCost"}) {
    2868             push(@implContent, "    visitor.reportExtraMemoryUsage(cell, thisObject->impl().memoryCost());\n");
     2868            push(@implContent, "    visitor.reportExtraMemoryVisited(cell, thisObject->impl().memoryCost());\n");
    28692869        }
    28702870        if ($numCachedAttributes > 0) {
     
    30813081END
    30823082        push(@implContent, <<END) if $interface->extendedAttributes->{"ReportExtraMemoryCost"};
    3083     globalObject->vm().heap.reportExtraMemoryCost(impl->memoryCost());
     3083    globalObject->vm().heap.reportExtraMemoryAllocated(impl->memoryCost());
    30843084END
    30853085
  • trunk/Source/WebCore/dom/CollectionIndexCache.cpp

    r164968 r181407  
    3131namespace WebCore {
    3232
    33 void reportExtraMemoryCostForCollectionIndexCache(size_t cost)
     33void reportExtraMemoryAllocatedForCollectionIndexCache(size_t cost)
    3434{
    3535    JSC::VM& vm = JSDOMWindowBase::commonVM();
    3636    JSC::JSLockHolder lock(vm);
    37     vm.heap.reportExtraMemoryCost(cost);
     37    // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
     38    // https://bugs.webkit.org/show_bug.cgi?id=142593
     39    vm.heap.reportExtraMemoryAllocated(cost);
    3840}
    3941
  • trunk/Source/WebCore/dom/CollectionIndexCache.h

    r166460 r181407  
    3131namespace WebCore {
    3232
    33 void reportExtraMemoryCostForCollectionIndexCache(size_t);
     33void reportExtraMemoryAllocatedForCollectionIndexCache(size_t);
    3434
    3535template <class Collection, class Iterator>
     
    101101
    102102    if (unsigned capacityDifference = m_cachedList.capacity() - oldCapacity)
    103         reportExtraMemoryCostForCollectionIndexCache(capacityDifference * sizeof(NodeType*));
     103        reportExtraMemoryAllocatedForCollectionIndexCache(capacityDifference * sizeof(NodeType*));
    104104
    105105    return m_cachedList.size();
  • trunk/Source/WebCore/html/HTMLCanvasElement.cpp

    r180520 r181407  
    577577    JSC::JSLockHolder lock(scriptExecutionContext()->vm());
    578578    size_t numBytes = 4 * m_imageBuffer->internalSize().width() * m_imageBuffer->internalSize().height();
    579     scriptExecutionContext()->vm().heap.reportExtraMemoryCost(numBytes);
     579    // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
     580    // https://bugs.webkit.org/show_bug.cgi?id=142593
     581    scriptExecutionContext()->vm().heap.reportExtraMemoryAllocated(numBytes);
    580582
    581583#if USE(IOSURFACE_CANVAS_BACKING_STORE) || ENABLE(ACCELERATED_2D_CANVAS)
  • trunk/Source/WebCore/html/HTMLCollection.h

    r177259 r181407  
    161161#endif
    162162    if (size_t cost = memoryCost())
    163         reportExtraMemoryCostForCollectionIndexCache(cost);
     163        reportExtraMemoryAllocatedForCollectionIndexCache(cost);
    164164}
    165165
  • trunk/Source/WebCore/html/HTMLImageLoader.cpp

    r180653 r181407  
    8989            JSC::VM& vm = JSDOMWindowBase::commonVM();
    9090            JSC::JSLockHolder lock(vm);
    91             vm.heap.reportExtraMemoryCost(cachedImage->encodedSize());
     91            // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
     92            // https://bugs.webkit.org/show_bug.cgi?id=142593
     93            vm.heap.reportExtraMemoryAllocated(cachedImage->encodedSize());
    9294        }
    9395    }
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r181358 r181407  
    637637            m_reportedExtraMemoryCost = extraMemoryCost;
    638638
    639             if (extraMemoryCostDelta > 0)
    640                 vm.heap.reportExtraMemoryCost(extraMemoryCostDelta);
     639            if (extraMemoryCostDelta > 0) {
     640                // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
     641                // https://bugs.webkit.org/show_bug.cgi?id=142593
     642                vm.heap.reportExtraMemoryAllocated(extraMemoryCostDelta);
     643            }
    641644        }
    642645    }
  • trunk/Source/WebCore/xml/XMLHttpRequest.cpp

    r180801 r181407  
    914914    JSC::VM& vm = scriptExecutionContext()->vm();
    915915    JSC::JSLockHolder lock(vm);
    916     vm.heap.reportExtraMemoryCost(m_responseBuilder.length() * 2);
     916    // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
     917    // https://bugs.webkit.org/show_bug.cgi?id=142593
     918    vm.heap.reportExtraMemoryAllocated(m_responseBuilder.length() * 2);
    917919
    918920    unsetPendingActivity(this);
Note: See TracChangeset for help on using the changeset viewer.