| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 abstract class OptimizationPhase { | 7 abstract class OptimizationPhase { |
| 8 String get name; | 8 String get name; |
| 9 void visitGraph(HGraph graph); | 9 void visitGraph(HGraph graph); |
| 10 } | 10 } |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 SsaDeadCodeEliminator(this.types); | 745 SsaDeadCodeEliminator(this.types); |
| 746 | 746 |
| 747 bool isDeadCode(HInstruction instruction) { | 747 bool isDeadCode(HInstruction instruction) { |
| 748 return !instruction.hasSideEffects(types) | 748 return !instruction.hasSideEffects(types) |
| 749 && instruction.usedBy.isEmpty | 749 && instruction.usedBy.isEmpty |
| 750 // A dynamic getter that has no side effect can still throw | 750 // A dynamic getter that has no side effect can still throw |
| 751 // a NoSuchMethodError or a NullPointerException. | 751 // a NoSuchMethodError or a NullPointerException. |
| 752 && instruction is !HInvokeDynamicGetter | 752 && instruction is !HInvokeDynamicGetter |
| 753 && instruction is !HCheck | 753 && instruction is !HCheck |
| 754 && instruction is !HTypeGuard | 754 && instruction is !HTypeGuard |
| 755 && instruction is !HParameterValue |
| 755 && !instruction.isControlFlow(); | 756 && !instruction.isControlFlow(); |
| 756 } | 757 } |
| 757 | 758 |
| 758 void visitGraph(HGraph graph) { | 759 void visitGraph(HGraph graph) { |
| 759 visitPostDominatorTree(graph); | 760 visitPostDominatorTree(graph); |
| 760 } | 761 } |
| 761 | 762 |
| 762 void visitBasicBlock(HBasicBlock block) { | 763 void visitBasicBlock(HBasicBlock block) { |
| 763 HInstruction instruction = block.last; | 764 HInstruction instruction = block.last; |
| 764 while (instruction != null) { | 765 while (instruction != null) { |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1350 } | 1351 } |
| 1351 | 1352 |
| 1352 // For other fields having setters in the generative constructor body, set | 1353 // For other fields having setters in the generative constructor body, set |
| 1353 // the type to UNKNOWN to avoid relying on the type set in the initializer | 1354 // the type to UNKNOWN to avoid relying on the type set in the initializer |
| 1354 // list. | 1355 // list. |
| 1355 allSetters.forEach((Element element) { | 1356 allSetters.forEach((Element element) { |
| 1356 backend.registerFieldConstructor(element, HType.UNKNOWN); | 1357 backend.registerFieldConstructor(element, HType.UNKNOWN); |
| 1357 }); | 1358 }); |
| 1358 } | 1359 } |
| 1359 } | 1360 } |
| OLD | NEW |