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 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'; |
11 import 'closure.dart' as closureMapping show ClosureConversionTask; | |
12 import 'common/names.dart' show Selectors; | 11 import 'common/names.dart' show Selectors; |
13 import 'common/names.dart' show Uris; | 12 import 'common/names.dart' show Uris; |
14 import 'common/resolution.dart' | 13 import 'common/resolution.dart' |
15 show | 14 show |
16 ParsingContext, | 15 ParsingContext, |
17 Resolution, | 16 Resolution, |
18 ResolutionWorkItem, | 17 ResolutionWorkItem, |
19 ResolutionImpact, | 18 ResolutionImpact, |
20 Target; | 19 Target; |
21 import 'common/tasks.dart' show CompilerTask, GenericTask, Measurer; | 20 import 'common/tasks.dart' show CompilerTask, GenericTask, Measurer; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 Entity get currentElement => _reporter.currentElement; | 137 Entity get currentElement => _reporter.currentElement; |
139 | 138 |
140 List<CompilerTask> tasks; | 139 List<CompilerTask> tasks; |
141 ScannerTask scanner; | 140 ScannerTask scanner; |
142 DietParserTask dietParser; | 141 DietParserTask dietParser; |
143 ParserTask parser; | 142 ParserTask parser; |
144 PatchParserTask patchParser; | 143 PatchParserTask patchParser; |
145 LibraryLoaderTask libraryLoader; | 144 LibraryLoaderTask libraryLoader; |
146 SerializationTask serialization; | 145 SerializationTask serialization; |
147 ResolverTask resolver; | 146 ResolverTask resolver; |
148 closureMapping.ClosureConversionTask closureDataLookup; | |
149 TypeCheckerTask checker; | 147 TypeCheckerTask checker; |
150 GlobalTypeInferenceTask globalInference; | 148 GlobalTypeInferenceTask globalInference; |
151 JavaScriptBackend backend; | 149 JavaScriptBackend backend; |
152 CodegenWorldBuilder _codegenWorldBuilder; | 150 CodegenWorldBuilder _codegenWorldBuilder; |
153 | 151 |
154 GenericTask selfTask; | 152 GenericTask selfTask; |
155 | 153 |
156 /// The constant environment for the frontend interpretation of compile-time | 154 /// The constant environment for the frontend interpretation of compile-time |
157 /// constants. | 155 /// constants. |
158 ConstantEnvironment constants; | 156 ConstantEnvironment constants; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 : new _ScriptLoader(this), | 218 : new _ScriptLoader(this), |
221 new _ElementScanner(scanner), | 219 new _ElementScanner(scanner), |
222 serialization, | 220 serialization, |
223 resolvePatchUri, | 221 resolvePatchUri, |
224 patchParser, | 222 patchParser, |
225 environment, | 223 environment, |
226 reporter, | 224 reporter, |
227 measurer), | 225 measurer), |
228 parser = new ParserTask(this), | 226 parser = new ParserTask(this), |
229 resolver = createResolverTask(), | 227 resolver = createResolverTask(), |
230 closureDataLookup = backendStrategy.createClosureConversionTask(this), | |
231 checker = new TypeCheckerTask(this), | 228 checker = new TypeCheckerTask(this), |
232 globalInference = new GlobalTypeInferenceTask(this), | 229 globalInference = new GlobalTypeInferenceTask(this), |
233 constants = backend.constantCompilerTask, | 230 constants = backend.constantCompilerTask, |
234 deferredLoadTask = new DeferredLoadTask(this), | 231 deferredLoadTask = new DeferredLoadTask(this), |
235 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), | 232 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), |
236 // [enqueuer] is created earlier because it contains the resolution world | 233 // [enqueuer] is created earlier because it contains the resolution world |
237 // objects needed by other tasks. | 234 // objects needed by other tasks. |
238 enqueuer, | 235 enqueuer, |
239 dumpInfoTask = new DumpInfoTask(this), | 236 dumpInfoTask = new DumpInfoTask(this), |
240 selfTask = new GenericTask('self', measurer), | 237 selfTask = new GenericTask('self', measurer), |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 ClosedWorldRefiner closedWorldRefiner = | 652 ClosedWorldRefiner closedWorldRefiner = |
656 backendStrategy.createClosedWorldRefiner(closedWorld); | 653 backendStrategy.createClosedWorldRefiner(closedWorld); |
657 // Compute whole-program-knowledge that the backend needs. (This might | 654 // Compute whole-program-knowledge that the backend needs. (This might |
658 // require the information computed in [world.closeWorld].) | 655 // require the information computed in [world.closeWorld].) |
659 backend.onResolutionClosedWorld(closedWorld, closedWorldRefiner); | 656 backend.onResolutionClosedWorld(closedWorld, closedWorldRefiner); |
660 | 657 |
661 deferredLoadTask.onResolutionComplete(mainFunction, closedWorld); | 658 deferredLoadTask.onResolutionComplete(mainFunction, closedWorld); |
662 | 659 |
663 // TODO(johnniwinther): Move this after rti computation but before | 660 // TODO(johnniwinther): Move this after rti computation but before |
664 // reflection members computation, and (re-)close the world afterwards. | 661 // reflection members computation, and (re-)close the world afterwards. |
665 closureDataLookup.convertClosures( | 662 backendStrategy.closureDataLookup.convertClosures( |
666 enqueuer.resolution.processedEntities, closedWorldRefiner); | 663 enqueuer.resolution.processedEntities, closedWorldRefiner); |
667 return closedWorldRefiner; | 664 return closedWorldRefiner; |
668 } | 665 } |
669 | 666 |
670 /// Compute the [WorldImpact] for accessing all elements in [library]. | 667 /// Compute the [WorldImpact] for accessing all elements in [library]. |
671 WorldImpact computeImpactForLibrary(LibraryElement library) { | 668 WorldImpact computeImpactForLibrary(LibraryElement library) { |
672 WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl(); | 669 WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl(); |
673 | 670 |
674 void registerStaticUse(Element element) { | 671 void registerStaticUse(Element element) { |
675 impactBuilder.registerStaticUse(new StaticUse.directUse(element)); | 672 impactBuilder.registerStaticUse(new StaticUse.directUse(element)); |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 _ElementScanner(this.scanner); | 1594 _ElementScanner(this.scanner); |
1598 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 1595 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
1599 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 1596 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
1600 } | 1597 } |
1601 | 1598 |
1602 class _EmptyEnvironment implements Environment { | 1599 class _EmptyEnvironment implements Environment { |
1603 const _EmptyEnvironment(); | 1600 const _EmptyEnvironment(); |
1604 | 1601 |
1605 String valueOf(String key) => null; | 1602 String valueOf(String key) => null; |
1606 } | 1603 } |
OLD | NEW |