| 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 library tree_ir.optimization.loop_rewriter; | 5 library tree_ir.optimization.loop_rewriter; |
| 6 | 6 |
| 7 import '../tree_ir_nodes.dart'; |
| 7 import 'optimization.dart' show Pass; | 8 import 'optimization.dart' show Pass; |
| 8 import '../tree_ir_nodes.dart'; | |
| 9 | 9 |
| 10 /// Rewrites [WhileTrue] statements into [For] statements. | 10 /// Rewrites [WhileTrue] statements into [For] statements. |
| 11 /// | 11 /// |
| 12 /// Before this phase, loops usually contain a lot of "exit code", that is, | 12 /// Before this phase, loops usually contain a lot of "exit code", that is, |
| 13 /// code that happens at a point where a [Continue] can no longer be reached, | 13 /// code that happens at a point where a [Continue] can no longer be reached, |
| 14 /// and is therefore not really part of the loop. | 14 /// and is therefore not really part of the loop. |
| 15 /// Exit code is moved down after the loop using the following rewrites rules: | 15 /// Exit code is moved down after the loop using the following rewrites rules: |
| 16 /// | 16 /// |
| 17 /// EXTRACT LABELED STATEMENT: | 17 /// EXTRACT LABELED STATEMENT: |
| 18 /// | 18 /// |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } else { | 186 } else { |
| 187 return next; | 187 return next; |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 // The expression statements could not be pulled into a loop update. | 191 // The expression statements could not be pulled into a loop update. |
| 192 node.next = next; | 192 node.next = next; |
| 193 return statements.first; | 193 return statements.first; |
| 194 } | 194 } |
| 195 } | 195 } |
| OLD | NEW |