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

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

Issue 2289353003: Make Enqueuer a pure interface. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « pkg/compiler/lib/src/common/codegen.dart ('k') | pkg/compiler/lib/src/enqueue.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 19 matching lines...) Expand all
30 import 'dart_types.dart' show DartType, DynamicType, InterfaceType, Types; 30 import 'dart_types.dart' show DartType, DynamicType, InterfaceType, Types;
31 import 'deferred_load.dart' show DeferredLoadTask; 31 import 'deferred_load.dart' show DeferredLoadTask;
32 import 'diagnostics/code_location.dart'; 32 import 'diagnostics/code_location.dart';
33 import 'diagnostics/diagnostic_listener.dart' show DiagnosticReporter; 33 import 'diagnostics/diagnostic_listener.dart' show DiagnosticReporter;
34 import 'diagnostics/invariant.dart' show REPORT_EXCESS_RESOLUTION; 34 import 'diagnostics/invariant.dart' show REPORT_EXCESS_RESOLUTION;
35 import 'diagnostics/messages.dart' show Message, MessageTemplate; 35 import 'diagnostics/messages.dart' show Message, MessageTemplate;
36 import 'dump_info.dart' show DumpInfoTask; 36 import 'dump_info.dart' show DumpInfoTask;
37 import 'elements/elements.dart'; 37 import 'elements/elements.dart';
38 import 'elements/modelx.dart' show ErroneousElementX; 38 import 'elements/modelx.dart' show ErroneousElementX;
39 import 'enqueue.dart' 39 import 'enqueue.dart'
40 show 40 show Enqueuer, EnqueueTask, ResolutionEnqueuer, QueueFilter;
41 CodegenEnqueuer,
42 Enqueuer,
43 EnqueueTask,
44 ResolutionEnqueuer,
45 QueueFilter;
46 import 'environment.dart'; 41 import 'environment.dart';
47 import 'id_generator.dart'; 42 import 'id_generator.dart';
48 import 'io/source_information.dart' show SourceInformation; 43 import 'io/source_information.dart' show SourceInformation;
49 import 'js_backend/backend_helpers.dart' as js_backend show BackendHelpers; 44 import 'js_backend/backend_helpers.dart' as js_backend show BackendHelpers;
50 import 'js_backend/js_backend.dart' as js_backend show JavaScriptBackend; 45 import 'js_backend/js_backend.dart' as js_backend show JavaScriptBackend;
51 import 'library_loader.dart' 46 import 'library_loader.dart'
52 show 47 show
53 ElementScanner, 48 ElementScanner,
54 LibraryLoader, 49 LibraryLoader,
55 LibraryLoaderTask, 50 LibraryLoaderTask,
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 * were resolved, but not compiled (aka excess resolution). 867 * were resolved, but not compiled (aka excess resolution).
873 */ 868 */
874 checkQueues() { 869 checkQueues() {
875 for (Enqueuer world in [enqueuer.resolution, enqueuer.codegen]) { 870 for (Enqueuer world in [enqueuer.resolution, enqueuer.codegen]) {
876 world.forEach((WorkItem work) { 871 world.forEach((WorkItem work) {
877 reporter.internalError(work.element, "Work list is not empty."); 872 reporter.internalError(work.element, "Work list is not empty.");
878 }); 873 });
879 } 874 }
880 if (!REPORT_EXCESS_RESOLUTION) return; 875 if (!REPORT_EXCESS_RESOLUTION) return;
881 var resolved = new Set.from(enqueuer.resolution.processedElements); 876 var resolved = new Set.from(enqueuer.resolution.processedElements);
882 for (Element e in enqueuer.codegen.generatedCode.keys) { 877 for (Element e in enqueuer.codegen.processedEntities) {
883 resolved.remove(e); 878 resolved.remove(e);
884 } 879 }
885 for (Element e in new Set.from(resolved)) { 880 for (Element e in new Set.from(resolved)) {
886 if (e.isClass || 881 if (e.isClass ||
887 e.isField || 882 e.isField ||
888 e.isTypeVariable || 883 e.isTypeVariable ||
889 e.isTypedef || 884 e.isTypedef ||
890 identical(e.kind, ElementKind.ABSTRACT_FIELD)) { 885 identical(e.kind, ElementKind.ABSTRACT_FIELD)) {
891 resolved.remove(e); 886 resolved.remove(e);
892 } 887 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 } 933 }
939 AstElement element = work.element; 934 AstElement element = work.element;
940 if (world.hasBeenProcessed(element)) { 935 if (world.hasBeenProcessed(element)) {
941 return const WorldImpact(); 936 return const WorldImpact();
942 } 937 }
943 WorldImpact worldImpact = analyzeElement(element); 938 WorldImpact worldImpact = analyzeElement(element);
944 world.registerProcessedElement(element); 939 world.registerProcessedElement(element);
945 return worldImpact; 940 return worldImpact;
946 }); 941 });
947 942
948 WorldImpact codegen(CodegenWorkItem work, CodegenEnqueuer world) { 943 WorldImpact codegen(CodegenWorkItem work, Enqueuer world) {
949 assert(invariant(work.element, identical(world, enqueuer.codegen))); 944 assert(invariant(work.element, identical(world, enqueuer.codegen)));
950 if (shouldPrintProgress) { 945 if (shouldPrintProgress) {
951 // TODO(ahe): Add structured diagnostics to the compiler API and 946 // TODO(ahe): Add structured diagnostics to the compiler API and
952 // use it to separate this from the --verbose option. 947 // use it to separate this from the --verbose option.
953 reporter 948 reporter.log(
954 .log('Compiled ${enqueuer.codegen.generatedCode.length} methods.'); 949 'Compiled ${enqueuer.codegen.processedEntities.length} methods.');
955 progress.reset(); 950 progress.reset();
956 } 951 }
957 return backend.codegen(work); 952 return backend.codegen(work);
958 } 953 }
959 954
960 void reportDiagnostic(DiagnosticMessage message, 955 void reportDiagnostic(DiagnosticMessage message,
961 List<DiagnosticMessage> infos, api.Diagnostic kind); 956 List<DiagnosticMessage> infos, api.Diagnostic kind);
962 957
963 void reportCrashInUserCode(String message, exception, stackTrace) { 958 void reportCrashInUserCode(String message, exception, stackTrace) {
964 reporter.onCrashInUserCode(message, exception, stackTrace); 959 reporter.onCrashInUserCode(message, exception, stackTrace);
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 _ElementScanner(this.scanner); 2231 _ElementScanner(this.scanner);
2237 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); 2232 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library);
2238 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); 2233 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit);
2239 } 2234 }
2240 2235
2241 class _EmptyEnvironment implements Environment { 2236 class _EmptyEnvironment implements Environment {
2242 const _EmptyEnvironment(); 2237 const _EmptyEnvironment();
2243 2238
2244 String valueOf(String key) => null; 2239 String valueOf(String key) => null;
2245 } 2240 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/common/codegen.dart ('k') | pkg/compiler/lib/src/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698