| 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 class JavaScriptItemCompilationContext extends ItemCompilationContext { | 9 class JavaScriptItemCompilationContext extends ItemCompilationContext { |
| 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); | 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 * (unintercepted) classes. | 316 * (unintercepted) classes. |
| 317 */ | 317 */ |
| 318 final Set<ClassElement> classesMixedIntoInterceptedClasses = | 318 final Set<ClassElement> classesMixedIntoInterceptedClasses = |
| 319 new Set<ClassElement>(); | 319 new Set<ClassElement>(); |
| 320 | 320 |
| 321 /** | 321 /** |
| 322 * Set of classes whose `operator ==` methods handle `null` themselves. | 322 * Set of classes whose `operator ==` methods handle `null` themselves. |
| 323 */ | 323 */ |
| 324 final Set<ClassElement> specialOperatorEqClasses = new Set<ClassElement>(); | 324 final Set<ClassElement> specialOperatorEqClasses = new Set<ClassElement>(); |
| 325 | 325 |
| 326 /** |
| 327 * A set of members that are called from subclasses via super. |
| 328 */ |
| 329 final Set<FunctionElement> aliasedSuperMembers = |
| 330 new Setlet<FunctionElement>(); |
| 331 |
| 326 List<CompilerTask> get tasks { | 332 List<CompilerTask> get tasks { |
| 327 return <CompilerTask>[builder, optimizer, generator, emitter]; | 333 return <CompilerTask>[builder, optimizer, generator, emitter]; |
| 328 } | 334 } |
| 329 | 335 |
| 330 final RuntimeTypes rti; | 336 final RuntimeTypes rti; |
| 331 | 337 |
| 332 /// Holds the method "disableTreeShaking" in js_mirrors when | 338 /// Holds the method "disableTreeShaking" in js_mirrors when |
| 333 /// dart:mirrors has been loaded. | 339 /// dart:mirrors has been loaded. |
| 334 FunctionElement disableTreeShakingMarker; | 340 FunctionElement disableTreeShakingMarker; |
| 335 | 341 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 String registerOneShotInterceptor(Selector selector) { | 527 String registerOneShotInterceptor(Selector selector) { |
| 522 Set<ClassElement> classes = getInterceptedClassesOn(selector.name); | 528 Set<ClassElement> classes = getInterceptedClassesOn(selector.name); |
| 523 String name = namer.getOneShotInterceptorName(selector, classes); | 529 String name = namer.getOneShotInterceptorName(selector, classes); |
| 524 if (!oneShotInterceptors.containsKey(name)) { | 530 if (!oneShotInterceptors.containsKey(name)) { |
| 525 registerSpecializedGetInterceptor(classes); | 531 registerSpecializedGetInterceptor(classes); |
| 526 oneShotInterceptors[name] = selector; | 532 oneShotInterceptors[name] = selector; |
| 527 } | 533 } |
| 528 return name; | 534 return name; |
| 529 } | 535 } |
| 530 | 536 |
| 537 /** |
| 538 * Record that [method] is called from a subclass via `super`. |
| 539 */ |
| 540 void registerAliasedSuperMember(FunctionElement method) { |
| 541 aliasedSuperMembers.add(method); |
| 542 } |
| 543 |
| 544 /** |
| 545 * Returns `true` is [member] is called from a subclass via `super`. |
| 546 */ |
| 547 bool isAliasedSuperMember(FunctionElement member) { |
| 548 return aliasedSuperMembers.contains(member); |
| 549 } |
| 550 |
| 531 bool isInterceptedMethod(Element element) { | 551 bool isInterceptedMethod(Element element) { |
| 532 if (!element.isInstanceMember) return false; | 552 if (!element.isInstanceMember) return false; |
| 533 if (element.isGenerativeConstructorBody) { | 553 if (element.isGenerativeConstructorBody) { |
| 534 return Elements.isNativeOrExtendsNative(element.enclosingClass); | 554 return Elements.isNativeOrExtendsNative(element.enclosingClass); |
| 535 } | 555 } |
| 536 return interceptedElements[element.name] != null; | 556 return interceptedElements[element.name] != null; |
| 537 } | 557 } |
| 538 | 558 |
| 539 bool fieldHasInterceptedGetter(Element element) { | 559 bool fieldHasInterceptedGetter(Element element) { |
| 540 assert(element.isField); | 560 assert(element.isField); |
| (...skipping 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2441 } | 2461 } |
| 2442 } | 2462 } |
| 2443 | 2463 |
| 2444 /// Records that [constant] is used by the element behind [registry]. | 2464 /// Records that [constant] is used by the element behind [registry]. |
| 2445 class Dependency { | 2465 class Dependency { |
| 2446 final ConstantValue constant; | 2466 final ConstantValue constant; |
| 2447 final Element annotatedElement; | 2467 final Element annotatedElement; |
| 2448 | 2468 |
| 2449 const Dependency(this.constant, this.annotatedElement); | 2469 const Dependency(this.constant, this.annotatedElement); |
| 2450 } | 2470 } |
| OLD | NEW |