Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b3c012e316ed5c9aa40a4f6767f2b6806e6ae004
      
https://github.com/WebKit/WebKit/commit/b3c012e316ed5c9aa40a4f6767f2b6806e6ae004
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-05-13 (Wed, 13 May 2026)

  Changed paths:
    A JSTests/stress/module-loader-cached-record-dense-graph.js
    A JSTests/stress/module-loader-cached-record-shared-dep-error.js
    A JSTests/stress/resources/module-cached-record/a.js
    A JSTests/stress/resources/module-cached-record/b.js
    A JSTests/stress/resources/module-cached-record/c.js
    A JSTests/stress/resources/module-cached-record/dense-entry.js
    A JSTests/stress/resources/module-cached-record/m-broken-dep.js
    A JSTests/stress/resources/module-cached-record/referrer-a.js
    A JSTests/stress/resources/module-cached-record/referrer-b.js
    A JSTests/stress/resources/module-cached-record/shared.js
    M Source/JavaScriptCore/runtime/JSModuleLoader.cpp

  Log Message:
  -----------
  [JSC] Skip redundant `ModuleGraphLoadingError` reactions for already-loaded 
modules in `InnerModuleLoading`
https://bugs.webkit.org/show_bug.cgi?id=314519

Reviewed by Yusuke Suzuki.

InnerModuleLoading attaches a ModuleGraphLoadingError reaction to the promise
returned by HostLoadImportedModule for every import edge it processes. When the
requested module is already fully loaded (its registry entry has a record),
HostLoadImportedModule continued the graph synchronously via
FinishLoadingImportedModule, and any failure in that subtree is already
observable through reactions attached deeper in the recursion. The reaction on
the returned loadPromise is then a guaranteed no-op.

Detect this by checking whether module.[[LoadedModules]] grew across the call:
the only entry HostLoadImportedModule can synchronously add is the one for the
current request, and only when its record was already cached. If it grew, skip
the reaction.

For dense `export * from` graphs where the number of import edges greatly
exceeds the number of modules, most edges resolve against an already-loaded
module. On a synthetic 1000-module graph with ~125k import edges, this
eliminates 99.2% of ModuleGraphLoadingError reaction allocations and reduces
peak RSS by ~4.5% (~4 MB), with no measurable wall-clock change.

Tests: JSTests/stress/module-loader-cached-record-dense-graph.js
       JSTests/stress/module-loader-cached-record-shared-dep-error.js

* JSTests/stress/module-loader-cached-record-dense-graph.js: Added.
(async const):
(catch):
* JSTests/stress/module-loader-cached-record-shared-dep-error.js: Added.
(async shouldReject):
(async const):
(catch):
* JSTests/stress/resources/module-cached-record/a.js: Added.
* JSTests/stress/resources/module-cached-record/b.js: Added.
* JSTests/stress/resources/module-cached-record/c.js: Added.
* JSTests/stress/resources/module-cached-record/dense-entry.js: Added.
* JSTests/stress/resources/module-cached-record/m-broken-dep.js: Added.
* JSTests/stress/resources/module-cached-record/referrer-a.js: Added.
* JSTests/stress/resources/module-cached-record/referrer-b.js: Added.
* JSTests/stress/resources/module-cached-record/shared.js: Added.
* Source/JavaScriptCore/runtime/JSModuleLoader.cpp:
(JSC::JSModuleLoader::innerModuleLoading):

Canonical link: https://commits.webkit.org/313223@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to