Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: pkg/compiler/lib/src/ssa/codegen.dart

Issue 722163002: Add support for static calls to the cps pipeline code generator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 10
(...skipping 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 use(node.receiver); 1630 use(node.receiver);
1631 push(jsPropertyCall(pop(), 1631 push(jsPropertyCall(pop(),
1632 backend.namer.invocationName(call), 1632 backend.namer.invocationName(call),
1633 visitArguments(node.inputs)), 1633 visitArguments(node.inputs)),
1634 node); 1634 node);
1635 registry.registerDynamicInvocation(call); 1635 registry.registerDynamicInvocation(call);
1636 } 1636 }
1637 1637
1638 visitInvokeStatic(HInvokeStatic node) { 1638 visitInvokeStatic(HInvokeStatic node) {
1639 Element element = node.element; 1639 Element element = node.element;
1640 ClassElement cls = element.enclosingClass;
1641 List<DartType> instantiatedTypes = node.instantiatedTypes; 1640 List<DartType> instantiatedTypes = node.instantiatedTypes;
1642 1641
1643 registry.registerStaticUse(element); 1642 registry.registerStaticInvocation(element);
1644 1643
1645 if (instantiatedTypes != null && !instantiatedTypes.isEmpty) { 1644 if (instantiatedTypes != null && !instantiatedTypes.isEmpty) {
1646 instantiatedTypes.forEach((type) { 1645 instantiatedTypes.forEach((type) {
1647 registry.registerInstantiatedType(type); 1646 registry.registerInstantiatedType(type);
1648 }); 1647 });
1649 } 1648 }
1650 1649
1651 push(backend.namer.elementAccess(node.element)); 1650 push(backend.namer.elementAccess(node.element));
1652 push(new js.Call(pop(), visitArguments(node.inputs, start: 0)), node); 1651 push(new js.Call(pop(), visitArguments(node.inputs, start: 0)), node);
1653 } 1652 }
1654 1653
1655 visitInvokeSuper(HInvokeSuper node) { 1654 visitInvokeSuper(HInvokeSuper node) {
1656 Element superMethod = node.element; 1655 Element superMethod = node.element;
1657 registry.registerStaticUse(superMethod); 1656 registry.registerSuperInvocation(superMethod);
1658 ClassElement superClass = superMethod.enclosingClass; 1657 ClassElement superClass = superMethod.enclosingClass;
1659 if (superMethod.kind == ElementKind.FIELD) { 1658 if (superMethod.kind == ElementKind.FIELD) {
1660 String fieldName = backend.namer.instanceFieldPropertyName(superMethod); 1659 String fieldName = backend.namer.instanceFieldPropertyName(superMethod);
1661 use(node.inputs[0]); 1660 use(node.inputs[0]);
1662 js.PropertyAccess access = 1661 js.PropertyAccess access =
1663 new js.PropertyAccess.field(pop(), fieldName); 1662 new js.PropertyAccess.field(pop(), fieldName);
1664 if (node.isSetter) { 1663 if (node.isSetter) {
1665 use(node.value); 1664 use(node.value);
1666 push(new js.Assignment(access, pop()), node); 1665 push(new js.Assignment(access, pop()), node);
1667 } else { 1666 } else {
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
2722 js.PropertyAccess accessHelper(String name) { 2721 js.PropertyAccess accessHelper(String name) {
2723 Element helper = backend.findHelper(name); 2722 Element helper = backend.findHelper(name);
2724 if (helper == null) { 2723 if (helper == null) {
2725 // For mocked-up tests. 2724 // For mocked-up tests.
2726 return js.js('(void 0).$name'); 2725 return js.js('(void 0).$name');
2727 } 2726 }
2728 registry.registerStaticUse(helper); 2727 registry.registerStaticUse(helper);
2729 return backend.namer.elementAccess(helper); 2728 return backend.namer.elementAccess(helper);
2730 } 2729 }
2731 } 2730 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698