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

Unified Diff: pkg/compiler/lib/src/cps_ir/use_field_initializers.dart

Issue 1743283002: dart2js cps: Use definitions by default, not references. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix doc comments and long lines Created 4 years, 10 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: pkg/compiler/lib/src/cps_ir/use_field_initializers.dart
diff --git a/pkg/compiler/lib/src/cps_ir/use_field_initializers.dart b/pkg/compiler/lib/src/cps_ir/use_field_initializers.dart
index a8944c627372264fa38aa1f5da118445ad169a18..ca510f78d6fa06e9e102ed7949d78d9777331213 100644
--- a/pkg/compiler/lib/src/cps_ir/use_field_initializers.dart
+++ b/pkg/compiler/lib/src/cps_ir/use_field_initializers.dart
@@ -94,7 +94,7 @@ class UseFieldInitializers extends BlockVisitor implements Pass {
}
void visitLetMutable(LetMutable node) {
- escape(node.value);
+ escape(node.valueRef);
}
void visitLetCont(LetCont node) {
@@ -125,24 +125,24 @@ class UseFieldInitializers extends BlockVisitor implements Pass {
Primitive prim = node.primitive;
if (prim is CreateInstance) {
unescaped.add(prim);
- prim.arguments.forEach(escape);
+ prim.argumentRefs.forEach(escape);
return;
}
if (unescaped.isEmpty) return;
if (prim is SetField) {
- escape(prim.value);
- Primitive object = prim.object.definition;
+ escape(prim.valueRef);
+ Primitive object = prim.object;
if (object is CreateInstance && unescaped.contains(object)) {
int index = getFieldIndex(object.classElement, prim.field);
if (index == -1) {
// This field is not initialized at creation time, so we cannot pull
// set SetField into the CreateInstance instruction. We have to
// leave the instruction here, and this counts as a use of the object.
- escape(prim.object);
+ escape(prim.objectRef);
} else {
// Replace the field initializer with the new value. There are no uses
// of the object before this, so the old value cannot have been seen.
- object.arguments[index].changeTo(prim.value.definition);
+ object.argumentRefs[index].changeTo(prim.value);
prim.destroy();
// The right-hand side might not be in scope at the CreateInstance.
// Sink the creation down to this point.
@@ -156,13 +156,13 @@ class UseFieldInitializers extends BlockVisitor implements Pass {
// When reading the field of a newly created object, just use the initial
// value and destroy the GetField. This can unblock the other optimization
// since we remove a use of the object.
- Primitive object = prim.object.definition;
+ Primitive object = prim.object;
if (object is CreateInstance && unescaped.contains(object)) {
int index = getFieldIndex(object.classElement, prim.field);
if (index == -1) {
- escape(prim.object);
+ escape(prim.objectRef);
} else {
- prim.replaceUsesWith(object.arguments[index].definition);
+ prim.replaceUsesWith(object.argument(index));
prim.destroy();
node.remove();
}

Powered by Google App Engine
This is Rietveld 408576698