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

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

Issue 2646733006: Use entities in native_emitter.dart (Closed)
Patch Set: Created 3 years, 11 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
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/resolution.dart' show Resolution; 9 import '../common/resolution.dart' show Resolution;
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
11 import '../constants/values.dart'; 11 import '../constants/values.dart';
12 import '../core_types.dart' show CommonElements; 12 import '../core_types.dart' show CommonElements;
13 import '../elements/elements.dart';
14 import '../elements/entities.dart';
15 import '../elements/modelx.dart' show FunctionElementX;
13 import '../elements/resolution_types.dart'; 16 import '../elements/resolution_types.dart';
14 import '../elements/elements.dart';
15 import '../elements/modelx.dart' show FunctionElementX;
16 import '../js_backend/backend_helpers.dart' show BackendHelpers; 17 import '../js_backend/backend_helpers.dart' show BackendHelpers;
17 import '../js_backend/js_backend.dart'; 18 import '../js_backend/js_backend.dart';
18 import '../js_emitter/js_emitter.dart' show CodeEmitterTask, NativeEmitter; 19 import '../js_emitter/js_emitter.dart' show CodeEmitterTask, NativeEmitter;
19 import '../tokens/token.dart' show BeginGroupToken, Token; 20 import '../tokens/token.dart' show BeginGroupToken, Token;
20 import '../tokens/token_constants.dart' as Tokens show EOF_TOKEN; 21 import '../tokens/token_constants.dart' as Tokens show EOF_TOKEN;
21 import '../tree/tree.dart'; 22 import '../tree/tree.dart';
22 import '../universe/use.dart' show StaticUse, TypeUse; 23 import '../universe/use.dart' show StaticUse, TypeUse;
23 import '../universe/world_impact.dart' 24 import '../universe/world_impact.dart'
24 show WorldImpact, WorldImpactBuilder, WorldImpactBuilderImpl; 25 show WorldImpact, WorldImpactBuilder, WorldImpactBuilderImpl;
25 import 'behavior.dart'; 26 import 'behavior.dart';
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 629
629 void _addSubtypes(ClassElement cls, NativeEmitter emitter) { 630 void _addSubtypes(ClassElement cls, NativeEmitter emitter) {
630 if (!backend.isNative(cls)) return; 631 if (!backend.isNative(cls)) return;
631 if (doneAddSubtypes.contains(cls)) return; 632 if (doneAddSubtypes.contains(cls)) return;
632 doneAddSubtypes.add(cls); 633 doneAddSubtypes.add(cls);
633 634
634 // Walk the superclass chain since classes on the superclass chain might not 635 // Walk the superclass chain since classes on the superclass chain might not
635 // be instantiated (abstract or simply unused). 636 // be instantiated (abstract or simply unused).
636 _addSubtypes(cls.superclass, emitter); 637 _addSubtypes(cls.superclass, emitter);
637 638
638 for (ResolutionDartType type in cls.allSupertypes) { 639 for (ResolutionInterfaceType type in cls.allSupertypes) {
639 List<Element> subtypes = 640 List<ClassEntity> subtypes =
640 emitter.subtypes.putIfAbsent(type.element, () => <ClassElement>[]); 641 emitter.subtypes.putIfAbsent(type.element, () => <ClassEntity>[]);
641 subtypes.add(cls); 642 subtypes.add(cls);
642 } 643 }
643 644
644 // Skip through all the mixin applications in the super class 645 // Skip through all the mixin applications in the super class
645 // chain. That way, the direct subtypes set only contain the 646 // chain. That way, the direct subtypes set only contain the
646 // natives classes. 647 // natives classes.
647 ClassElement superclass = cls.superclass; 648 ClassElement superclass = cls.superclass;
648 while (superclass != null && superclass.isMixinApplication) { 649 while (superclass != null && superclass.isMixinApplication) {
649 assert(!backend.isNative(superclass)); 650 assert(!backend.isNative(superclass));
650 superclass = superclass.superclass; 651 superclass = superclass.superclass;
651 } 652 }
652 653
653 List<Element> directSubtypes = 654 List<ClassEntity> directSubtypes =
654 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassElement>[]); 655 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassEntity>[]);
655 directSubtypes.add(cls); 656 directSubtypes.add(cls);
656 } 657 }
657 658
658 void logSummary(log(message)) { 659 void logSummary(log(message)) {
659 log('Compiled ${_registeredClasses.length} native classes, ' 660 log('Compiled ${_registeredClasses.length} native classes, '
660 '${_unusedClasses.length} native classes omitted.'); 661 '${_unusedClasses.length} native classes omitted.');
661 } 662 }
662 } 663 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698