| 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 ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 class SsaCodeGeneratorTask extends CompilerTask { | 7 class SsaCodeGeneratorTask extends CompilerTask { |
| 8 | 8 |
| 9 final JavaScriptBackend backend; | 9 final JavaScriptBackend backend; |
| 10 final SourceInformationStrategy sourceInformationFactory; | 10 final SourceInformationStrategy sourceInformationFactory; |
| (...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1756 push(new js.Assignment(access, pop()) | 1756 push(new js.Assignment(access, pop()) |
| 1757 .withSourceInformation(node.sourceInformation)); | 1757 .withSourceInformation(node.sourceInformation)); |
| 1758 } else { | 1758 } else { |
| 1759 registry.registerStaticUse(new StaticUse.superGet(superElement)); | 1759 registry.registerStaticUse(new StaticUse.superGet(superElement)); |
| 1760 push(access); | 1760 push(access); |
| 1761 } | 1761 } |
| 1762 } else { | 1762 } else { |
| 1763 Selector selector = node.selector; | 1763 Selector selector = node.selector; |
| 1764 if (!backend.maybeRegisterAliasedSuperMember(superElement, selector)) { | 1764 if (!backend.maybeRegisterAliasedSuperMember(superElement, selector)) { |
| 1765 js.Name methodName; | 1765 js.Name methodName; |
| 1766 if (selector.isGetter) { | 1766 if (selector.isGetter && !superElement.isGetter) { |
| 1767 // If the selector we need to register a typed getter to the | 1767 // If this is a tear-off, register the fact that a tear-off closure |
| 1768 // [world]. The emitter needs to know if it needs to emit a | 1768 // will be created, and that this tear-off must bypass ordinary |
| 1769 // bound closure for a method. | 1769 // dispatch to ensure the super method is invoked. |
| 1770 | 1770 FunctionElement helper = backend.helpers.closureFromTearOff; |
| 1771 // If [superMethod] is mixed in, [superClass] might not be live. | 1771 registry.registerStaticUse(new StaticUse.staticInvoke(helper, |
| 1772 // We use the superclass of the access instead. | 1772 new CallStructure.unnamed(helper.parameters.length))); |
| 1773 TypeMask receiverType = | 1773 registry.registerStaticUse(new StaticUse.superTearOff(node.element)); |
| 1774 new TypeMask.nonNullExact(node.caller.superclass, compiler.world); | |
| 1775 // TODO(floitsch): we know the target. We shouldn't register a | |
| 1776 // dynamic getter. | |
| 1777 registry.registerDynamicUse( | |
| 1778 new DynamicUse(selector, receiverType)); | |
| 1779 if (superElement.isFunction) { | |
| 1780 registry.registerStaticUse( | |
| 1781 new StaticUse.superTearOff(superElement)); | |
| 1782 } | |
| 1783 methodName = backend.namer.invocationName(selector); | 1774 methodName = backend.namer.invocationName(selector); |
| 1784 } else { | 1775 } else { |
| 1785 assert(invariant(node, compiler.hasIncrementalSupport)); | |
| 1786 methodName = backend.namer.instanceMethodName(superElement); | 1776 methodName = backend.namer.instanceMethodName(superElement); |
| 1787 } | 1777 } |
| 1788 registry.registerStaticUse( | 1778 registry.registerStaticUse( |
| 1789 new StaticUse.superInvoke( | 1779 new StaticUse.superInvoke( |
| 1790 superElement, | 1780 superElement, |
| 1791 new CallStructure.unnamed(node.inputs.length))); | 1781 new CallStructure.unnamed(node.inputs.length))); |
| 1792 push(js.js('#.#.call(#)', | 1782 push(js.js('#.#.call(#)', |
| 1793 [backend.emitter.prototypeAccess(superClass, | 1783 [backend.emitter.prototypeAccess(superClass, |
| 1794 hasBeenInstantiated: true), | 1784 hasBeenInstantiated: true), |
| 1795 methodName, visitArguments(node.inputs, start: 0)]) | 1785 methodName, visitArguments(node.inputs, start: 0)]) |
| (...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2919 new StaticUse.staticInvoke(helper, | 2909 new StaticUse.staticInvoke(helper, |
| 2920 new CallStructure.unnamed(argumentCount))); | 2910 new CallStructure.unnamed(argumentCount))); |
| 2921 return backend.emitter.staticFunctionAccess(helper); | 2911 return backend.emitter.staticFunctionAccess(helper); |
| 2922 } | 2912 } |
| 2923 | 2913 |
| 2924 @override | 2914 @override |
| 2925 void visitRef(HRef node) { | 2915 void visitRef(HRef node) { |
| 2926 visit(node.value); | 2916 visit(node.value); |
| 2927 } | 2917 } |
| 2928 } | 2918 } |
| OLD | NEW |