| 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 2985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2996 int index = 0; | 2996 int index = 0; |
| 2997 js.Expression result = backend.rtiEncoder.getTypeRepresentation( | 2997 js.Expression result = backend.rtiEncoder.getTypeRepresentation( |
| 2998 node.dartType, (TypeVariableType variable) => arguments[index++]); | 2998 node.dartType, (TypeVariableType variable) => arguments[index++]); |
| 2999 assert(index == node.inputs.length); | 2999 assert(index == node.inputs.length); |
| 3000 push(result); | 3000 push(result); |
| 3001 return; | 3001 return; |
| 3002 | 3002 |
| 3003 case TypeInfoExpressionKind.INSTANCE: | 3003 case TypeInfoExpressionKind.INSTANCE: |
| 3004 // We expect only flat types for the INSTANCE representation. | 3004 // We expect only flat types for the INSTANCE representation. |
| 3005 assert( | 3005 assert( |
| 3006 node.dartType == (node.dartType.element as ClassElement).thisType); | 3006 node.dartType == (node.dartType as InterfaceType).element.thisType); |
| 3007 registry.registerInstantiatedClass(commonElements.listClass); | 3007 registry.registerInstantiatedClass(commonElements.listClass); |
| 3008 push(new js.ArrayInitializer(arguments) | 3008 push(new js.ArrayInitializer(arguments) |
| 3009 .withSourceInformation(node.sourceInformation)); | 3009 .withSourceInformation(node.sourceInformation)); |
| 3010 } | 3010 } |
| 3011 } | 3011 } |
| 3012 | 3012 |
| 3013 bool typeVariableAccessNeedsSubstitution( | 3013 bool typeVariableAccessNeedsSubstitution( |
| 3014 TypeVariableElement element, TypeMask receiverMask) { | 3014 TypeVariableElement element, TypeMask receiverMask) { |
| 3015 ClassElement cls = element.enclosingClass; | 3015 ClassElement cls = element.enclosingClass; |
| 3016 | 3016 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3064 [backend.emitter.staticFunctionAccess(helperElement), pop()])); | 3064 [backend.emitter.staticFunctionAccess(helperElement), pop()])); |
| 3065 } | 3065 } |
| 3066 } | 3066 } |
| 3067 | 3067 |
| 3068 void visitInterfaceType(HInterfaceType node) { | 3068 void visitInterfaceType(HInterfaceType node) { |
| 3069 List<js.Expression> typeArguments = <js.Expression>[]; | 3069 List<js.Expression> typeArguments = <js.Expression>[]; |
| 3070 for (HInstruction type in node.inputs) { | 3070 for (HInstruction type in node.inputs) { |
| 3071 use(type); | 3071 use(type); |
| 3072 typeArguments.add(pop()); | 3072 typeArguments.add(pop()); |
| 3073 } | 3073 } |
| 3074 | 3074 InterfaceType type = node.dartType; |
| 3075 ClassElement cls = node.dartType.element; | 3075 ClassElement cls = type.element; |
| 3076 var arguments = [backend.emitter.typeAccess(cls)]; | 3076 var arguments = [backend.emitter.typeAccess(cls)]; |
| 3077 if (!typeArguments.isEmpty) { | 3077 if (!typeArguments.isEmpty) { |
| 3078 arguments.add(new js.ArrayInitializer(typeArguments)); | 3078 arguments.add(new js.ArrayInitializer(typeArguments)); |
| 3079 } | 3079 } |
| 3080 push(js.js('#(#)', | 3080 push(js.js('#(#)', |
| 3081 [accessHelper('buildInterfaceType', arguments.length), arguments])); | 3081 [accessHelper('buildInterfaceType', arguments.length), arguments])); |
| 3082 } | 3082 } |
| 3083 | 3083 |
| 3084 void visitVoidType(HVoidType node) { | 3084 void visitVoidType(HVoidType node) { |
| 3085 push(js.js('#()', accessHelper('getVoidRuntimeType'))); | 3085 push(js.js('#()', accessHelper('getVoidRuntimeType'))); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 3098 registry.registerStaticUse(new StaticUse.staticInvoke( | 3098 registry.registerStaticUse(new StaticUse.staticInvoke( |
| 3099 helper, new CallStructure.unnamed(argumentCount))); | 3099 helper, new CallStructure.unnamed(argumentCount))); |
| 3100 return backend.emitter.staticFunctionAccess(helper); | 3100 return backend.emitter.staticFunctionAccess(helper); |
| 3101 } | 3101 } |
| 3102 | 3102 |
| 3103 @override | 3103 @override |
| 3104 void visitRef(HRef node) { | 3104 void visitRef(HRef node) { |
| 3105 visit(node.value); | 3105 visit(node.value); |
| 3106 } | 3106 } |
| 3107 } | 3107 } |
| OLD | NEW |