Chromium Code Reviews| 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; |
| + } |
| } |
| } |