| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.variable_merger; | 5 library tree_ir.optimization.variable_merger; |
| 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 /// Merges variables based on liveness and source variable information. | 10 /// Merges variables based on liveness and source variable information. |
| 11 /// | 11 /// |
| 12 /// This phase cleans up artifacts introduced by the translation through CPS, | 12 /// This phase cleans up artifacts introduced by the translation through CPS, |
| 13 /// where each source variable is translated into several copies. The copies | 13 /// where each source variable is translated into several copies. The copies |
| 14 /// are merged again when they are not live simultaneously. | 14 /// are merged again when they are not live simultaneously. |
| 15 class VariableMerger implements Pass { | 15 class VariableMerger implements Pass { |
| 16 String get passName => 'Variable merger'; | 16 String get passName => 'Variable merger'; |
| 17 | 17 |
| 18 final bool minifying; | 18 final bool minifying; |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 node.expression = visitExpression(node.expression); | 604 node.expression = visitExpression(node.expression); |
| 605 node.next = visitStatement(node.next); | 605 node.next = visitStatement(node.next); |
| 606 if (node.expression is VariableUse) { | 606 if (node.expression is VariableUse) { |
| 607 VariableUse use = node.expression; | 607 VariableUse use = node.expression; |
| 608 --use.variable.readCount; | 608 --use.variable.readCount; |
| 609 return node.next; | 609 return node.next; |
| 610 } | 610 } |
| 611 return node; | 611 return node; |
| 612 } | 612 } |
| 613 } | 613 } |
| OLD | NEW |