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

Unified Diff: pkg/compiler/lib/src/js_backend/runtime_types.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/js_backend/mirrors_data.dart ('k') | pkg/compiler/lib/src/native/enqueue.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/runtime_types.dart
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types.dart b/pkg/compiler/lib/src/js_backend/runtime_types.dart
index 558a1ca8daaa39f23a8bb607afb062bae22a481c..da5223ee34a43f31f4c49c4c7893cd2306a37485 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types.dart
@@ -158,17 +158,15 @@ abstract class _RuntimeTypesBase {
// If there are no classes that use their variables in checks, there is
// nothing to do.
if (classesUsingChecks.isEmpty) return;
- Set<ResolutionDartType> instantiatedTypes = worldBuilder.instantiatedTypes;
+ Set<InterfaceType> instantiatedTypes = worldBuilder.instantiatedTypes;
if (cannotDetermineInstantiatedTypesPrecisely) {
- for (ResolutionDartType type in instantiatedTypes) {
- if (type.kind != ResolutionTypeKind.INTERFACE) continue;
- ResolutionInterfaceType interface = type;
+ for (ResolutionInterfaceType type in instantiatedTypes) {
do {
- for (ResolutionDartType argument in interface.typeArguments) {
+ for (ResolutionDartType argument in type.typeArguments) {
worldBuilder.registerIsCheck(argument);
}
- interface = interface.element.supertype;
- } while (interface != null && !instantiatedTypes.contains(interface));
+ type = type.element.supertype;
+ } while (type != null && !instantiatedTypes.contains(type));
}
} else {
// Find all instantiated types that are a subtype of a class that uses
@@ -176,22 +174,19 @@ abstract class _RuntimeTypesBase {
// set of is-checks.
// TODO(karlklose): replace this with code that uses a subtype lookup
// datastructure in the world.
- for (ResolutionDartType type in instantiatedTypes) {
- if (type.kind != ResolutionTypeKind.INTERFACE) continue;
- ResolutionInterfaceType classType = type;
+ for (ResolutionInterfaceType type in instantiatedTypes) {
for (ClassElement cls in classesUsingChecks) {
- ResolutionInterfaceType current = classType;
do {
// We need the type as instance of its superclass anyway, so we just
// try to compute the substitution; if the result is [:null:], the
// classes are not related.
- ResolutionInterfaceType instance = current.asInstanceOf(cls);
+ ResolutionInterfaceType instance = type.asInstanceOf(cls);
if (instance == null) break;
for (ResolutionDartType argument in instance.typeArguments) {
worldBuilder.registerIsCheck(argument);
}
- current = current.element.supertype;
- } while (current != null && !instantiatedTypes.contains(current));
+ type = type.element.supertype;
+ } while (type != null && !instantiatedTypes.contains(type));
}
}
}
@@ -502,14 +497,11 @@ class _RuntimeTypes extends _RuntimeTypesBase
CodegenWorldBuilder worldBuilder) {
Set<ResolutionDartType> instantiatedTypes =
new Set<ResolutionDartType>.from(worldBuilder.instantiatedTypes);
- for (ResolutionDartType instantiatedType
+ for (ResolutionInterfaceType instantiatedType
in worldBuilder.instantiatedTypes) {
- if (instantiatedType.isInterfaceType) {
- ResolutionInterfaceType interface = instantiatedType;
- ResolutionFunctionType callType = interface.callType;
- if (callType != null) {
- instantiatedTypes.add(callType);
- }
+ ResolutionFunctionType callType = instantiatedType.callType;
+ if (callType != null) {
+ instantiatedTypes.add(callType);
}
}
for (FunctionElement element in worldBuilder.staticFunctionsNeedingGetter) {
« no previous file with comments | « pkg/compiler/lib/src/js_backend/mirrors_data.dart ('k') | pkg/compiler/lib/src/native/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698