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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/types.dart

Issue 12380058: Remove HBoundedPotentialPrimitiveArray type. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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/types/type_mask.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/ssa/types.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/types.dart b/sdk/lib/_internal/compiler/implementation/ssa/types.dart
index 83356d29facf6fc2304e1e522d0bfc27360b9909..d4b2594859ec5dfcf9435c6e885e34f76b872de2 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/types.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/types.dart
@@ -45,10 +45,7 @@ abstract class HType {
? HType.READABLE_ARRAY.union(HType.NULL, compiler)
: HType.READABLE_ARRAY;
} else if (mask.isSubtype) {
- if (element == compiler.listClass
- || Elements.isListSupertype(element, compiler)) {
- return new HBoundedPotentialPrimitiveArray(mask);
- } else if (Elements.isNumberOrStringSupertype(element, compiler)) {
+ if (Elements.isNumberOrStringSupertype(element, compiler)) {
return new HBoundedPotentialPrimitiveNumberOrString(mask);
} else if (Elements.isStringOnlySupertype(element, compiler)) {
return new HBoundedPotentialPrimitiveString(mask);
@@ -151,22 +148,22 @@ abstract class HType {
}
factory HType.readableArrayOrNull(Compiler compiler) {
- return new HBoundedPotentialPrimitiveArray(
+ return new HBoundedType(
READABLE_ARRAY.computeMask(compiler).nullable());
}
factory HType.mutableArrayOrNull(Compiler compiler) {
- return new HBoundedPotentialPrimitiveArray(
+ return new HBoundedType(
MUTABLE_ARRAY.computeMask(compiler).nullable());
}
factory HType.fixedArrayOrNull(Compiler compiler) {
- return new HBoundedPotentialPrimitiveArray(
+ return new HBoundedType(
FIXED_ARRAY.computeMask(compiler).nullable());
}
factory HType.extendableArrayOrNull(Compiler compiler) {
- return new HBoundedPotentialPrimitiveArray(
+ return new HBoundedType(
EXTENDABLE_ARRAY.computeMask(compiler).nullable());
}
@@ -917,6 +914,12 @@ class HBoundedType extends HType {
bool canBeNull() => mask.isNullable;
+ bool canBePrimitiveArray(Compiler compiler) {
+ JavaScriptBackend backend = compiler.backend;
+ DartType jsArrayType = backend.jsArrayClass.computeType(compiler);
+ return mask.contains(jsArrayType, compiler);
+ }
+
DartType computeType(Compiler compiler) => mask.base;
TypeMask computeMask(Compiler compiler) => mask;
@@ -962,10 +965,6 @@ class HBoundedType extends HType {
}
}
- // TODO(kasperl): Not sure this is strictly necessary if we make
- // sure the mock compiler treats JSArray as a subtype of List.
- if (canBePrimitiveArray(compiler) && other.isArray()) return this;
-
TypeMask otherMask = other.computeMask(compiler);
if (otherMask != null) {
TypeMask union = mask.union(otherMask, compiler.types);
@@ -1062,12 +1061,6 @@ class HBoundedPotentialPrimitiveNumberOrString
}
}
-class HBoundedPotentialPrimitiveArray extends HBoundedPotentialPrimitiveType {
- const HBoundedPotentialPrimitiveArray(TypeMask mask)
- : super(mask, false);
- bool canBePrimitiveArray(Compiler compiler) => true;
-}
-
class HBoundedPotentialPrimitiveString extends HBoundedPotentialPrimitiveType {
const HBoundedPotentialPrimitiveString(TypeMask mask)
: super(mask, false);
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/types/type_mask.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698