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

Side by Side Diff: pkg/compiler/lib/src/library_loader.dart

Issue 2865693002: Create closed world for hello world using .dill file (Closed)
Patch Set: Updated cf. comments. 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.library_loader; 5 library dart2js.library_loader;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'common/names.dart' show Uris; 9 import 'common/names.dart' show Uris;
10 import 'common/tasks.dart' show CompilerTask, Measurer; 10 import 'common/tasks.dart' show CompilerTask, Measurer;
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 this.reporter, Measurer measurer) 828 this.reporter, Measurer measurer)
829 : _allLoadedLibraries = new List<LibraryEntity>(), 829 : _allLoadedLibraries = new List<LibraryEntity>(),
830 super(measurer); 830 super(measurer);
831 831
832 /// Loads an entire Kernel [Program] from a file on disk (note, not just a 832 /// Loads an entire Kernel [Program] from a file on disk (note, not just a
833 /// library, so this name is actually a bit of a misnomer). 833 /// library, so this name is actually a bit of a misnomer).
834 // TODO(efortuna): Rename this once the Element library loader class goes 834 // TODO(efortuna): Rename this once the Element library loader class goes
835 // away. 835 // away.
836 Future<LoadedLibraries> loadLibrary(Uri resolvedUri, 836 Future<LoadedLibraries> loadLibrary(Uri resolvedUri,
837 {bool skipFileWithPartOfTag: false}) { 837 {bool skipFileWithPartOfTag: false}) {
838 assert(resolvedUri.pathSegments.last.endsWith('.dill')); 838 assert(resolvedUri.pathSegments.last.endsWith('.dill'),
839 'Invalid uri: $resolvedUri');
839 Uri readableUri = uriTranslator.translate(null, resolvedUri, null); 840 Uri readableUri = uriTranslator.translate(null, resolvedUri, null);
840 return measure(() async { 841 return measure(() async {
841 Script script = await scriptLoader.readScript(readableUri, null); 842 Script script = await scriptLoader.readScript(readableUri, null);
842 ir.Program program = new ir.Program(); 843 ir.Program program = new ir.Program();
843 // Hack because the existing file has a terminating 0 and the 844 // Hack because the existing file has a terminating 0 and the
844 // BinaryBuilder doesn't expect that. 845 // BinaryBuilder doesn't expect that.
845 var bytes = new List<int>.from(script.file.slowUtf8ZeroTerminatedBytes()); 846 var bytes = new List<int>.from(script.file.slowUtf8ZeroTerminatedBytes());
846 bytes.removeLast(); 847 bytes.removeLast();
847 new BinaryBuilder(bytes).readProgram(program); 848 new BinaryBuilder(bytes).readProgram(program);
848 return measure(() { 849 return measure(() {
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 } 1660 }
1660 1661
1661 /// API used by the library loader to synchronously scan a library or 1662 /// API used by the library loader to synchronously scan a library or
1662 /// compilation unit and ensure that their library tags are computed. 1663 /// compilation unit and ensure that their library tags are computed.
1663 abstract class ElementScanner { 1664 abstract class ElementScanner {
1664 void scanLibrary(LibraryElement library); 1665 void scanLibrary(LibraryElement library);
1665 void scanUnit(CompilationUnitElement unit); 1666 void scanUnit(CompilationUnitElement unit);
1666 } 1667 }
1667 1668
1668 const _reuseLibrarySubtaskName = "Reuse library"; 1669 const _reuseLibrarySubtaskName = "Reuse library";
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/kernel_visitor.dart ('k') | pkg/compiler/lib/src/ordered_typeset.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698