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 library js_backend.backend; | 5 library js_backend.backend; |
6 | 6 |
7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
8 | 8 |
9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
10 | 10 |
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 registry.registerInstantiation(typeImplementation.rawType); | 1106 registry.registerInstantiation(typeImplementation.rawType); |
1107 } | 1107 } |
1108 lookupMapAnalysis.registerConstantKey(constant); | 1108 lookupMapAnalysis.registerConstantKey(constant); |
1109 } | 1109 } |
1110 | 1110 |
1111 void registerInstantiatedConstantType(DartType type, Registry registry) { | 1111 void registerInstantiatedConstantType(DartType type, Registry registry) { |
1112 DartType instantiatedType = | 1112 DartType instantiatedType = |
1113 type.isFunctionType ? coreTypes.functionType : type; | 1113 type.isFunctionType ? coreTypes.functionType : type; |
1114 if (type is InterfaceType) { | 1114 if (type is InterfaceType) { |
1115 registry.registerInstantiation(instantiatedType); | 1115 registry.registerInstantiation(instantiatedType); |
1116 if (!type.treatAsRaw && classNeedsRti(type.element)) { | 1116 if (classNeedsRti(type.element)) { |
1117 registry.registerStaticUse(new StaticUse.staticInvoke( | 1117 registry.registerStaticUse(new StaticUse.staticInvoke( |
1118 // TODO(johnniwinther): Find the right [CallStructure]. | 1118 // TODO(johnniwinther): Find the right [CallStructure]. |
1119 helpers.setRuntimeTypeInfo, | 1119 helpers.setRuntimeTypeInfo, |
1120 null)); | 1120 null)); |
1121 } | 1121 } |
1122 if (type.element == typeImplementation) { | 1122 if (type.element == typeImplementation) { |
1123 // If we use a type literal in a constant, the compile time | 1123 // If we use a type literal in a constant, the compile time |
1124 // constant emitter will generate a call to the createRuntimeType | 1124 // constant emitter will generate a call to the createRuntimeType |
1125 // helper so we register a use of that. | 1125 // helper so we register a use of that. |
1126 registry.registerStaticUse(new StaticUse.staticInvoke( | 1126 registry.registerStaticUse(new StaticUse.staticInvoke( |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1479 | 1479 |
1480 enqueue(helpers.startRootIsolate); | 1480 enqueue(helpers.startRootIsolate); |
1481 enqueue(helpers.currentIsolate); | 1481 enqueue(helpers.currentIsolate); |
1482 enqueue(helpers.callInIsolate); | 1482 enqueue(helpers.callInIsolate); |
1483 } else { | 1483 } else { |
1484 enqueuer.addToWorkList(helpers.startRootIsolate); | 1484 enqueuer.addToWorkList(helpers.startRootIsolate); |
1485 } | 1485 } |
1486 } | 1486 } |
1487 | 1487 |
1488 bool classNeedsRti(ClassElement cls) { | 1488 bool classNeedsRti(ClassElement cls) { |
1489 return rti.classesNeedingRti.contains(cls.declaration) || | 1489 if (cls.rawType.typeArguments.isEmpty) return false; |
1490 compiler.enabledRuntimeType; | 1490 if (rti.classesNeedingRti.contains(cls.declaration)) return true; |
| 1491 if (compiler.enabledRuntimeType) return true; // Needed e.g. to print. |
| 1492 return false; |
1491 } | 1493 } |
1492 | 1494 |
1493 bool isComplexNoSuchMethod(FunctionElement element) => | 1495 bool isComplexNoSuchMethod(FunctionElement element) => |
1494 noSuchMethodRegistry.isComplex(element); | 1496 noSuchMethodRegistry.isComplex(element); |
1495 | 1497 |
1496 bool isDefaultEqualityImplementation(Element element) { | 1498 bool isDefaultEqualityImplementation(Element element) { |
1497 assert(element.name == '=='); | 1499 assert(element.name == '=='); |
1498 ClassElement classElement = element.enclosingClass; | 1500 ClassElement classElement = element.enclosingClass; |
1499 return classElement == coreClasses.objectClass || | 1501 return classElement == coreClasses.objectClass || |
1500 classElement == helpers.jsInterceptorClass || | 1502 classElement == helpers.jsInterceptorClass || |
(...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3196 | 3198 |
3197 @override | 3199 @override |
3198 void onImpactUsed(ImpactUseCase impactUse) { | 3200 void onImpactUsed(ImpactUseCase impactUse) { |
3199 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { | 3201 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { |
3200 // TODO(johnniwinther): Allow emptying when serialization has been | 3202 // TODO(johnniwinther): Allow emptying when serialization has been |
3201 // performed. | 3203 // performed. |
3202 resolution.emptyCache(); | 3204 resolution.emptyCache(); |
3203 } | 3205 } |
3204 } | 3206 } |
3205 } | 3207 } |
OLD | NEW |