Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0c95ee27a86ea97629da9bc1dfe216be3317814c
      
https://github.com/WebKit/WebKit/commit/0c95ee27a86ea97629da9bc1dfe216be3317814c
  Author: Darin Adler <[email protected]>
  Date:   2025-07-21 (Mon, 21 Jul 2025)

  Changed paths:
    M Source/JavaScriptCore/API/JSBase.cpp
    M Source/JavaScriptCore/API/JSClassRef.cpp
    M Source/JavaScriptCore/API/JSClassRef.h
    M Source/JavaScriptCore/ftl/FTLAbstractHeap.cpp
    M Source/JavaScriptCore/ftl/FTLAbstractHeap.h
    M Source/JavaScriptCore/heap/CompleteSubspace.cpp
    M Source/JavaScriptCore/heap/Heap.cpp
    M Source/JavaScriptCore/heap/Heap.h
    M Source/JavaScriptCore/heap/HeapUtil.h
    M Source/JavaScriptCore/heap/MarkedSpace.cpp
    M Source/JavaScriptCore/heap/MarkedSpace.h
    M Source/WebCore/page/MemoryRelease.cpp
    M Source/WebCore/page/PerformanceLogging.cpp
    M Source/WebKitLegacy/mac/Misc/WebCoreStatistics.mm

  Log Message:
  -----------
  Putting HashMap in a heap block hurts memory use, speed, code size (part 1)
https://bugs.webkit.org/show_bug.cgi?id=226162
rdar://78675956

Reviewed by Keith Miller.

HashMap, HashSet, and HashCountedSet are already pointers to a hash table,
so there is no reason to wrap them in a unique_ptr in a heap block and add
another level of indirection. Fix this in a few places in JavaScriptCore.

* Source/JavaScriptCore/API/JSBase.cpp:
(JSGetMemoryUsageStatistics): Removed pointer dereference.
* Source/JavaScriptCore/API/JSClassRef.cpp:
(OpaqueJSClass::~OpaqueJSClass): Use simpler for loops.
(OpaqueJSClassContextData::OpaqueJSClassContextData): Ditto.
(OpaqueJSClass::staticValues): No need to call unique_ptr::get().
(OpaqueJSClass::staticFunctions): Ditto.
* Source/JavaScriptCore/API/JSClassRef.h: Stop using unique_ptr for
the static values and functions tables.

* Source/JavaScriptCore/ftl/FTLAbstractHeap.cpp:
(JSC::FTL::IndexedAbstractHeap::atSlow): Removed code to allocate 
m_largeIndices.
* Source/JavaScriptCore/ftl/FTLAbstractHeap.h: Made m_largeIndices a map, not
a unique_ptr to a map.

* Source/JavaScriptCore/heap/CompleteSubspace.cpp:
(JSC::CompleteSubspace::reallocatePreciseAllocationNonVirtual): Update since
preciseAllocationSet is now an optional rather than a pointer to a heap block.

* Source/JavaScriptCore/heap/Heap.cpp:
(JSC::Heap::protectedObjectTypeCounts): Return a set instead of a pointer 
holding one.
(JSC::Heap::objectTypeCounts): Ditto.
* Source/JavaScriptCore/heap/Heap.h: Ditto.

* Source/JavaScriptCore/heap/HeapUtil.h:
(JSC::HeapUtil::isPointerGCObjectJSCell): Update since preciseAllocationSet is 
now an
optional rather than a pointer to a heap block. Also remove an unneeded empty 
check
since the contains function already handles that case so it's just redundant.

* Source/JavaScriptCore/heap/MarkedSpace.cpp:
(JSC::MarkedSpace::registerPreciseAllocation): Update since 
preciseAllocationSet is
now an optional rather than a pointer to a heap block.
(JSC::MarkedSpace::sweepPreciseAllocations): Ditto.
(JSC::MarkedSpace::enablePreciseAllocationTracking): Ditto.

* Source/JavaScriptCore/heap/MarkedSpace.h:
(JSC::MarkedSpace::preciseAllocationSet): Use std::optional instead of 
std::unique_ptr.

* Source/WebCore/page/MemoryRelease.cpp:
(WebCore::logMemoryStatistics): Update since objectTypeCounts now returns a set
instead of a unique_ptr to a set.
* Source/WebCore/page/PerformanceLogging.cpp:
(WebCore::PerformanceLogging::javaScriptObjectCounts): Ditto.
* Source/WebKitLegacy/mac/Misc/WebCoreStatistics.mm:
(+[WebCoreStatistics javaScriptProtectedObjectTypeCounts]): Ditto.
(+[WebCoreStatistics javaScriptObjectTypeCounts]): Ditto.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to