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

Unified Diff: pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart

Issue 1528953002: Tweaks to improve performance of type-inference. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
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;
}
}
« no previous file with comments | « no previous file | pkg/compiler/lib/src/types/union_type_mask.dart » ('j') | pkg/compiler/lib/src/types/union_type_mask.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698