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

Side by Side Diff: pkg/compiler/lib/src/universe/universe.dart

Issue 790023004: Remove static state. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 | « pkg/compiler/lib/src/native/enqueue.dart ('k') | pkg/compiler/lib/src/world.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 library universe; 5 library universe;
6 6
7 import '../elements/elements.dart'; 7 import '../elements/elements.dart';
8 import '../dart2jslib.dart'; 8 import '../dart2jslib.dart';
9 import '../dart_types.dart'; 9 import '../dart_types.dart';
10 import '../types/types.dart'; 10 import '../types/types.dart';
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 selector.name, 774 selector.name,
775 selector.library, 775 selector.library,
776 selector.argumentCount, 776 selector.argumentCount,
777 selector.namedArguments, 777 selector.namedArguments,
778 selector._orderedNamedArguments, 778 selector._orderedNamedArguments,
779 hashCode) { 779 hashCode) {
780 assert(mask != null); 780 assert(mask != null);
781 assert(asUntyped.mask == null); 781 assert(asUntyped.mask == null);
782 } 782 }
783 783
784 static Map<Selector, Map<TypeMask, TypedSelector>> canonicalizedValues =
785 new Map<Selector, Map<TypeMask, TypedSelector>>();
786 784
787 factory TypedSelector(TypeMask mask, Selector selector, World world) { 785 factory TypedSelector(TypeMask mask, Selector selector, World world) {
788 if (!world.hasClosedWorldAssumption) { 786 if (!world.hasClosedWorldAssumption) {
789 // TODO(johnniwinther): Improve use of TypedSelector in an open world. 787 // TODO(johnniwinther): Improve use of TypedSelector in an open world.
790 bool isNullable = mask.isNullable; 788 bool isNullable = mask.isNullable;
791 mask = world.compiler.typesTask.dynamicType; 789 mask = world.compiler.typesTask.dynamicType;
792 if (isNullable) { 790 if (isNullable) {
793 mask = mask.nullable(); 791 mask = mask.nullable();
794 } 792 }
795 } 793 }
796 // TODO(johnniwinther): Allow more TypeSelector kinds during resoluton. 794 // TODO(johnniwinther): Allow more TypeSelector kinds during resoluton.
797 assert(world.isClosed || mask.isExact); 795 assert(world.isClosed || mask.isExact);
798 if (selector.mask == mask) return selector; 796 if (selector.mask == mask) return selector;
799 Selector untyped = selector.asUntyped; 797 Selector untyped = selector.asUntyped;
800 Map<TypeMask, TypedSelector> map = canonicalizedValues.putIfAbsent(untyped, 798 Map<TypeMask, TypedSelector> map = world.canonicalizedValues
801 () => new Map<TypeMask, TypedSelector>()); 799 .putIfAbsent(untyped, () => new Map<TypeMask, TypedSelector>());
802 TypedSelector result = map[mask]; 800 TypedSelector result = map[mask];
803 if (result == null) { 801 if (result == null) {
804 int hashCode = Selector.mixHashCodeBits(untyped.hashCode, mask.hashCode); 802 int hashCode = Selector.mixHashCodeBits(untyped.hashCode, mask.hashCode);
805 result = map[mask] = new TypedSelector.internal(mask, untyped, hashCode); 803 result = map[mask] = new TypedSelector.internal(mask, untyped, hashCode);
806 } 804 }
807 return result; 805 return result;
808 } 806 }
809 807
810 factory TypedSelector.exact( 808 factory TypedSelector.exact(
811 ClassElement base, Selector selector, World world) 809 ClassElement base, Selector selector, World world)
(...skipping 30 matching lines...) Expand all
842 840
843 Selector extendIfReachesAll(Compiler compiler) { 841 Selector extendIfReachesAll(Compiler compiler) {
844 bool canReachAll = compiler.enabledInvokeOn 842 bool canReachAll = compiler.enabledInvokeOn
845 && mask.needsNoSuchMethodHandling(this, compiler.world); 843 && mask.needsNoSuchMethodHandling(this, compiler.world);
846 return canReachAll 844 return canReachAll
847 ? new TypedSelector( 845 ? new TypedSelector(
848 compiler.typesTask.dynamicType, this, compiler.world) 846 compiler.typesTask.dynamicType, this, compiler.world)
849 : this; 847 : this;
850 } 848 }
851 } 849 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/native/enqueue.dart ('k') | pkg/compiler/lib/src/world.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698