OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 | 7 |
8 import 'package:front_end/file_system.dart'; | 8 import 'package:front_end/file_system.dart'; |
9 import 'package:front_end/incremental_kernel_generator.dart'; | 9 import 'package:front_end/incremental_kernel_generator.dart'; |
10 import 'package:front_end/src/base/api_signature.dart'; | 10 import 'package:front_end/src/base/api_signature.dart'; |
11 import 'package:front_end/src/base/performace_logger.dart'; | 11 import 'package:front_end/src/base/performace_logger.dart'; |
12 import 'package:front_end/src/base/processed_options.dart'; | 12 import 'package:front_end/src/base/processed_options.dart'; |
13 import 'package:front_end/src/fasta/dill/dill_library_builder.dart'; | 13 import 'package:front_end/src/fasta/dill/dill_library_builder.dart'; |
14 import 'package:front_end/src/fasta/dill/dill_target.dart'; | 14 import 'package:front_end/src/fasta/dill/dill_target.dart'; |
15 import 'package:front_end/src/fasta/kernel/kernel_target.dart'; | 15 import 'package:front_end/src/fasta/kernel/kernel_target.dart'; |
16 import 'package:front_end/src/fasta/ticker.dart'; | 16 import 'package:front_end/src/fasta/ticker.dart'; |
17 import 'package:front_end/src/fasta/translate_uri.dart'; | 17 import 'package:front_end/src/fasta/translate_uri.dart'; |
18 import 'package:front_end/src/incremental/byte_store.dart'; | 18 import 'package:front_end/src/incremental/byte_store.dart'; |
19 import 'package:front_end/src/incremental/file_state.dart'; | 19 import 'package:front_end/src/incremental/file_state.dart'; |
20 import 'package:kernel/binary/ast_from_binary.dart'; | 20 import 'package:kernel/binary/ast_from_binary.dart'; |
21 import 'package:kernel/binary/limited_ast_to_binary.dart'; | 21 import 'package:kernel/binary/limited_ast_to_binary.dart'; |
22 import 'package:kernel/kernel.dart' hide Source; | 22 import 'package:kernel/kernel.dart' hide Source; |
23 import 'package:kernel/target/targets.dart' show TargetFlags; | 23 import 'package:kernel/target/targets.dart' show TargetFlags; |
| 24 import 'package:kernel/target/vm_fasta.dart' show VmFastaTarget; |
24 | 25 |
25 dynamic unimplemented() { | 26 dynamic unimplemented() { |
26 // TODO(paulberry): get rid of this. | 27 // TODO(paulberry): get rid of this. |
27 throw new UnimplementedError(); | 28 throw new UnimplementedError(); |
28 } | 29 } |
29 | 30 |
30 class ByteSink implements Sink<List<int>> { | 31 class ByteSink implements Sink<List<int>> { |
31 final BytesBuilder builder = new BytesBuilder(); | 32 final BytesBuilder builder = new BytesBuilder(); |
32 | 33 |
33 void add(List<int> data) { | 34 void add(List<int> data) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 FileState entryLibrary = await _fsState.getFile(_entryPoint); | 96 FileState entryLibrary = await _fsState.getFile(_entryPoint); |
96 | 97 |
97 List<LibraryCycle> cycles = _logger.run('Compute library cycles', () { | 98 List<LibraryCycle> cycles = _logger.run('Compute library cycles', () { |
98 List<LibraryCycle> cycles = entryLibrary.topologicalOrder; | 99 List<LibraryCycle> cycles = entryLibrary.topologicalOrder; |
99 _logger.writeln('Computed ${cycles.length} cycles.'); | 100 _logger.writeln('Computed ${cycles.length} cycles.'); |
100 return cycles; | 101 return cycles; |
101 }); | 102 }); |
102 | 103 |
103 CanonicalName nameRoot = new CanonicalName.root(); | 104 CanonicalName nameRoot = new CanonicalName.root(); |
104 DillTarget dillTarget = new DillTarget( | 105 DillTarget dillTarget = new DillTarget( |
105 new Ticker(isVerbose: false), _uriTranslator, "vm_fasta", | 106 new Ticker(isVerbose: false), |
106 flags: new TargetFlags(strongMode: _options.strongMode)); | 107 _uriTranslator, |
| 108 new VmFastaTarget(new TargetFlags(strongMode: _options.strongMode))); |
107 | 109 |
108 List<_LibraryCycleResult> results = []; | 110 List<_LibraryCycleResult> results = []; |
109 await _logger.runAsync('Compute results for cycles', () async { | 111 await _logger.runAsync('Compute results for cycles', () async { |
110 for (LibraryCycle cycle in cycles) { | 112 for (LibraryCycle cycle in cycles) { |
111 _LibraryCycleResult result = | 113 _LibraryCycleResult result = |
112 await _compileCycle(nameRoot, dillTarget, cycle); | 114 await _compileCycle(nameRoot, dillTarget, cycle); |
113 results.add(result); | 115 results.add(result); |
114 } | 116 } |
115 }); | 117 }); |
116 | 118 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 /// TODO(scheglov) Use API signatures. | 310 /// TODO(scheglov) Use API signatures. |
309 /// TODO(scheglov) Or use tree shaking and compute signatures of outlines. | 311 /// TODO(scheglov) Or use tree shaking and compute signatures of outlines. |
310 final String signature; | 312 final String signature; |
311 | 313 |
312 /// Kernel libraries for libraries in the [cycle]. Bodies of dependencies | 314 /// Kernel libraries for libraries in the [cycle]. Bodies of dependencies |
313 /// are not included, but but references to those dependencies are included. | 315 /// are not included, but but references to those dependencies are included. |
314 final List<Library> kernelLibraries; | 316 final List<Library> kernelLibraries; |
315 | 317 |
316 _LibraryCycleResult(this.cycle, this.signature, this.kernelLibraries); | 318 _LibraryCycleResult(this.cycle, this.signature, this.kernelLibraries); |
317 } | 319 } |
OLD | NEW |