| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 interface OptimizationPhase { | 5 interface OptimizationPhase { |
| 6 String get name(); | 6 String get name(); |
| 7 void visitGraph(HGraph graph); | 7 void visitGraph(HGraph graph); |
| 8 } | 8 } |
| 9 | 9 |
| 10 class SsaOptimizerTask extends CompilerTask { | 10 class SsaOptimizerTask extends CompilerTask { |
| (...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 List<HBasicBlock> predecessors = dominated.predecessors; | 992 List<HBasicBlock> predecessors = dominated.predecessors; |
| 993 for (int i = 0, length = predecessors.length; i < length; i++) { | 993 for (int i = 0, length = predecessors.length; i < length; i++) { |
| 994 HBasicBlock block = predecessors[i]; | 994 HBasicBlock block = predecessors[i]; |
| 995 int id = block.id; | 995 int id = block.id; |
| 996 // If the current predecessor block is on the path from the | 996 // If the current predecessor block is on the path from the |
| 997 // dominator to the dominated, it must have an id that is in the | 997 // dominator to the dominated, it must have an id that is in the |
| 998 // range from the dominator to the dominated. | 998 // range from the dominator to the dominated. |
| 999 if (dominator.id < id && id < dominated.id && !visited.contains(id)) { | 999 if (dominator.id < id && id < dominated.id && !visited.contains(id)) { |
| 1000 visited.add(id); | 1000 visited.add(id); |
| 1001 changesFlags |= blockChangesFlags[id]; | 1001 changesFlags |= blockChangesFlags[id]; |
| 1002 // Loop bodies might not be on the path from dominator to dominated, |
| 1003 // but they can invalidate values. |
| 1004 changesFlags |= loopChangesFlags[id]; |
| 1002 changesFlags |= getChangesFlagsForDominatedBlock(dominator, block); | 1005 changesFlags |= getChangesFlagsForDominatedBlock(dominator, block); |
| 1003 } | 1006 } |
| 1004 } | 1007 } |
| 1005 return changesFlags; | 1008 return changesFlags; |
| 1006 } | 1009 } |
| 1007 } | 1010 } |
| 1008 | 1011 |
| 1009 // This phase merges equivalent instructions on different paths into | 1012 // This phase merges equivalent instructions on different paths into |
| 1010 // one instruction in a dominator block. It runs through the graph | 1013 // one instruction in a dominator block. It runs through the graph |
| 1011 // post dominator order and computes a ValueSet for each block of | 1014 // post dominator order and computes a ValueSet for each block of |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 // this type for the field is still a strong signal | 1309 // this type for the field is still a strong signal |
| 1307 // indicating the expected type of the field. | 1310 // indicating the expected type of the field. |
| 1308 field.propagatedType = type; | 1311 field.propagatedType = type; |
| 1309 } else { | 1312 } else { |
| 1310 // If there are no invoked setters we know the type of | 1313 // If there are no invoked setters we know the type of |
| 1311 // this field for sure. | 1314 // this field for sure. |
| 1312 field.guaranteedType = type; | 1315 field.guaranteedType = type; |
| 1313 } | 1316 } |
| 1314 } | 1317 } |
| 1315 } | 1318 } |
| OLD | NEW |