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

Unified Diff: pkg/compiler/lib/src/cps_ir/share_interceptors.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/scalar_replacement.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/share_interceptors.dart
diff --git a/pkg/compiler/lib/src/cps_ir/share_interceptors.dart b/pkg/compiler/lib/src/cps_ir/share_interceptors.dart
index a4552008bb5ec2c3a74d4b562e96831b610ffe44..5ae912e81d0baa0b4698bff409c298eb1ecb024b 100644
--- a/pkg/compiler/lib/src/cps_ir/share_interceptors.dart
+++ b/pkg/compiler/lib/src/cps_ir/share_interceptors.dart
@@ -94,10 +94,8 @@ class ShareInterceptors extends RecursiveVisitor implements Pass {
existing.interceptedClasses.addAll(interceptor.interceptedClasses);
}
existing.substituteFor(interceptor);
- InteriorNode parent = node.parent;
- parent.body = node.body;
- node.body.parent = parent;
- interceptor.input.unlink();
+ interceptor.destroy();
+ node.remove();
return next;
}
@@ -109,10 +107,8 @@ class ShareInterceptors extends RecursiveVisitor implements Pass {
existing = sharedConstantFor[constant];
if (existing != null) {
existing.substituteFor(interceptor);
- InteriorNode parent = node.parent;
- parent.body = node.body;
- node.body.parent = parent;
- interceptor.input.unlink();
+ interceptor.destroy();
+ node.remove();
return next;
}
@@ -122,7 +118,7 @@ class ShareInterceptors extends RecursiveVisitor implements Pass {
constantPrim.hint = interceptor.hint;
constantPrim.type = interceptor.type;
constantPrim.substituteFor(interceptor);
- interceptor.input.unlink();
+ interceptor.destroy();
sharedConstantFor[constant] = constantPrim;
} else {
interceptorFor[input] = interceptor;
@@ -147,18 +143,10 @@ class ShareInterceptors extends RecursiveVisitor implements Pass {
}
assert(loop != null);
- // Remove LetPrim from its current position.
- InteriorNode parent = node.parent;
- parent.body = node.body;
- node.body.parent = parent;
-
- // Insert the LetPrim immediately before the loop.
+ // Move the LetPrim above the loop binding.
LetCont loopBinding = loop.parent;
- InteriorNode newParent = loopBinding.parent;
- newParent.body = node;
- node.body = loopBinding;
- loopBinding.parent = node;
- node.parent = newParent;
+ node.remove();
+ node.insertAbove(loopBinding);
// A different loop now contains the interceptor.
loopHeaderFor[node.primitive] = enclosing;
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/scalar_replacement.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698