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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/dart2jslib.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart2js; 5 part of dart2js;
6 6
7 abstract class ConstantVisitor<R> { 7 abstract class ConstantVisitor<R> {
8 R visitFunction(FunctionConstant constant); 8 R visitFunction(FunctionConstant constant);
9 R visitNull(NullConstant constant); 9 R visitNull(NullConstant constant);
10 R visitInt(IntConstant constant); 10 R visitInt(IntConstant constant);
11 R visitDouble(DoubleConstant constant); 11 R visitDouble(DoubleConstant constant);
12 R visitTrue(TrueConstant constant); 12 R visitTrue(TrueConstant constant);
13 R visitFalse(FalseConstant constant); 13 R visitFalse(FalseConstant constant);
14 R visitString(StringConstant constant); 14 R visitString(StringConstant constant);
15 R visitList(ListConstant constant); 15 R visitList(ListConstant constant);
16 R visitMap(MapConstant constant); 16 R visitMap(MapConstant constant);
17 R visitConstructed(ConstructedConstant constant); 17 R visitConstructed(ConstructedConstant constant);
18 R visitType(TypeConstant constant); 18 R visitType(TypeConstant constant);
19 R visitInterceptor(InterceptorConstant constant); 19 R visitInterceptor(InterceptorConstant constant);
20 R visitDummy(DummyConstant constant); 20 R visitDummy(DummyConstant constant);
21 R visitDeferred(DeferredConstant constant);
21 } 22 }
22 23
23 abstract class Constant { 24 abstract class Constant {
24 const Constant(); 25 const Constant();
25 26
26 bool get isNull => false; 27 bool get isNull => false;
27 bool get isBool => false; 28 bool get isBool => false;
28 bool get isTrue => false; 29 bool get isTrue => false;
29 bool get isFalse => false; 30 bool get isFalse => false;
30 bool get isInt => false; 31 bool get isInt => false;
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 if (i > 0) sb.write(','); 646 if (i > 0) sb.write(',');
646 sb.write(Error.safeToString(field.name)); 647 sb.write(Error.safeToString(field.name));
647 sb.write('='); 648 sb.write('=');
648 sb.write(Error.safeToString(value)); 649 sb.write(Error.safeToString(value));
649 i++; 650 i++;
650 }); 651 });
651 sb.write('))'); 652 sb.write('))');
652 return sb.toString(); 653 return sb.toString();
653 } 654 }
654 } 655 }
656
657 /// A reference to a constant in another output unit.
658 /// Used for referring to deferred constants.
659 class DeferredConstant extends Constant {
660 DeferredConstant(this.referenced, this.prefix);
661
662 final Constant referenced;
663 final PrefixElement prefix;
664
665 bool get isReference => true;
666
667 bool operator ==(other) {
668 return other is DeferredConstant
669 && referenced == other.referenced
670 && prefix == other.prefix;
671 }
672
673 get hashCode => (referenced.hashCode * 17 + prefix.hashCode) & 0x3fffffff;
674
675 List<Constant> getDependencies() => <Constant>[referenced];
676
677 accept(ConstantVisitor visitor) => visitor.visitDeferred(this);
678
679 DartType computeType(Compiler compiler) => referenced.computeType(compiler);
680
681 ti.TypeMask computeMask(Compiler compiler) {
682 return referenced.computeMask(compiler);
683 }
684
685 String toString() {
686 return 'DeferredConstant($referenced)';
687 }
688 }
OLDNEW
« 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