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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 17315012: Generate less code when importing dart:mirrors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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
Index: dart/sdk/lib/_internal/compiler/implementation/compiler.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/compiler.dart b/dart/sdk/lib/_internal/compiler/implementation/compiler.dart
index 177eefe4421865b1606816a6171c4e9f15d04481..6547fbf872bdd2b76b7b6dd1a08e93f817fb8bb4 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/compiler.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/compiler.dart
@@ -140,7 +140,7 @@ abstract class Backend {
void registerThrowExpression(TreeElements elements) {}
void registerLazyField(TreeElements elements) {}
void registerTypeVariableExpression(TreeElements elements) {}
- void registerTypeLiteral(TreeElements elements) {}
+ void registerTypeLiteral(Element element, TreeElements elements) {}
void registerStackTraceInCatch(TreeElements elements) {}
void registerIsCheck(DartType type,
Enqueuer enqueuer,
@@ -157,6 +157,9 @@ abstract class Backend {
void registerRequiredType(DartType type, Element enclosingElement) {}
void registerClassUsingVariableExpression(ClassElement cls) {}
+ void registerConstSymbol(String name, TreeElements elements) {}
+ void registerNewSymbol(TreeElements elements) {}
+
bool isNullImplementation(ClassElement cls) {
return cls == compiler.nullClass;
}
@@ -183,9 +186,14 @@ abstract class Backend {
return classElement == compiler.objectClass;
}
- void enableMirrors() {}
-
void registerStaticUse(Element element, Enqueuer enqueuer) {}
+
+ void onLibraryScanned(LibraryElement library, Uri uri) {}
+
+ void registerMetadataInstantiatedClass(ClassElement element,
+ TreeElements elements) {}
+ void registerMetadataStaticUse(Element element) {}
+ void registerMetadataGetOfStaticFunction(FunctionElement element) {}
}
/**
@@ -529,8 +537,6 @@ abstract class Compiler implements DiagnosticListener {
bool get hasBuildId => buildId != UNDETERMINED_BUILD_ID;
- bool get mirrorsEnabled => mirrorSystemClass != null;
-
bool get analyzeAll => analyzeAllFlag || compileAll;
bool get compileAll => false;
@@ -674,11 +680,10 @@ abstract class Compiler implements DiagnosticListener {
}
if (uri == Uri.parse('dart:mirrors')) {
mirrorSystemClass = library.find(const SourceString('MirrorSystem'));
- backend.enableMirrors();
- metadataHandler = constantHandler;
} else if (uri == Uri.parse('dart:_collection-dev')) {
symbolImplementationClass = library.find(const SourceString('Symbol'));
}
+ backend.onLibraryScanned(library, uri);
}
void onClassResolved(ClassElement cls) {
@@ -866,7 +871,6 @@ abstract class Compiler implements DiagnosticListener {
// Elements required by enqueueHelpers are global dependencies
// that are not pulled in by a particular element.
backend.enqueueHelpers(enqueuer.resolution, globalDependencies);
- resolveReflectiveDataIfNeeded();
processQueue(enqueuer.resolution, main);
enqueuer.resolution.logSummary(log);
@@ -912,17 +916,6 @@ abstract class Compiler implements DiagnosticListener {
checkQueues();
}
- void resolveReflectiveDataIfNeeded() {
- // Only need reflective data when dart:mirrors is loaded.
- if (!mirrorsEnabled) return;
-
- for (LibraryElement library in libraries.values) {
- for (Link link = library.metadata; !link.isEmpty; link = link.tail) {
- link.head.ensureResolved(this);
- }
- }
- }
-
void fullyEnqueueLibrary(LibraryElement library, Enqueuer world) {
void enqueueAll(Element element) {
fullyEnqueueTopLevelElement(element, world);

Powered by Google App Engine
This is Rietveld 408576698