Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 03e836de2f7bd5627a95f60357633d59fb6bb18d
      
https://github.com/WebKit/WebKit/commit/03e836de2f7bd5627a95f60357633d59fb6bb18d
  Author: Sergey Rubanov <[email protected]>
  Date:   2026-08-20 (Thu, 20 Aug 2026)

  Changed paths:
    A LayoutTests/fast/workers/resources/worker-atomics-wait-forever.js
    A LayoutTests/fast/workers/resources/worker-wasm-atomic-wait-forever.js
    A LayoutTests/fast/workers/worker-terminate-atomics-wait-expected.txt
    A LayoutTests/fast/workers/worker-terminate-atomics-wait.html
    A LayoutTests/fast/workers/worker-terminate-wasm-atomic-wait-expected.txt
    A LayoutTests/fast/workers/worker-terminate-wasm-atomic-wait.html
    M Source/JavaScriptCore/runtime/AtomicsObject.cpp
    M Source/JavaScriptCore/runtime/VM.cpp
    M Source/JavaScriptCore/runtime/VM.h
    M Source/JavaScriptCore/runtime/WaiterListManager.cpp
    M Source/JavaScriptCore/wasm/WasmOperationsInlines.h

  Log Message:
  -----------
  [JSC] Terminate Atomics.wait / Wasm atomic.wait on worker.terminate()
https://bugs.webkit.org/show_bug.cgi?id=289686

Reviewed by Yusuke Suzuki.

After https://bugs.webkit.org/show_bug.cgi?id=305440, notifyNeedTermination()
only fires the NeedTermination trap bit and no longer sets
hasTerminationRequest() immediately. waitSync still only checked
hasTerminationRequest(), so a worker blocked in Atomics.wait or Wasm
memory.atomic.wait was woken by the stop-request condition notify but
never returned Terminated.

Teach waitSync to observe the pending NeedTermination trap, prefer
Terminated when shutdown races with notify or timeout, and materialize the
TerminationException via throwTerminationExceptionIfNeeded(). When Wasm
tiers take the OutOfBounds path for wait's -1 return with termination
already pending, throwWasmToJSException keeps the TerminationException.

Tests handshake that the worker is inside the wait, then terminate and GC
until workerThreadCount hits zero.

* Source/JavaScriptCore/runtime/AtomicsObject.cpp:
(JSC::atomicsWaitImpl):
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::throwTerminationExceptionIfNeeded):
* Source/JavaScriptCore/runtime/VM.h:
* Source/JavaScriptCore/runtime/WaiterListManager.cpp:
(JSC::WaiterListManager::waitSyncImpl):
* Source/JavaScriptCore/wasm/WasmOperationsInlines.h:
(JSC::Wasm::waitImpl):
(JSC::Wasm::throwWasmToJSException):
* LayoutTests/fast/workers/worker-terminate-atomics-wait.html: Added.
* LayoutTests/fast/workers/worker-terminate-atomics-wait-expected.txt: Added.
* LayoutTests/fast/workers/worker-terminate-wasm-atomic-wait.html: Added.
* LayoutTests/fast/workers/worker-terminate-wasm-atomic-wait-expected.txt: 
Added.
* LayoutTests/fast/workers/resources/worker-atomics-wait-forever.js: Added.
* LayoutTests/fast/workers/resources/worker-wasm-atomic-wait-forever.js: Added.

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



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

Reply via email to