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

Unified Diff: pkg/compiler/lib/src/cps_ir/insert_refinements.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: Fix 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/insert_refinements.dart
diff --git a/pkg/compiler/lib/src/cps_ir/insert_refinements.dart b/pkg/compiler/lib/src/cps_ir/insert_refinements.dart
index afea3976dee6bb0de887eee47d1d8de6b271ba79..4dded8d127ae2879f6b16268224d4c7815cb0735 100644
--- a/pkg/compiler/lib/src/cps_ir/insert_refinements.dart
+++ b/pkg/compiler/lib/src/cps_ir/insert_refinements.dart
@@ -5,7 +5,6 @@
library cps_ir.optimization.insert_refinements;
import 'optimizers.dart' show Pass;
-import 'shrinking_reductions.dart' show ParentVisitor;
import 'cps_ir_nodes.dart';
import '../types/constants.dart';
import '../constants/values.dart';
@@ -23,7 +22,7 @@ import 'type_mask_system.dart';
///
/// Refinement nodes are inserted after a method invocation to refine the
/// receiver to the types that can respond to the given selector.
-class InsertRefinements extends RecursiveVisitor implements Pass {
+class InsertRefinements extends TrampolineRecursiveVisitor implements Pass {
String get passName => 'Insert refinement nodes';
final TypeMaskSystem types;
@@ -34,7 +33,6 @@ class InsertRefinements extends RecursiveVisitor implements Pass {
InsertRefinements(this.types);
void rewrite(FunctionDefinition node) {
- new ParentVisitor().visit(node);
visit(node.body);
}
@@ -80,6 +78,7 @@ class InsertRefinements extends RecursiveVisitor implements Pass {
/// Enqueues [cont] for processing in a context where [refined] is the
/// current refinement for its value.
void pushRefinement(Continuation cont, Refinement refined) {
+ refined.value.parent = refined;
Kevin Millikin (Google) 2015/10/05 12:04:37 Is this necessary here? It looks like the constru
asgerf 2015/10/12 13:18:32 You're right, done.
Primitive value = refined.effectiveDefinition;
Primitive currentRefinement = refinementFor[value];
pushAction(() {
@@ -121,7 +120,8 @@ class InsertRefinements extends RecursiveVisitor implements Pass {
} else {
// Filter away receivers that throw on this selector.
TypeMask type = types.receiverTypeFor(node.selector, node.mask);
- pushRefinement(cont, new Refinement(receiver, type));
+ Refinement refinement = new Refinement(receiver, type);
+ pushRefinement(cont, refinement);
}
}

Powered by Google App Engine
This is Rietveld 408576698