| 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 js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 const VERBOSE_OPTIMIZER_HINTS = false; | 7 const VERBOSE_OPTIMIZER_HINTS = false; |
| 8 | 8 |
| 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); | 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); |
| 10 | 10 |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 registerSpecializedGetInterceptor(classes); | 695 registerSpecializedGetInterceptor(classes); |
| 696 oneShotInterceptors[name] = selector; | 696 oneShotInterceptors[name] = selector; |
| 697 } | 697 } |
| 698 return name; | 698 return name; |
| 699 } | 699 } |
| 700 | 700 |
| 701 /** | 701 /** |
| 702 * Record that [method] is called from a subclass via `super`. | 702 * Record that [method] is called from a subclass via `super`. |
| 703 */ | 703 */ |
| 704 bool maybeRegisterAliasedSuperMember(Element member, Selector selector) { | 704 bool maybeRegisterAliasedSuperMember(Element member, Selector selector) { |
| 705 if (selector.isGetter || compiler.hasIncrementalSupport) { | 705 if (!canUseAliasedSuperMember(member, selector)) { |
| 706 // Invoking a super getter isn't supported, this would require changes to | 706 // Invoking a super getter isn't supported, this would require changes to |
| 707 // compact field descriptors in the emitter. | 707 // compact field descriptors in the emitter. |
| 708 // We also turn off this optimization in incremental compilation, to | 708 // We also turn off this optimization in incremental compilation, to |
| 709 // avoid having to regenerate a method just because someone started | 709 // avoid having to regenerate a method just because someone started |
| 710 // calling it through super. | 710 // calling it through super. |
| 711 return false; | 711 return false; |
| 712 } | 712 } |
| 713 aliasedSuperMembers.add(member); | 713 aliasedSuperMembers.add(member); |
| 714 return true; | 714 return true; |
| 715 } | 715 } |
| 716 | 716 |
| 717 bool canUseAliasedSuperMember(Element member, Selector selector) { |
| 718 return !selector.isGetter && !compiler.hasIncrementalSupport; |
| 719 } |
| 720 |
| 717 /** | 721 /** |
| 718 * Returns `true` if [member] is called from a subclass via `super`. | 722 * Returns `true` if [member] is called from a subclass via `super`. |
| 719 */ | 723 */ |
| 720 bool isAliasedSuperMember(FunctionElement member) { | 724 bool isAliasedSuperMember(FunctionElement member) { |
| 721 return aliasedSuperMembers.contains(member); | 725 return aliasedSuperMembers.contains(member); |
| 722 } | 726 } |
| 723 | 727 |
| 724 bool isInterceptedMethod(Element element) { | 728 bool isInterceptedMethod(Element element) { |
| 725 if (!element.isInstanceMember) return false; | 729 if (!element.isInstanceMember) return false; |
| 726 if (element.isGenerativeConstructorBody) { | 730 if (element.isGenerativeConstructorBody) { |
| (...skipping 2116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2843 } | 2847 } |
| 2844 } | 2848 } |
| 2845 | 2849 |
| 2846 /// Records that [constant] is used by the element behind [registry]. | 2850 /// Records that [constant] is used by the element behind [registry]. |
| 2847 class Dependency { | 2851 class Dependency { |
| 2848 final ConstantValue constant; | 2852 final ConstantValue constant; |
| 2849 final Element annotatedElement; | 2853 final Element annotatedElement; |
| 2850 | 2854 |
| 2851 const Dependency(this.constant, this.annotatedElement); | 2855 const Dependency(this.constant, this.annotatedElement); |
| 2852 } | 2856 } |
| OLD | NEW |