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

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

Issue 15725018: Fix bug in SsaConstructionFieldTypes: handle mulitple assignments to the same field. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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/optimize.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/optimize.dart (revision 23664)
+++ sdk/lib/_internal/compiler/implementation/ssa/optimize.dart (working copy)
@@ -1465,13 +1465,25 @@
HInstruction value = node.value;
HType type = value.instructionType;
// [HFieldSet] is also used for variables in try/catch.
- if (field.isField()) allSetters.add(field);
+ if (!field.isField()) return;
+ allSetters.add(field);
// Don't handle fields defined in superclasses. Given that the field is
// always added to the [allSetters] set, setting a field defined in a
// superclass will get an inferred type of UNKNOWN.
- if (identical(work.element.getEnclosingClass(), field.getEnclosingClass()) &&
- !value.instructionType.isUnknown()) {
- currentFieldSetters[field] = type;
+ if (work.element.getEnclosingClass() == field.getEnclosingClass()) {
+ HType existing = currentFieldSetters[field];
+ // If we have seen an assignment already, we check if
+ // it's of the same type. If it's not, we remove the current
+ // field type information.
+ if (existing != null) {
+ if (existing == type) {
+ return;
+ } else {
+ currentFieldSetters.remove(field);
kasperl 2013/06/06 08:15:12 Can we then get another field type added after thi
ngeoffray 2013/06/06 08:44:00 Good catch. Done.
+ }
+ } else if (!type.isUnknown()) {
+ currentFieldSetters[field] = type;
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698