Ignore:
Timestamp:
Mar 11, 2015, 2:29:57 PM (10 years ago)
Author:
[email protected]
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):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 {
Note: See TracChangeset for help on using the changeset viewer.