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