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

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

Issue 2954493002: Less inequivalence on Hello World! (Closed)
Patch Set: Updated cf. comments Created 3 years, 5 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 Future; 7 import 'dart:async' show Future;
8 8
9 import '../compiler_new.dart' as api; 9 import '../compiler_new.dart' as api;
10 import 'backend_strategy.dart'; 10 import 'backend_strategy.dart';
(...skipping 14 matching lines...) Expand all
25 import 'common_elements.dart' show CommonElements, ElementEnvironment; 25 import 'common_elements.dart' show CommonElements, ElementEnvironment;
26 import 'deferred_load.dart' show DeferredLoadTask; 26 import 'deferred_load.dart' show DeferredLoadTask;
27 import 'diagnostics/code_location.dart'; 27 import 'diagnostics/code_location.dart';
28 import 'diagnostics/diagnostic_listener.dart' show DiagnosticReporter; 28 import 'diagnostics/diagnostic_listener.dart' show DiagnosticReporter;
29 import 'diagnostics/invariant.dart' show REPORT_EXCESS_RESOLUTION; 29 import 'diagnostics/invariant.dart' show REPORT_EXCESS_RESOLUTION;
30 import 'diagnostics/messages.dart' show Message, MessageTemplate; 30 import 'diagnostics/messages.dart' show Message, MessageTemplate;
31 import 'dump_info.dart' show DumpInfoTask; 31 import 'dump_info.dart' show DumpInfoTask;
32 import 'elements/elements.dart'; 32 import 'elements/elements.dart';
33 import 'elements/entities.dart'; 33 import 'elements/entities.dart';
34 import 'elements/resolution_types.dart' show ResolutionDartType, Types; 34 import 'elements/resolution_types.dart' show ResolutionDartType, Types;
35 import 'elements/types.dart' show DartTypes;
36 import 'enqueue.dart' show Enqueuer, EnqueueTask, ResolutionEnqueuer; 35 import 'enqueue.dart' show Enqueuer, EnqueueTask, ResolutionEnqueuer;
37 import 'environment.dart'; 36 import 'environment.dart';
38 import 'frontend_strategy.dart'; 37 import 'frontend_strategy.dart';
39 import 'id_generator.dart'; 38 import 'id_generator.dart';
40 import 'io/source_information.dart' show SourceInformation; 39 import 'io/source_information.dart' show SourceInformation;
41 import 'io/source_file.dart' show Binary; 40 import 'io/source_file.dart' show Binary;
42 import 'js_backend/backend.dart' show JavaScriptBackend; 41 import 'js_backend/backend.dart' show JavaScriptBackend;
43 import 'js_backend/element_strategy.dart' show ElementBackendStrategy; 42 import 'js_backend/element_strategy.dart' show ElementBackendStrategy;
44 import 'kernel/kernel_backend_strategy.dart'; 43 import 'kernel/kernel_backend_strategy.dart';
45 import 'kernel/kernel_strategy.dart'; 44 import 'kernel/kernel_strategy.dart';
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 import 'util/util.dart' show Link; 76 import 'util/util.dart' show Link;
78 import 'world.dart' show ClosedWorld, ClosedWorldRefiner; 77 import 'world.dart' show ClosedWorld, ClosedWorldRefiner;
79 78
80 typedef CompilerDiagnosticReporter MakeReporterFunction( 79 typedef CompilerDiagnosticReporter MakeReporterFunction(
81 Compiler compiler, CompilerOptions options); 80 Compiler compiler, CompilerOptions options);
82 81
83 abstract class Compiler { 82 abstract class Compiler {
84 Measurer get measurer; 83 Measurer get measurer;
85 84
86 final IdGenerator idGenerator = new IdGenerator(); 85 final IdGenerator idGenerator = new IdGenerator();
87 DartTypes types;
88 FrontendStrategy frontendStrategy; 86 FrontendStrategy frontendStrategy;
89 BackendStrategy backendStrategy; 87 BackendStrategy backendStrategy;
90 CompilerDiagnosticReporter _reporter; 88 CompilerDiagnosticReporter _reporter;
91 CompilerResolution _resolution; 89 CompilerResolution _resolution;
92 ParsingContext _parsingContext; 90 ParsingContext _parsingContext;
93 91
94 ImpactStrategy impactStrategy = const ImpactStrategy(); 92 ImpactStrategy impactStrategy = const ImpactStrategy();
95 93
96 /** 94 /**
97 * Map from token to the first preceding comment token. 95 * Map from token to the first preceding comment token.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } else { 188 } else {
191 _reporter = new CompilerDiagnosticReporter(this, options); 189 _reporter = new CompilerDiagnosticReporter(this, options);
192 } 190 }
193 frontendStrategy = options.loadFromDill 191 frontendStrategy = options.loadFromDill
194 ? new KernelFrontEndStrategy(reporter, environment) 192 ? new KernelFrontEndStrategy(reporter, environment)
195 : new ResolutionFrontEndStrategy(this); 193 : new ResolutionFrontEndStrategy(this);
196 backendStrategy = options.loadFromDill 194 backendStrategy = options.loadFromDill
197 ? new KernelBackendStrategyImpl(this) 195 ? new KernelBackendStrategyImpl(this)
198 : new ElementBackendStrategy(this); 196 : new ElementBackendStrategy(this);
199 _resolution = createResolution(); 197 _resolution = createResolution();
200 types = new Types(_resolution);
201 198
202 if (options.verbose) { 199 if (options.verbose) {
203 progress = new Stopwatch()..start(); 200 progress = new Stopwatch()..start();
204 } 201 }
205 202
206 backend = createBackend(); 203 backend = createBackend();
207 enqueuer = backend.makeEnqueuer(); 204 enqueuer = backend.makeEnqueuer();
208 205
209 tasks = [ 206 tasks = [
210 dietParser = new DietParserTask(idGenerator, backend, reporter, measurer), 207 dietParser = new DietParserTask(idGenerator, backend, reporter, measurer),
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 } 1284 }
1288 } 1285 }
1289 1286
1290 // TODO(johnniwinther): Move [ResolverTask] here. 1287 // TODO(johnniwinther): Move [ResolverTask] here.
1291 class CompilerResolution implements Resolution { 1288 class CompilerResolution implements Resolution {
1292 final Compiler _compiler; 1289 final Compiler _compiler;
1293 final Map<Element, ResolutionImpact> _resolutionImpactCache = 1290 final Map<Element, ResolutionImpact> _resolutionImpactCache =
1294 <Element, ResolutionImpact>{}; 1291 <Element, ResolutionImpact>{};
1295 final Map<Element, WorldImpact> _worldImpactCache = <Element, WorldImpact>{}; 1292 final Map<Element, WorldImpact> _worldImpactCache = <Element, WorldImpact>{};
1296 bool retainCachesForTesting = false; 1293 bool retainCachesForTesting = false;
1294 Types _types;
1297 1295
1298 CompilerResolution(this._compiler); 1296 CompilerResolution(this._compiler) {
1297 _types = new Types(this);
1298 }
1299 1299
1300 @override 1300 @override
1301 DiagnosticReporter get reporter => _compiler.reporter; 1301 DiagnosticReporter get reporter => _compiler.reporter;
1302 1302
1303 @override 1303 @override
1304 ParsingContext get parsingContext => _compiler.parsingContext; 1304 ParsingContext get parsingContext => _compiler.parsingContext;
1305 1305
1306 @override 1306 @override
1307 ElementEnvironment get elementEnvironment => 1307 ElementEnvironment get elementEnvironment =>
1308 _compiler.frontendStrategy.elementEnvironment; 1308 _compiler.frontendStrategy.elementEnvironment;
1309 1309
1310 @override 1310 @override
1311 CommonElements get commonElements => 1311 CommonElements get commonElements =>
1312 _compiler.frontendStrategy.commonElements; 1312 _compiler.frontendStrategy.commonElements;
1313 1313
1314 @override 1314 @override
1315 Types get types => _compiler.types; 1315 Types get types => _types;
1316 1316
1317 @override 1317 @override
1318 Target get target => _compiler.backend.target; 1318 Target get target => _compiler.backend.target;
1319 1319
1320 @override 1320 @override
1321 ResolverTask get resolver => _compiler.resolver; 1321 ResolverTask get resolver => _compiler.resolver;
1322 1322
1323 @override 1323 @override
1324 ResolutionEnqueuer get enqueuer => _compiler.enqueuer.resolution; 1324 ResolutionEnqueuer get enqueuer => _compiler.enqueuer.resolution;
1325 1325
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 _ElementScanner(this.scanner); 1594 _ElementScanner(this.scanner);
1595 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); 1595 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library);
1596 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); 1596 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit);
1597 } 1597 }
1598 1598
1599 class _EmptyEnvironment implements Environment { 1599 class _EmptyEnvironment implements Environment {
1600 const _EmptyEnvironment(); 1600 const _EmptyEnvironment();
1601 1601
1602 String valueOf(String key) => null; 1602 String valueOf(String key) => null;
1603 } 1603 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/compile_time_constants.dart ('k') | pkg/compiler/lib/src/elements/resolution_types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698