[JSC] Optimize returned promise from async function when it does not have await#63356
Merged
Conversation
Collaborator
|
EWS run on previous version of this PR (hash 141712d) Details
|
141712d to
7b190ec
Compare
Collaborator
|
EWS run on previous version of this PR (hash 7b190ec) Details
|
7b190ec to
0ea821e
Compare
Collaborator
|
EWS run on previous version of this PR (hash 0ea821e) Details
|
hyjorc1
reviewed
Apr 23, 2026
|
|
||
| JumpList slowCases; | ||
|
|
||
| FrozenValue* structure = m_graph.freezeStrong(globalObject->promiseStructure()); |
Contributor
There was a problem hiding this comment.
Should we use
RegisteredStructure structure = m_graph.registerStructure(globalObject->promiseStructure());
which is same as the one used by compileCreatePromise?
Member
Author
There was a problem hiding this comment.
Sounds good, changed.
hyjorc1
approved these changes
Apr 23, 2026
0ea821e to
697b279
Compare
Collaborator
|
EWS run on current version of this PR (hash 697b279) Details
|
…have await https://bugs.webkit.org/show_bug.cgi?id=313029 rdar://175369313 Reviewed by Yijia Huang. Let's optimize returned promise from async function when we do not have `await`. Currently, we are calling operationFulfillPromiseFirstResolving for the created promise when resolving. But since we know that we do not have `await`, we do not need to create a promise a-priori, and we can just create and resolve a promise when returning. This is more efficient since we can fold it into a fulfilled promise allocation when input is proven as non-object. Test: JSTests/stress/async-function-empty-resolved-promise.js * JSTests/stress/async-function-empty-resolved-promise.js: Added. (shouldBe): (async empty): (async emptyArrow): (C.prototype.async emptyMethod): (C): (const.obj.async emptyShort): (async onlyUsing): (async onlyAwaitUsing): (async returnsThenable): (async throwsLiteral): (async throwsError): (thrower): (async defaultThrower): (async defaultThrowerBody): (async run.async returnsPromise): (async run): * Source/JavaScriptCore/builtins/BuiltinNames.h: * Source/JavaScriptCore/bytecode/LinkTimeConstant.h: * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::BytecodeGenerator): * Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp: (JSC::FunctionNode::emitBytecode): * Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleIntrinsicCall): * Source/JavaScriptCore/dfg/DFGClobberize.h: (JSC::DFG::clobberize): * Source/JavaScriptCore/dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * Source/JavaScriptCore/dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * Source/JavaScriptCore/dfg/DFGNodeType.h: * Source/JavaScriptCore/dfg/DFGOperations.cpp: (JSC::DFG::JSC_DEFINE_JIT_OPERATION): * Source/JavaScriptCore/dfg/DFGOperations.h: * Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp: * Source/JavaScriptCore/dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp: * Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h: * Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * Source/JavaScriptCore/ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq): * Source/JavaScriptCore/parser/Nodes.h: (JSC::ScopeNode::isEmptyBody const): * Source/JavaScriptCore/runtime/Intrinsic.h: * Source/JavaScriptCore/runtime/JSGlobalObject.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): (JSC::JSGlobalObject::init): Canonical link: https://commits.webkit.org/311883@main
697b279 to
19dc01a
Compare
Collaborator
|
Committed 311883@main (19dc01a): https://commits.webkit.org/311883@main Reviewed commits have been landed. Closing PR #63356 and removing active labels. |
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.
19dc01a
697b279
🛠 win🛠 ios-sim🧪 wpe-wk2🧪 win-tests🧪 ios-wk2🧪 api-mac🧪 api-wpe🧪 ios-wk2-wpt🧪 api-mac-debug🧪 api-ios🛠 ios-safer-cpp🧪 mac-wk2🧪 gtk-wk2🛠 vision🧪 mac-AS-debug-wk2🧪 api-gtk🛠 vision-sim🛠 playstation🧪 vision-wk2🧪 mac-intel-wk2🛠 mac-safer-cpp🛠 tv-sim🛠 watch🛠 watch-sim