| 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 import '../common.dart'; | 5 import '../common.dart'; |
| 6 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 6 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
| 7 import '../common/tasks.dart' show CompilerTask; | 7 import '../common/tasks.dart' show CompilerTask; |
| 8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
| 9 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
| (...skipping 2807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2818 CheckedModeHelper helper; | 2818 CheckedModeHelper helper; |
| 2819 if (node.isBooleanConversionCheck) { | 2819 if (node.isBooleanConversionCheck) { |
| 2820 helper = const CheckedModeHelper('boolConversionCheck'); | 2820 helper = const CheckedModeHelper('boolConversionCheck'); |
| 2821 } else { | 2821 } else { |
| 2822 helper = | 2822 helper = |
| 2823 backend.getCheckedModeHelper(type, typeCast: node.isCastTypeCheck); | 2823 backend.getCheckedModeHelper(type, typeCast: node.isCastTypeCheck); |
| 2824 } | 2824 } |
| 2825 | 2825 |
| 2826 if (helper == null) { | 2826 if (helper == null) { |
| 2827 assert(type.isFunctionType); | 2827 assert(type.isFunctionType); |
| 2828 use(node.inputs[0]); | 2828 assert(node.usesMethodOnType); |
| 2829 |
| 2830 String name = node.isCastTypeCheck ? '_asCheck' : '_assertCheck'; |
| 2831 HInstruction reifiedType = node.inputs[0]; |
| 2832 HInstruction checkedInput = node.inputs[1]; |
| 2833 use(reifiedType); |
| 2834 js.Expression receiver = pop(); |
| 2835 use(checkedInput); |
| 2836 Selector selector = new Selector.call( |
| 2837 new Name(name, helpers.jsHelperLibrary), CallStructure.ONE_ARG); |
| 2838 registry.registerDynamicUse( |
| 2839 new DynamicUse(selector, reifiedType.instructionType)); |
| 2840 js.Name methodLiteral = backend.namer.invocationName(selector); |
| 2841 push(js.js('#.#(#)', [receiver, methodLiteral, pop()])); |
| 2829 } else { | 2842 } else { |
| 2843 assert(!node.usesMethodOnType); |
| 2830 push(helper.generateCall(this, node)); | 2844 push(helper.generateCall(this, node)); |
| 2831 } | 2845 } |
| 2832 } | 2846 } |
| 2833 | 2847 |
| 2834 void visitTypeKnown(HTypeKnown node) { | 2848 void visitTypeKnown(HTypeKnown node) { |
| 2835 // [HTypeKnown] instructions are removed before generating code. | 2849 // [HTypeKnown] instructions are removed before generating code. |
| 2836 assert(false); | 2850 assert(false); |
| 2837 } | 2851 } |
| 2838 | 2852 |
| 2839 void visitFunctionType(HFunctionType node) { | 2853 void visitFunctionType(HFunctionType node) { |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3030 registry.registerStaticUse(new StaticUse.staticInvoke( | 3044 registry.registerStaticUse(new StaticUse.staticInvoke( |
| 3031 helper, new CallStructure.unnamed(argumentCount))); | 3045 helper, new CallStructure.unnamed(argumentCount))); |
| 3032 return backend.emitter.staticFunctionAccess(helper); | 3046 return backend.emitter.staticFunctionAccess(helper); |
| 3033 } | 3047 } |
| 3034 | 3048 |
| 3035 @override | 3049 @override |
| 3036 void visitRef(HRef node) { | 3050 void visitRef(HRef node) { |
| 3037 visit(node.value); | 3051 visit(node.value); |
| 3038 } | 3052 } |
| 3039 } | 3053 } |
| OLD | NEW |