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

Unified Diff: lib/compiler/implementation/ssa/optimize.dart

Issue 10353014: Start implementing checked mode and tools support for using it. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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: lib/compiler/implementation/ssa/optimize.dart
===================================================================
--- lib/compiler/implementation/ssa/optimize.dart (revision 7269)
+++ lib/compiler/implementation/ssa/optimize.dart (working copy)
@@ -130,7 +130,8 @@
HInstruction input = inputs[0];
if (input.isBoolean()) return input;
// All values !== true are boolified to false.
- if (input.propagatedType.isUseful()) {
+ Type type = input.propagatedType.computeType(compiler);
+ if (type !== null && type.element !== compiler.boolClass) {
return graph.addConstantBool(false);
}
return node;
@@ -437,7 +438,7 @@
}
if (right.isConstantNull()) {
- if (left.propagatedType.isUseful()) {
+ if (!left.propagatedType.canBeNull()) {
floitsch 2012/05/07 09:50:07 I would prefer switching to the new semantics in a
ngeoffray 2012/05/07 13:15:42 This should have been if (leg.propagatedType.isPri
return graph.addConstantBool(false);
} else {
// TODO(floitsch): cache interceptors.
@@ -532,6 +533,7 @@
}
// TODO(karlklose): remove the hasTypeArguments check.
} else if (expressionType.isUseful()
+ && !expressionType.canBeNull()
floitsch 2012/05/07 09:50:07 you could move that check into the 'true' section.
ngeoffray 2012/05/07 13:15:42 Done.
&& !compiler.universe.rti.hasTypeArguments(type)) {
Type receiverType = expressionType.computeType(compiler);
if (receiverType !== null) {
@@ -1054,6 +1056,10 @@
void visitIs(HIs instruction) {
HInstruction input = instruction.expression;
+ HType convertedType =
+ new HType.fromBoundedType(instruction.typeExpression, compiler);
+ if (convertedType === null) return;
+
List<HInstruction> ifUsers = <HInstruction>[];
List<HInstruction> notIfUsers = <HInstruction>[];
@@ -1069,9 +1075,6 @@
if (ifUsers.isEmpty() && notIfUsers.isEmpty()) return;
- HType convertedType =
- new HType.fromBoundedType(instruction.typeExpression, compiler);
-
for (HIf ifUser in ifUsers) {
changeUsesDominatedBy(ifUser.thenBlock, input, convertedType);
// TODO(ngeoffray): Also change uses for the else block on a HType

Powered by Google App Engine
This is Rietveld 408576698