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

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

Issue 10511008: Support overriding fields with fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 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
« no previous file with comments | « dart/lib/compiler/implementation/ssa/nodes.dart ('k') | dart/lib/compiler/implementation/world.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/lib/compiler/implementation/ssa/optimize.dart
diff --git a/dart/lib/compiler/implementation/ssa/optimize.dart b/dart/lib/compiler/implementation/ssa/optimize.dart
index 9ea146f623e1625bacb3b3a058778351c50cc5e3..d29e599fd5bb3738e8498a0bd61ffd9c05405196 100644
--- a/dart/lib/compiler/implementation/ssa/optimize.dart
+++ b/dart/lib/compiler/implementation/ssa/optimize.dart
@@ -571,21 +571,14 @@ class SsaConstantFolder extends HBaseVisitor implements OptimizationPhase {
if (!receiver.propagatedType.isUseful()) return node;
Type type = receiver.propagatedType.computeType(compiler);
if (type === null) return node;
- if (!compiler.world.isOnlyFields(type, node.name)) return node;
- ClassElement cls = type.element;
- if (cls === null) return node;
- Element element = cls.lookupLocalMember(node.name);
- // If a subclass overrides a final field then there will be two fields,
- // and here the final field will be used.
- if (element === null) return node;
- Modifiers modifiers = element.modifiers;
+ Element field = compiler.world.locateSingleField(type, node.name);
+ if (field === null) return node;
+ Modifiers modifiers = field.modifiers;
bool isFinalOrConst = false;
if (modifiers != null) {
isFinalOrConst = modifiers.isFinal() || modifiers.isConst();
}
- return new HFieldGet(node.name,
- node.inputs[0],
- isFinalOrConst: isFinalOrConst);
+ return new HFieldGet(field, node.inputs[0], isFinalOrConst: isFinalOrConst);
}
HInstruction visitInvokeDynamicSetter(HInvokeDynamicSetter node) {
@@ -593,8 +586,9 @@ class SsaConstantFolder extends HBaseVisitor implements OptimizationPhase {
if (!receiver.propagatedType.isUseful()) return node;
Type type = receiver.propagatedType.computeType(compiler);
if (type === null) return node;
- if (!compiler.world.isOnlyFields(type, node.name)) return node;
- return new HFieldSet(node.name, node.inputs[0], node.inputs[1]);
+ Element field = compiler.world.locateSingleField(type, node.name);
+ if (field === null) return node;
+ return new HFieldSet(field, node.inputs[0], node.inputs[1]);
}
}
« no previous file with comments | « dart/lib/compiler/implementation/ssa/nodes.dart ('k') | dart/lib/compiler/implementation/world.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698