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

Side by Side Diff: pkg/front_end/lib/src/fasta/compile_platform.dart

Issue 2919003003: Reapply "Use backend targets to run Kernel transformations in Fasta" (Closed)
Patch Set: Follow dartanalyzer suggestions Created 3 years, 6 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 fasta.compile_platform; 5 library fasta.compile_platform;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:io' show exitCode; 9 import 'dart:io' show exitCode;
10 10
11 import 'compiler_command_line.dart' show CompilerCommandLine; 11 import 'compiler_command_line.dart' show CompilerCommandLine;
12 12
13 import 'compiler_context.dart' show CompilerContext; 13 import 'compiler_context.dart' show CompilerContext;
14 14
15 import 'dill/dill_target.dart' show DillTarget; 15 import 'dill/dill_target.dart' show DillTarget;
16 16
17 import 'errors.dart' show InputError; 17 import 'errors.dart' show InputError;
18 18
19 import 'kernel/kernel_target.dart' show KernelTarget; 19 import 'kernel/kernel_target.dart' show KernelTarget;
20 20
21 import 'kernel/utils.dart' show printProgramText, writeProgramToFile; 21 import 'kernel/utils.dart' show printProgramText, writeProgramToFile;
22 22
23 import 'ticker.dart' show Ticker; 23 import 'ticker.dart' show Ticker;
24 24
25 import 'translate_uri.dart' show TranslateUri; 25 import 'translate_uri.dart' show TranslateUri;
26 26
27 import 'package:kernel/target/targets.dart' show TargetFlags;
28
27 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1); 29 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1);
28 30
29 Future mainEntryPoint(List<String> arguments) async { 31 Future mainEntryPoint(List<String> arguments) async {
30 for (int i = 0; i < iterations; i++) { 32 for (int i = 0; i < iterations; i++) {
31 if (i > 0) { 33 if (i > 0) {
32 print("\n"); 34 print("\n");
33 } 35 }
34 try { 36 try {
35 await compilePlatform(arguments); 37 await compilePlatform(arguments);
36 } on InputError catch (e) { 38 } on InputError catch (e) {
(...skipping 27 matching lines...) Expand all
64 ticker.logMs("Parsed arguments"); 66 ticker.logMs("Parsed arguments");
65 if (ticker.isVerbose) { 67 if (ticker.isVerbose) {
66 print("Generating outline of $patchedSdk into $outlineOutput"); 68 print("Generating outline of $patchedSdk into $outlineOutput");
67 print("Compiling $patchedSdk to $fullOutput"); 69 print("Compiling $patchedSdk to $fullOutput");
68 } 70 }
69 71
70 TranslateUri uriTranslator = await TranslateUri 72 TranslateUri uriTranslator = await TranslateUri
71 .parse(c.fileSystem, patchedSdk, packages: c.options.packages); 73 .parse(c.fileSystem, patchedSdk, packages: c.options.packages);
72 ticker.logMs("Read packages file"); 74 ticker.logMs("Read packages file");
73 75
74 DillTarget dillTarget = 76 DillTarget dillTarget = new DillTarget(
75 new DillTarget(ticker, uriTranslator, c.options.target); 77 ticker, uriTranslator, c.options.target,
76 KernelTarget kernelTarget = new KernelTarget(c.fileSystem, dillTarget, 78 flags: new TargetFlags(strongMode: c.options.strongMode));
77 uriTranslator, c.options.strongMode, c.uriToSource); 79 KernelTarget kernelTarget =
80 new KernelTarget(c.fileSystem, dillTarget, uriTranslator, c.uriToSource);
78 81
79 kernelTarget.read(Uri.parse("dart:core")); 82 kernelTarget.read(Uri.parse("dart:core"));
80 await dillTarget.buildOutlines(); 83 await dillTarget.buildOutlines();
81 var outline = await kernelTarget.buildOutlines(); 84 var outline = await kernelTarget.buildOutlines();
82 85
83 await writeProgramToFile(outline, outlineOutput); 86 await writeProgramToFile(outline, outlineOutput);
84 ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}"); 87 ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}");
85 88
86 if (exitCode != 0) return null; 89 if (exitCode != 0) return null;
87 90
88 var program = await kernelTarget.buildProgram(verify: c.options.verify); 91 var program = await kernelTarget.buildProgram(verify: c.options.verify);
89 if (c.options.dumpIr) printProgramText(program); 92 if (c.options.dumpIr) printProgramText(program);
90 await writeProgramToFile(program, fullOutput); 93 await writeProgramToFile(program, fullOutput);
91 ticker.logMs("Wrote program to ${fullOutput.toFilePath()}"); 94 ticker.logMs("Wrote program to ${fullOutput.toFilePath()}");
92 await kernelTarget.writeDepsFile(fullOutput, deps); 95 await kernelTarget.writeDepsFile(fullOutput, deps);
93 } 96 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698