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