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

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

Issue 10827359: Fix field-accesses for private fields that were "shadowed" by other private fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update comments. Created 8 years, 4 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 | « lib/compiler/implementation/elements/elements.dart ('k') | lib/compiler/implementation/world.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/optimize.dart
diff --git a/lib/compiler/implementation/ssa/optimize.dart b/lib/compiler/implementation/ssa/optimize.dart
index 2e2f3d354988d6368865494a8588ef65044ed71f..ac980346e831df32aabe8b55903662ec2775ca41 100644
--- a/lib/compiler/implementation/ssa/optimize.dart
+++ b/lib/compiler/implementation/ssa/optimize.dart
@@ -567,19 +567,21 @@ class SsaConstantFolder extends HBaseVisitor implements OptimizationPhase {
return (combinedType == types[value]) ? value : node;
}
- HInstruction visitInvokeDynamicGetter(HInvokeDynamicGetter node) {
- HInstruction receiver = node.inputs[0];
+ Element findConcreteFieldForDynamicAccess(HInstruction receiver,
+ Selector selector) {
HType receiverType = types[receiver];
- if (!receiverType.isUseful()) return node;
- if (receiverType.canBeNull()) return node;
+ if (!receiverType.isUseful()) return null;
+ if (receiverType.canBeNull()) return null;
Type type = receiverType.computeType(compiler);
- if (type === null) return node;
- Element field = compiler.world.locateSingleField(type, node.name);
- if (field === null) return node;
- if (node.name.isPrivate() &&
- field.getLibrary() !== work.element.getLibrary()) {
- return node;
- }
+ if (type === null) return null;
+ return compiler.world.locateSingleField(type, selector);
+ }
+
+ HInstruction visitInvokeDynamicGetter(HInvokeDynamicGetter node) {
+ Element field =
+ findConcreteFieldForDynamicAccess(node.receiver, node.selector);
+ if (field == null) return node;
+
Modifiers modifiers = field.modifiers;
bool isFinalOrConst = false;
if (modifiers != null) {
@@ -611,13 +613,8 @@ class SsaConstantFolder extends HBaseVisitor implements OptimizationPhase {
}
HInstruction visitInvokeDynamicSetter(HInvokeDynamicSetter node) {
- HInstruction receiver = node.inputs[0];
- HType receiverType = types[receiver];
- if (!receiverType.isUseful()) return node;
- if (receiverType.canBeNull()) return node;
- Type type = receiverType.computeType(compiler);
- if (type === null) return node;
- Element field = compiler.world.locateSingleField(type, node.name);
+ Element field =
+ findConcreteFieldForDynamicAccess(node.receiver, node.selector);
if (field === null) return node;
return new HFieldSet.withElement(field, node.inputs[0], node.inputs[1]);
}
« no previous file with comments | « lib/compiler/implementation/elements/elements.dart ('k') | lib/compiler/implementation/world.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698