| 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 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |