| 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);
|
|
|