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 2840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2851 new js.ArrayInitializer(parameterTypes), | 2851 new js.ArrayInitializer(parameterTypes), |
2852 new js.ObjectInitializer(namedParameters) | 2852 new js.ObjectInitializer(namedParameters) |
2853 ]; | 2853 ]; |
2854 push(js.js('#(#)', [accessHelper('buildNamedFunctionType'), arguments])); | 2854 push(js.js('#(#)', [accessHelper('buildNamedFunctionType'), arguments])); |
2855 } | 2855 } |
2856 } | 2856 } |
2857 | 2857 |
2858 void visitTypeInfoReadRaw(HTypeInfoReadRaw node) { | 2858 void visitTypeInfoReadRaw(HTypeInfoReadRaw node) { |
2859 use(node.inputs[0]); | 2859 use(node.inputs[0]); |
2860 js.Expression receiver = pop(); | 2860 js.Expression receiver = pop(); |
2861 push(js.js(r'#.$builtinTypeInfo', receiver)); | 2861 push(js.js(r'#.#', [receiver, backend.namer.rtiFieldName])); |
2862 } | 2862 } |
2863 | 2863 |
2864 void visitTypeInfoReadVariable(HTypeInfoReadVariable node) { | 2864 void visitTypeInfoReadVariable(HTypeInfoReadVariable node) { |
2865 TypeVariableElement element = node.variable.element; | 2865 TypeVariableElement element = node.variable.element; |
2866 ClassElement context = element.enclosingClass; | 2866 ClassElement context = element.enclosingClass; |
2867 | 2867 |
2868 int index = element.index; | 2868 int index = element.index; |
2869 use(node.inputs[0]); | 2869 use(node.inputs[0]); |
2870 js.Expression receiver = pop(); | 2870 js.Expression receiver = pop(); |
2871 | 2871 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2930 registry.registerStaticUse( | 2930 registry.registerStaticUse( |
2931 new StaticUse.staticInvoke(helperElement, CallStructure.ONE_ARG)); | 2931 new StaticUse.staticInvoke(helperElement, CallStructure.ONE_ARG)); |
2932 | 2932 |
2933 use(node.inputs[0]); | 2933 use(node.inputs[0]); |
2934 if (node.hasReceiver) { | 2934 if (node.hasReceiver) { |
2935 if (backend.isInterceptorClass(element.enclosingClass)) { | 2935 if (backend.isInterceptorClass(element.enclosingClass)) { |
2936 int index = element.index; | 2936 int index = element.index; |
2937 js.Expression receiver = pop(); | 2937 js.Expression receiver = pop(); |
2938 js.Expression helper = | 2938 js.Expression helper = |
2939 backend.emitter.staticFunctionAccess(helperElement); | 2939 backend.emitter.staticFunctionAccess(helperElement); |
2940 push(js.js(r'#(#.$builtinTypeInfo && #.$builtinTypeInfo[#])', | 2940 js.Expression rtiFieldName = backend.namer.rtiFieldName; |
2941 [helper, receiver, receiver, js.js.number(index)])); | 2941 push(js.js(r'#(#.# && #.#[#])', [ |
| 2942 helper, |
| 2943 receiver, |
| 2944 rtiFieldName, |
| 2945 receiver, |
| 2946 rtiFieldName, |
| 2947 js.js.number(index) |
| 2948 ])); |
2942 } else { | 2949 } else { |
2943 backend.emitter.registerReadTypeVariable(element); | 2950 backend.emitter.registerReadTypeVariable(element); |
2944 push(js.js( | 2951 push(js.js( |
2945 '#.#()', [pop(), backend.namer.nameForReadTypeVariable(element)])); | 2952 '#.#()', [pop(), backend.namer.nameForReadTypeVariable(element)])); |
2946 } | 2953 } |
2947 } else { | 2954 } else { |
2948 push(js.js('#(#)', | 2955 push(js.js('#(#)', |
2949 [backend.emitter.staticFunctionAccess(helperElement), pop()])); | 2956 [backend.emitter.staticFunctionAccess(helperElement), pop()])); |
2950 } | 2957 } |
2951 } | 2958 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2983 registry.registerStaticUse(new StaticUse.staticInvoke( | 2990 registry.registerStaticUse(new StaticUse.staticInvoke( |
2984 helper, new CallStructure.unnamed(argumentCount))); | 2991 helper, new CallStructure.unnamed(argumentCount))); |
2985 return backend.emitter.staticFunctionAccess(helper); | 2992 return backend.emitter.staticFunctionAccess(helper); |
2986 } | 2993 } |
2987 | 2994 |
2988 @override | 2995 @override |
2989 void visitRef(HRef node) { | 2996 void visitRef(HRef node) { |
2990 visit(node.value); | 2997 visit(node.value); |
2991 } | 2998 } |
2992 } | 2999 } |
OLD | NEW |