| Index: pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart
|
| diff --git a/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart b/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart
|
| index 81e11376d91f244772402ea2a5da7ea595ccb20f..cf5061c409d760bd0c23b24b466e8411a65bd86f 100644
|
| --- a/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart
|
| +++ b/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart
|
| @@ -2,18 +2,20 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -part of dart2js.optimizers;
|
| +part of dart2js.cps_ir.optimizers;
|
|
|
| /**
|
| * [[ShrinkingReducer]] applies shrinking reductions to CPS terms as described
|
| * in 'Compiling with Continuations, Continued' by Andrew Kennedy.
|
| */
|
| -class ShrinkingReducer extends Pass {
|
| +class ShrinkingReducer extends PassMixin {
|
| _RedexVisitor _redexVisitor;
|
| Set<_ReductionTask> _worklist;
|
|
|
| static final _DeletedNode _DELETED = new _DeletedNode();
|
|
|
| + /// Applies shrinking reductions to root, mutating root in the process.
|
| + @override
|
| void rewriteExecutableDefinition(ExecutableDefinition root) {
|
| _worklist = new Set<_ReductionTask>();
|
| _redexVisitor = new _RedexVisitor(_worklist);
|
| @@ -32,18 +34,6 @@ class ShrinkingReducer extends Pass {
|
| }
|
| }
|
|
|
| - /// Applies shrinking reductions to root, mutating root in the process.
|
| - void rewriteFieldDefinition(FieldDefinition root) {
|
| - if (!root.hasInitializer) return;
|
| - rewriteExecutableDefinition(root);
|
| - }
|
| -
|
| - /// Applies shrinking reductions to root, mutating root in the process.
|
| - void rewriteFunctionDefinition(FunctionDefinition root) {
|
| - if (root.isAbstract) return;
|
| - rewriteExecutableDefinition(root);
|
| - }
|
| -
|
| /// Removes the given node from the CPS graph, replacing it with its body
|
| /// and marking it as deleted. The node's parent must be a [[InteriorNode]].
|
| void _removeNode(InteriorNode node) {
|
| @@ -304,17 +294,32 @@ class _RemovalRedexVisitor extends _RedexVisitor {
|
| /// Traverses the CPS term and sets node.parent for each visited node.
|
| class ParentVisitor extends RecursiveVisitor {
|
|
|
| - processFieldDefinition(FieldDefinition node) {
|
| + processFunctionDefinition(FunctionDefinition node) {
|
| node.body.parent = node;
|
| + node.parameters.forEach((Definition p) => p.parent = node);
|
| }
|
|
|
| - processFunctionDefinition(FunctionDefinition node) {
|
| + processRunnableBody(RunnableBody node) {
|
| + node.body.parent = node;
|
| + }
|
| +
|
| + processConstructorDefinition(ConstructorDefinition node) {
|
| node.body.parent = node;
|
| node.parameters.forEach((Definition p) => p.parent = node);
|
| + node.initializers.forEach((Initializer i) => i.parent = node);
|
| }
|
|
|
| // Expressions.
|
|
|
| + processFieldInitializer(FieldInitializer node) {
|
| + node.body.body.parent = node;
|
| + }
|
| +
|
| + processSuperInitializer(SuperInitializer node) {
|
| + node.arguments.forEach(
|
| + (RunnableBody argument) => argument.body.parent = node);
|
| + }
|
| +
|
| processLetPrim(LetPrim node) {
|
| node.primitive.parent = node;
|
| node.body.parent = node;
|
|
|