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

Unified Diff: pkg/compiler/lib/src/deferred_load.dart

Issue 2315973002: When registering deferred constant, use canonical output unit. (Closed)
Patch Set: Created 4 years, 3 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 | pkg/compiler/lib/src/dump_info.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/deferred_load.dart
diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart
index 114bdcaaf8886442f87a8fc3b0fd7dbe63de1948..aa3bace09926215e4d1f4dadfbd8ecc01c5d9aab 100644
--- a/pkg/compiler/lib/src/deferred_load.dart
+++ b/pkg/compiler/lib/src/deferred_load.dart
@@ -226,7 +226,14 @@ class DeferredLoadTask extends CompilerTask {
DeferredConstantValue constant, PrefixElement prefix) {
OutputUnit outputUnit = new OutputUnit();
outputUnit.imports.add(new _DeclaredDeferredImport(prefix.deferredImport));
- _constantToOutputUnit[constant] = outputUnit;
+
+ // Check to see if there is already a canonical output unit registered.
+ OutputUnit representative = allOutputUnits.lookup(outputUnit);
Siggi Cherem (dart-lang) 2016/09/07 18:10:44 I see this logic replicated in a few places, maybe
Siggi Cherem (dart-lang) 2016/09/07 18:14:09 reading more into this, it feels like we are doing
Harry Terkelsen 2016/09/07 23:53:50 Done.
Harry Terkelsen 2016/09/07 23:53:50 added a todo
+ if (representative == null) {
+ representative = outputUnit;
+ allOutputUnits.add(representative);
+ }
+ _constantToOutputUnit[constant] = representative;
}
/// Answers whether [element] is explicitly deferred when referred to from
@@ -679,6 +686,11 @@ class DeferredLoadTask extends CompilerTask {
Map<ConstantValue, OutputUnit> constantToOutputUnitBuilder =
new Map<ConstantValue, OutputUnit>();
+ // Add all constants that may have been registered during
+ // resolution with [registerConstantDeferredUse].
Siggi Cherem (dart-lang) 2016/09/07 18:10:44 would it make sense to store those somewhere else
Harry Terkelsen 2016/09/07 23:53:50 I wanted to do that at first, but it would mean ha
+ constantToOutputUnitBuilder.addAll(_constantToOutputUnit);
+ _constantToOutputUnit.clear();
+
// Reverse the mappings. For each element record an OutputUnit
// collecting all deferred imports mapped to this element. Same
// for constants.
« no previous file with comments | « no previous file | pkg/compiler/lib/src/dump_info.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698