| 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.optimizers; | 5 part of dart2js.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 */ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // Process the worklist. | 27 // Process the worklist. |
| 28 while (_worklist.isNotEmpty) { | 28 while (_worklist.isNotEmpty) { |
| 29 _ReductionTask task = _worklist.first; | 29 _ReductionTask task = _worklist.first; |
| 30 _worklist.remove(task); | 30 _worklist.remove(task); |
| 31 _processTask(task); | 31 _processTask(task); |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 /// Applies shrinking reductions to root, mutating root in the process. | 35 /// Applies shrinking reductions to root, mutating root in the process. |
| 36 void rewriteFieldDefinition(FieldDefinition root) { | 36 void rewriteFieldDefinition(FieldDefinition root) { |
| 37 if (!root.hasInitializer) return; |
| 37 rewriteExecutableDefinition(root); | 38 rewriteExecutableDefinition(root); |
| 38 } | 39 } |
| 39 | 40 |
| 40 /// Applies shrinking reductions to root, mutating root in the process. | 41 /// Applies shrinking reductions to root, mutating root in the process. |
| 41 void rewriteFunctionDefinition(FunctionDefinition root) { | 42 void rewriteFunctionDefinition(FunctionDefinition root) { |
| 42 if (root.isAbstract) return; | 43 if (root.isAbstract) return; |
| 43 rewriteExecutableDefinition(root); | 44 rewriteExecutableDefinition(root); |
| 44 } | 45 } |
| 45 | 46 |
| 46 /// Removes the given node from the CPS graph, replacing it with its body | 47 /// Removes the given node from the CPS graph, replacing it with its body |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 } | 450 } |
| 450 | 451 |
| 451 String toString() => "$kind: $node"; | 452 String toString() => "$kind: $node"; |
| 452 } | 453 } |
| 453 | 454 |
| 454 /// A dummy class used solely to mark nodes as deleted once they are removed | 455 /// A dummy class used solely to mark nodes as deleted once they are removed |
| 455 /// from a term. | 456 /// from a term. |
| 456 class _DeletedNode extends Node { | 457 class _DeletedNode extends Node { |
| 457 accept(_) => null; | 458 accept(_) => null; |
| 458 } | 459 } |
| OLD | NEW |