Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 36d446cb4f99abdcc03a3001c1999e2f4d411be1
      
https://github.com/WebKit/WebKit/commit/36d446cb4f99abdcc03a3001c1999e2f4d411be1
  Author: Dan Hecht <[email protected]>
  Date:   2026-09-28 (Mon, 28 Sep 2026)

  Changed paths:
    M Source/JavaScriptCore/heap/Collector.cpp
    M Source/JavaScriptCore/heap/Collector.h
    M Source/JavaScriptCore/heap/Heap.cpp

  Log Message:
  -----------
  [JSC] Move the Collector's setup and teardown out of Heap's constructor and 
destructor
https://bugs.webkit.org/show_bug.cgi?id=325434
rdar://188535170

Reviewed by Mark Lam.

Heap's constructor built the Collector's parallel slot visitors, chose its 
mutator
scheduler, prepared its collector slot visitor and created its collector 
thread, and
Heap's destructor cleared its race mark stack. That is the Collector's own 
state, and
once one Collector serves more than one heap, no single heap can set it up. 
Move it into
Collector's constructor and destructor.

Creating the collector thread in the constructor is safe: constructing a 
CollectorThread
only registers it with its condition, and no thread runs until a collection is 
requested,
which Heap refuses until notifyIsSafeToCollect(). Collector::startThread(), 
which did
only that registration, is removed.

Heap's destructor also cleared every slot visitor's mark stacks, which 
~SlotVisitor
already does, so that loop is removed.

No change in behavior.

* Source/JavaScriptCore/heap/Collector.cpp:
(JSC::Collector::Collector):
(JSC::Collector::~Collector):
(JSC::Collector::startThread): Deleted.
* Source/JavaScriptCore/heap/Collector.h:
* Source/JavaScriptCore/heap/Heap.cpp:
(JSC::Heap::Heap):
(JSC::Heap::~Heap):

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



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

Reply via email to