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

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, 7 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
« no previous file with comments | « lib/compiler/implementation/ssa/nodes.dart ('k') | lib/compiler/implementation/ssa/types.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/optimize.dart
===================================================================
--- lib/compiler/implementation/ssa/optimize.dart (revision 7371)
+++ 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.isPrimitive()) {
return graph.addConstantBool(false);
} else {
// TODO(floitsch): cache interceptors.
@@ -1054,6 +1055,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 +1074,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
« no previous file with comments | « lib/compiler/implementation/ssa/nodes.dart ('k') | lib/compiler/implementation/ssa/types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698