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

Unified Diff: pkg/compiler/lib/src/cps_ir/type_propagation.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/type_propagation.dart
diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
index fa48c8436cf40d289e944a71142155bc5d0e31e4..bb458ce02ab0db24f7498360fc3c2b94d6521847 100644
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
@@ -581,9 +581,6 @@ class TypePropagator extends Pass {
@override
void rewrite(FunctionDefinition root) {
- // Set all parent pointers.
- new ParentVisitor().visit(root);
-
Map<Expression, ConstantValue> replacements = <Expression, ConstantValue>{};
// Analyze. In this phase, the entire term is analyzed for reachability
@@ -629,7 +626,7 @@ final Map<String, BuiltinOperator> NumBinaryBuiltins =
* Uses the information from a preceding analysis pass in order to perform the
* actual transformations on the CPS graph.
*/
-class TransformingVisitor extends LeafVisitor {
+class TransformingVisitor extends DeepRecursiveVisitor {
final TypePropagationVisitor analyzer;
final Map<Expression, ConstantValue> replacements;
final ConstantPropagationLattice lattice;
@@ -736,7 +733,7 @@ class TransformingVisitor extends LeafVisitor {
/// Sets parent pointers and computes types for the given subtree.
void reanalyze(Node node) {
- new ParentVisitor().visit(node);
+ ParentVisitor.setParents(node);
analyzer.reanalyzeSubtree(node);
}
@@ -781,7 +778,6 @@ class TransformingVisitor extends LeafVisitor {
// traversing the entire subtree of [node]. Temporarily close the
// term with a dummy node while recomputing types.
context.body = new Unreachable();
- new ParentVisitor().visit(insertedCode.root);
reanalyze(insertedCode.root);
context.body = node;
@@ -1764,8 +1760,7 @@ class TransformingVisitor extends LeafVisitor {
// target definitely does not use it.
Constant dummy = makeConstantPrimitive(new IntConstantValue(0));
insertLetPrim(node, dummy);
- node.arguments[0].unlink();
- node.arguments[0] = new Reference<Primitive>(dummy);
+ node.arguments[0].changeTo(dummy);
node.receiverIsIntercepted = false;
}
}
@@ -3024,7 +3019,7 @@ class OriginalLengthEntity extends Entity {
String get name => 'length';
}
-class ResetAnalysisInfo extends RecursiveVisitor {
+class ResetAnalysisInfo extends TrampolineRecursiveVisitor {
Set<Continuation> reachableContinuations;
Map<Variable, ConstantValue> values;
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698