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

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

Issue 1117223002: dart2js: Inline across deferred output units if that leads to reduced size. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comments. Created 5 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 | pkg/compiler/lib/src/ssa/builder.dart » ('j') | pkg/compiler/lib/src/ssa/builder.dart » ('J')
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 b4ef154f4a0e134a4ebbe6326991f26ff048c9fe..2cd08666d72248d7548290bca9c27f852bba9bca 100644
--- a/pkg/compiler/lib/src/deferred_load.dart
+++ b/pkg/compiler/lib/src/deferred_load.dart
@@ -201,9 +201,20 @@ class DeferredLoadTask extends CompilerTask {
return outputUnitForElement(element) != mainOutputUnit;
}
- /// Returns true if e1 and e2 are in the same output unit.
- bool inSameOutputUnit(Element e1, Element e2) {
- return outputUnitForElement(e1) == outputUnitForElement(e2);
+ /// Returns `true` if element [to] is reachable from element [from] without
+ /// crossing a deferred import.
+ ///
+ /// For example, if we have two deferred libraries `A` and `B` that both
+ /// import a library `C`, then even though elements from `A` and `C` end up in
+ /// different output units, there is a non-deferred path between `A` and `C`.
+ bool hasOnlyNonDeferredImportPaths(Element from, Element to) {
+ OutputUnit outputUnitFrom = outputUnitForElement(from);
+ OutputUnit outputUnitTo = outputUnitForElement(to);
+ return outputUnitTo.imports.containsAll(outputUnitFrom.imports);
+ }
+
+ bool isFromMainOutputUnit(Element element) {
+ return outputUnitForElement(element) == mainOutputUnit;
}
void registerConstantDeferredUse(DeferredConstantValue constant,
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder.dart » ('j') | pkg/compiler/lib/src/ssa/builder.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698