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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_fragment.dart

Issue 1353443002: dart2js cps: Add a pass for eliminating bounds checks. (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/cps_fragment.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_fragment.dart b/pkg/compiler/lib/src/cps_ir/cps_fragment.dart
index a9190ddf77aea155692d8abd5577be719ce2a22e..1932a722a759a117aa053576c98bb75553fdd67c 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_fragment.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_fragment.dart
@@ -10,6 +10,7 @@ import '../universe/universe.dart' show Selector;
import '../types/types.dart' show TypeMask;
import '../io/source_information.dart';
import '../elements/elements.dart';
+import 'shrinking_reductions.dart' show ParentVisitor;
/// Builds a CPS fragment that can be plugged into another CPS term.
///
@@ -298,3 +299,17 @@ class CpsFragment {
context = let;
}
}
+
+/// Removes [node], unlinking all its references and replaces it with [newNode],
+/// setting all parent pointers in [newNode].
+///
+/// Be careful not to pass in a [newNode] containing a existing IR subtree as
+/// this will generally cause expensive redundant reprocessing.
+void replaceExpression(Expression node, Expression newNode) {
+ InteriorNode parent = node.parent;
+ RemovalVisitor.remove(node);
+ parent.body = newNode;
+ newNode.parent = parent;
+ ParentVisitor.setParentPointers(newNode);
+}
+

Powered by Google App Engine
This is Rietveld 408576698