Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f488eac0e00cee453b7ca9f24c42f585df236e97
https://github.com/WebKit/WebKit/commit/f488eac0e00cee453b7ca9f24c42f585df236e97
Author: Dan Hecht <[email protected]>
Date: 2026-10-07 (Wed, 07 Oct 2026)
Changed paths:
M Source/JavaScriptCore/heap/Collector.cpp
M Source/JavaScriptCore/heap/Collector.h
M Source/JavaScriptCore/heap/CollectorInlines.h
Log Message:
-----------
[JSC] Replace the Collector's Heap& with a vector of heaps
https://bugs.webkit.org/show_bug.cgi?id=326517
rdar://189309281
Reviewed by Yijia Huang.
Eventually, a Collector will run collections that cover several heaps.
Currently it holds a single Heap&, so replace it with the set of heaps the
Collector's collections cover, which still always holds one heap. Then loop
over the set wherever a collection does the same thing to every heap it covers:
the per-heap steps of Begin and End, stopping and resuming the periphery,
forgiving the mutators' increment balance, waking waiting mutators, setting the
collection epilogue pending, and visiting each heap's mutator slot visitor.
The remaining uses of heap() mean one particular heap, such as the one that
requested the collection or the one conducting it. heap() now asserts that the
set holds one heap; those uses will change as each is worked out.
Heap::endMarking() is given the bytes visited in its own heap. Until the
visitors count bytes per heap, bytesVisitedIn() returns the collection's total,
which is that heap's while the set holds one.
addMarkingConstraint() checks, through the Collector's phase rather than the
heap's collection scope, that no collection is running, since the constraint
set belongs to the Collector.
The vector has an inline capacity of one, so the heap pointer stays on the
Collector cache line that held the Heap&, which the slot visitors still read
while marking.
No change in behavior.
* Source/JavaScriptCore/heap/Collector.cpp:
(JSC::Collector::Collector):
(JSC::Collector::beginCollectionInEachHeap):
(JSC::Collector::runFixpointPhase):
(JSC::Collector::runEndPhase):
(JSC::Collector::endCollectionInEachHeap):
(JSC::Collector::stopThePeriphery):
(JSC::Collector::resumeThePeriphery):
(JSC::Collector::addMarkingConstraint):
(JSC::Collector::bytesVisitedIn):
* Source/JavaScriptCore/heap/Collector.h:
(JSC::Collector::heap):
(JSC::Collector::forEachHeap):
* Source/JavaScriptCore/heap/CollectorInlines.h:
(JSC::Collector::forEachSlotVisitor):
Canonical link: https://commits.webkit.org/322984@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications