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

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

Issue 23258002: Load builtin helper libraries on demand. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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: sdk/lib/_internal/compiler/implementation/compiler.dart
diff --git a/sdk/lib/_internal/compiler/implementation/compiler.dart b/sdk/lib/_internal/compiler/implementation/compiler.dart
index 88d35c5b5e09c04ad7913bb54136a2fed13d1890..866bb33ca1a9c9cc6b8ee4b846720659b1c6f5db 100644
--- a/sdk/lib/_internal/compiler/implementation/compiler.dart
+++ b/sdk/lib/_internal/compiler/implementation/compiler.dart
@@ -206,7 +206,7 @@ abstract class Backend {
void registerStaticUse(Element element, Enqueuer enqueuer) {}
- void onLibraryScanned(LibraryElement library, Uri uri) {}
+ void onLibraryLoaded(LibraryElement library, Uri uri) {}
void registerMetadataInstantiatedType(DartType type, TreeElements elements) {}
void registerMetadataStaticUse(Element element) {}
@@ -704,7 +704,7 @@ abstract class Compiler implements DiagnosticListener {
* This method is called before [library] import and export scopes have been
* set up.
*/
- void onLibraryScanned(LibraryElement library, Uri uri) {
+ void onLibraryLoaded(LibraryElement library, Uri uri) {
if (dynamicClass != null) {
// When loading the built-in libraries, dynamicClass is null. We
// take advantage of this as core imports js_helper and sees [dynamic]
@@ -726,7 +726,15 @@ abstract class Compiler implements DiagnosticListener {
deferredLibraryClass =
findRequiredElement(library, const SourceString('DeferredLibrary'));
}
ngeoffray 2013/08/15 19:13:02 Nit: Keep the else/if syntax.
zarah 2013/08/28 10:20:13 Done.
- backend.onLibraryScanned(library, uri);
+
+ if (isolateHelperLibrary == null
+ && (uri == new Uri(scheme: 'dart', path: '_isolate_helper'))) {
+ isolateHelperLibrary = scanBuiltinLibrary('_isolate_helper');
+ } else if (foreignLibrary == null
+ && (uri == new Uri(scheme: 'dart', path: '_foreign_helper'))) {
ngeoffray 2013/08/15 19:13:02 Nit: '&&' at the same indentation as foreignLibrar
zarah 2013/08/28 10:20:13 Done.
+ foreignLibrary = scanBuiltinLibrary('_foreign_helper');
+ }
+ backend.onLibraryLoaded(library, uri);
}
Element findRequiredElement(LibraryElement library, SourceString name) {
@@ -835,9 +843,6 @@ abstract class Compiler implements DiagnosticListener {
void scanBuiltinLibraries() {
jsHelperLibrary = scanBuiltinLibrary('_js_helper');
interceptorsLibrary = scanBuiltinLibrary('_interceptors');
ngeoffray 2013/08/15 19:13:02 What about those two? Do you plan on moving them?
zarah 2013/08/28 10:20:13 The jsHelperLibrary is used just below and the int
- foreignLibrary = scanBuiltinLibrary('_foreign_helper');
- isolateHelperLibrary = scanBuiltinLibrary('_isolate_helper');
-
assertMethod = jsHelperLibrary.find(const SourceString('assertHelper'));
identicalFunction = coreLibrary.find(const SourceString('identical'));

Powered by Google App Engine
This is Rietveld 408576698