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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/types/flat_type_mask.dart

Issue 94303002: Add another type JSPositiveInt to show a range analysis in the inferrer would be very beneficial :-… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 types; 5 part of types;
6 6
7 /** 7 /**
8 * A flat type mask is a type mask that has been flatten to contain a 8 * A flat type mask is a type mask that has been flatten to contain a
9 * base type. 9 * base type.
10 */ 10 */
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 Backend backend = compiler.backend; 91 Backend backend = compiler.backend;
92 if (containsOnlyString(compiler)) { 92 if (containsOnlyString(compiler)) {
93 return cls == compiler.stringClass || cls == backend.stringImplementation; 93 return cls == compiler.stringClass || cls == backend.stringImplementation;
94 } 94 }
95 if (containsOnlyBool(compiler)) { 95 if (containsOnlyBool(compiler)) {
96 return cls == compiler.boolClass || cls == backend.boolImplementation; 96 return cls == compiler.boolClass || cls == backend.boolImplementation;
97 } 97 }
98 if (containsOnlyInt(compiler)) { 98 if (containsOnlyInt(compiler)) {
99 return cls == compiler.intClass 99 return cls == compiler.intClass
100 || cls == backend.intImplementation 100 || cls == backend.intImplementation
101 || cls == backend.positiveIntImplementation
101 || cls == backend.uint32Implementation 102 || cls == backend.uint32Implementation
102 || cls == backend.uint31Implementation; 103 || cls == backend.uint31Implementation;
103 } 104 }
104 if (containsOnlyDouble(compiler)) { 105 if (containsOnlyDouble(compiler)) {
105 return cls == compiler.doubleClass 106 return cls == compiler.doubleClass
106 || cls == compiler.backend.doubleImplementation; 107 || cls == compiler.backend.doubleImplementation;
107 } 108 }
108 return false; 109 return false;
109 } 110 }
110 111
(...skipping 18 matching lines...) Expand all
129 return satisfies(otherBase, compiler); 130 return satisfies(otherBase, compiler);
130 } 131 }
131 132
132 bool containsMask(TypeMask other, Compiler compiler) { 133 bool containsMask(TypeMask other, Compiler compiler) {
133 return other.isInMask(this, compiler); 134 return other.isInMask(this, compiler);
134 } 135 }
135 136
136 bool containsOnlyInt(Compiler compiler) { 137 bool containsOnlyInt(Compiler compiler) {
137 return base == compiler.intClass 138 return base == compiler.intClass
138 || base == compiler.backend.intImplementation 139 || base == compiler.backend.intImplementation
140 || base == compiler.backend.positiveIntImplementation
139 || base == compiler.backend.uint31Implementation 141 || base == compiler.backend.uint31Implementation
140 || base == compiler.backend.uint32Implementation; 142 || base == compiler.backend.uint32Implementation;
141 } 143 }
142 144
143 bool containsOnlyDouble(Compiler compiler) { 145 bool containsOnlyDouble(Compiler compiler) {
144 return base == compiler.doubleClass 146 return base == compiler.doubleClass
145 || base == compiler.backend.doubleImplementation; 147 || base == compiler.backend.doubleImplementation;
146 } 148 }
147 149
148 bool containsOnlyNum(Compiler compiler) { 150 bool containsOnlyNum(Compiler compiler) {
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 if (x.isExact) { 662 if (x.isExact) {
661 return null; 663 return null;
662 } else if (x.isSubclass) { 664 } else if (x.isSubclass) {
663 return compiler.world.subclassesOf(element); 665 return compiler.world.subclassesOf(element);
664 } else { 666 } else {
665 assert(x.isSubtype); 667 assert(x.isSubtype);
666 return compiler.world.subtypesOf(element); 668 return compiler.world.subtypesOf(element);
667 } 669 }
668 } 670 }
669 } 671 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698