Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(578)

Unified Diff: third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp

Issue 2889783002: [ES6 modules] FetchDescendants: skip fetch algorithm for descendants that are already ready
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp
diff --git a/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp b/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp
index baceb7eedd23f10e52a9ea52e7ffd19e0cf300e0..8a904b112ea8bc0ad2af6e157ad7480fd26cb69c 100644
--- a/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp
+++ b/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp
@@ -265,12 +265,23 @@ void ModuleTreeLinker::FetchDescendants() {
return;
}
- // Step 4.3. Otherwise, if ancestor list does not contain url, append url to
- // urls.
-
// Modulator::resolveModuleSpecifier() impl must return either a valid url
// or null.
CHECK(url.IsValid());
+
+ // [nospec, optimization]
+ // If we can already resolve the descendant module script from
+ // the module map at this point, we can skip "internal module script
+ // graph fetching procedure" for the descendant.
+ if (ModuleScript* script = modulator_->GetFetchedModuleScript(url)) {
+ if (script->InstantiationState() ==
+ ModuleInstantiationState::kInstantiated)
+ continue;
+ }
+
+ // Step 4.3. Otherwise, if ancestor list does not contain url, append url to
+ // urls.
+
if (!ancestor_list_with_url_.Contains(url))
urls.push_back(url);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698