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

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

Issue 1375213003: dart2js cps: Maintain parent pointers instead of recomputing them. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix 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 4a1f34056156fdb184f01b250f4e70d3856e78cf..79ad510e3957e6608e47f1ffdbdafbf50c607a97 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/selector.dart' show Selector;
import '../types/types.dart' show TypeMask;
import '../io/source_information.dart';
import '../elements/elements.dart';
+import 'parent_visitor.dart';
/// Builds a CPS fragment that can be plugged into another CPS term.
///
@@ -83,6 +84,7 @@ class CpsFragment {
}
if (context != null) {
context.body = node;
+ node.parent = context;
}
context = null;
}
@@ -297,4 +299,19 @@ class CpsFragment {
put(let);
context = let;
}
+
+ void insertBelow(InteriorNode node) {
+ assert(isOpen);
+ if (isEmpty) return;
+ Expression child = node.body;
+ node.body = root;
+ root.parent = node;
+ context.body = child;
+ child.parent = context;
+ root = context = null;
+ }
+
+ void insertAbove(InteriorExpression node) {
+ insertBelow(node.parent);
+ }
}
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_integrity.dart » ('j') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698