| 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 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 registry.registerInstantiation(typeImplementation.rawType); | 1099 registry.registerInstantiation(typeImplementation.rawType); |
| 1100 } | 1100 } |
| 1101 lookupMapAnalysis.registerConstantKey(constant); | 1101 lookupMapAnalysis.registerConstantKey(constant); |
| 1102 } | 1102 } |
| 1103 | 1103 |
| 1104 void registerInstantiatedConstantType(DartType type, Registry registry) { | 1104 void registerInstantiatedConstantType(DartType type, Registry registry) { |
| 1105 DartType instantiatedType = | 1105 DartType instantiatedType = |
| 1106 type.isFunctionType ? coreTypes.functionType : type; | 1106 type.isFunctionType ? coreTypes.functionType : type; |
| 1107 if (type is InterfaceType) { | 1107 if (type is InterfaceType) { |
| 1108 registry.registerInstantiation(instantiatedType); | 1108 registry.registerInstantiation(instantiatedType); |
| 1109 if (!type.treatAsRaw && classNeedsRti(type.element)) { | 1109 if (classNeedsRtiField(type.element)) { |
| 1110 registry.registerStaticUse(new StaticUse.staticInvoke( | 1110 registry.registerStaticUse(new StaticUse.staticInvoke( |
| 1111 // TODO(johnniwinther): Find the right [CallStructure]. | 1111 // TODO(johnniwinther): Find the right [CallStructure]. |
| 1112 helpers.setRuntimeTypeInfo, | 1112 helpers.setRuntimeTypeInfo, |
| 1113 null)); | 1113 null)); |
| 1114 } | 1114 } |
| 1115 if (type.element == typeImplementation) { | 1115 if (type.element == typeImplementation) { |
| 1116 // If we use a type literal in a constant, the compile time | 1116 // If we use a type literal in a constant, the compile time |
| 1117 // constant emitter will generate a call to the createRuntimeType | 1117 // constant emitter will generate a call to the createRuntimeType |
| 1118 // helper so we register a use of that. | 1118 // helper so we register a use of that. |
| 1119 registry.registerStaticUse(new StaticUse.staticInvoke( | 1119 registry.registerStaticUse(new StaticUse.staticInvoke( |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 | 1468 |
| 1469 enqueue(helpers.startRootIsolate); | 1469 enqueue(helpers.startRootIsolate); |
| 1470 enqueue(helpers.currentIsolate); | 1470 enqueue(helpers.currentIsolate); |
| 1471 enqueue(helpers.callInIsolate); | 1471 enqueue(helpers.callInIsolate); |
| 1472 } else { | 1472 } else { |
| 1473 enqueuer.addToWorkList(helpers.startRootIsolate); | 1473 enqueuer.addToWorkList(helpers.startRootIsolate); |
| 1474 } | 1474 } |
| 1475 } | 1475 } |
| 1476 | 1476 |
| 1477 bool classNeedsRti(ClassElement cls) { | 1477 bool classNeedsRti(ClassElement cls) { |
| 1478 return rti.classesNeedingRti.contains(cls.declaration) || | 1478 if (compiler.enabledRuntimeType) return true; |
| 1479 compiler.enabledRuntimeType; | 1479 return rti.classesNeedingRti.contains(cls.declaration); |
| 1480 } |
| 1481 |
| 1482 bool classNeedsRtiField(ClassElement cls) { |
| 1483 if (cls.rawType.typeArguments.isEmpty) return false; |
| 1484 if (compiler.enabledRuntimeType) return true; |
| 1485 return rti.classesNeedingRti.contains(cls.declaration); |
| 1480 } | 1486 } |
| 1481 | 1487 |
| 1482 bool isComplexNoSuchMethod(FunctionElement element) => | 1488 bool isComplexNoSuchMethod(FunctionElement element) => |
| 1483 noSuchMethodRegistry.isComplex(element); | 1489 noSuchMethodRegistry.isComplex(element); |
| 1484 | 1490 |
| 1485 bool isDefaultEqualityImplementation(Element element) { | 1491 bool isDefaultEqualityImplementation(Element element) { |
| 1486 assert(element.name == '=='); | 1492 assert(element.name == '=='); |
| 1487 ClassElement classElement = element.enclosingClass; | 1493 ClassElement classElement = element.enclosingClass; |
| 1488 return classElement == coreClasses.objectClass || | 1494 return classElement == coreClasses.objectClass || |
| 1489 classElement == helpers.jsInterceptorClass || | 1495 classElement == helpers.jsInterceptorClass || |
| (...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3200 | 3206 |
| 3201 @override | 3207 @override |
| 3202 void onImpactUsed(ImpactUseCase impactUse) { | 3208 void onImpactUsed(ImpactUseCase impactUse) { |
| 3203 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { | 3209 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { |
| 3204 // TODO(johnniwinther): Allow emptying when serialization has been | 3210 // TODO(johnniwinther): Allow emptying when serialization has been |
| 3205 // performed. | 3211 // performed. |
| 3206 resolution.emptyCache(); | 3212 resolution.emptyCache(); |
| 3207 } | 3213 } |
| 3208 } | 3214 } |
| 3209 } | 3215 } |
| OLD | NEW |