Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 75a9d414a4a8b98d26840162d103eb16227eaeb6
      
https://github.com/WebKit/WebKit/commit/75a9d414a4a8b98d26840162d103eb16227eaeb6
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-08-20 (Thu, 20 Aug 2026)

  Changed paths:
    A JSTests/stress/microtask-call-cache-delete-all-code.js
    M Source/JavaScriptCore/heap/Heap.cpp
    M Source/JavaScriptCore/interpreter/MicrotaskCall.cpp
    M Source/JavaScriptCore/interpreter/MicrotaskCall.h
    M Source/JavaScriptCore/runtime/CodeCache.h
    M Source/JavaScriptCore/runtime/MicrotaskQueue.cpp
    M Source/JavaScriptCore/runtime/VM.cpp
    M Source/JavaScriptCore/runtime/VM.h

  Log Message:
  -----------
  [JSC] Clear MicrotaskCallCache in VM when CodeBlock gets detached
https://bugs.webkit.org/show_bug.cgi?id=322226
rdar://184993354

Reviewed by Yijia Huang.

When Heap::deleteAllCodeBlocks is called, CodeBlock is forcefully
detached from the ScriptExecutable. As a result, many of CallLinkInfo
cache's Executable -> CodeBlock pair gets broken. When using CachedCall
/ MicrotaskCall on the stack, this is fine since we use them only after
entering VMEntryScope, and Heap::deleteAllCodeBlocks cannot be called
with VMEntryScope. But MicrotaskCallCache in VM is not scoped with
VMEntryScope, thus its pairing is important and needs to be cleared when
Heap::deleteAllCodeBlocks is called.

We are doing the same thing for Wasm's DataIC below, and we need to do
the same for VM's MicrotaskCallCache. This patch clears that cache in
Heap::deleteAllCodeBlocks.

Test: JSTests/stress/microtask-call-cache-delete-all-code.js

* JSTests/stress/microtask-call-cache-delete-all-code.js: Added.
(shouldBe):
(async generator):
(async sum):
(sum.then):
* Source/JavaScriptCore/heap/Heap.cpp:
(JSC::Heap::deleteAllCodeBlocks):
* Source/JavaScriptCore/interpreter/MicrotaskCall.cpp:
(JSC::MicrotaskCall::clear):
(JSC::MicrotaskCall::reconcileWeakReferencesAtGCEnd):
* Source/JavaScriptCore/interpreter/MicrotaskCall.h:
* Source/JavaScriptCore/runtime/CodeCache.h:
(JSC::CodeCache::clear):
* Source/JavaScriptCore/runtime/MicrotaskQueue.cpp:
(JSC::MicrotaskQueue::drainImpl):
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::clearMicrotaskCallCaches):
* Source/JavaScriptCore/runtime/VM.h:

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



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

Reply via email to