Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7cc10147ece2c421705df24543c2c2ec4ef0244a
      
https://github.com/WebKit/WebKit/commit/7cc10147ece2c421705df24543c2c2ec4ef0244a
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-07-20 (Mon, 20 Jul 2026)

  Changed paths:
    A JSTests/stress/async-generator-driver-cached-result-concurrent-drivers.js
    A JSTests/stress/async-generator-driver-cached-result-not-aliased.js
    A JSTests/stress/async-generator-driver-cross-realm-iterator-result.js
    A JSTests/stress/async-generator-manual-next-distinct-results.js
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/runtime/AsyncGeneratorPrototype.cpp
    M Source/JavaScriptCore/runtime/JSAsyncFromSyncIterator.cpp
    M Source/JavaScriptCore/runtime/JSAsyncFromSyncIterator.h
    M Source/JavaScriptCore/runtime/JSAsyncGenerator.cpp
    M Source/JavaScriptCore/runtime/JSAsyncGenerator.h
    A Source/JavaScriptCore/runtime/JSAsyncGeneratorInlines.h
    M Source/JavaScriptCore/runtime/JSMicrotask.cpp

  Log Message:
  -----------
  [JSC] Use cached iterator result object for async generator cooperative 
driving
https://bugs.webkit.org/show_bug.cgi?id=319817
rdar://182715613

Reviewed by Yijia Huang and Sosuke Suzuki.

When syntax-level cooperative driving of async generator is used and
promise watchpoint is valid, iterator result object is non-observable to
users. Promise resolution just propagates the object and only done and
value properties are accessed, and they are own properties defined for
normal iterator result object.

In this patch,

1. Clean up some queueing function and move them to
   JSAsyncGeneratorInlines.h.
2. Cache iterator result object in JSAsyncGenerator and reuse it so long
   as promise watchpoint is valid & cooperative driving is used.

Tests: JSTests/stress/async-generator-driver-cached-result-not-aliased.js
       JSTests/stress/async-generator-manual-next-distinct-results.js

* JSTests/stress/async-generator-driver-cached-result-concurrent-drivers.js: 
Added.
(shouldBe):
(async gen):
(async for):
* JSTests/stress/async-generator-driver-cached-result-not-aliased.js: Added.
(shouldBe):
(async gen):
(get if):
(async for):
(async let):
(get then):
* JSTests/stress/async-generator-driver-cross-realm-iterator-result.js: Added.
(shouldBe):
(async let):
* JSTests/stress/async-generator-manual-next-distinct-results.js: Added.
(shouldBe):
(async gen):
(async let):
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/runtime/AsyncGeneratorPrototype.cpp:
(JSC::asyncGeneratorNext):
* Source/JavaScriptCore/runtime/JSAsyncFromSyncIterator.cpp:
(JSC::JSAsyncFromSyncIterator::visitChildrenImpl):
* Source/JavaScriptCore/runtime/JSAsyncFromSyncIterator.h:
* Source/JavaScriptCore/runtime/JSAsyncGenerator.cpp:
(JSC::JSAsyncGenerator::enqueue): Deleted.
(JSC::JSAsyncGenerator::dequeue): Deleted.
* Source/JavaScriptCore/runtime/JSAsyncGenerator.h:
* Source/JavaScriptCore/runtime/JSAsyncGeneratorInlines.h: Added.
(JSC::JSAsyncGenerator::enqueue):
(JSC::JSAsyncGenerator::dequeue):
* Source/JavaScriptCore/runtime/JSMicrotask.cpp:
(JSC::settleDriverWithIteratorResult):
(JSC::asyncFromSyncIteratorContinueOrDone):
(JSC::asyncGeneratorCompleteStep):
(JSC::enqueueAsyncGeneratorDriver):

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



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

Reply via email to