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

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

Issue 1375513002: dart2js cps: Add helpers for common IR manipulation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix type annotation Created 5 years, 3 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/mutable_ssa.dart
diff --git a/pkg/compiler/lib/src/cps_ir/mutable_ssa.dart b/pkg/compiler/lib/src/cps_ir/mutable_ssa.dart
index 3dea17c0ba40cf1418c74a096b7e34dcecd095c0..e2252c4d55eecf9c45e77f541b1c1db126ad722c 100644
--- a/pkg/compiler/lib/src/cps_ir/mutable_ssa.dart
+++ b/pkg/compiler/lib/src/cps_ir/mutable_ssa.dart
@@ -114,12 +114,6 @@ class MutableVariableEliminator implements Pass {
cont.firstRef.parent is InvokeContinuation;
}
- void removeNode(InteriorNode node) {
- InteriorNode parent = node.parent;
- parent.body = node.body;
- node.body.parent = parent;
- }
-
/// If some useful source information is attached to exactly one of the
/// two definitions, the information is copied onto the other.
void mergeHints(MutableVariable variable, Primitive value) {
@@ -139,7 +133,8 @@ class MutableVariableEliminator implements Pass {
/// Continuations to be processed are put on the stack for later processing.
void processBlock(Expression node,
Map<MutableVariable, Primitive> environment) {
- for (; node is! TailExpression; node = node.next) {
+ Expression next = node.next;
+ for (; node is! TailExpression; node = next, next = node.next) {
if (node is LetMutable && shouldRewrite(node.variable)) {
// Put the new mutable variable on the stack while processing the body,
// and pop it off again when done with the body.
@@ -155,7 +150,7 @@ class MutableVariableEliminator implements Pass {
// Remove the mutable variable binding.
node.value.unlink();
- removeNode(node);
+ node.remove();
} else if (node is LetPrim && node.primitive is SetMutable) {
SetMutable setter = node.primitive;
MutableVariable variable = setter.variable.definition;
@@ -165,7 +160,7 @@ class MutableVariableEliminator implements Pass {
environment[variable] = setter.value.definition;
mergeHints(variable, setter.value.definition);
setter.value.unlink();
- removeNode(node);
+ node.remove();
}
} else if (node is LetPrim && node.primitive is GetMutable) {
GetMutable getter = node.primitive;
@@ -175,7 +170,7 @@ class MutableVariableEliminator implements Pass {
Primitive value = environment[variable];
value.substituteFor(getter);
mergeHints(variable, value);
- removeNode(node);
+ node.remove();
}
} else if (node is LetCont) {
// Create phi parameters for each join continuation bound here, and put
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/insert_refinements.dart ('k') | pkg/compiler/lib/src/cps_ir/redundant_join.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698