| 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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 bool isInterceptorClass(ClassElement element) { | 536 bool isInterceptorClass(ClassElement element) { |
| 537 if (element == null) return false; | 537 if (element == null) return false; |
| 538 if (Elements.isNativeOrExtendsNative(element)) return true; | 538 if (Elements.isNativeOrExtendsNative(element)) return true; |
| 539 if (interceptedClasses.contains(element)) return true; | 539 if (interceptedClasses.contains(element)) return true; |
| 540 if (classesMixedIntoInterceptedClasses.contains(element)) return true; | 540 if (classesMixedIntoInterceptedClasses.contains(element)) return true; |
| 541 return false; | 541 return false; |
| 542 } | 542 } |
| 543 | 543 |
| 544 String registerOneShotInterceptor(Selector selector) { | 544 String registerOneShotInterceptor(Selector selector) { |
| 545 Set<ClassElement> classes = getInterceptedClassesOn(selector.name); | 545 Set<ClassElement> classes = getInterceptedClassesOn(selector.name); |
| 546 String name = namer.nameForGetOneShotInterceptor(selector, classes); | 546 String name = namer.getOneShotInterceptorName(selector, classes); |
| 547 if (!oneShotInterceptors.containsKey(name)) { | 547 if (!oneShotInterceptors.containsKey(name)) { |
| 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 */ |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 } | 735 } |
| 736 enqueueClass(enqueuer, cls, registry); | 736 enqueueClass(enqueuer, cls, registry); |
| 737 } | 737 } |
| 738 | 738 |
| 739 Set<ClassElement> get interceptedClasses { | 739 Set<ClassElement> get interceptedClasses { |
| 740 assert(compiler.enqueuer.resolution.queueIsClosed); | 740 assert(compiler.enqueuer.resolution.queueIsClosed); |
| 741 return _interceptedClasses; | 741 return _interceptedClasses; |
| 742 } | 742 } |
| 743 | 743 |
| 744 void registerSpecializedGetInterceptor(Set<ClassElement> classes) { | 744 void registerSpecializedGetInterceptor(Set<ClassElement> classes) { |
| 745 String name = namer.nameForGetInterceptor(classes); | 745 String name = namer.getInterceptorName(getInterceptorMethod, classes); |
| 746 if (classes.contains(jsInterceptorClass)) { | 746 if (classes.contains(jsInterceptorClass)) { |
| 747 // We can't use a specialized [getInterceptorMethod], so we make | 747 // We can't use a specialized [getInterceptorMethod], so we make |
| 748 // sure we emit the one with all checks. | 748 // sure we emit the one with all checks. |
| 749 specializedGetInterceptors[name] = interceptedClasses; | 749 specializedGetInterceptors[name] = interceptedClasses; |
| 750 } else { | 750 } else { |
| 751 specializedGetInterceptors[name] = classes; | 751 specializedGetInterceptors[name] = classes; |
| 752 } | 752 } |
| 753 } | 753 } |
| 754 | 754 |
| 755 void registerCompileTimeConstant(ConstantValue constant, Registry registry) { | 755 void registerCompileTimeConstant(ConstantValue constant, Registry registry) { |
| (...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2681 } | 2681 } |
| 2682 } | 2682 } |
| 2683 | 2683 |
| 2684 /// Records that [constant] is used by the element behind [registry]. | 2684 /// Records that [constant] is used by the element behind [registry]. |
| 2685 class Dependency { | 2685 class Dependency { |
| 2686 final ConstantValue constant; | 2686 final ConstantValue constant; |
| 2687 final Element annotatedElement; | 2687 final Element annotatedElement; |
| 2688 | 2688 |
| 2689 const Dependency(this.constant, this.annotatedElement); | 2689 const Dependency(this.constant, this.annotatedElement); |
| 2690 } | 2690 } |
| OLD | NEW |