OLD | NEW |
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 part of dart_backend; | 5 part of dart_backend; |
6 | 6 |
7 // TODO(ahe): This class is simply wrong. This backend should use | 7 // TODO(ahe): This class is simply wrong. This backend should use |
8 // elements when it can, not AST nodes. Perhaps a [Map<Element, | 8 // elements when it can, not AST nodes. Perhaps a [Map<Element, |
9 // TreeElements>] is what is needed. | 9 // TreeElements>] is what is needed. |
10 class ElementAst { | 10 class ElementAst { |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 nonPlatformSize += compilationUnit.script.file.length; | 454 nonPlatformSize += compilationUnit.script.file.length; |
455 } | 455 } |
456 } | 456 } |
457 int percentage = compiler.assembledCode.length * 100 ~/ nonPlatformSize; | 457 int percentage = compiler.assembledCode.length * 100 ~/ nonPlatformSize; |
458 log('Total used non-platform files size: ${nonPlatformSize} bytes, ' | 458 log('Total used non-platform files size: ${nonPlatformSize} bytes, ' |
459 'bundle size: ${compiler.assembledCode.length} bytes (${percentage}%)'); | 459 'bundle size: ${compiler.assembledCode.length} bytes (${percentage}%)'); |
460 } | 460 } |
461 | 461 |
462 log(String message) => compiler.log('[DartBackend] $message'); | 462 log(String message) => compiler.log('[DartBackend] $message'); |
463 | 463 |
464 Future onLibraryLoaded(LibraryElement library, Uri uri) { | 464 Future onLibrariesLoaded(Map<Uri, LibraryElement> loadedLibraries) { |
465 if (useMirrorHelperLibrary && library == compiler.mirrorsLibrary) { | 465 if (useMirrorHelperLibrary && |
466 return compiler.scanBuiltinLibrary( | 466 loadedLibraries.containsKey(Compiler.DART_MIRRORS)) { |
467 MirrorRenamer.MIRROR_HELPER_LIBRARY_NAME). | 467 return compiler.libraryLoader.loadLibrary( |
| 468 compiler.translateResolvedUri( |
| 469 loadedLibraries[Compiler.DART_MIRRORS], |
| 470 MirrorRenamer.DART_MIRROR_HELPER, null)). |
468 then((LibraryElement element) { | 471 then((LibraryElement element) { |
469 mirrorHelperLibrary = element; | 472 mirrorHelperLibrary = element; |
470 mirrorHelperGetNameFunction = mirrorHelperLibrary.find( | 473 mirrorHelperGetNameFunction = mirrorHelperLibrary.find( |
471 MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION); | 474 MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION); |
472 mirrorHelperSymbolsMap = mirrorHelperLibrary.find( | 475 mirrorHelperSymbolsMap = mirrorHelperLibrary.find( |
473 MirrorRenamer.MIRROR_HELPER_SYMBOLS_MAP_NAME); | 476 MirrorRenamer.MIRROR_HELPER_SYMBOLS_MAP_NAME); |
474 }); | 477 }); |
475 } | 478 } |
476 return new Future.value(); | 479 return new Future.value(); |
477 } | 480 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 } | 637 } |
635 | 638 |
636 Constant compileMetadata(MetadataAnnotation metadata, | 639 Constant compileMetadata(MetadataAnnotation metadata, |
637 Node node, | 640 Node node, |
638 TreeElements elements) { | 641 TreeElements elements) { |
639 return measure(() { | 642 return measure(() { |
640 return constantCompiler.compileMetadata(metadata, node, elements); | 643 return constantCompiler.compileMetadata(metadata, node, elements); |
641 }); | 644 }); |
642 } | 645 } |
643 } | 646 } |
OLD | NEW |