Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f42c363069b53b4c3787cdd815d86f3840711b3d
https://github.com/WebKit/WebKit/commit/f42c363069b53b4c3787cdd815d86f3840711b3d
Author: Yusuke Suzuki <[email protected]>
Date: 2025-12-29 (Mon, 29 Dec 2025)
Changed paths:
A JSTests/stress/async-function-without-await.js
M JSTests/stress/async-stack-trace-basic.js
M JSTests/stress/async-stack-trace-nested-deep.js
M JSTests/stress/async-stack-trace-nested.js
M
LayoutTests/http/tests/webgpu/webgpu/api/operation/uncapturederror-expected.txt
M
LayoutTests/http/tests/webgpu/webgpu/api/validation/capability_checks/limits/maxInterStageShaderVariables-expected.txt
M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
M Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
M Source/JavaScriptCore/parser/Nodes.h
M Source/JavaScriptCore/parser/Parser.cpp
M Source/JavaScriptCore/parser/Parser.h
M Source/JavaScriptCore/parser/ParserModes.h
M Source/JavaScriptCore/parser/SourceProviderCacheItem.h
Log Message:
-----------
[JSC] Inline async function body when there is no await
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
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications