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

Unified Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 1416253002: Remove requiredTypes (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 2 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/enqueue.dart ('k') | pkg/compiler/lib/src/js_backend/backend_impact.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/backend.dart
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index 4d4490cf6b4946a24eb7fb6fbc6c13d5cc1229e2..554d40611ed1188043a2c1f23f0efaf41d27efcc 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -1439,18 +1439,6 @@ class JavaScriptBackend extends Backend {
}
}
- void registerRequiredType(DartType type) {
- // If [argument] has type variables or is a type variable, this method
- // registers a RTI dependency between the class where the type variable is
- // defined (that is the enclosing class of the current element being
- // resolved) and the class of [type]. If the class of [type] requires RTI,
- // then the class of the type variable does too.
- ClassElement contextClass = Types.getClassContext(type);
- if (contextClass != null) {
- rti.registerRtiDependency(type.element, contextClass);
- }
- }
-
bool classNeedsRti(ClassElement cls) {
return rti.classesNeedingRti.contains(cls.declaration) ||
compiler.enabledRuntimeType;
@@ -2909,6 +2897,11 @@ class JavaScriptResolutionCallbacks extends ResolutionCallbacks {
break;
}
}
+
+ for (InterfaceType type in worldImpact.instantiatedTypes) {
+ registerRequiredType(type);
+ }
+
for (DartType type in worldImpact.isChecks) {
onIsCheck(type, transformed);
}
@@ -2926,8 +2919,8 @@ class JavaScriptResolutionCallbacks extends ResolutionCallbacks {
}
}
- for (DartType requiredType in worldImpact.requiredTypes) {
- backend.registerRequiredType(requiredType);
+ for (DartType type in worldImpact.onCatchTypes) {
+ onIsCheck(type, transformed);
}
for (MapLiteralUse mapLiteralUse in worldImpact.mapLiterals) {
@@ -2938,12 +2931,14 @@ class JavaScriptResolutionCallbacks extends ResolutionCallbacks {
} else {
transformed.registerInstantiatedType(mapLiteralUse.type);
}
+ registerRequiredType(mapLiteralUse.type);
}
for (ListLiteralUse listLiteralUse in worldImpact.listLiterals) {
// TODO(johnniwinther): Use the [isConstant] and [isEmpty] property when
// factory constructors are registered directly.
transformed.registerInstantiatedType(listLiteralUse.type);
+ registerRequiredType(listLiteralUse.type);
}
if (worldImpact.typeLiterals.isNotEmpty) {
@@ -2962,17 +2957,24 @@ class JavaScriptResolutionCallbacks extends ResolutionCallbacks {
}
}
- for (String constSymbolName in worldImpact.constSymbolNames) {
- backend.registerConstSymbol(constSymbolName);
+ if (worldImpact.constSymbolNames.isNotEmpty) {
+ registerBackendImpact(transformed, impacts.constSymbol);
+ for (String constSymbolName in worldImpact.constSymbolNames) {
+ backend.registerConstSymbol(constSymbolName);
+ }
}
- for (LocalFunctionElement closure in worldImpact.closures) {
- if (closure.computeType(backend.resolution).containsTypeVariables) {
- backend.compiler.enqueuer.resolution.universe
- .closuresWithFreeTypeVariables.add(closure);
- registerBackendImpact(transformed, impacts.computeSignature);
+ if (worldImpact.closures.isNotEmpty) {
+ registerBackendImpact(transformed, impacts.closure);
+ for (LocalFunctionElement closure in worldImpact.closures) {
+ if (closure.computeType(backend.resolution).containsTypeVariables) {
+ backend.compiler.enqueuer.resolution.universe
+ .closuresWithFreeTypeVariables.add(closure);
+ registerBackendImpact(transformed, impacts.computeSignature);
+ }
}
}
+
return transformed;
}
@@ -2997,8 +2999,22 @@ class JavaScriptResolutionCallbacks extends ResolutionCallbacks {
}
}
+ /// Register [type] as required for the runtime type information system.
+ void registerRequiredType(DartType type) {
+ // If [argument] has type variables or is a type variable, this method
+ // registers a RTI dependency between the class where the type variable is
+ // defined (that is the enclosing class of the current element being
+ // resolved) and the class of [type]. If the class of [type] requires RTI,
+ // then the class of the type variable does too.
+ ClassElement contextClass = Types.getClassContext(type);
+ if (contextClass != null) {
+ backend.rti.registerRtiDependency(type.element, contextClass);
+ }
+ }
+
// TODO(johnniwinther): Maybe split this into [onAssertType] and [onTestType].
void onIsCheck(DartType type, TransformedWorldImpact transformed) {
+ registerRequiredType(type);
type.computeUnaliased(backend.resolution);
type = type.unaliased;
registerBackendImpact(transformed, impacts.typeCheck);
« no previous file with comments | « pkg/compiler/lib/src/enqueue.dart ('k') | pkg/compiler/lib/src/js_backend/backend_impact.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698