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

Unified Diff: pkg/compiler/lib/src/library_loader.dart

Issue 1192103002: Support serialization of the compiler backbone. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Handle (bypass) external const constructors. Created 5 years, 5 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/mirrors/dart2js_library_mirror.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/library_loader.dart
diff --git a/pkg/compiler/lib/src/library_loader.dart b/pkg/compiler/lib/src/library_loader.dart
index 227030aa3a58121edc228ac22047d603ac8c2d36..3e6acb5b93c15dbe34145ddb44d5655620a1b801 100644
--- a/pkg/compiler/lib/src/library_loader.dart
+++ b/pkg/compiler/lib/src/library_loader.dart
@@ -483,7 +483,7 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask {
then((Script sourceScript) {
if (sourceScript == null) return;
- CompilationUnitElement unit =
+ CompilationUnitElementX unit =
new CompilationUnitElementX(sourceScript, library);
compiler.withCurrentElement(unit, () {
compiler.scanner.scan(unit);
@@ -524,6 +524,23 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask {
});
}
+ /// Loads the deserialized [library] with the [handler].
+ ///
+ /// All libraries imported or exported transitively from [library] will be
+ /// loaded as well.
+ Future<LibraryElement> loadDeserializedLibrary(
+ LibraryDependencyHandler handler,
+ LibraryElement library) async {
+ compiler.onLibraryCreated(library);
+ libraryCanonicalUriMap[library.canonicalUri] = library;
+ await compiler.onLibraryScanned(library, handler);
+ for (LibraryTag tag in library.tags) {
+ LibraryElement dependency = library.getLibraryFromTag(tag);
+ await createLibrary(handler, library, dependency.canonicalUri);
+ }
+ return library;
+ }
+
/**
* Create (or reuse) a library element for the library specified by the
* [resolvedUri].
@@ -540,6 +557,10 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask {
if (library != null) {
return new Future.value(library);
}
+ library = compiler.serialization.readLibrary(resolvedUri);
+ if (library != null) {
+ return loadDeserializedLibrary(handler, library);
+ }
var readScript = compiler.readScript;
if (readableUri == null) {
readableUri = resolvedUri;
« no previous file with comments | « pkg/compiler/lib/src/enqueue.dart ('k') | pkg/compiler/lib/src/mirrors/dart2js_library_mirror.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698