| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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:collection' show Queue; | 5 import 'dart:collection' show Queue; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/backend_api.dart' show ForeignResolver; | 8 import '../common/backend_api.dart' show ForeignResolver; |
| 9 import '../common/resolution.dart' show Resolution; | 9 import '../common/resolution.dart' show Resolution; |
| 10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 int unusedBefore = _unusedClasses.length; | 430 int unusedBefore = _unusedClasses.length; |
| 431 Set<ClassElement> matchingClasses = new Set<ClassElement>(); | 431 Set<ClassElement> matchingClasses = new Set<ClassElement>(); |
| 432 for (var type in behavior.typesInstantiated) { | 432 for (var type in behavior.typesInstantiated) { |
| 433 if (type is SpecialType) { | 433 if (type is SpecialType) { |
| 434 if (type == SpecialType.JsObject) { | 434 if (type == SpecialType.JsObject) { |
| 435 registerInstantiation(compiler.commonElements.objectType); | 435 registerInstantiation(compiler.commonElements.objectType); |
| 436 } | 436 } |
| 437 continue; | 437 continue; |
| 438 } | 438 } |
| 439 if (type is ResolutionInterfaceType) { | 439 if (type is ResolutionInterfaceType) { |
| 440 if (type == commonElements.intType) { | 440 if (type == commonElements.numType) { |
| 441 registerInstantiation(type); | |
| 442 } else if (type == commonElements.doubleType) { | |
| 443 registerInstantiation(type); | |
| 444 } else if (type == commonElements.numType) { | |
| 445 registerInstantiation(commonElements.doubleType); | 441 registerInstantiation(commonElements.doubleType); |
| 446 registerInstantiation(commonElements.intType); | 442 registerInstantiation(commonElements.intType); |
| 447 } else if (type == commonElements.stringType) { | 443 } else if (type == commonElements.intType || |
| 448 registerInstantiation(type); | 444 type == commonElements.doubleType || |
| 449 } else if (type == commonElements.nullType) { | 445 type == commonElements.stringType || |
| 450 registerInstantiation(type); | 446 type == commonElements.nullType || |
| 451 } else if (type == commonElements.boolType) { | 447 type == commonElements.boolType || |
| 452 registerInstantiation(type); | 448 type.asInstanceOf(backend.backendClasses.listClass) != null) { |
| 453 } else if (compiler.types.isSubtype( | |
| 454 type, backend.backendClasses.listImplementation.rawType)) { | |
| 455 registerInstantiation(type); | 449 registerInstantiation(type); |
| 456 } | 450 } |
| 457 // TODO(johnniwinther): Improve spec string precision to handle type | 451 // TODO(johnniwinther): Improve spec string precision to handle type |
| 458 // arguments and implements relations that preserve generics. Currently | 452 // arguments and implements relations that preserve generics. Currently |
| 459 // we cannot distinguish between `List`, `List<dynamic>`, and | 453 // we cannot distinguish between `List`, `List<dynamic>`, and |
| 460 // `List<int>` and take all to mean `List<E>`; in effect not including | 454 // `List<int>` and take all to mean `List<E>`; in effect not including |
| 461 // any native subclasses of generic classes. | 455 // any native subclasses of generic classes. |
| 462 // TODO(johnniwinther,sra): Find and replace uses of `List` with the | 456 // TODO(johnniwinther,sra): Find and replace uses of `List` with the |
| 463 // actual implementation classes such as `JSArray` et al. | 457 // actual implementation classes such as `JSArray` et al. |
| 464 matchingClasses | 458 matchingClasses |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 List<ClassEntity> directSubtypes = | 648 List<ClassEntity> directSubtypes = |
| 655 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassEntity>[]); | 649 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassEntity>[]); |
| 656 directSubtypes.add(cls); | 650 directSubtypes.add(cls); |
| 657 } | 651 } |
| 658 | 652 |
| 659 void logSummary(log(message)) { | 653 void logSummary(log(message)) { |
| 660 log('Compiled ${_registeredClasses.length} native classes, ' | 654 log('Compiled ${_registeredClasses.length} native classes, ' |
| 661 '${_unusedClasses.length} native classes omitted.'); | 655 '${_unusedClasses.length} native classes omitted.'); |
| 662 } | 656 } |
| 663 } | 657 } |
| OLD | NEW |