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

Unified Diff: pkg/compiler/lib/src/cps_ir/insert_refinements.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/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/cps_ir/mutable_ssa.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/insert_refinements.dart
diff --git a/pkg/compiler/lib/src/cps_ir/insert_refinements.dart b/pkg/compiler/lib/src/cps_ir/insert_refinements.dart
index ec12543275f6e585eb251b777b09d364a4ace61f..afea3976dee6bb0de887eee47d1d8de6b271ba79 100644
--- a/pkg/compiler/lib/src/cps_ir/insert_refinements.dart
+++ b/pkg/compiler/lib/src/cps_ir/insert_refinements.dart
@@ -68,17 +68,9 @@ class InsertRefinements extends RecursiveVisitor implements Pass {
let = new LetCont(cont, null);
cont.parent = let;
} else {
- // Remove LetCont from current position.
- InteriorNode letParent = let.parent;
- letParent.body = let.body;
- let.body.parent = letParent;
+ let.remove(); // Reuse the existing LetCont.
}
-
- // Insert LetCont before use.
- useParent.body = let;
- let.body = use;
- use.parent = let;
- let.parent = useParent;
+ let.insertAbove(use);
}
Primitive unfoldInterceptor(Primitive prim) {
@@ -94,11 +86,11 @@ class InsertRefinements extends RecursiveVisitor implements Pass {
refinementFor[value] = currentRefinement;
if (refined.hasNoUses) {
// Clean up refinements that are not used.
- refined.value.unlink();
+ refined.destroy();
} else {
- cont.body = new LetPrim(refined, cont.body);
- refined.parent = cont.body;
- refined.value.parent = refined;
+ LetPrim let = new LetPrim(refined);
+ refined.parent = let;
+ let.insertBelow(cont);
}
});
push(cont);
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/cps_ir/mutable_ssa.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698