Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: pkg/compiler/lib/src/native/enqueue.dart

Issue 2021723003: Fix code-size regression (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/compiler/dart2js/mirrors_used_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/registry.dart' show Registry; 9 import '../common/registry.dart' show Registry;
10 import '../common/resolution.dart' show Resolution; 10 import '../common/resolution.dart' show Resolution;
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 } else if (type == coreTypes.stringType) { 513 } else if (type == coreTypes.stringType) {
514 backend.registerInstantiatedType(type, world, registry); 514 backend.registerInstantiatedType(type, world, registry);
515 } else if (type == coreTypes.nullType) { 515 } else if (type == coreTypes.nullType) {
516 backend.registerInstantiatedType(type, world, registry); 516 backend.registerInstantiatedType(type, world, registry);
517 } else if (type == coreTypes.boolType) { 517 } else if (type == coreTypes.boolType) {
518 backend.registerInstantiatedType(type, world, registry); 518 backend.registerInstantiatedType(type, world, registry);
519 } else if (compiler.types 519 } else if (compiler.types
520 .isSubtype(type, backend.listImplementation.rawType)) { 520 .isSubtype(type, backend.listImplementation.rawType)) {
521 backend.registerInstantiatedType(type, world, registry); 521 backend.registerInstantiatedType(type, world, registry);
522 } 522 }
523 // TODO(johnniwinther): Improve spec string precision to handle type
524 // arguments and implements relations that preserve generics. Currently
525 // we cannot distinguish between `List`, `List<dynamic>`, and
526 // `List<int>` and take all to mean `List<E>`; in effect not including
527 // any native subclasses of generic classes.
sra1 2016/05/31 20:47:05 Add comment that we should hunt down uses of `List
Johnni Winther 2016/06/02 08:19:20 Done.
528 enqueueUnusedClassesMatching((ClassElement nativeClass) {
529 InterfaceType nativeType = nativeClass.thisType;
530 InterfaceType specType = type.element.thisType;
531 return compiler.types.isSubtype(nativeType, specType);
532 }, cause, 'subtypeof($type)');
533 return;
523 } 534 }
524 assert(type is DartType); 535 assert(type is VoidType || type is DynamicType);
525 enqueueUnusedClassesMatching(
526 (nativeClass) => compiler.types.isSubtype(nativeClass.thisType, type),
527 cause,
528 'subtypeof($type)');
529 } 536 }
530 537
531 // Give an info so that library developers can compile with -v to find why 538 // Give an info so that library developers can compile with -v to find why
532 // all the native classes are included. 539 // all the native classes are included.
533 if (unusedClasses.isEmpty && !allUsedBefore) { 540 if (unusedClasses.isEmpty && !allUsedBefore) {
534 reporter.log('All native types marked as used due to $cause.'); 541 reporter.log('All native types marked as used due to $cause.');
535 } 542 }
536 } 543 }
537 544
538 enqueueUnusedClassesMatching(bool predicate(classElement), cause, 545 enqueueUnusedClassesMatching(bool predicate(classElement), cause,
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 List<Element> directSubtypes = 702 List<Element> directSubtypes =
696 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassElement>[]); 703 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassElement>[]);
697 directSubtypes.add(cls); 704 directSubtypes.add(cls);
698 } 705 }
699 706
700 void logSummary(log(message)) { 707 void logSummary(log(message)) {
701 log('Compiled ${registeredClasses.length} native classes, ' 708 log('Compiled ${registeredClasses.length} native classes, '
702 '${unusedClasses.length} native classes omitted.'); 709 '${unusedClasses.length} native classes omitted.');
703 } 710 }
704 } 711 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/mirrors_used_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698