[webkit-changes] [WebKit/WebKit] 96f8b4: [JSC] Account owner cell's color for extra memory ...

Yusuke Suzuki noreply at github.com
Tue Oct 3 11:58:51 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 96f8b42d219564ebc87ab37838f923dbee8b244a
      https://github.com/WebKit/WebKit/commit/96f8b42d219564ebc87ab37838f923dbee8b244a
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-10-03 (Tue, 03 Oct 2023)

  Changed paths:
    M Source/JavaScriptCore/bytecode/CodeBlock.cpp
    M Source/JavaScriptCore/bytecode/CodeBlock.h
    M Source/JavaScriptCore/bytecode/UnlinkedCodeBlockGenerator.cpp
    M Source/JavaScriptCore/heap/Heap.cpp
    M Source/JavaScriptCore/heap/Heap.h
    M Source/JavaScriptCore/heap/HeapInlines.h
    M Source/JavaScriptCore/runtime/ArrayBuffer.cpp
    M Source/JavaScriptCore/runtime/JSArrayBufferView.cpp
    M Source/JavaScriptCore/runtime/JSString.cpp
    M Source/JavaScriptCore/runtime/JSString.h
    M Source/JavaScriptCore/runtime/JSStringInlines.h
    M Source/JavaScriptCore/runtime/PropertyTable.cpp
    M Source/JavaScriptCore/runtime/PropertyTable.h
    M Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp
    M Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.cpp
    M Source/JavaScriptCore/wasm/js/JSWebAssemblyMemory.cpp
    M Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
    M Source/WebCore/bindings/scripts/test/JS/JSTestReportExtraMemoryCost.cpp
    M Source/WebCore/html/CanvasBase.cpp
    M Source/WebCore/xml/XMLHttpRequest.cpp

  Log Message:
  -----------
  [JSC] Account owner cell's color for extra memory allocation
https://bugs.webkit.org/show_bug.cgi?id=262393
rdar://116251726

Reviewed by Keith Miller.

We report extra memory allocation via reportExtraMemoryAllocated, and it can invoke GC.
And reportExtraMemoryVisited will account the current total live size of extra memory through GC scan,
so GC can know the current shape well. However, consider the following case,

1. If the cell is already old region.
2. New reportExtraMemoryAllocated happens for this cell.
3. Eden GC is happening.

In this case, it is already marked. So we will not get the new allocated memory reporting via reportExtraMemoryVisited.
In this patch, we do reportExtraMemoryVisited from reportExtraMemoryAllocated when the cell will not report it again.
It is basically the same condition to WriteBarrier's remember-set addition.

* Source/JavaScriptCore/bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finishCreation):
* Source/JavaScriptCore/bytecode/CodeBlock.h:
(JSC::CodeBlock::setJITCode):
* Source/JavaScriptCore/bytecode/UnlinkedCodeBlockGenerator.cpp:
(JSC::UnlinkedCodeBlockGenerator::finalize):
* Source/JavaScriptCore/heap/Heap.cpp:
(JSC::Heap::reportExtraMemoryAllocatedPossiblyFromAlreadyMarkedCell):
(JSC::Heap::reportExtraMemoryAllocatedSlowCase):
(JSC::Heap::deprecatedReportExtraMemorySlowCase):
* Source/JavaScriptCore/heap/Heap.h:
* Source/JavaScriptCore/heap/HeapInlines.h:
(JSC::Heap::reportExtraMemoryAllocated):
* Source/JavaScriptCore/runtime/ArrayBuffer.cpp:
(JSC::ArrayBuffer::grow):
(JSC::ArrayBuffer::resize):
* Source/JavaScriptCore/runtime/JSArrayBufferView.cpp:
(JSC::JSArrayBufferView::ConstructionContext::ConstructionContext):
* Source/JavaScriptCore/runtime/JSString.cpp:
(JSC::JSRopeString::resolveRopeToAtomString const):
(JSC::JSRopeString::resolveRopeWithFunction const):
* Source/JavaScriptCore/runtime/JSString.h:
(JSC::JSString::finishCreation):
* Source/JavaScriptCore/runtime/JSStringInlines.h:
(JSC::jsAtomString):
* Source/JavaScriptCore/runtime/PropertyTable.cpp:
(JSC::PropertyTable::finishCreation):
* Source/JavaScriptCore/runtime/PropertyTable.h:
(JSC::PropertyTable::rehash):
* Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp:
(JSC::SparseArrayValueMap::add):
* Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.cpp:
(JSC::JSWebAssemblyInstance::finishCreation):
* Source/JavaScriptCore/wasm/js/JSWebAssemblyMemory.cpp:
(JSC::JSWebAssemblyMemory::growSuccessCallback):
(JSC::JSWebAssemblyMemory::finishCreation):
* Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
* Source/WebCore/bindings/scripts/test/JS/JSTestReportExtraMemoryCost.cpp:
(WebCore::JSTestReportExtraMemoryCost::finishCreation):
* Source/WebCore/html/CanvasBase.cpp:
(WebCore::CanvasBase::setImageBuffer const):
* Source/WebCore/xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::changeState):

Canonical link: https://commits.webkit.org/268796@main




More information about the webkit-changes mailing list