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

Unified Diff: sdk/lib/_internal/compiler/implementation/constants.dart

Issue 256453004: Avoid inlining constants that are used via a deferred import. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 6 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 | sdk/lib/_internal/compiler/implementation/dart2jslib.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/constants.dart
diff --git a/sdk/lib/_internal/compiler/implementation/constants.dart b/sdk/lib/_internal/compiler/implementation/constants.dart
index ab9a45bf7220ed19cfac49756ea2892ede2eb14d..8fe7212972352215a0c651672a36e992141b5230 100644
--- a/sdk/lib/_internal/compiler/implementation/constants.dart
+++ b/sdk/lib/_internal/compiler/implementation/constants.dart
@@ -18,6 +18,7 @@ abstract class ConstantVisitor<R> {
R visitType(TypeConstant constant);
R visitInterceptor(InterceptorConstant constant);
R visitDummy(DummyConstant constant);
+ R visitDeferred(DeferredConstant constant);
}
abstract class Constant {
@@ -652,3 +653,36 @@ class ConstructedConstant extends ObjectConstant {
return sb.toString();
}
}
+
+/// A reference to a constant in another output unit.
+/// Used for referring to deferred constants.
+class DeferredConstant extends Constant {
+ DeferredConstant(this.referenced, this.prefix);
+
+ final Constant referenced;
+ final PrefixElement prefix;
+
+ bool get isReference => true;
+
+ bool operator ==(other) {
+ return other is DeferredConstant
+ && referenced == other.referenced
+ && prefix == other.prefix;
+ }
+
+ get hashCode => (referenced.hashCode * 17 + prefix.hashCode) & 0x3fffffff;
+
+ List<Constant> getDependencies() => <Constant>[referenced];
+
+ accept(ConstantVisitor visitor) => visitor.visitDeferred(this);
+
+ DartType computeType(Compiler compiler) => referenced.computeType(compiler);
+
+ ti.TypeMask computeMask(Compiler compiler) {
+ return referenced.computeMask(compiler);
+ }
+
+ String toString() {
+ return 'DeferredConstant($referenced)';
+ }
+}
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/dart2jslib.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698