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

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

Issue 2580403002: Extract ClosedWorldImpl from WorldImpl. (Closed)
Patch Set: Created 4 years 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 import 'universe/world_builder.dart' 71 import 'universe/world_builder.dart'
72 show ResolutionWorldBuilder, CodegenWorldBuilder; 72 show ResolutionWorldBuilder, CodegenWorldBuilder;
73 import 'universe/use.dart' show StaticUse, TypeUse; 73 import 'universe/use.dart' show StaticUse, TypeUse;
74 import 'universe/world_impact.dart' 74 import 'universe/world_impact.dart'
75 show 75 show
76 ImpactStrategy, 76 ImpactStrategy,
77 WorldImpact, 77 WorldImpact,
78 WorldImpactBuilder, 78 WorldImpactBuilder,
79 WorldImpactBuilderImpl; 79 WorldImpactBuilderImpl;
80 import 'util/util.dart' show Link, Setlet; 80 import 'util/util.dart' show Link, Setlet;
81 import 'world.dart' show ClosedWorld, ClosedWorldRefiner, WorldImpl; 81 import 'world.dart' show ClosedWorld, ClosedWorldRefiner, ClosedWorldImpl;
82 82
83 typedef Backend MakeBackendFuncion(Compiler compiler); 83 typedef Backend MakeBackendFunction(Compiler compiler);
84 84
85 typedef CompilerDiagnosticReporter MakeReporterFunction( 85 typedef CompilerDiagnosticReporter MakeReporterFunction(
86 Compiler compiler, CompilerOptions options); 86 Compiler compiler, CompilerOptions options);
87 87
88 abstract class Compiler implements LibraryLoaderListener { 88 abstract class Compiler implements LibraryLoaderListener {
89 Measurer get measurer; 89 Measurer get measurer;
90 90
91 final IdGenerator idGenerator = new IdGenerator(); 91 final IdGenerator idGenerator = new IdGenerator();
92 Types types; 92 Types types;
93 _CompilerCoreTypes _coreTypes; 93 _CompilerCoreTypes _coreTypes;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 static const int PHASE_DONE_RESOLVING = 2; 190 static const int PHASE_DONE_RESOLVING = 2;
191 static const int PHASE_COMPILING = 3; 191 static const int PHASE_COMPILING = 3;
192 int phase; 192 int phase;
193 193
194 bool compilationFailed = false; 194 bool compilationFailed = false;
195 195
196 Compiler( 196 Compiler(
197 {CompilerOptions options, 197 {CompilerOptions options,
198 api.CompilerOutput outputProvider, 198 api.CompilerOutput outputProvider,
199 this.environment: const _EmptyEnvironment(), 199 this.environment: const _EmptyEnvironment(),
200 MakeBackendFuncion makeBackend, 200 MakeBackendFunction makeBackend,
201 MakeReporterFunction makeReporter}) 201 MakeReporterFunction makeReporter})
202 : this.options = options, 202 : this.options = options,
203 this.cacheStrategy = new CacheStrategy(options.hasIncrementalSupport), 203 this.cacheStrategy = new CacheStrategy(options.hasIncrementalSupport),
204 this.userOutputProvider = outputProvider == null 204 this.userOutputProvider = outputProvider == null
205 ? const NullCompilerOutput() 205 ? const NullCompilerOutput()
206 : outputProvider { 206 : outputProvider {
207 if (makeReporter != null) { 207 if (makeReporter != null) {
208 _reporter = makeReporter(this, options); 208 _reporter = makeReporter(this, options);
209 } else { 209 } else {
210 _reporter = new CompilerDiagnosticReporter(this, options); 210 _reporter = new CompilerDiagnosticReporter(this, options);
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 730
731 backend.onCodegenEnd(); 731 backend.onCodegenEnd();
732 732
733 checkQueues(); 733 checkQueues();
734 }); 734 });
735 735
736 /// Perform the steps needed to fully end the resolution phase. 736 /// Perform the steps needed to fully end the resolution phase.
737 ClosedWorldRefiner closeResolution() { 737 ClosedWorldRefiner closeResolution() {
738 phase = PHASE_DONE_RESOLVING; 738 phase = PHASE_DONE_RESOLVING;
739 739
740 WorldImpl world = resolverWorld.openWorld.closeWorld(reporter); 740 ClosedWorldImpl world = resolverWorld.openWorld.closeWorld(reporter);
741 // Compute whole-program-knowledge that the backend needs. (This might 741 // Compute whole-program-knowledge that the backend needs. (This might
742 // require the information computed in [world.closeWorld].) 742 // require the information computed in [world.closeWorld].)
743 backend.onResolutionComplete(world, world); 743 backend.onResolutionComplete(world, world);
744 744
745 deferredLoadTask.onResolutionComplete(mainFunction); 745 deferredLoadTask.onResolutionComplete(mainFunction);
746 746
747 // TODO(johnniwinther): Move this after rti computation but before 747 // TODO(johnniwinther): Move this after rti computation but before
748 // reflection members computation, and (re-)close the world afterwards. 748 // reflection members computation, and (re-)close the world afterwards.
749 closureToClassMapper.createClosureClasses(world); 749 closureToClassMapper.createClosureClasses(world);
750 return world; 750 return world;
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after
2220 _ElementScanner(this.scanner); 2220 _ElementScanner(this.scanner);
2221 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); 2221 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library);
2222 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); 2222 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit);
2223 } 2223 }
2224 2224
2225 class _EmptyEnvironment implements Environment { 2225 class _EmptyEnvironment implements Environment {
2226 const _EmptyEnvironment(); 2226 const _EmptyEnvironment();
2227 2227
2228 String valueOf(String key) => null; 2228 String valueOf(String key) => null;
2229 } 2229 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698