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

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

Issue 2890593002: [ES6 modules] UninstantiatedInclusiveDescendants: skip recursion for instantiated sub-trees.
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..b4400f988a3a5b7feee76b8800aa953144895064 100644
--- a/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp
+++ b/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp
@@ -451,6 +451,14 @@ ModuleTreeLinker::UninstantiatedInclusiveDescendants() {
// or null).
DCHECK(current);
+ // [nospec, optimization]
+ // We can safely skip recursing into the descendants if the module graph
+ // node status is "instantiated". The sub-graph is guaranteed to be all
+ // "instantiated", thus never would end up in the "uninstantiated set".
+ if (current->InstantiationState() ==
+ ModuleInstantiationState::kInstantiated)
+ continue;
+
// Step 4.3. If inclusive descendants and stack both do not contain current,
// then:
if (inclusive_descendants.Contains(current))
« 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