| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart2js.cps_ir.optimizers; | 5 part of dart2js.cps_ir.optimizers; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * [ShrinkingReducer] applies shrinking reductions to CPS terms as described | 8 * [ShrinkingReducer] applies shrinking reductions to CPS terms as described |
| 9 * in 'Compiling with Continuations, Continued' by Andrew Kennedy. | 9 * in 'Compiling with Continuations, Continued' by Andrew Kennedy. |
| 10 */ | 10 */ |
| 11 class ShrinkingReducer extends PassMixin { | 11 class ShrinkingReducer extends PassMixin { |
| 12 String get passName => 'Shrinking reductions'; |
| 13 |
| 12 Set<_ReductionTask> _worklist; | 14 Set<_ReductionTask> _worklist; |
| 13 | 15 |
| 14 static final _DeletedNode _DELETED = new _DeletedNode(); | 16 static final _DeletedNode _DELETED = new _DeletedNode(); |
| 15 | 17 |
| 16 /// Applies shrinking reductions to root, mutating root in the process. | 18 /// Applies shrinking reductions to root, mutating root in the process. |
| 17 @override | 19 @override |
| 18 void rewriteExecutableDefinition(ExecutableDefinition root) { | 20 void rewriteExecutableDefinition(ExecutableDefinition root) { |
| 19 _worklist = new Set<_ReductionTask>(); | 21 _worklist = new Set<_ReductionTask>(); |
| 20 _RedexVisitor redexVisitor = new _RedexVisitor(_worklist); | 22 _RedexVisitor redexVisitor = new _RedexVisitor(_worklist); |
| 21 | 23 |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 } | 700 } |
| 699 | 701 |
| 700 String toString() => "$kind: $node"; | 702 String toString() => "$kind: $node"; |
| 701 } | 703 } |
| 702 | 704 |
| 703 /// A dummy class used solely to mark nodes as deleted once they are removed | 705 /// A dummy class used solely to mark nodes as deleted once they are removed |
| 704 /// from a term. | 706 /// from a term. |
| 705 class _DeletedNode extends Node { | 707 class _DeletedNode extends Node { |
| 706 accept(_) => null; | 708 accept(_) => null; |
| 707 } | 709 } |
| OLD | NEW |