Chromium Code Reviews| 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 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1123 final String name = "SsaTypeconversionInserter"; | 1123 final String name = "SsaTypeconversionInserter"; |
| 1124 final Compiler compiler; | 1124 final Compiler compiler; |
| 1125 | 1125 |
| 1126 SsaTypeConversionInserter(this.compiler); | 1126 SsaTypeConversionInserter(this.compiler); |
| 1127 | 1127 |
| 1128 void visitGraph(HGraph graph) { | 1128 void visitGraph(HGraph graph) { |
| 1129 visitDominatorTree(graph); | 1129 visitDominatorTree(graph); |
| 1130 } | 1130 } |
| 1131 | 1131 |
| 1132 | 1132 |
| 1133 // Update users of [input] that are dominated by [:dominator.first:] | 1133 // Update users of [input] that are dominated by [:dominator.first:] |
|
kasperl
2012/08/20 11:37:22
Update comment.
| |
| 1134 // to use [newInput] instead. | 1134 // to use [newInput] instead. |
| 1135 void changeUsesDominatedBy(HBasicBlock dominator, | 1135 void changeUsesDominatedBy(HBasicBlock dominator, |
| 1136 HInstruction input, | 1136 HInstruction input, |
| 1137 HType convertedType) { | 1137 HType convertedType) { |
| 1138 HTypeConversion newInput; | 1138 HTypeConversion newInput; |
| 1139 Set<HInstruction> dominatedUsers = input.dominatedUsers(dominator.first); | 1139 Set<HInstruction> dominatedUsers = input.dominatedUsers(null, dominator); |
| 1140 for (HInstruction user in dominatedUsers) { | 1140 for (HInstruction user in dominatedUsers) { |
|
kasperl
2012/08/20 11:37:22
How about returning if dominatedUsers.isEmpty and
| |
| 1141 if (newInput === null) { | 1141 if (newInput === null) { |
| 1142 newInput = new HTypeConversion(convertedType, input); | 1142 newInput = new HTypeConversion(convertedType, input); |
| 1143 dominator.addBefore(dominator.first, newInput); | 1143 dominator.addBefore(dominator.first, newInput); |
| 1144 } | 1144 } |
| 1145 user.changeUse(input, newInput); | 1145 user.changeUse(input, newInput); |
| 1146 } | 1146 } |
| 1147 } | 1147 } |
| 1148 | 1148 |
| 1149 void visitIs(HIs instruction) { | 1149 void visitIs(HIs instruction) { |
| 1150 HInstruction input = instruction.expression; | 1150 HInstruction input = instruction.expression; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1330 // this type for the field is still a strong signal | 1330 // this type for the field is still a strong signal |
| 1331 // indicating the expected type of the field. | 1331 // indicating the expected type of the field. |
| 1332 types[field] = type; | 1332 types[field] = type; |
| 1333 } else { | 1333 } else { |
| 1334 // If there are no invoked setters we know the type of | 1334 // If there are no invoked setters we know the type of |
| 1335 // this field for sure. | 1335 // this field for sure. |
| 1336 field.guaranteedType = type; | 1336 field.guaranteedType = type; |
| 1337 } | 1337 } |
| 1338 } | 1338 } |
| 1339 } | 1339 } |
| OLD | NEW |