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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart

Issue 54473003: Fix a bug in the way we deal with HTypeKnown instructions in our SSA type propagation phase. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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: sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart (revision 29654)
+++ sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart (working copy)
@@ -309,25 +309,26 @@
TypeMask newMask = compiler.world.allFunctions.receiverType(selector);
newMask = newMask.intersection(oldMask, compiler);
- if (newMask != oldMask) {
- HType newType = new HType.fromMask(newMask, compiler);
- var next = instruction.next;
- if (next is HTypeKnown && next.checkedInput == receiver) {
- // We already have refined [receiver].
- HType nextType = next.instructionType;
- if (nextType != newType) {
- next.knownType = next.instructionType = newType;
- addDependentInstructionsToWorkList(next);
- }
- } else {
- // Insert a refinement node after the call and update all
- // users dominated by the call to use that node instead of
- // [receiver].
- HTypeKnown converted = new HTypeKnown(newType, receiver);
- instruction.block.addBefore(instruction.next, converted);
- receiver.replaceAllUsersDominatedBy(converted.next, converted);
- addDependentInstructionsToWorkList(converted);
+ HType newType = new HType.fromMask(newMask, compiler);
+ var next = instruction.next;
+ if (next is HTypeKnown && next.checkedInput == receiver) {
+ // We already have refined [receiver]. We still update the
+ // type of the [HTypeKnown] instruction because it may have
+ // been refined with a correct type at the time, but
+ // incorrect now.
+ HType nextType = next.instructionType;
+ if (nextType != newType) {
+ next.knownType = next.instructionType = newType;
+ addDependentInstructionsToWorkList(next);
}
+ } else if (newMask != oldMask) {
+ // Insert a refinement node after the call and update all
+ // users dominated by the call to use that node instead of
+ // [receiver].
+ HTypeKnown converted = new HTypeKnown(newType, receiver);
+ instruction.block.addBefore(instruction.next, converted);
+ receiver.replaceAllUsersDominatedBy(converted.next, converted);
+ addDependentInstructionsToWorkList(converted);
}
}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/tracer.dart ('k') | tests/language/type_propagation3_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698