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

Unified Diff: pkg/compiler/lib/src/cps_ir/scalar_replacement.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: Rebase Created 5 years, 2 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/scalar_replacement.dart
diff --git a/pkg/compiler/lib/src/cps_ir/scalar_replacement.dart b/pkg/compiler/lib/src/cps_ir/scalar_replacement.dart
index adb799e5bbcdc6acc986ff31afc7d6781950f2f8..0ff315c8627b47bcc8f7d86f91e8ecb4b59d7ed8 100644
--- a/pkg/compiler/lib/src/cps_ir/scalar_replacement.dart
+++ b/pkg/compiler/lib/src/cps_ir/scalar_replacement.dart
@@ -32,8 +32,6 @@ class ScalarReplacer extends Pass {
@override
void rewrite(FunctionDefinition root) {
- // Set all parent pointers.
- new ParentVisitor().visit(root);
ScalarReplacementVisitor analyzer =
new ScalarReplacementVisitor(_internalError, _classWorld);
analyzer.analyze(root);
@@ -45,7 +43,7 @@ class ScalarReplacer extends Pass {
* Do scalar replacement of aggregates on instances. Since scalar replacement
* can create new candidiates, iterate until all scalar replacements are done.
*/
-class ScalarReplacementVisitor extends RecursiveVisitor {
+class ScalarReplacementVisitor extends TrampolineRecursiveVisitor {
final InternalErrorFunction internalError;
final World classWorld;
@@ -176,6 +174,7 @@ class ScalarReplacementVisitor extends RecursiveVisitor {
void replacePrimitive(Primitive old, Primitive primitive) {
LetPrim letPrim = old.parent;
letPrim.primitive = primitive;
+ primitive.parent = letPrim;
}
void deleteLetPrimOf(Primitive primitive) {
@@ -217,7 +216,7 @@ class ScalarReplacementVisitor extends RecursiveVisitor {
/// Visit a just-deleted subterm and unlink all [Reference]s in it. Reconsider
/// allocations for scalar replacement.
-class ScalarReplacementRemovalVisitor extends RecursiveVisitor {
+class ScalarReplacementRemovalVisitor extends TrampolineRecursiveVisitor {
ScalarReplacementVisitor process;
ScalarReplacementRemovalVisitor(this.process);
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/remove_refinements.dart ('k') | pkg/compiler/lib/src/cps_ir/share_interceptors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698