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

Unified Diff: pkg/compiler/lib/src/cps_ir/redundant_phi.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/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 ae57325dff142de9c48634b8f72fb5ecd28aa61c..e678a968efcf9fee1f8ba667aa715a210a08d24f 100644
--- a/pkg/compiler/lib/src/cps_ir/redundant_phi.dart
+++ b/pkg/compiler/lib/src/cps_ir/redundant_phi.dart
@@ -187,9 +187,19 @@ 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.remove();
- letCont.insertBelow(binding);
+
+ letCont.body = binding.body;
+ binding.body.parent = letCont;
+
+ binding.body = letCont;
+ letCont.parent = binding;
}
/// Ensures [continuation] has its own LetCont binding by creating
@@ -201,7 +211,9 @@ LetCont _makeUniqueBinding(Continuation continuation) {
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;
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