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

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

Issue 1380513002: Revert "dart2js cps: Add helpers for common IR manipulation." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 e2252c4d55eecf9c45e77f541b1c1db126ad722c..3dea17c0ba40cf1418c74a096b7e34dcecd095c0 100644
--- a/pkg/compiler/lib/src/cps_ir/mutable_ssa.dart
+++ b/pkg/compiler/lib/src/cps_ir/mutable_ssa.dart
@@ -114,6 +114,12 @@ 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) {
@@ -133,8 +139,7 @@ class MutableVariableEliminator implements Pass {
/// Continuations to be processed are put on the stack for later processing.
void processBlock(Expression node,
Map<MutableVariable, Primitive> environment) {
- Expression next = node.next;
- for (; node is! TailExpression; node = next, next = node.next) {
+ for (; node is! TailExpression; node = 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.
@@ -150,7 +155,7 @@ class MutableVariableEliminator implements Pass {
// Remove the mutable variable binding.
node.value.unlink();
- node.remove();
+ removeNode(node);
} else if (node is LetPrim && node.primitive is SetMutable) {
SetMutable setter = node.primitive;
MutableVariable variable = setter.variable.definition;
@@ -160,7 +165,7 @@ class MutableVariableEliminator implements Pass {
environment[variable] = setter.value.definition;
mergeHints(variable, setter.value.definition);
setter.value.unlink();
- node.remove();
+ removeNode(node);
}
} else if (node is LetPrim && node.primitive is GetMutable) {
GetMutable getter = node.primitive;
@@ -170,7 +175,7 @@ class MutableVariableEliminator implements Pass {
Primitive value = environment[variable];
value.substituteFor(getter);
mergeHints(variable, value);
- node.remove();
+ removeNode(node);
}
} 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