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

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

Issue 1155463005: dart2js cps: Remove dart2dart from cps pipeline and clean up. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Skip tests specific to the dart backend Created 5 years, 7 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 842d460e100272048de5271cc68f01f3cac6d5e4..8b7141f1303cf5c31c266239a4a9af1509b6fc2f 100644
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
@@ -134,9 +134,7 @@ class TypePropagator<T> extends Pass {
: _types = <Node, _AbstractValue>{};
@override
- void rewrite(RootNode root) {
- if (root.isEmpty) return;
-
+ void rewrite(FunctionDefinition root) {
// Set all parent pointers.
new ParentVisitor().visit(root);
@@ -178,7 +176,7 @@ class _TransformingVisitor<T> extends RecursiveVisitor {
this.internalError,
this.typeSystem);
- void transform(RootNode root) {
+ void transform(FunctionDefinition root) {
visit(root);
}
@@ -384,7 +382,7 @@ class _TypePropagationVisitor<T> implements Visitor {
this._dartTypes)
: this.typeSystem = typeSystem;
- void analyze(RootNode root) {
+ void analyze(FunctionDefinition root) {
reachableNodes.clear();
defWorkset.clear();
nodeWorklist.clear();
@@ -453,10 +451,6 @@ class _TypePropagationVisitor<T> implements Visitor {
// -------------------------- Visitor overrides ------------------------------
void visit(Node node) { node.accept(this); }
- void visitFieldDefinition(FieldDefinition node) {
- setReachable(node.body);
- }
-
void visitFunctionDefinition(FunctionDefinition node) {
if (node.thisParameter != null) {
setValue(node.thisParameter, nonConstant());
@@ -465,26 +459,6 @@ class _TypePropagationVisitor<T> implements Visitor {
setReachable(node.body);
}
- void visitConstructorDefinition(ConstructorDefinition node) {
- node.parameters.forEach(visit);
- node.initializers.forEach(visit);
- setReachable(node.body);
- }
-
- void visitBody(Body node) {
- setReachable(node.body);
- }
-
- void visitFieldInitializer(FieldInitializer node) {
- setReachable(node.body);
- }
-
- void visitSuperInitializer(SuperInitializer node) {
- node.arguments.forEach(setReachable);
- }
-
- // Expressions.
-
void visitLetPrim(LetPrim node) {
visit(node.primitive); // No reason to delay visits to primitives.
setReachable(node.body);
@@ -747,12 +721,6 @@ class _TypePropagationVisitor<T> implements Visitor {
setReachable(node.body);
}
- void visitDeclareFunction(DeclareFunction node) {
- setReachable(node.definition);
- setReachable(node.body);
- }
-
- // Definitions.
void visitLiteralList(LiteralList node) {
// Constant lists are translated into (Constant ListConstant(...)) IR nodes,
// and thus LiteralList nodes are NonConst.
@@ -770,10 +738,6 @@ class _TypePropagationVisitor<T> implements Visitor {
setValue(node, constantValue(value, typeSystem.typeOf(value)));
}
- void visitReifyTypeVar(ReifyTypeVar node) {
- setValue(node, nonConstant(typeSystem.typeType));
- }
-
void visitCreateFunction(CreateFunction node) {
setReachable(node.definition);
ConstantValue constant =
@@ -787,8 +751,8 @@ class _TypePropagationVisitor<T> implements Visitor {
void visitMutableVariable(MutableVariable node) {
// [MutableVariable]s are bound either as parameters to
- // [FunctionDefinition]s, by [LetMutable], or by [DeclareFunction].
- if (node.parent is RootNode) {
+ // [FunctionDefinition]s, by [LetMutable].
+ if (node.parent is FunctionDefinition) {
// Just like immutable parameters, the values of mutable parameters are
// never constant.
// TODO(karlklose): remove reference to the element model.
@@ -797,9 +761,8 @@ class _TypePropagationVisitor<T> implements Visitor {
? typeSystem.getParameterType(source)
: typeSystem.dynamicType;
setValue(node, nonConstant(type));
- } else if (node.parent is LetMutable || node.parent is DeclareFunction) {
- // Mutable values bound by LetMutable or DeclareFunction could have
- // known values.
+ } else if (node.parent is LetMutable) {
+ // Mutable values bound by LetMutable could have known values.
} else {
internalError(node.hint, "Unexpected parent of MutableVariable");
}
@@ -811,7 +774,7 @@ class _TypePropagationVisitor<T> implements Visitor {
T type = (source is ParameterElement)
? typeSystem.getParameterType(source)
: typeSystem.dynamicType;
- if (node.parent is RootNode) {
+ if (node.parent is FunctionDefinition) {
// Functions may escape and thus their parameters must be non-constant.
setValue(node, nonConstant(type));
} else if (node.parent is Continuation) {
@@ -847,15 +810,11 @@ class _TypePropagationVisitor<T> implements Visitor {
setValue(returnValue, nonConstant());
}
- // Conditions.
-
void visitIsTrue(IsTrue node) {
Branch branch = node.parent;
visitBranch(branch);
}
- // JavaScript specific nodes.
-
void visitIdentical(Identical node) {
_AbstractValue<T> leftConst = getValue(node.left.definition);
_AbstractValue<T> rightConst = getValue(node.right.definition);
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart ('k') | pkg/compiler/lib/src/dart_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698