| 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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 registerSpecializedGetInterceptor(classes); | 548 registerSpecializedGetInterceptor(classes); |
| 549 oneShotInterceptors[name] = selector; | 549 oneShotInterceptors[name] = selector; |
| 550 } | 550 } |
| 551 return name; | 551 return name; |
| 552 } | 552 } |
| 553 | 553 |
| 554 /** | 554 /** |
| 555 * Record that [method] is called from a subclass via `super`. | 555 * Record that [method] is called from a subclass via `super`. |
| 556 */ | 556 */ |
| 557 bool maybeRegisterAliasedSuperMember(Element member, Selector selector) { | 557 bool maybeRegisterAliasedSuperMember(Element member, Selector selector) { |
| 558 if (selector.isGetter || compiler.hasIncrementalSupport) { | 558 if (!canUseAliasedSuperMember(member, selector)) { |
| 559 // Invoking a super getter isn't supported, this would require changes to | 559 // Invoking a super getter isn't supported, this would require changes to |
| 560 // compact field descriptors in the emitter. | 560 // compact field descriptors in the emitter. |
| 561 // We also turn off this optimization in incremental compilation, to | 561 // We also turn off this optimization in incremental compilation, to |
| 562 // avoid having to regenerate a method just because someone started | 562 // avoid having to regenerate a method just because someone started |
| 563 // calling it through super. | 563 // calling it through super. |
| 564 return false; | 564 return false; |
| 565 } | 565 } |
| 566 aliasedSuperMembers.add(member); | 566 aliasedSuperMembers.add(member); |
| 567 return true; | 567 return true; |
| 568 } | 568 } |
| 569 | 569 |
| 570 bool canUseAliasedSuperMember(Element member, Selector selector) { |
| 571 return !selector.isGetter && !compiler.hasIncrementalSupport; |
| 572 } |
| 573 |
| 570 /** | 574 /** |
| 571 * Returns `true` if [member] is called from a subclass via `super`. | 575 * Returns `true` if [member] is called from a subclass via `super`. |
| 572 */ | 576 */ |
| 573 bool isAliasedSuperMember(FunctionElement member) { | 577 bool isAliasedSuperMember(FunctionElement member) { |
| 574 return aliasedSuperMembers.contains(member); | 578 return aliasedSuperMembers.contains(member); |
| 575 } | 579 } |
| 576 | 580 |
| 577 bool isInterceptedMethod(Element element) { | 581 bool isInterceptedMethod(Element element) { |
| 578 if (!element.isInstanceMember) return false; | 582 if (!element.isInstanceMember) return false; |
| 579 if (element.isGenerativeConstructorBody) { | 583 if (element.isGenerativeConstructorBody) { |
| (...skipping 2113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2693 } | 2697 } |
| 2694 } | 2698 } |
| 2695 | 2699 |
| 2696 /// Records that [constant] is used by the element behind [registry]. | 2700 /// Records that [constant] is used by the element behind [registry]. |
| 2697 class Dependency { | 2701 class Dependency { |
| 2698 final ConstantValue constant; | 2702 final ConstantValue constant; |
| 2699 final Element annotatedElement; | 2703 final Element annotatedElement; |
| 2700 | 2704 |
| 2701 const Dependency(this.constant, this.annotatedElement); | 2705 const Dependency(this.constant, this.annotatedElement); |
| 2702 } | 2706 } |
| OLD | NEW |