Repository navigation
[JSC] Inline async function body when there is no await - #55900
Merged
webkit-commit-queue merged 1 commit intoDec 29, 2025
Conversation
Collaborator
|
EWS run on previous version of this PR (hash 76b0d7e) Details |
Constellation
force-pushed
the
eng/JSC-Inline-async-function-body-when-there-is-no-await
branch
from
December 28, 2025 22:01
76b0d7e to
22992b6
Compare
Collaborator
|
EWS run on previous version of this PR (hash 22992b6) Details |
Constellation
force-pushed
the
eng/JSC-Inline-async-function-body-when-there-is-no-await
branch
from
December 28, 2025 23:52
22992b6 to
a5f2050
Compare
Collaborator
|
EWS run on current version of this PR (hash a5f2050) Details |
justinmichaud
approved these changes
Dec 29, 2025
https://bugs.webkit.org/show_bug.cgi?id=304740 rdar://167254635 Reviewed by Justin Michaud and Sosuke Suzuki. When there is no await in async function, it does not need to have a separate body function and we do not need to use generator since it does not have any suspend and resume. We can detect it lexically and we can fully inline the implementation in the async wrapper function side. The inlined code is something like, let promise = newPromise(); try { async-function-body } catch (error) { rejectPromise(proimse, error); } finally { resolvePromise(promise, returnedValue); return promise; } We also fix async stack trace by setting implementationVisibility::Private for async wrapper function (when body is not inlined). Test: JSTests/stress/async-function-without-await.js * JSTests/stress/async-function-without-await.js: Added. (shouldBe): (shouldThrow): (async asyncReturn42): (async asyncReturnUndefined): (async asyncThrow): (async asyncWithLocals): (helper): (async asyncCallsHelper): (async asyncWithTryCatch): (async asyncWithControlFlow): (AsyncClass.prototype.async asyncMethod): (AsyncClass.async staticAsyncMethod): (AsyncClass): (async asyncWithAwait): (async runTests): * JSTests/stress/async-stack-trace-basic.js: * JSTests/stress/async-stack-trace-nested-deep.js: * JSTests/stress/async-stack-trace-nested.js: (async problematicFunction): * LayoutTests/http/tests/webgpu/webgpu/api/operation/uncapturederror-expected.txt: * LayoutTests/http/tests/webgpu/webgpu/api/validation/capability_checks/limits/maxInterStageShaderVariables-expected.txt: * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::isAsyncFunctionWithoutAwait const): (JSC::BytecodeGenerator::hasFinallyScopes const): * Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp: (JSC::ReturnNode::emitBytecode): (JSC::FunctionNode::emitBytecode): * Source/JavaScriptCore/parser/Nodes.h: (JSC::ScopeNode::isAsyncFunctionWithoutAwait const): * Source/JavaScriptCore/parser/Parser.cpp: (JSC::Parser<LexerType>::parseInner): (JSC::Parser<LexerType>::parseAsyncFunctionSourceElements): (JSC::Parser<LexerType>::parseForStatement): (JSC::Parser<LexerType>::parseFunctionBody): (JSC::Parser<LexerType>::parseFunctionInfo): (JSC::Parser<LexerType>::parseAwaitExpression): * Source/JavaScriptCore/parser/Parser.h: (JSC::Scope::resetImplementationVisibility): (JSC::Scope::setImplementationVisibility): (JSC::Scope::setAsyncFunctionBodyDoesNotUseAwait): (JSC::Scope::asyncFunctionBodyDoesNotUseAwait const): (JSC::Scope::setUsesAwait): (JSC::Scope::usesAwait const): (JSC::Scope::restoreFromSourceProviderCache): * Source/JavaScriptCore/parser/ParserModes.h: * Source/JavaScriptCore/parser/SourceProviderCacheItem.h: (JSC::SourceProviderCacheItem::SourceProviderCacheItem): Canonical link: https://commits.webkit.org/304987@main
webkit-commit-queue
force-pushed
the
eng/JSC-Inline-async-function-body-when-there-is-no-await
branch
from
December 29, 2025 22:39
a5f2050 to
f42c363
Compare
Collaborator
|
Committed 304987@main (f42c363): https://commits.webkit.org/304987@main Reviewed commits have been landed. Closing PR #55900 and removing active labels. |
Constellation
deleted the
eng/JSC-Inline-async-function-body-when-there-is-no-await
branch
December 30, 2025 00:20
sosukesuzuki
added a commit
to oven-sh/WebKit
that referenced
this pull request
Jan 4, 2026
…der.js After upstream WebKit PR WebKit#55900, async functions containing 'await' are automatically set to ImplementationVisibility::Private by the parser. The hand-rolled parser in BuiltinExecutables.cpp doesn't detect this, causing metadata mismatch in debug builds. Add @visibility=PrivateRecursive annotations to the 4 async functions in ModuleLoader.js to align with upstream and fix debug build crashes: - asyncModuleEvaluation - loadModule - loadAndEvaluateModule - requestImportModule
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
f42c363
a5f2050
🧪 win-tests