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

Unified Diff: pkg/compiler/lib/src/cps_ir/redundant_phi.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/redundant_phi.dart
diff --git a/pkg/compiler/lib/src/cps_ir/redundant_phi.dart b/pkg/compiler/lib/src/cps_ir/redundant_phi.dart
index e678a968efcf9fee1f8ba667aa715a210a08d24f..693b612d6858c901c18fec4f69a8858e74027ad8 100644
--- a/pkg/compiler/lib/src/cps_ir/redundant_phi.dart
+++ b/pkg/compiler/lib/src/cps_ir/redundant_phi.dart
@@ -187,19 +187,9 @@ bool _isInScopeOf(LetCont letCont, Definition definition) {
void _moveIntoScopeOf(LetCont letCont, Definition definition) {
if (_isInScopeOf(letCont, definition)) return;
- // Remove the continuation binding from its current spot.
- InteriorNode parent = letCont.parent;
- parent.body = letCont.body;
- letCont.body.parent = parent;
-
- // Insert it just below the binding of definition.
InteriorNode binding = definition.parent;
-
- letCont.body = binding.body;
- binding.body.parent = letCont;
-
- binding.body = letCont;
- letCont.parent = binding;
+ letCont.remove();
+ letCont.insertBelow(binding);
}
/// Ensures [continuation] has its own LetCont binding by creating
@@ -210,10 +200,8 @@ LetCont _makeUniqueBinding(Continuation continuation) {
LetCont letCont = continuation.parent;
if (letCont.continuations.length == 1) return letCont;
letCont.continuations.remove(continuation);
- LetCont newBinding = new LetCont(continuation, letCont.body);
- newBinding.body.parent = newBinding;
- newBinding.parent = letCont;
- letCont.body = newBinding;
+ LetCont newBinding = new LetCont(continuation, null);
continuation.parent = newBinding;
+ newBinding.insertBelow(letCont);
return newBinding;
}
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/redundant_join.dart ('k') | pkg/compiler/lib/src/cps_ir/remove_refinements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698