| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 return node; | 171 return node; |
| 172 } | 172 } |
| 173 | 173 |
| 174 HInstruction visitInvokeDynamic(HInvokeDynamic node) { | 174 HInstruction visitInvokeDynamic(HInvokeDynamic node) { |
| 175 HType receiverType = node.receiver.propagatedType; | 175 HType receiverType = node.receiver.propagatedType; |
| 176 if (receiverType.isNonPrimitive()) { | 176 if (receiverType.isNonPrimitive()) { |
| 177 HNonPrimitiveType type = receiverType; | 177 HNonPrimitiveType type = receiverType; |
| 178 Element element = type.lookupMember(node.name); | 178 Element element = type.lookupMember(node.name); |
| 179 // TODO(ngeoffray): Also fold if it's a getter or variable. | 179 // TODO(ngeoffray): Also fold if it's a getter or variable. |
| 180 if (element != null && element.isFunction()) { | 180 if (element != null && element.isFunction()) { |
| 181 FunctionElement method = element; | 181 if (node.selector.applies(element, compiler)) { |
| 182 FunctionParameters parameters = method.computeParameters(compiler); | 182 FunctionElement method = element; |
| 183 if (node.selector.applies(parameters)) { | 183 FunctionParameters parameters = method.computeParameters(compiler); |
| 184 if (parameters.optionalParameterCount == 0) { | 184 if (parameters.optionalParameterCount == 0) { |
| 185 node.element = element; | 185 node.element = element; |
| 186 } | 186 } |
| 187 // TODO(ngeoffray): If the method has optional parameters, | 187 // TODO(ngeoffray): If the method has optional parameters, |
| 188 // we should pass the default values here. | 188 // we should pass the default values here. |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 return node; | 192 return node; |
| 193 } | 193 } |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 } | 816 } |
| 817 } | 817 } |
| 818 if (!canBeMoved) continue; | 818 if (!canBeMoved) continue; |
| 819 | 819 |
| 820 // This is safe because we are running after GVN. | 820 // This is safe because we are running after GVN. |
| 821 // TODO(ngeoffray): ensure GVN has been run. | 821 // TODO(ngeoffray): ensure GVN has been run. |
| 822 set_.add(current); | 822 set_.add(current); |
| 823 } | 823 } |
| 824 } | 824 } |
| 825 } | 825 } |
| OLD | NEW |