| 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 |
| 334 List<CompilerTask> get tasks { | 340 List<CompilerTask> get tasks { |
| 335 List<CompilerTask> result = functionCompiler.tasks; | 341 List<CompilerTask> result = functionCompiler.tasks; |
| 336 result.add(emitter); | 342 result.add(emitter); |
| 337 return result; | 343 return result; |
| 338 } | 344 } |
| 339 | 345 |
| 340 final RuntimeTypes rti; | 346 final RuntimeTypes rti; |
| 341 | 347 |
| 342 /// Holds the method "disableTreeShaking" in js_mirrors when | 348 /// Holds the method "disableTreeShaking" in js_mirrors when |
| 343 /// dart:mirrors has been loaded. | 349 /// dart:mirrors has been loaded. |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 String registerOneShotInterceptor(Selector selector) { | 537 String registerOneShotInterceptor(Selector selector) { |
| 532 Set<ClassElement> classes = getInterceptedClassesOn(selector.name); | 538 Set<ClassElement> classes = getInterceptedClassesOn(selector.name); |
| 533 String name = namer.getOneShotInterceptorName(selector, classes); | 539 String name = namer.getOneShotInterceptorName(selector, classes); |
| 534 if (!oneShotInterceptors.containsKey(name)) { | 540 if (!oneShotInterceptors.containsKey(name)) { |
| 535 registerSpecializedGetInterceptor(classes); | 541 registerSpecializedGetInterceptor(classes); |
| 536 oneShotInterceptors[name] = selector; | 542 oneShotInterceptors[name] = selector; |
| 537 } | 543 } |
| 538 return name; | 544 return name; |
| 539 } | 545 } |
| 540 | 546 |
| 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 |
| 541 bool isInterceptedMethod(Element element) { | 561 bool isInterceptedMethod(Element element) { |
| 542 if (!element.isInstanceMember) return false; | 562 if (!element.isInstanceMember) return false; |
| 543 if (element.isGenerativeConstructorBody) { | 563 if (element.isGenerativeConstructorBody) { |
| 544 return Elements.isNativeOrExtendsNative(element.enclosingClass); | 564 return Elements.isNativeOrExtendsNative(element.enclosingClass); |
| 545 } | 565 } |
| 546 return interceptedElements[element.name] != null; | 566 return interceptedElements[element.name] != null; |
| 547 } | 567 } |
| 548 | 568 |
| 549 bool fieldHasInterceptedGetter(Element element) { | 569 bool fieldHasInterceptedGetter(Element element) { |
| 550 assert(element.isField); | 570 assert(element.isField); |
| (...skipping 1899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2450 } | 2470 } |
| 2451 } | 2471 } |
| 2452 | 2472 |
| 2453 /// Records that [constant] is used by the element behind [registry]. | 2473 /// Records that [constant] is used by the element behind [registry]. |
| 2454 class Dependency { | 2474 class Dependency { |
| 2455 final ConstantValue constant; | 2475 final ConstantValue constant; |
| 2456 final Element annotatedElement; | 2476 final Element annotatedElement; |
| 2457 | 2477 |
| 2458 const Dependency(this.constant, this.annotatedElement); | 2478 const Dependency(this.constant, this.annotatedElement); |
| 2459 } | 2479 } |
| OLD | NEW |