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

Side by Side Diff: dart/frog/leg/ssa/codegen.dart

Issue 9753007: Implement super-send to non-function. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 8 years, 9 months 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
« no previous file with comments | « dart/frog/leg/ssa/builder.dart ('k') | dart/tests/co19/co19-leg.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class SsaCodeGeneratorTask extends CompilerTask { 5 class SsaCodeGeneratorTask extends CompilerTask {
6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); 6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler);
7 String get name() => 'SSA code generator'; 7 String get name() => 'SSA code generator';
8 8
9 String generate(WorkItem work, HGraph graph) { 9 String generate(WorkItem work, HGraph graph) {
10 return measure(() { 10 return measure(() {
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 endExpression(JSPrecedence.CALL_PRECEDENCE); 631 endExpression(JSPrecedence.CALL_PRECEDENCE);
632 } 632 }
633 633
634 visitInvokeSuper(HInvokeSuper node) { 634 visitInvokeSuper(HInvokeSuper node) {
635 beginExpression(JSPrecedence.CALL_PRECEDENCE); 635 beginExpression(JSPrecedence.CALL_PRECEDENCE);
636 Element superMethod = node.element; 636 Element superMethod = node.element;
637 Element superClass = superMethod.enclosingElement; 637 Element superClass = superMethod.enclosingElement;
638 // Remove the element and 'this'. 638 // Remove the element and 'this'.
639 int argumentCount = node.inputs.length - 2; 639 int argumentCount = node.inputs.length - 2;
640 String className = compiler.namer.isolatePropertyAccess(superClass); 640 String className = compiler.namer.isolatePropertyAccess(superClass);
641 String methodName = compiler.namer.instanceMethodName( 641 String methodName;
642 currentLibrary, superMethod.name, argumentCount); 642 if (superMethod.kind == ElementKind.FUNCTION ||
643 superMethod.kind == ElementKind.GENERATIVE_CONSTRUCTOR) {
644 methodName = compiler.namer.instanceMethodName(
645 currentLibrary, superMethod.name, argumentCount);
646 } else {
647 methodName = compiler.namer.getterName(currentLibrary, superMethod.name);
648 // We need to register the name to ensure that the emitter
649 // generates the necessary getter.
650 // TODO(ahe): This is not optimal for tree-shaking, but we lack
651 // API to register the precise information. In this case, the
652 // enclosingElement of superMethod needs the getter, no other
653 // class (not even its subclasses).
654 compiler.registerDynamicGetter(superMethod.name);
655 }
643 buffer.add('$className.prototype.$methodName.call'); 656 buffer.add('$className.prototype.$methodName.call');
644 visitArguments(node.inputs); 657 visitArguments(node.inputs);
645 endExpression(JSPrecedence.CALL_PRECEDENCE); 658 endExpression(JSPrecedence.CALL_PRECEDENCE);
646 compiler.registerStaticUse(superMethod); 659 compiler.registerStaticUse(superMethod);
647 } 660 }
648 661
649 visitFieldGet(HFieldGet node) { 662 visitFieldGet(HFieldGet node) {
650 String name = JsNames.getValid(node.element.name.slowToString()); 663 String name = JsNames.getValid(node.element.name.slowToString());
651 if (node.receiver !== null) { 664 if (node.receiver !== null) {
652 beginExpression(JSPrecedence.MEMBER_PRECEDENCE); 665 beginExpression(JSPrecedence.MEMBER_PRECEDENCE);
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 startBailoutSwitch(); 1497 startBailoutSwitch();
1485 } 1498 }
1486 } 1499 }
1487 1500
1488 void endElse(HIf node) { 1501 void endElse(HIf node) {
1489 if (node.elseBlock.hasBailouts()) { 1502 if (node.elseBlock.hasBailouts()) {
1490 endBailoutSwitch(); 1503 endBailoutSwitch();
1491 } 1504 }
1492 } 1505 }
1493 } 1506 }
OLDNEW
« no previous file with comments | « dart/frog/leg/ssa/builder.dart ('k') | dart/tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698