| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 HType combinedType = value.propagatedType.combine(node.propagatedType); | 189 HType combinedType = value.propagatedType.combine(node.propagatedType); |
| 190 return (combinedType == value.propagatedType) ? value : node; | 190 return (combinedType == value.propagatedType) ? value : node; |
| 191 } | 191 } |
| 192 | 192 |
| 193 HInstruction visitIntegerCheck(HIntegerCheck node) { | 193 HInstruction visitIntegerCheck(HIntegerCheck node) { |
| 194 HInstruction value = node.value; | 194 HInstruction value = node.value; |
| 195 return value.isInteger() ? value : node; | 195 return value.isInteger() ? value : node; |
| 196 } | 196 } |
| 197 | 197 |
| 198 HInstruction visitIs(HIs node) { | 198 HInstruction visitIs(HIs node) { |
| 199 Type type = node.typeName; | 199 Type type = node.typeExpression; |
| 200 Element element = type.element; | 200 Element element = type.element; |
| 201 if (element.kind === ElementKind.TYPE_VARIABLE) { | 201 if (element.kind === ElementKind.TYPE_VARIABLE) { |
| 202 compiler.unimplemented("visitIs for type variables"); | 202 compiler.unimplemented("visitIs for type variables"); |
| 203 } | 203 } |
| 204 | 204 |
| 205 HType expressionType = node.expression.propagatedType; | 205 HType expressionType = node.expression.propagatedType; |
| 206 if (element === compiler.objectClass | 206 if (element === compiler.objectClass |
| 207 || element === compiler.dynamicClass) { | 207 || element === compiler.dynamicClass) { |
| 208 return graph.addConstantBool(true); | 208 return graph.addConstantBool(true); |
| 209 } else if (expressionType.isInteger()) { | 209 } else if (expressionType.isInteger()) { |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 } | 712 } |
| 713 } | 713 } |
| 714 if (!canBeMoved) continue; | 714 if (!canBeMoved) continue; |
| 715 | 715 |
| 716 // This is safe because we are running after GVN. | 716 // This is safe because we are running after GVN. |
| 717 // TODO(ngeoffray): ensure GVN has been run. | 717 // TODO(ngeoffray): ensure GVN has been run. |
| 718 set_.add(current); | 718 set_.add(current); |
| 719 } | 719 } |
| 720 } | 720 } |
| 721 } | 721 } |
| OLD | NEW |