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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 class SsaDeadCodeEliminator extends HGraphVisitor implements OptimizationPhase { | 744 class SsaDeadCodeEliminator extends HGraphVisitor implements OptimizationPhase { |
745 final HTypeMap types; | 745 final HTypeMap types; |
746 final String name = "SsaDeadCodeEliminator"; | 746 final String name = "SsaDeadCodeEliminator"; |
747 | 747 |
748 SsaDeadCodeEliminator(this.types); | 748 SsaDeadCodeEliminator(this.types); |
749 | 749 |
750 bool isDeadCode(HInstruction instruction) { | 750 bool isDeadCode(HInstruction instruction) { |
751 return !instruction.hasSideEffects(types) | 751 return !instruction.hasSideEffects(types) |
752 && instruction.usedBy.isEmpty | 752 && instruction.usedBy.isEmpty |
753 // A dynamic getter that has no side effect can still throw | 753 // A dynamic getter that has no side effect can still throw |
754 // a NoSuchMethodError or a NullPointerException. | 754 // a NoSuchMethodError. |
755 && instruction is !HInvokeDynamicGetter | 755 && instruction is !HInvokeDynamicGetter |
756 && instruction is !HCheck | 756 && instruction is !HCheck |
757 && instruction is !HTypeGuard | 757 && instruction is !HTypeGuard |
758 && instruction is !HParameterValue | 758 && instruction is !HParameterValue |
759 && !instruction.isControlFlow(); | 759 && !instruction.isControlFlow(); |
760 } | 760 } |
761 | 761 |
762 void visitGraph(HGraph graph) { | 762 void visitGraph(HGraph graph) { |
763 visitPostDominatorTree(graph); | 763 visitPostDominatorTree(graph); |
764 } | 764 } |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1354 } | 1354 } |
1355 | 1355 |
1356 // For other fields having setters in the generative constructor body, set | 1356 // For other fields having setters in the generative constructor body, set |
1357 // the type to UNKNOWN to avoid relying on the type set in the initializer | 1357 // the type to UNKNOWN to avoid relying on the type set in the initializer |
1358 // list. | 1358 // list. |
1359 allSetters.forEach((Element element) { | 1359 allSetters.forEach((Element element) { |
1360 backend.registerFieldConstructor(element, HType.UNKNOWN); | 1360 backend.registerFieldConstructor(element, HType.UNKNOWN); |
1361 }); | 1361 }); |
1362 } | 1362 } |
1363 } | 1363 } |
OLD | NEW |