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

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

Issue 1386343003: Revert "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, 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 db089cd344f07e9d53709eb29758d87beb00bd32..0a2b4cef8060d3aa61435b707c5d6d69397d3fc1 100644
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
@@ -361,6 +361,9 @@ 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 +408,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 DeepRecursiveVisitor {
+class TransformingVisitor extends LeafVisitor {
final TypePropagationVisitor analyzer;
final Map<Expression, ConstantValue> replacements;
final ConstantPropagationLattice lattice;
@@ -512,7 +515,7 @@ class TransformingVisitor extends DeepRecursiveVisitor {
/// Sets parent pointers and computes types for the given subtree.
void reanalyze(Node node) {
- ParentVisitor.setParents(node);
+ new ParentVisitor().visit(node);
analyzer.reanalyzeSubtree(node);
}
@@ -557,6 +560,7 @@ class TransformingVisitor extends DeepRecursiveVisitor {
// 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;
@@ -1498,7 +1502,8 @@ class TransformingVisitor extends DeepRecursiveVisitor {
// target definitely does not use it.
Constant dummy = makeConstantPrimitive(new IntConstantValue(0));
insertLetPrim(node, dummy);
- node.arguments[0].changeTo(dummy);
+ node.arguments[0].unlink();
+ node.arguments[0] = new Reference<Primitive>(dummy);
node.receiverIsIntercepted = false;
}
}
@@ -2693,7 +2698,7 @@ class OriginalLengthEntity extends Entity {
String get name => 'length';
}
-class ResetAnalysisInfo extends TrampolineRecursiveVisitor {
+class ResetAnalysisInfo extends RecursiveVisitor {
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