Chromium Code Reviews| 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 'dart:math' as math; | 5 import 'dart:math' as math; |
| 6 import '../common.dart'; | 6 import '../common.dart'; |
| 7 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 7 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
| 8 import '../common/tasks.dart' show CompilerTask; | 8 import '../common/tasks.dart' show CompilerTask; |
| 9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
| 10 import '../constants/constant_system.dart'; | 10 import '../constants/constant_system.dart'; |
| (...skipping 2921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2932 } | 2932 } |
| 2933 | 2933 |
| 2934 if (namedParameters.isEmpty) { | 2934 if (namedParameters.isEmpty) { |
| 2935 var arguments = [returnType]; | 2935 var arguments = [returnType]; |
| 2936 if (!parameterTypes.isEmpty || !optionalParameterTypes.isEmpty) { | 2936 if (!parameterTypes.isEmpty || !optionalParameterTypes.isEmpty) { |
| 2937 arguments.add(new js.ArrayInitializer(parameterTypes)); | 2937 arguments.add(new js.ArrayInitializer(parameterTypes)); |
| 2938 } | 2938 } |
| 2939 if (!optionalParameterTypes.isEmpty) { | 2939 if (!optionalParameterTypes.isEmpty) { |
| 2940 arguments.add(new js.ArrayInitializer(optionalParameterTypes)); | 2940 arguments.add(new js.ArrayInitializer(optionalParameterTypes)); |
| 2941 } | 2941 } |
| 2942 push(js.js('#(#)', [accessHelper('buildFunctionType'), arguments])); | 2942 push(js.js('#(#)', [accessHelper(helpers.buildFunctionType), arguments])); |
| 2943 } else { | 2943 } else { |
| 2944 var arguments = [ | 2944 var arguments = [ |
| 2945 returnType, | 2945 returnType, |
| 2946 new js.ArrayInitializer(parameterTypes), | 2946 new js.ArrayInitializer(parameterTypes), |
| 2947 new js.ObjectInitializer(namedParameters) | 2947 new js.ObjectInitializer(namedParameters) |
| 2948 ]; | 2948 ]; |
| 2949 push(js.js('#(#)', [accessHelper('buildNamedFunctionType'), arguments])); | 2949 push(js.js( |
| 2950 '#(#)', [accessHelper(helpers.buildNamedFunctionType), arguments])); | |
| 2950 } | 2951 } |
| 2951 } | 2952 } |
| 2952 | 2953 |
| 2953 void visitTypeInfoReadRaw(HTypeInfoReadRaw node) { | 2954 void visitTypeInfoReadRaw(HTypeInfoReadRaw node) { |
| 2954 use(node.inputs[0]); | 2955 use(node.inputs[0]); |
| 2955 js.Expression receiver = pop(); | 2956 js.Expression receiver = pop(); |
| 2956 push(js.js(r'#.#', [receiver, backend.namer.rtiFieldName])); | 2957 push(js.js(r'#.#', [receiver, backend.namer.rtiFieldName])); |
| 2957 } | 2958 } |
| 2958 | 2959 |
| 2959 void visitTypeInfoReadVariable(HTypeInfoReadVariable node) { | 2960 void visitTypeInfoReadVariable(HTypeInfoReadVariable node) { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3070 for (HInstruction type in node.inputs) { | 3071 for (HInstruction type in node.inputs) { |
| 3071 use(type); | 3072 use(type); |
| 3072 typeArguments.add(pop()); | 3073 typeArguments.add(pop()); |
| 3073 } | 3074 } |
| 3074 InterfaceType type = node.dartType; | 3075 InterfaceType type = node.dartType; |
| 3075 ClassElement cls = type.element; | 3076 ClassElement cls = type.element; |
| 3076 var arguments = [backend.emitter.typeAccess(cls)]; | 3077 var arguments = [backend.emitter.typeAccess(cls)]; |
| 3077 if (!typeArguments.isEmpty) { | 3078 if (!typeArguments.isEmpty) { |
| 3078 arguments.add(new js.ArrayInitializer(typeArguments)); | 3079 arguments.add(new js.ArrayInitializer(typeArguments)); |
| 3079 } | 3080 } |
| 3080 push(js.js('#(#)', | 3081 push(js.js('#(#)', [ |
| 3081 [accessHelper('buildInterfaceType', arguments.length), arguments])); | 3082 accessHelper(helpers.buildInterfaceType, arguments.length), |
| 3083 arguments | |
| 3084 ])); | |
| 3082 } | 3085 } |
| 3083 | 3086 |
| 3084 void visitVoidType(HVoidType node) { | 3087 void visitVoidType(HVoidType node) { |
| 3085 push(js.js('#()', accessHelper('getVoidRuntimeType'))); | 3088 push(js.js('#()', accessHelper(helpers.getVoidRuntimeType))); |
| 3086 } | 3089 } |
| 3087 | 3090 |
| 3088 void visitDynamicType(HDynamicType node) { | 3091 void visitDynamicType(HDynamicType node) { |
| 3089 push(js.js('#()', accessHelper('getDynamicRuntimeType'))); | 3092 push(js.js('#()', accessHelper(helpers.getDynamicRuntimeType))); |
| 3090 } | 3093 } |
| 3091 | 3094 |
| 3092 js.PropertyAccess accessHelper(String name, [int argumentCount = 0]) { | 3095 js.PropertyAccess accessHelper(FunctionEntity helper, |
| 3093 Element helper = helpers.findHelper(name); | 3096 [int argumentCount = 0]) { |
| 3094 if (helper == null) { | 3097 if (helper == null) { |
| 3095 // For mocked-up tests. | 3098 // For mocked-up tests. |
| 3096 return js.js('(void 0).$name'); | 3099 return js.js('(void 0).dummy'); |
|
Siggi Cherem (dart-lang)
2017/01/03 17:05:37
could mock up tests be relying on the old name her
Johnni Winther
2017/01/04 10:10:57
They seem not to. I think we just need a dummy pro
| |
| 3097 } | 3100 } |
| 3098 registry.registerStaticUse(new StaticUse.staticInvoke( | 3101 registry.registerStaticUse(new StaticUse.staticInvoke( |
| 3099 helper, new CallStructure.unnamed(argumentCount))); | 3102 helper, new CallStructure.unnamed(argumentCount))); |
| 3100 return backend.emitter.staticFunctionAccess(helper); | 3103 return backend.emitter.staticFunctionAccess(helper); |
| 3101 } | 3104 } |
| 3102 | 3105 |
| 3103 @override | 3106 @override |
| 3104 void visitRef(HRef node) { | 3107 void visitRef(HRef node) { |
| 3105 visit(node.value); | 3108 visit(node.value); |
| 3106 } | 3109 } |
| 3107 } | 3110 } |
| OLD | NEW |