| 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 * (unintercepted) classes. | 324 * (unintercepted) classes. |
| 325 */ | 325 */ |
| 326 final Set<ClassElement> classesMixedIntoInterceptedClasses = | 326 final Set<ClassElement> classesMixedIntoInterceptedClasses = |
| 327 new Set<ClassElement>(); | 327 new Set<ClassElement>(); |
| 328 | 328 |
| 329 /** | 329 /** |
| 330 * Set of classes whose `operator ==` methods handle `null` themselves. | 330 * Set of classes whose `operator ==` methods handle `null` themselves. |
| 331 */ | 331 */ |
| 332 final Set<ClassElement> specialOperatorEqClasses = new Set<ClassElement>(); | 332 final Set<ClassElement> specialOperatorEqClasses = new Set<ClassElement>(); |
| 333 | 333 |
| 334 /** | |
| 335 * A set of members that are called from subclasses via super. | |
| 336 */ | |
| 337 final Set<FunctionElement> aliasedSuperMembers = | |
| 338 new Setlet<FunctionElement>(); | |
| 339 | |
| 340 List<CompilerTask> get tasks { | 334 List<CompilerTask> get tasks { |
| 341 List<CompilerTask> result = functionCompiler.tasks; | 335 List<CompilerTask> result = functionCompiler.tasks; |
| 342 result.add(emitter); | 336 result.add(emitter); |
| 343 return result; | 337 return result; |
| 344 } | 338 } |
| 345 | 339 |
| 346 final RuntimeTypes rti; | 340 final RuntimeTypes rti; |
| 347 | 341 |
| 348 /// Holds the method "disableTreeShaking" in js_mirrors when | 342 /// Holds the method "disableTreeShaking" in js_mirrors when |
| 349 /// dart:mirrors has been loaded. | 343 /// dart:mirrors has been loaded. |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 String registerOneShotInterceptor(Selector selector) { | 531 String registerOneShotInterceptor(Selector selector) { |
| 538 Set<ClassElement> classes = getInterceptedClassesOn(selector.name); | 532 Set<ClassElement> classes = getInterceptedClassesOn(selector.name); |
| 539 String name = namer.getOneShotInterceptorName(selector, classes); | 533 String name = namer.getOneShotInterceptorName(selector, classes); |
| 540 if (!oneShotInterceptors.containsKey(name)) { | 534 if (!oneShotInterceptors.containsKey(name)) { |
| 541 registerSpecializedGetInterceptor(classes); | 535 registerSpecializedGetInterceptor(classes); |
| 542 oneShotInterceptors[name] = selector; | 536 oneShotInterceptors[name] = selector; |
| 543 } | 537 } |
| 544 return name; | 538 return name; |
| 545 } | 539 } |
| 546 | 540 |
| 547 /** | |
| 548 * Record that [method] is called from a subclass via `super`. | |
| 549 */ | |
| 550 void registerAliasedSuperMember(FunctionElement method) { | |
| 551 aliasedSuperMembers.add(method); | |
| 552 } | |
| 553 | |
| 554 /** | |
| 555 * Returns `true` is [member] is called from a subclass via `super`. | |
| 556 */ | |
| 557 bool isAliasedSuperMember(FunctionElement member) { | |
| 558 return aliasedSuperMembers.contains(member); | |
| 559 } | |
| 560 | |
| 561 bool isInterceptedMethod(Element element) { | 541 bool isInterceptedMethod(Element element) { |
| 562 if (!element.isInstanceMember) return false; | 542 if (!element.isInstanceMember) return false; |
| 563 if (element.isGenerativeConstructorBody) { | 543 if (element.isGenerativeConstructorBody) { |
| 564 return Elements.isNativeOrExtendsNative(element.enclosingClass); | 544 return Elements.isNativeOrExtendsNative(element.enclosingClass); |
| 565 } | 545 } |
| 566 return interceptedElements[element.name] != null; | 546 return interceptedElements[element.name] != null; |
| 567 } | 547 } |
| 568 | 548 |
| 569 bool fieldHasInterceptedGetter(Element element) { | 549 bool fieldHasInterceptedGetter(Element element) { |
| 570 assert(element.isField); | 550 assert(element.isField); |
| (...skipping 1899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2470 } | 2450 } |
| 2471 } | 2451 } |
| 2472 | 2452 |
| 2473 /// Records that [constant] is used by the element behind [registry]. | 2453 /// Records that [constant] is used by the element behind [registry]. |
| 2474 class Dependency { | 2454 class Dependency { |
| 2475 final ConstantValue constant; | 2455 final ConstantValue constant; |
| 2476 final Element annotatedElement; | 2456 final Element annotatedElement; |
| 2477 | 2457 |
| 2478 const Dependency(this.constant, this.annotatedElement); | 2458 const Dependency(this.constant, this.annotatedElement); |
| 2479 } | 2459 } |
| OLD | NEW |