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

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: 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/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 8c37b3ac201a5800178f8ce0a506e976b0d70912..9253ce68c0fbb75899904d78f955de4db1d9d9bd 100644
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
@@ -358,9 +358,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
@@ -405,7 +402,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;
@@ -512,7 +509,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);
}
@@ -557,7 +554,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;
@@ -1499,8 +1495,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;
}
}
@@ -2626,7 +2621,7 @@ class OriginalLengthEntity extends Entity {
String get name => 'length';
}
-class ResetAnalysisInfo extends RecursiveVisitor {
+class ResetAnalysisInfo extends TrampolineRecursiveVisitor {
Set<Continuation> reachableContinuations;
Map<Variable, ConstantValue> values;

Powered by Google App Engine
This is Rietveld 408576698