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 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 HInstruction visitInvokeDynamicMethod(HInvokeDynamicMethod node) { | 326 HInstruction visitInvokeDynamicMethod(HInvokeDynamicMethod node) { |
| 327 if (node.isInterceptedCall) { | 327 if (node.isInterceptedCall) { |
| 328 HInstruction folded = handleInterceptedCall(node); | 328 HInstruction folded = handleInterceptedCall(node); |
| 329 if (folded != node) return folded; | 329 if (folded != node) return folded; |
| 330 } | 330 } |
| 331 | 331 |
| 332 HType receiverType = node.getDartReceiver(compiler).instructionType; | 332 HType receiverType = node.getDartReceiver(compiler).instructionType; |
| 333 Selector selector = receiverType.refine(node.selector, compiler); | 333 Selector selector = receiverType.refine(node.selector, compiler); |
| 334 Element element = compiler.world.locateSingleElement(selector); | 334 Element element = compiler.world.locateSingleElement(selector); |
| 335 // TODO(ngeoffray): Also fold if it's a getter or variable. | 335 // TODO(ngeoffray): Also fold if it's a getter or variable. |
| 336 if (element != null && element.isFunction()) { | 336 if (element != null |
| 337 && element.isFunction() | |
| 338 // If we found out that the only target is a [:noSuchMethod:], | |
| 339 // we just ignore it. | |
| 340 && element.name != Compiler.NO_SUCH_METHOD) { | |
|
sra1
2013/04/16 18:57:19
What if I explicitly call noSuchMethod?
ngeoffray
2013/04/17 09:11:18
I changed the check. Explicitly calling noSuchMeth
| |
| 337 FunctionElement method = element; | 341 FunctionElement method = element; |
| 338 | 342 |
| 339 if (method.isNative()) { | 343 if (method.isNative()) { |
| 340 HInstruction folded = tryInlineNativeMethod(node, method); | 344 HInstruction folded = tryInlineNativeMethod(node, method); |
| 341 if (folded != null) return folded; | 345 if (folded != null) return folded; |
| 342 } else { | 346 } else { |
| 343 // TODO(ngeoffray): If the method has optional parameters, | 347 // TODO(ngeoffray): If the method has optional parameters, |
| 344 // we should pass the default values. | 348 // we should pass the default values. |
| 345 FunctionSignature parameters = method.computeSignature(compiler); | 349 FunctionSignature parameters = method.computeSignature(compiler); |
| 346 if (parameters.optionalParameterCount == 0 | 350 if (parameters.optionalParameterCount == 0 |
| (...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1688 HBasicBlock block = user.block; | 1692 HBasicBlock block = user.block; |
| 1689 block.addAfter(user, interceptor); | 1693 block.addAfter(user, interceptor); |
| 1690 block.rewrite(user, interceptor); | 1694 block.rewrite(user, interceptor); |
| 1691 block.remove(user); | 1695 block.remove(user); |
| 1692 | 1696 |
| 1693 // The interceptor will be removed in the dead code elimination | 1697 // The interceptor will be removed in the dead code elimination |
| 1694 // phase. Note that removing it here would not work because of how | 1698 // phase. Note that removing it here would not work because of how |
| 1695 // the [visitBasicBlock] is implemented. | 1699 // the [visitBasicBlock] is implemented. |
| 1696 } | 1700 } |
| 1697 } | 1701 } |
| OLD | NEW |