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

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

Issue 2070493003: Revert "Remove Registry from registerMetadataConstant" and "Serialize metadata" (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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/constant_emitter.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 40c11cac147899c33c317ea8aed085d157d44a87..e04aa6c8a991b49aea15f26be89224a53ecfd80c 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -449,9 +449,6 @@ class JavaScriptBackend extends Backend {
/// these constants must be registered.
final List<Dependency> metadataConstants = <Dependency>[];
- /// Set of elements for which metadata has been registered as dependencies.
- final Set<Element> _registeredMetadata = new Set<Element>();
-
/// List of elements that the user has requested for reflection.
final Set<Element> targetsUsed = new Set<Element>();
@@ -1057,6 +1054,14 @@ class JavaScriptBackend extends Backend {
}
}
+ void registerMetadataConstant(MetadataAnnotation metadata,
+ Element annotatedElement, Registry registry) {
+ assert(registry.isForResolution);
+ ConstantValue constant = constants.getConstantValueForMetadata(metadata);
+ registerCompileTimeConstant(constant, registry);
+ metadataConstants.add(new Dependency(constant, annotatedElement));
+ }
+
void registerInstantiatedClass(
ClassElement cls, Enqueuer enqueuer, Registry registry) {
_processClass(cls, enqueuer, registry);
@@ -1267,7 +1272,6 @@ class JavaScriptBackend extends Backend {
super.onResolutionComplete();
computeMembersNeededForReflection();
rti.computeClassesNeedingRti();
- _registeredMetadata.clear();
}
onTypeInferenceComplete() {
@@ -2300,60 +2304,17 @@ class JavaScriptBackend extends Backend {
reporter.log('Retaining metadata.');
compiler.libraryLoader.libraries.forEach(retainMetadataOf);
-
- if (enqueuer.isResolutionQueue) {
- /// 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);
- registerCompileTimeConstant(dependency.constant,
- new EagerRegistry('EagerRegistry for ${dependency}', enqueuer));
- }
-
- // TODO(johnniwinther): We should have access to all recently processed
- // elements and process these instead.
- processMetadata(compiler.enqueuer.resolution.processedElements,
- registerMetadataConstant);
- } else {
- for (Dependency dependency in metadataConstants) {
- registerCompileTimeConstant(dependency.constant,
- new EagerRegistry('EagerRegistry for ${dependency}', enqueuer));
- }
+ for (Dependency dependency in metadataConstants) {
+ registerCompileTimeConstant(dependency.constant,
+ new EagerRegistry('EagerRegistry for ${dependency}', enqueuer));
+ }
+ if (!enqueuer.isResolutionQueue) {
metadataConstants.clear();
}
}
return true;
}
- /// Call [registerMetadataConstant] on all metadata from [elements].
- void processMetadata(Iterable<Element> elements,
- void onMetadata(MetadataAnnotation metadata)) {
- void processLibraryMetadata(LibraryElement library) {
- if (_registeredMetadata.add(library)) {
- library.metadata.forEach(onMetadata);
- for (ImportElement import in library.imports) {
- import.metadata.forEach(onMetadata);
- }
- }
- }
-
- void processElementMetadata(Element element) {
- if (_registeredMetadata.add(element)) {
- element.metadata.forEach(onMetadata);
- if (element.enclosingClass != null) {
- processElementMetadata(element.enclosingClass);
- } else {
- processLibraryMetadata(element.library);
- }
- }
- }
-
- elements.forEach(processElementMetadata);
- }
-
void onQueueClosed() {
lookupMapAnalysis.onQueueClosed();
jsInteropAnalysis.onQueueClosed();
@@ -3076,8 +3037,6 @@ class Dependency {
final Element annotatedElement;
const Dependency(this.constant, this.annotatedElement);
-
- String toString() => '$annotatedElement:${constant.toStructuredText()}';
}
class JavaScriptImpactStrategy extends ImpactStrategy {
« no previous file with comments | « pkg/compiler/lib/src/enqueue.dart ('k') | pkg/compiler/lib/src/js_backend/constant_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698