| 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
|
|
|