| 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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 registerSpecializedGetInterceptor(classes); | 687 registerSpecializedGetInterceptor(classes); |
| 688 oneShotInterceptors[name] = selector; | 688 oneShotInterceptors[name] = selector; |
| 689 } | 689 } |
| 690 return name; | 690 return name; |
| 691 } | 691 } |
| 692 | 692 |
| 693 /** | 693 /** |
| 694 * Record that [method] is called from a subclass via `super`. | 694 * Record that [method] is called from a subclass via `super`. |
| 695 */ | 695 */ |
| 696 bool maybeRegisterAliasedSuperMember(Element member, Selector selector) { | 696 bool maybeRegisterAliasedSuperMember(Element member, Selector selector) { |
| 697 if (selector.isGetter || compiler.hasIncrementalSupport) { | 697 if (!canUseAliasedSuperMember(member, selector)) { |
| 698 // Invoking a super getter isn't supported, this would require changes to | 698 // Invoking a super getter isn't supported, this would require changes to |
| 699 // compact field descriptors in the emitter. | 699 // compact field descriptors in the emitter. |
| 700 // We also turn off this optimization in incremental compilation, to | 700 // We also turn off this optimization in incremental compilation, to |
| 701 // avoid having to regenerate a method just because someone started | 701 // avoid having to regenerate a method just because someone started |
| 702 // calling it through super. | 702 // calling it through super. |
| 703 return false; | 703 return false; |
| 704 } | 704 } |
| 705 aliasedSuperMembers.add(member); | 705 aliasedSuperMembers.add(member); |
| 706 return true; | 706 return true; |
| 707 } | 707 } |
| 708 | 708 |
| 709 bool canUseAliasedSuperMember(Element member, Selector selector) { |
| 710 return !selector.isGetter && !compiler.hasIncrementalSupport; |
| 711 } |
| 712 |
| 709 /** | 713 /** |
| 710 * Returns `true` if [member] is called from a subclass via `super`. | 714 * Returns `true` if [member] is called from a subclass via `super`. |
| 711 */ | 715 */ |
| 712 bool isAliasedSuperMember(FunctionElement member) { | 716 bool isAliasedSuperMember(FunctionElement member) { |
| 713 return aliasedSuperMembers.contains(member); | 717 return aliasedSuperMembers.contains(member); |
| 714 } | 718 } |
| 715 | 719 |
| 716 bool isInterceptedMethod(Element element) { | 720 bool isInterceptedMethod(Element element) { |
| 717 if (!element.isInstanceMember) return false; | 721 if (!element.isInstanceMember) return false; |
| 718 if (element.isGenerativeConstructorBody) { | 722 if (element.isGenerativeConstructorBody) { |
| (...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2834 } | 2838 } |
| 2835 } | 2839 } |
| 2836 | 2840 |
| 2837 /// Records that [constant] is used by the element behind [registry]. | 2841 /// Records that [constant] is used by the element behind [registry]. |
| 2838 class Dependency { | 2842 class Dependency { |
| 2839 final ConstantValue constant; | 2843 final ConstantValue constant; |
| 2840 final Element annotatedElement; | 2844 final Element annotatedElement; |
| 2841 | 2845 |
| 2842 const Dependency(this.constant, this.annotatedElement); | 2846 const Dependency(this.constant, this.annotatedElement); |
| 2843 } | 2847 } |
| OLD | NEW |