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

Side by Side Diff: pkg/compiler/lib/src/universe/resolution_world_builder.dart

Issue 2725933006: Reduce use of elements/resolution_types in enqueuer. (Closed)
Patch Set: Updated cf. comment. Created 3 years, 9 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 part of world_builder; 5 part of world_builder;
6 6
7 abstract class ResolutionWorldBuilder implements WorldBuilder, OpenWorld { 7 abstract class ResolutionWorldBuilder implements WorldBuilder, OpenWorld {
8 /// Set of all local functions in the program. Used by the mirror tracking 8 /// Set of all local functions in the program. Used by the mirror tracking
9 /// system to find all live closure instances. 9 /// system to find all live closure instances.
10 Iterable<LocalFunctionElement> get localFunctions; 10 Iterable<LocalFunctionElement> get localFunctions;
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 } 387 }
388 }); 388 });
389 return classes; 389 return classes;
390 } 390 }
391 391
392 /// All directly instantiated types, that is, the types of the directly 392 /// All directly instantiated types, that is, the types of the directly
393 /// instantiated classes. 393 /// instantiated classes.
394 /// 394 ///
395 /// See [directlyInstantiatedClasses]. 395 /// See [directlyInstantiatedClasses].
396 // TODO(johnniwinther): Improve semantic precision. 396 // TODO(johnniwinther): Improve semantic precision.
397 Iterable<ResolutionDartType> get instantiatedTypes { 397 Iterable<InterfaceType> get instantiatedTypes {
398 Set<ResolutionInterfaceType> types = new Set<ResolutionInterfaceType>(); 398 Set<ResolutionInterfaceType> types = new Set<ResolutionInterfaceType>();
399 getInstantiationMap().forEach((_, InstantiationInfo info) { 399 getInstantiationMap().forEach((_, InstantiationInfo info) {
400 if (info.instantiationMap != null) { 400 if (info.instantiationMap != null) {
401 for (Set<Instance> instances in info.instantiationMap.values) { 401 for (Set<Instance> instances in info.instantiationMap.values) {
402 for (Instance instance in instances) { 402 for (Instance instance in instances) {
403 types.add(instance.type); 403 types.add(instance.type);
404 } 404 }
405 } 405 }
406 } 406 }
407 }); 407 });
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 ReceiverConstraint mask = dynamicUse.mask; 593 ReceiverConstraint mask = dynamicUse.mask;
594 Map<Selector, SelectorConstraints> selectors = selectorMap.putIfAbsent( 594 Map<Selector, SelectorConstraints> selectors = selectorMap.putIfAbsent(
595 name, () => new Maplet<Selector, SelectorConstraints>()); 595 name, () => new Maplet<Selector, SelectorConstraints>());
596 UniverseSelectorConstraints constraints = 596 UniverseSelectorConstraints constraints =
597 selectors.putIfAbsent(selector, () { 597 selectors.putIfAbsent(selector, () {
598 return selectorConstraintsStrategy.createSelectorConstraints(selector); 598 return selectorConstraintsStrategy.createSelectorConstraints(selector);
599 }); 599 });
600 return constraints.addReceiverConstraint(mask); 600 return constraints.addReceiverConstraint(mask);
601 } 601 }
602 602
603 ResolutionDartType registerIsCheck(ResolutionDartType type) { 603 void registerIsCheck(ResolutionDartType type) {
604 type.computeUnaliased(_resolution); 604 type.computeUnaliased(_resolution);
605 type = type.unaliased; 605 type = type.unaliased;
606 // Even in checked mode, type annotations for return type and argument 606 // Even in checked mode, type annotations for return type and argument
607 // types do not imply type checks, so there should never be a check 607 // types do not imply type checks, so there should never be a check
608 // against the type variable of a typedef. 608 // against the type variable of a typedef.
609 assert(!type.isTypeVariable || !type.element.enclosingElement.isTypedef);
609 isChecks.add(type); 610 isChecks.add(type);
610 return type;
611 } 611 }
612 612
613 void registerStaticUse(StaticUse staticUse, MemberUsedCallback memberUsed) { 613 void registerStaticUse(StaticUse staticUse, MemberUsedCallback memberUsed) {
614 Element element = staticUse.element; 614 Element element = staticUse.element;
615 assert(invariant(element, element.isDeclaration, 615 assert(invariant(element, element.isDeclaration,
616 message: "Element ${element} is not the declaration.")); 616 message: "Element ${element} is not the declaration."));
617 _StaticMemberUsage usage = _staticMemberUsage.putIfAbsent(element, () { 617 _StaticMemberUsage usage = _staticMemberUsage.putIfAbsent(element, () {
618 if ((element.isStatic || element.isTopLevel) && element.isFunction) { 618 if ((element.isStatic || element.isTopLevel) && element.isFunction) {
619 return new _StaticFunctionUsage(element); 619 return new _StaticFunctionUsage(element);
620 } else { 620 } else {
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 @override 946 @override
947 bool isMemberUsed(MemberEntity member) { 947 bool isMemberUsed(MemberEntity member) {
948 if (member.isInstanceMember) { 948 if (member.isInstanceMember) {
949 _MemberUsage usage = _instanceMemberUsage[member]; 949 _MemberUsage usage = _instanceMemberUsage[member];
950 if (usage != null && usage.hasUse) return true; 950 if (usage != null && usage.hasUse) return true;
951 } 951 }
952 _StaticMemberUsage usage = _staticMemberUsage[member]; 952 _StaticMemberUsage usage = _staticMemberUsage[member];
953 return usage != null && usage.hasUse; 953 return usage != null && usage.hasUse;
954 } 954 }
955 } 955 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/universe/codegen_world_builder.dart ('k') | pkg/compiler/lib/src/universe/world_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698