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

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

Issue 1367353003: dart2js cps_ir: Seed type_propagation with constant bools from inference. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: value mask can be nullable Created 5 years, 3 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
Index: pkg/compiler/lib/src/cps_ir/type_propagation.dart
diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
index 8c37b3ac201a5800178f8ce0a506e976b0d70912..383b39fb68ce20471bb7b6a76aadfcea68172dd6 100644
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
@@ -321,7 +321,13 @@ class ConstantPropagationLattice {
/// [typedSelector]. If the given selector is not a [TypedSelector], any
/// reachable method matching the selector may be targeted.
AbstractValue getInvokeReturnType(Selector selector, TypeMask mask) {
- return nonConstant(typeSystem.getInvokeReturnType(selector, mask));
+ return fromMask(typeSystem.getInvokeReturnType(selector, mask));
+ }
+
+ AbstractValue fromMask(TypeMask mask) {
+ ConstantValue constantValue = typeSystem.getConstantOf(mask);
+ if (constantValue != null) return constant(constantValue, mask);
+ return nonConstant(mask);
}
}
@@ -2066,7 +2072,7 @@ class TypePropagationVisitor implements Visitor {
TypeMask type = param.hint is ParameterElement
? typeSystem.getParameterType(param.hint)
: typeSystem.dynamicType;
- setValue(param, nonConstant(type));
+ setValue(param, lattice.fromMask(type));
}
push(node.body);
}
@@ -2113,7 +2119,7 @@ class TypePropagationVisitor implements Visitor {
}
TypeMask returnType = typeSystem.getReturnType(node.target);
- setResult(node, nonConstant(returnType));
+ setResult(node, lattice.fromMask(returnType));
}
void visitInvokeContinuation(InvokeContinuation node) {
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/type_mask_system.dart ('k') | tests/compiler/dart2js/js_backend_cps_ir_control_flow_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698