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

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

Issue 10831154: Make field-get/set work without elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
Index: lib/compiler/implementation/ssa/nodes.dart
diff --git a/lib/compiler/implementation/ssa/nodes.dart b/lib/compiler/implementation/ssa/nodes.dart
index 38d94e52371636cce5e4a3b41703e16e48a78331..1db7e68c5f732a6c5a7ce32b0d83593a6d04efef 100644
--- a/lib/compiler/implementation/ssa/nodes.dart
+++ b/lib/compiler/implementation/ssa/nodes.dart
@@ -1308,16 +1308,29 @@ class HInvokeInterceptor extends HInvokeStatic {
abstract class HFieldAccess extends HInstruction {
final Element element;
+ final SourceString fieldName;
+ final LibraryElement libraryElement;
kasperl 2012/08/07 08:14:20 Maybe shorten this to library?
floitsch 2012/08/07 12:20:16 Done.
- HFieldAccess(this.element, List<HInstruction> inputs) : super(inputs);
+ HFieldAccess(this.fieldName, this.libraryElement, List<HInstruction> inputs)
+ : element = null, super(inputs);
+
+ HFieldAccess.withElement(Element element, List<HInstruction> inputs)
+ : this.element = element,
+ fieldName = element.name,
+ libraryElement = element.getLibrary(),
+ super(inputs);
}
class HFieldGet extends HFieldAccess {
final bool isFinalOrConst;
- HFieldGet(Element element, HInstruction receiver,
+ HFieldGet(SourceString name, LibraryElement library, HInstruction receiver,
[this.isFinalOrConst = false])
- : super(element, <HInstruction>[receiver]);
+ : super(name, library, <HInstruction>[receiver]);
+
+ HFieldGet.withElement(Element element, HInstruction receiver,
+ [this.isFinalOrConst = false])
+ : super.withElement(element, <HInstruction>[receiver]);
HInstruction get receiver() => inputs[0];
@@ -1332,12 +1345,20 @@ class HFieldGet extends HFieldAccess {
int typeCode() => 27;
bool typeEquals(other) => other is HFieldGet;
bool dataEquals(HFieldGet other) => element == other.element;
- String toString() => "FieldGet $element";
+ String toString() => "FieldGet ${element == null ? fieldName : element}";
}
class HFieldSet extends HFieldAccess {
- HFieldSet(Element element, HInstruction receiver, HInstruction value)
- : super(element, <HInstruction>[receiver, value]);
+ HFieldSet(SourceString name,
+ LibraryElement library,
+ HInstruction receiver,
+ HInstruction value)
+ : super(name, library, <HInstruction>[receiver, value]);
+
+ HFieldSet.withElement(Element element,
+ HInstruction receiver,
+ HInstruction value)
+ : super.withElement(element, <HInstruction>[receiver, value]);
HInstruction get receiver() => inputs[0];
HInstruction get value() => inputs[1];
@@ -1349,11 +1370,12 @@ class HFieldSet extends HFieldAccess {
}
final bool isStatement = true;
- String toString() => "FieldSet $element";
+ String toString() => "FieldSet ${element == null ? fieldName : element}";
}
class HLocalGet extends HFieldGet {
- HLocalGet(Element element, HLocalValue local) : super(element, local);
+ HLocalGet(Element element, HLocalValue local)
+ : super.withElement(element, local);
accept(HVisitor visitor) => visitor.visitLocalGet(this);
@@ -1370,7 +1392,7 @@ class HLocalGet extends HFieldGet {
class HLocalSet extends HFieldSet {
HLocalSet(Element element, HLocalValue local, HInstruction value)
- : super(element, local, value);
+ : super.withElement(element, local, value);
accept(HVisitor visitor) => visitor.visitLocalSet(this);

Powered by Google App Engine
This is Rietveld 408576698