Chromium Code Reviews| Index: pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart |
| diff --git a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart |
| index a5680663b42babb1f0b732cb0e6a77ce72a21d3c..b58855d8b2b2b113311b60e242e141afad23535c 100644 |
| --- a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart |
| +++ b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart |
| @@ -538,11 +538,17 @@ class TypeInformationSystem extends TypeSystem<TypeInformation> { |
| } |
| TypeMask joinTypeMasks(Iterable<TypeMask> masks) { |
| + var dynamicType = compiler.typesTask.dynamicType; |
| + // Don't do any work on computing unions if we know that after all that work |
| + // the result will be `dynamic`. |
| + if (masks.any((m) => m == dynamicType)) return dynamicType; |
| TypeMask newType = const TypeMask.nonNullEmpty(); |
| for (TypeMask mask in masks) { |
|
sra1
2015/12/16 05:06:17
what is the input iterable?
If its is mapped, this
Siggi Cherem (dart-lang)
2015/12/17 01:02:56
Done. It's mapped, although I couldn't observe any
|
| newType = newType.union(mask, classWorld); |
|
Johnni Winther
2015/12/16 09:07:08
How about:
TypeMask newType;
for (TypeMask mask i
Siggi Cherem (dart-lang)
2015/12/17 01:02:57
Done. Also not much savings from this: empty is ha
|
| + // Likewise - stop early if we already reach dynamic. |
| + if (newType == dynamicType) return dynamicType; |
| } |
| - return newType.containsAll(classWorld) ? dynamicType.type : newType; |
| + return newType; |
| } |
| } |