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

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

Issue 2387353002: Eagerly compute closure classes (Closed)
Patch Set: Add comments. Created 4 years, 2 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.compiler_base; 5 library dart2js.compiler_base;
6 6
7 import 'dart:async' show EventSink, Future; 7 import 'dart:async' show EventSink, Future;
8 8
9 import '../compiler_new.dart' as api; 9 import '../compiler_new.dart' as api;
10 import 'cache_strategy.dart' show CacheStrategy; 10 import 'cache_strategy.dart' show CacheStrategy;
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 // code is artificially used. 717 // code is artificially used.
718 // If compilation failed, it is possible that the error prevents the 718 // If compilation failed, it is possible that the error prevents the
719 // compiler from analyzing all the code. 719 // compiler from analyzing all the code.
720 // TODO(johnniwinther): Reenable this when the reporting is more 720 // TODO(johnniwinther): Reenable this when the reporting is more
721 // precise. 721 // precise.
722 //reportUnusedCode(); 722 //reportUnusedCode();
723 } 723 }
724 return; 724 return;
725 } 725 }
726 assert(mainFunction != null); 726 assert(mainFunction != null);
727 phase = PHASE_DONE_RESOLVING;
728 727
729 openWorld.closeWorld(); 728 closeResolution();
730 // Compute whole-program-knowledge that the backend needs. (This might
731 // require the information computed in [world.populate].)
732 backend.onResolutionComplete();
733
734 deferredLoadTask.onResolutionComplete(mainFunction);
735 729
736 reporter.log('Inferring types...'); 730 reporter.log('Inferring types...');
737 globalInference.runGlobalTypeInference(mainFunction); 731 globalInference.runGlobalTypeInference(mainFunction);
738 732
739 if (stopAfterTypeInference) return; 733 if (stopAfterTypeInference) return;
740 734
741 backend.onTypeInferenceComplete(); 735 backend.onTypeInferenceComplete();
742 736
743 reporter.log('Compiling...'); 737 reporter.log('Compiling...');
744 phase = PHASE_COMPILING; 738 phase = PHASE_COMPILING;
(...skipping 15 matching lines...) Expand all
760 if (options.dumpInfo) { 754 if (options.dumpInfo) {
761 dumpInfoTask.reportSize(programSize); 755 dumpInfoTask.reportSize(programSize);
762 dumpInfoTask.dumpInfo(); 756 dumpInfoTask.dumpInfo();
763 } 757 }
764 758
765 backend.sourceInformationStrategy.onComplete(); 759 backend.sourceInformationStrategy.onComplete();
766 760
767 checkQueues(); 761 checkQueues();
768 }); 762 });
769 763
764 /// Perform the steps needed to fully end the resolution phase.
765 void closeResolution() {
766 phase = PHASE_DONE_RESOLVING;
767
768 openWorld.closeWorld();
769 // Compute whole-program-knowledge that the backend needs. (This might
770 // require the information computed in [world.closeWorld].)
771 backend.onResolutionComplete();
772
773 deferredLoadTask.onResolutionComplete(mainFunction);
774
775 // TODO(johnniwinther): Move this after rti computation but before
776 // reflection members computation, and (re-)close the world afterwards.
777 closureToClassMapper.createClosureClasses();
778 }
779
770 void fullyEnqueueLibrary(LibraryElement library, Enqueuer world) { 780 void fullyEnqueueLibrary(LibraryElement library, Enqueuer world) {
771 void enqueueAll(Element element) { 781 void enqueueAll(Element element) {
772 fullyEnqueueTopLevelElement(element, world); 782 fullyEnqueueTopLevelElement(element, world);
773 } 783 }
774 784
775 library.implementation.forEachLocalMember(enqueueAll); 785 library.implementation.forEachLocalMember(enqueueAll);
776 library.imports.forEach((ImportElement import) { 786 library.imports.forEach((ImportElement import) {
777 if (import.isDeferred) { 787 if (import.isDeferred) {
778 // `import.prefix` and `loadLibrary` may be `null` when the deferred 788 // `import.prefix` and `loadLibrary` may be `null` when the deferred
779 // import has compile-time errors. 789 // import has compile-time errors.
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after
2246 _ElementScanner(this.scanner); 2256 _ElementScanner(this.scanner);
2247 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); 2257 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library);
2248 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); 2258 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit);
2249 } 2259 }
2250 2260
2251 class _EmptyEnvironment implements Environment { 2261 class _EmptyEnvironment implements Environment {
2252 const _EmptyEnvironment(); 2262 const _EmptyEnvironment();
2253 2263
2254 String valueOf(String key) => null; 2264 String valueOf(String key) => null;
2255 } 2265 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/closure.dart ('k') | pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698