Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 91e8fd1b2f0cec329c19c738cf90d470ac51be40
      
https://github.com/WebKit/WebKit/commit/91e8fd1b2f0cec329c19c738cf90d470ac51be40
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-10-11 (Sun, 11 Oct 2026)

  Changed paths:
    A JSTests/stress/array-buffer-incoming-references-across-eden-and-full-gc.js
    M Source/JavaScriptCore/heap/GCIncomingRefCounted.h
    M Source/JavaScriptCore/heap/GCIncomingRefCountedSet.h
    M Source/JavaScriptCore/heap/GCIncomingRefCountedSetInlines.h
    M Source/JavaScriptCore/heap/Heap.cpp

  Log Message:
  -----------
  [JSC] Eden GC should sweep only new and dirty ArrayBuffers
https://bugs.webkit.org/show_bug.cgi?id=326981

Reviewed by Yusuke Suzuki.

GCIncomingRefCountedSet::sweep() filters the incoming references of every
ArrayBuffer in each collection. With many live ArrayBuffers, each Eden
collection pays for all of them.

Mark bits are kept across Eden collections, so a cell that survived the
previous sweep stays marked until the next full collection begins. In an Eden
collection, filtering can change only an ArrayBuffer that was added after the
previous sweep, or one that got a new incoming reference after it.

This patch makes the Eden sweep filter only those. New ArrayBuffers are at the
tail of m_vector, from m_oldCount. Old ArrayBuffers that got a new incoming
reference are recorded in m_markedObjectsWithNewIncomingReferences, and
m_needsFilteringIncomingReferences keeps each of them from being recorded
twice. The full sweep still filters everything, and Heap::sweepArrayBuffers()
now treats an unknown collection scope as Full.

Tests: 
JSTests/stress/array-buffer-incoming-references-across-eden-and-full-gc.js

* JSTests/stress/array-buffer-incoming-references-across-eden-and-full-gc.js: 
Added.
(shouldBe):
* Source/JavaScriptCore/heap/GCIncomingRefCounted.h:
* Source/JavaScriptCore/heap/GCIncomingRefCountedSet.h:
* Source/JavaScriptCore/heap/GCIncomingRefCountedSetInlines.h:
(JSC::GCIncomingRefCountedSet<T>::addReference):
(JSC::GCIncomingRefCountedSet<T>::sweep):
* Source/JavaScriptCore/heap/Heap.cpp:
(JSC::Heap::clearConcurrentRetainedDataIfPossible):

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



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

Reply via email to