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

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

Issue 2921933002: Only call MirrorsData.retainMetadata* from codegen (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | pkg/compiler/lib/src/js_backend/mirrors_data.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/mirrors_analysis.dart
diff --git a/pkg/compiler/lib/src/js_backend/mirrors_analysis.dart b/pkg/compiler/lib/src/js_backend/mirrors_analysis.dart
index 6bc41cc82f3e19144a0dade020f311773be6bcc1..130e2cb6b9e5c7f2bcd330617c44f56afcb6623a 100644
--- a/pkg/compiler/lib/src/js_backend/mirrors_analysis.dart
+++ b/pkg/compiler/lib/src/js_backend/mirrors_analysis.dart
@@ -126,33 +126,20 @@ class MirrorsResolutionAnalysisImpl implements MirrorsResolutionAnalysis {
if (_mirrorsData.mustRetainMetadata) {
_reporter.log('Retaining metadata.');
- for (LibraryEntity library in _compiler.libraryLoader.libraries) {
- _mirrorsData.retainMetadataOfLibrary(library,
- addForEmission: !enqueuer.isResolutionQueue);
+ /// Register the constant value of [metadata] as live in resolution.
+ void registerMetadataConstant(MetadataAnnotation metadata) {
+ metadata.ensureResolved(_compiler.resolution);
+ ConstantValue constant =
+ _constants.getConstantValueForMetadata(metadata);
+ Dependency dependency =
+ new Dependency(constant, metadata.annotatedElement);
+ _metadataConstants.add(dependency);
+ _impactBuilder.registerConstantUse(new ConstantUse.mirrors(constant));
}
- if (!enqueuer.queueIsClosed) {
- /// Register the constant value of [metadata] as live in resolution.
- void registerMetadataConstant(MetadataAnnotation metadata) {
- ConstantValue constant =
- _constants.getConstantValueForMetadata(metadata);
- Dependency dependency =
- new Dependency(constant, metadata.annotatedElement);
- _metadataConstants.add(dependency);
- _impactBuilder.registerConstantUse(new ConstantUse.mirrors(constant));
- }
-
- // TODO(johnniwinther): We should have access to all recently processed
- // elements and process these instead.
- processMetadata(enqueuer.processedEntities, registerMetadataConstant);
- } else {
- for (Dependency dependency in _metadataConstants) {
- _impactBuilder.registerConstantUse(
- new ConstantUse.mirrors(dependency.constant));
- }
- _metadataConstants.clear();
- }
- enqueuer.applyImpact(_impactBuilder.flush());
+ // TODO(johnniwinther): We should have access to all recently processed
+ // elements and process these instead.
+ processMetadata(enqueuer.processedEntities, registerMetadataConstant);
}
}
@@ -186,11 +173,10 @@ class MirrorsResolutionAnalysisImpl implements MirrorsResolutionAnalysis {
if (element.enclosingElement is ClassElement) {
// Use [enclosingElement] instead of [enclosingClass] to ensure that
// we process patch class metadata for patch and injected members.
- processElementMetadata(element.enclosingElement);
}
- } else {
- processLibraryMetadata(element.library);
+ processElementMetadata(element.enclosingClass);
}
+ processLibraryMetadata(element.library);
}
}
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/mirrors_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698