[webkit-changes] [WebKit/WebKit] b8c363: JSWebAssemblyInstance should be allocated out of a...

Keith Miller noreply at github.com
Thu Feb 20 05:31:45 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b8c3632cf76735ab4151bd90fcd370d18d948c5f
      https://github.com/WebKit/WebKit/commit/b8c3632cf76735ab4151bd90fcd370d18d948c5f
  Author: Keith Miller <keith_miller at apple.com>
  Date:   2025-02-20 (Thu, 20 Feb 2025)

  Changed paths:
    A JSTests/wasm/stress/stress-JSWebAssemblyInstance-allocations.js
    M Source/JavaScriptCore/CMakeLists.txt
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/Sources.txt
    M Source/JavaScriptCore/heap/CompleteSubspace.cpp
    M Source/JavaScriptCore/heap/Heap.cpp
    M Source/JavaScriptCore/heap/Heap.h
    M Source/JavaScriptCore/heap/IsoSubspace.cpp
    M Source/JavaScriptCore/heap/MarkedSpace.cpp
    M Source/JavaScriptCore/heap/MarkedSpace.h
    M Source/JavaScriptCore/heap/PreciseAllocation.h
    A Source/JavaScriptCore/heap/PreciseSubspace.cpp
    A Source/JavaScriptCore/heap/PreciseSubspace.h
    M Source/JavaScriptCore/runtime/VM.cpp
    M Source/JavaScriptCore/runtime/VM.h
    M Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.h

  Log Message:
  -----------
  JSWebAssemblyInstance should be allocated out of a new PreciseSubspace.
https://bugs.webkit.org/show_bug.cgi?id=287518
rdar://144647030

Reviewed by Yusuke Suzuki.

Previously we added a new mode, preciseOnly, to IsoSubspace. However, this was unnecessarily complicated
and wasteful. Additionally, it was confusing since most places assumed IsoSubspaces always allocated
objects of the same size.

This change adds a new PreciseSubspace that always allocates objects into a PreciseAllocation and factors
out most of this logic. In a subsequent patch I'll remove the old, now dead, preciseOnly logic.

I tried to have the heap account for IsoSubspace's lower tier precise as part of it's capacity
but that seemed to cause significant performance regressions across the board both in memory and runtime.
So I'm going to skip that for now with a FIXME to correct it later.

* JSTests/wasm/stress/stress-JSWebAssemblyInstance-allocations.js: Added.
(catch):
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/Sources.txt:
* Source/JavaScriptCore/heap/CompleteSubspace.cpp:
(JSC::CompleteSubspace::tryAllocateSlow):
* Source/JavaScriptCore/heap/Heap.cpp:
(JSC::Heap::deleteAllCodeBlocks):
(JSC::Heap::updateAllocationLimits):
(JSC::Heap::webAssemblyInstanceSpaceSlow):
* Source/JavaScriptCore/heap/Heap.h:
(JSC::Heap::webAssemblyInstanceSpace):
* Source/JavaScriptCore/heap/IsoSubspace.cpp:
(JSC::IsoSubspace::tryAllocatePreciseOrLowerTierPrecise):
* Source/JavaScriptCore/heap/MarkedSpace.cpp:
(JSC::MarkedSpace::registerPreciseAllocation):
* Source/JavaScriptCore/heap/MarkedSpace.h:
* Source/JavaScriptCore/heap/PreciseAllocation.h:
* Source/JavaScriptCore/heap/PreciseSubspace.cpp: Added.
(JSC::PreciseSubspace::PreciseSubspace):
(JSC::PreciseSubspace::didResizeBits):
(JSC::PreciseSubspace::didRemoveBlock):
(JSC::PreciseSubspace::didBeginSweepingToFreeList):
(JSC::PreciseSubspace::tryAllocate):
(JSC::PreciseSubspace::allocate):
* Source/JavaScriptCore/heap/PreciseSubspace.h: Added.
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::updateStackLimits):
* Source/JavaScriptCore/runtime/VM.h:
(JSC::VM::webAssemblyInstanceSpace):
* Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.h:

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list