-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JSC] Fix satisfy cache in module loader
https://bugs.webkit.org/show_bug.cgi?id=258540 rdar://110339520 Reviewed by Yusuke Suzuki. Current satisfy cache in ModuleLoader.js is problematic when module entries who encounter some visited children in requestSatisfy. This is because the way we use to break infinitely looping is to return a promise of instantiation for the visited children. In that case, when all children's promises are fulfilled, we should not mark the entry as satisfied since we don't know whether the visited module entry is satisfied or not. Current spec doesn't have concept satisfy before link phase see: 1. https://tc39.es/ecma262/#sec-import-calls 2. https://tc39.es/ecma262/#sec-ContinueDynamicImport 3. https://tc39.es/ecma262/#sec-LoadRequestedModules 4. https://tc39.es/ecma262/#sec-InnerModuleLoading Ideally we should use DFS (https://tc39.es/ecma262/#sec-moduledeclarationlinking) to track strongly connected component (SCC). If the requestSatisfyUtil promise for the start entry of the SCC is fulfilled, then we can mark all entries of the SCC satisfied. However, current requestSatisfyUtil cannot guarantee DFS due to various requestInstantiate time for children. And we don't prefer to force DFS. This is because if one child requests a lot of time in requestInstantiate, then the other children have to wait for it. And this is expensive. This patch fixes this issue by updating those "satisfying entries" after the root entry is resolved in satisfy phase. * Source/JavaScriptCore/builtins/ModuleLoader.js: (linkTimeConstant.newRegistryEntry): (visibility.PrivateRecursive.requestSatisfy): (async visibility.PrivateRecursive.requestSatisfyUtil): (visibility.PrivateRecursive.link): (visibility.PrivateRecursive.linkAndEvaluateModule): * Source/JavaScriptCore/runtime/JSModuleLoader.cpp: (JSC::JSModuleLoader::finishCreation): Canonical link: https://commits.webkit.org/266063@main
- Loading branch information
Showing
2 changed files
with
171 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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