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

Unified Diff: pkg/compiler/lib/src/cps_ir/redundant_join.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
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/mutable_ssa.dart ('k') | pkg/compiler/lib/src/cps_ir/redundant_phi.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/redundant_join.dart
diff --git a/pkg/compiler/lib/src/cps_ir/redundant_join.dart b/pkg/compiler/lib/src/cps_ir/redundant_join.dart
index 747e701a26112abc500069caa1f4cd3e3ea04f28..d07d5190ab480754da3971396e74e6d0b89a72d5 100644
--- a/pkg/compiler/lib/src/cps_ir/redundant_join.dart
+++ b/pkg/compiler/lib/src/cps_ir/redundant_join.dart
@@ -64,20 +64,6 @@ class RedundantJoinEliminator extends RecursiveVisitor implements Pass {
}
}
- /// Removes [movedNode] from its current position and inserts it
- /// before [target].
- void moveToBefore(Expression target, LetCont movedNode) {
- if (movedNode.parent != null) {
- movedNode.parent.body = movedNode.body;
- movedNode.body.parent = movedNode.parent;
- }
- InteriorNode parent = target.parent;
- parent.body = movedNode;
- movedNode.body = target;
- target.parent = movedNode;
- movedNode.parent = parent;
- }
-
void rewriteBranch(Branch branch) {
InteriorNode parent = getEffectiveParent(branch);
if (parent is! Continuation) return;
@@ -161,7 +147,8 @@ class RedundantJoinEliminator extends RecursiveVisitor implements Pass {
}
}
}
- moveToBefore(outerLetCont, innerLetCont);
+ innerLetCont.remove();
+ innerLetCont.insertAbove(outerLetCont);
}
assert(branchCont.body == branch);
@@ -196,9 +183,7 @@ class RedundantJoinEliminator extends RecursiveVisitor implements Pass {
branch.falseContinuation.unlink();
outerLetCont.continuations.remove(branchCont);
if (outerLetCont.continuations.isEmpty) {
- InteriorNode parent = outerLetCont.parent;
- parent.body = outerLetCont.body;
- outerLetCont.body.parent = parent;
+ outerLetCont.remove();
}
// We may have created new redundant join points in the two branches.
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/mutable_ssa.dart ('k') | pkg/compiler/lib/src/cps_ir/redundant_phi.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698