| Index: pkg/compiler/lib/src/cps_ir/constant_propagation.dart
|
| diff --git a/pkg/compiler/lib/src/cps_ir/constant_propagation.dart b/pkg/compiler/lib/src/cps_ir/constant_propagation.dart
|
| index c9adf089d055cb93124b59faaef4fa3db00dd64e..1bab9ddb2c575101df64fc502ee9ebe360b2924c 100644
|
| --- a/pkg/compiler/lib/src/cps_ir/constant_propagation.dart
|
| +++ b/pkg/compiler/lib/src/cps_ir/constant_propagation.dart
|
| @@ -2,7 +2,7 @@
|
| // 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;
|
|
|
| /**
|
| * Propagates constants throughout the IR, and replaces branches with fixed
|
| @@ -12,7 +12,7 @@ part of dart2js.optimizers;
|
| * Implemented according to 'Constant Propagation with Conditional Branches'
|
| * by Wegman, Zadeck.
|
| */
|
| -class ConstantPropagator extends Pass {
|
| +class ConstantPropagator extends PassMixin {
|
|
|
| // Required for type determination in analysis of TypeOperator expressions.
|
| final dart2js.Compiler _compiler;
|
| @@ -23,7 +23,8 @@ class ConstantPropagator extends Pass {
|
|
|
| ConstantPropagator(this._compiler, this._constantSystem);
|
|
|
| - void _rewriteExecutableDefinition(ExecutableDefinition root) {
|
| + @override
|
| + void rewriteExecutableDefinition(ExecutableDefinition root) {
|
| // Set all parent pointers.
|
| new ParentVisitor().visit(root);
|
|
|
| @@ -43,16 +44,6 @@ class ConstantPropagator extends Pass {
|
| transformer.transform(root);
|
| }
|
|
|
| - void rewriteFunctionDefinition(FunctionDefinition root) {
|
| - if (root.isAbstract) return;
|
| - _rewriteExecutableDefinition(root);
|
| - }
|
| -
|
| - void rewriteFieldDefinition(FieldDefinition root) {
|
| - if (!root.hasInitializer) return;
|
| - _rewriteExecutableDefinition(root);
|
| - }
|
| -
|
| }
|
|
|
| /**
|
| @@ -307,6 +298,10 @@ class _ConstPropagationVisitor extends Visitor {
|
| "_ConstPropagationVisitor is stale, add missing visit overrides");
|
| }
|
|
|
| + void visitRunnableBody(RunnableBody node) {
|
| + setReachable(node.body);
|
| + }
|
| +
|
| void visitFunctionDefinition(FunctionDefinition node) {
|
| node.parameters.forEach(visit);
|
| setReachable(node.body);
|
|
|