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

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

Issue 11361059: Fix issue 6472 that exhibited a few crashing bugs in dart2js. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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: lib/compiler/implementation/ssa/optimize.dart
===================================================================
--- lib/compiler/implementation/ssa/optimize.dart (revision 14453)
+++ lib/compiler/implementation/ssa/optimize.dart (working copy)
@@ -142,12 +142,15 @@
}
block.rewrite(instruction, replacement);
block.remove(instruction);
- // If the replacement instruction does not know its type or
- // source element yet, use the type and source element of the
+
+ // If we can replace [instruction] with [replacement], then
+ // [replacement]'s type can be narrowed.
+ types[replacement] =
+ types[replacement].intersection(types[instruction], compiler);
+
+ // If the replacement instruction does not know its
+ // source element, use the source element of the
// instruction.
- if (!types[replacement].isUseful()) {
- types[replacement] = types[instruction];
- }
if (replacement.sourceElement == null) {
replacement.sourceElement = instruction.sourceElement;
}

Powered by Google App Engine
This is Rietveld 408576698