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

Unified Diff: pkg/compiler/lib/src/cps_ir/type_mask_system.dart

Issue 1444363002: dart2js cps: Global value numbering and loop-invariant code motion. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add comment Created 5 years, 1 month 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/cps_ir/type_mask_system.dart
diff --git a/pkg/compiler/lib/src/cps_ir/type_mask_system.dart b/pkg/compiler/lib/src/cps_ir/type_mask_system.dart
index a36f2843e8bd3d1f7a768a7acc0c4073e15a5509..4c1eb432c23f80161c7da0abd1f4116e4d9b30a0 100644
--- a/pkg/compiler/lib/src/cps_ir/type_mask_system.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_mask_system.dart
@@ -162,15 +162,16 @@ class TypeMaskSystem {
}
TypeMask getParameterType(ParameterElement parameter) {
- return inferrer.getGuaranteedTypeOfElement(parameter);
+ return inferrer.getGuaranteedTypeOfElement(parameter) ?? dynamicType;
sra1 2015/11/17 05:41:15 Why are these functions returning null?
asgerf 2015/11/17 12:43:43 I can't reproduce it anymore so I've reverted the
}
TypeMask getReturnType(FunctionElement function) {
- return inferrer.getGuaranteedReturnTypeOfElement(function);
+ return inferrer.getGuaranteedReturnTypeOfElement(function) ?? dynamicType;
}
TypeMask getInvokeReturnType(Selector selector, TypeMask mask) {
TypeMask result = inferrer.getGuaranteedTypeOfSelector(selector, mask);
+ if (result == null) return dynamicType;
// Tearing off .call from a function returns the function itself.
if (selector.isGetter &&
selector.name == Identifiers.call &&
@@ -181,7 +182,7 @@ class TypeMaskSystem {
}
TypeMask getFieldType(FieldElement field) {
- return inferrer.getGuaranteedTypeOfElement(field);
+ return inferrer.getGuaranteedTypeOfElement(field) ?? dynamicType;
}
TypeMask join(TypeMask a, TypeMask b) {
@@ -195,7 +196,7 @@ class TypeMaskSystem {
}
TypeMask getTypeOf(ConstantValue constant) {
- return computeTypeMask(inferrer.compiler, constant);
+ return computeTypeMask(inferrer.compiler, constant) ?? dynamicType;
}
// Returns the constant value if a TypeMask represents a single value.
@@ -347,8 +348,12 @@ class TypeMaskSystem {
}
bool areDisjoint(TypeMask leftType, TypeMask rightType) {
- TypeMask intersection = leftType.intersection(rightType, classWorld);
- return intersection.isEmpty && !intersection.isNullable;
+ TypeMask intersected = intersection(leftType, rightType);
+ return intersected.isEmpty && !intersected.isNullable;
+ }
+
+ bool isMorePreciseOrEqual(TypeMask t1, TypeMask t2) {
+ return t2.containsMask(t1, classWorld);
}
AbstractBool isSubtypeOf(TypeMask value,

Powered by Google App Engine
This is Rietveld 408576698