Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d096ff9cfae1885b50963d346ef89b3e4729e37d
https://github.com/WebKit/WebKit/commit/d096ff9cfae1885b50963d346ef89b3e4729e37d
Author: Yusuke Suzuki <[email protected]>
Date: 2026-06-08 (Mon, 08 Jun 2026)
Changed paths:
A JSTests/stress/async-generator-next-on-completed-reentrant.js
A JSTests/stress/async-generator-reentrant-resume-during-resolve.js
M JSTests/test262/expectations.yaml
M Source/JavaScriptCore/builtins/AsyncGeneratorPrototype.js
M Source/JavaScriptCore/builtins/BuiltinNames.h
M Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp
M Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h
M Source/JavaScriptCore/bytecode/LinkTimeConstant.h
M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
M Source/JavaScriptCore/runtime/AsyncGeneratorPrototype.cpp
M Source/JavaScriptCore/runtime/JSAsyncGenerator.h
M Source/JavaScriptCore/runtime/JSGlobalObject.cpp
M Source/JavaScriptCore/runtime/JSMicrotask.cpp
M Source/JavaScriptCore/runtime/JSMicrotask.h
M Source/JavaScriptCore/runtime/Microtask.h
Log Message:
-----------
[JSC] Update async generator code aligned to the spec
https://bugs.webkit.org/show_bug.cgi?id=316447
rdar://178560512
Reviewed by Yijia Huang.
When Object.prototype.then is set, when resolving iterator result
object, it can have a side effect since it can look up "then" field.
And this can cause recursive generator reentrance which confuses the
state machine of the async generator, which exists in the old spec's
behavior.
Instead we update our implementation to the latest spec's behavior more
closely. Introducing DrainingQueue state instead of AwaitingReturn as it
is updated in the spec.
We also move return / throw implementations to C++ to make next function
simplified. These two functions are called only when abruption happens.
Then we also move the code to next() function as a helper is only used
by one function now.
Test: JSTests/stress/async-generator-reentrant-resume-during-resolve.js
* JSTests/stress/async-generator-next-on-completed-reentrant.js: Added.
(shouldBe):
(async gen):
* JSTests/stress/async-generator-reentrant-resume-during-resolve.js: Added.
(shouldBe):
(async gen):
(async main):
* JSTests/test262/expectations.yaml:
* Source/JavaScriptCore/builtins/AsyncGeneratorPrototype.js:
(next):
(linkTimeConstant.asyncGeneratorResumeNext):
(return): Deleted.
(throw): Deleted.
* Source/JavaScriptCore/builtins/BuiltinNames.h:
* Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp:
(JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
* Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h:
* Source/JavaScriptCore/bytecode/LinkTimeConstant.h:
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitYield):
(JSC::BytecodeGenerator::emitDelegateYield):
* Source/JavaScriptCore/runtime/AsyncGeneratorPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/JSAsyncGenerator.h:
* Source/JavaScriptCore/runtime/JSGlobalObject.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::JSGlobalObject::init):
* Source/JavaScriptCore/runtime/JSMicrotask.cpp:
(JSC::asyncGeneratorCompleteStep):
(JSC::asyncGeneratorAwaitReturn):
(JSC::asyncGeneratorDrainQueue):
(JSC::asyncGeneratorBodyCall):
(JSC::asyncGeneratorUnwrapYieldResumption):
(JSC::asyncGeneratorResume):
(JSC::asyncGeneratorYield):
(JSC::asyncGeneratorYieldAwaited):
(JSC::asyncGeneratorDispatchSuspend):
(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::asyncGeneratorBodyCallNormal):
(JSC::asyncGeneratorBodyCallReturn):
(JSC::asyncGeneratorAwaitReturnContinuation):
(JSC::runInternalMicrotask):
(JSC::isSuspendYieldState): Deleted.
(JSC::asyncGeneratorReject): Deleted.
(JSC::asyncGeneratorResolve): Deleted.
(JSC::asyncGeneratorResumeNext): Deleted.
(JSC::asyncGeneratorResumeNextReturn): Deleted.
* Source/JavaScriptCore/runtime/JSMicrotask.h:
* Source/JavaScriptCore/runtime/Microtask.h:
Canonical link: https://commits.webkit.org/314732@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications