| 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 | 10 |
| (...skipping 2646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2657 } | 2657 } |
| 2658 | 2658 |
| 2659 void visitInterfaceType(HInterfaceType node) { | 2659 void visitInterfaceType(HInterfaceType node) { |
| 2660 List<js.Expression> typeArguments = <js.Expression>[]; | 2660 List<js.Expression> typeArguments = <js.Expression>[]; |
| 2661 for (HInstruction type in node.inputs) { | 2661 for (HInstruction type in node.inputs) { |
| 2662 use(type); | 2662 use(type); |
| 2663 typeArguments.add(pop()); | 2663 typeArguments.add(pop()); |
| 2664 } | 2664 } |
| 2665 | 2665 |
| 2666 ClassElement cls = node.dartType.element; | 2666 ClassElement cls = node.dartType.element; |
| 2667 var arguments = [ | 2667 var arguments = [backend.namer.elementAccess(cls)]; |
| 2668 backend.namer.elementAccess(backend.getImplementationClass(cls))]; | |
| 2669 if (!typeArguments.isEmpty) { | 2668 if (!typeArguments.isEmpty) { |
| 2670 arguments.add(new js.ArrayInitializer.from(typeArguments)); | 2669 arguments.add(new js.ArrayInitializer.from(typeArguments)); |
| 2671 } | 2670 } |
| 2672 push(js.js('#(#)', [accessHelper('buildInterfaceType'), arguments])); | 2671 push(js.js('#(#)', [accessHelper('buildInterfaceType'), arguments])); |
| 2673 } | 2672 } |
| 2674 | 2673 |
| 2675 void visitVoidType(HVoidType node) { | 2674 void visitVoidType(HVoidType node) { |
| 2676 push(js.js('#()', accessHelper('getVoidRuntimeType'))); | 2675 push(js.js('#()', accessHelper('getVoidRuntimeType'))); |
| 2677 } | 2676 } |
| 2678 | 2677 |
| 2679 void visitDynamicType(HDynamicType node) { | 2678 void visitDynamicType(HDynamicType node) { |
| 2680 push(js.js('#()', accessHelper('getDynamicRuntimeType'))); | 2679 push(js.js('#()', accessHelper('getDynamicRuntimeType'))); |
| 2681 } | 2680 } |
| 2682 | 2681 |
| 2683 js.PropertyAccess accessHelper(String name) { | 2682 js.PropertyAccess accessHelper(String name) { |
| 2684 Element helper = compiler.findHelper(name); | 2683 Element helper = compiler.findHelper(name); |
| 2685 if (helper == null) { | 2684 if (helper == null) { |
| 2686 // For mocked-up tests. | 2685 // For mocked-up tests. |
| 2687 return js.js('(void 0).$name'); | 2686 return js.js('(void 0).$name'); |
| 2688 } | 2687 } |
| 2689 world.registerStaticUse(helper); | 2688 world.registerStaticUse(helper); |
| 2690 return backend.namer.elementAccess(helper); | 2689 return backend.namer.elementAccess(helper); |
| 2691 } | 2690 } |
| 2692 } | 2691 } |
| OLD | NEW |