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 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 5 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
6 import '../common/names.dart' show Selectors; | 6 import '../common/names.dart' show Selectors; |
7 import '../common/tasks.dart' show CompilerTask; | 7 import '../common/tasks.dart' show CompilerTask; |
8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
9 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 HInstruction folded = handleInterceptedCall(node); | 442 HInstruction folded = handleInterceptedCall(node); |
443 if (folded != node) return folded; | 443 if (folded != node) return folded; |
444 } | 444 } |
445 | 445 |
446 TypeMask receiverType = node.getDartReceiver(compiler).instructionType; | 446 TypeMask receiverType = node.getDartReceiver(compiler).instructionType; |
447 Element element = | 447 Element element = |
448 compiler.closedWorld.locateSingleElement(node.selector, receiverType); | 448 compiler.closedWorld.locateSingleElement(node.selector, receiverType); |
449 // TODO(ngeoffray): Also fold if it's a getter or variable. | 449 // TODO(ngeoffray): Also fold if it's a getter or variable. |
450 if (element != null && | 450 if (element != null && |
451 element.isFunction | 451 element.isFunction |
452 // If we found out that the only target is a [:noSuchMethod:], | 452 // If we found out that the only target is an implicitly called |
453 // we just ignore it. | 453 // [:noSuchMethod:] we just ignore it. |
454 && | 454 && |
455 element.name == node.selector.name) { | 455 node.selector.applies(element)) { |
456 FunctionElement method = element; | 456 FunctionElement method = element; |
457 | 457 |
458 if (backend.isNative(method)) { | 458 if (backend.isNative(method)) { |
459 HInstruction folded = tryInlineNativeMethod(node, method); | 459 HInstruction folded = tryInlineNativeMethod(node, method); |
460 if (folded != null) return folded; | 460 if (folded != null) return folded; |
461 } else { | 461 } else { |
462 // TODO(ngeoffray): If the method has optional parameters, | 462 // TODO(ngeoffray): If the method has optional parameters, |
463 // we should pass the default values. | 463 // we should pass the default values. |
464 FunctionSignature parameters = method.functionSignature; | 464 FunctionSignature parameters = method.functionSignature; |
465 if (parameters.optionalParameterCount == 0 || | 465 if (parameters.optionalParameterCount == 0 || |
(...skipping 2228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2694 | 2694 |
2695 keyedValues.forEach((receiver, values) { | 2695 keyedValues.forEach((receiver, values) { |
2696 result.keyedValues[receiver] = | 2696 result.keyedValues[receiver] = |
2697 new Map<HInstruction, HInstruction>.from(values); | 2697 new Map<HInstruction, HInstruction>.from(values); |
2698 }); | 2698 }); |
2699 | 2699 |
2700 result.nonEscapingReceivers.addAll(nonEscapingReceivers); | 2700 result.nonEscapingReceivers.addAll(nonEscapingReceivers); |
2701 return result; | 2701 return result; |
2702 } | 2702 } |
2703 } | 2703 } |
OLD | NEW |