OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 compiler_configuration; | 5 library compiler_configuration; |
6 | 6 |
7 import 'dart:io' show Platform; | 7 import 'dart:io' show Platform; |
8 | 8 |
9 import 'runtime_configuration.dart' show RuntimeConfiguration; | 9 import 'runtime_configuration.dart' show RuntimeConfiguration; |
10 | 10 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 return new PrecompilerCompilerConfiguration( | 87 return new PrecompilerCompilerConfiguration( |
88 isDebug: isDebug, | 88 isDebug: isDebug, |
89 isChecked: isChecked, | 89 isChecked: isChecked, |
90 arch: configuration['arch'], | 90 arch: configuration['arch'], |
91 useBlobs: useBlobs, | 91 useBlobs: useBlobs, |
92 isAndroid: configuration['system'] == 'android'); | 92 isAndroid: configuration['system'] == 'android'); |
93 case 'dartk': | 93 case 'dartk': |
94 return ComposedCompilerConfiguration.createDartKConfiguration( | 94 return ComposedCompilerConfiguration.createDartKConfiguration( |
95 isHostChecked: isHostChecked, | 95 isHostChecked: isHostChecked, |
96 useSdk: useSdk, | 96 useSdk: useSdk, |
97 verify: verifyKernel); | 97 verify: verifyKernel, |
| 98 strong: isStrong); |
98 case 'dartkp': | 99 case 'dartkp': |
99 return ComposedCompilerConfiguration.createDartKPConfiguration( | 100 return ComposedCompilerConfiguration.createDartKPConfiguration( |
100 isHostChecked: isHostChecked, | 101 isHostChecked: isHostChecked, |
101 arch: configuration['arch'], | 102 arch: configuration['arch'], |
102 useBlobs: useBlobs, | 103 useBlobs: useBlobs, |
103 isAndroid: configuration['system'] == 'android', | 104 isAndroid: configuration['system'] == 'android', |
104 useSdk: useSdk, | 105 useSdk: useSdk, |
105 verify: verifyKernel); | 106 verify: verifyKernel, |
| 107 strong: isStrong); |
106 case 'none': | 108 case 'none': |
107 return new NoneCompilerConfiguration( | 109 return new NoneCompilerConfiguration( |
108 isDebug: isDebug, | 110 isDebug: isDebug, |
109 isChecked: isChecked, | 111 isChecked: isChecked, |
110 isHostChecked: isHostChecked, | 112 isHostChecked: isHostChecked, |
111 useSdk: useSdk, | 113 useSdk: useSdk, |
112 hotReload: hotReload, | 114 hotReload: hotReload, |
113 hotReloadRollback: hotReloadRollback); | 115 hotReloadRollback: hotReloadRollback); |
114 default: | 116 default: |
115 throw "Unknown compiler '$compiler'"; | 117 throw "Unknown compiler '$compiler'"; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 } | 210 } |
209 return args | 211 return args |
210 ..addAll(vmOptions) | 212 ..addAll(vmOptions) |
211 ..addAll(sharedOptions) | 213 ..addAll(sharedOptions) |
212 ..addAll(originalArguments); | 214 ..addAll(originalArguments); |
213 } | 215 } |
214 } | 216 } |
215 | 217 |
216 /// The "dartk" compiler. | 218 /// The "dartk" compiler. |
217 class DartKCompilerConfiguration extends CompilerConfiguration { | 219 class DartKCompilerConfiguration extends CompilerConfiguration { |
218 final bool verify; | 220 final bool verify, strong; |
219 | 221 |
220 DartKCompilerConfiguration({bool isHostChecked, bool useSdk, this.verify}) | 222 DartKCompilerConfiguration({bool isHostChecked, bool useSdk, this.verify, |
| 223 this.strong}) |
221 : super._subclass(isHostChecked: isHostChecked, useSdk: useSdk); | 224 : super._subclass(isHostChecked: isHostChecked, useSdk: useSdk); |
222 | 225 |
223 @override | 226 @override |
224 String computeCompilerPath(String buildDir) { | 227 String computeCompilerPath(String buildDir) { |
225 return 'tools/dartk_wrappers/dartk$executableScriptSuffix'; | 228 return 'tools/dartk_wrappers/dartk$executableScriptSuffix'; |
226 } | 229 } |
227 | 230 |
228 CompilationCommand computeCompilationCommand( | 231 CompilationCommand computeCompilationCommand( |
229 String outputFileName, | 232 String outputFileName, |
230 String buildDir, | 233 String buildDir, |
231 CommandBuilder commandBuilder, | 234 CommandBuilder commandBuilder, |
232 List arguments, | 235 List arguments, |
233 Map<String, String> environmentOverrides) { | 236 Map<String, String> environmentOverrides) { |
234 Iterable<String> extraArguments = [ | 237 Iterable<String> extraArguments = [ |
235 '--sdk', | 238 '--sdk', |
236 '$buildDir/patched_sdk', | 239 '$buildDir/patched_sdk', |
237 '--link', | 240 '--link', |
238 '--target=vm', | 241 '--target=vm', |
| 242 strong ? '--strong' : null, |
239 verify ? '--verify-ir' : null, | 243 verify ? '--verify-ir' : null, |
240 '--out', | 244 '--out', |
241 outputFileName | 245 outputFileName |
242 ].where((x) => x != null); | 246 ].where((x) => x != null); |
243 return commandBuilder.getKernelCompilationCommand( | 247 return commandBuilder.getKernelCompilationCommand( |
244 'dartk', | 248 'dartk', |
245 outputFileName, | 249 outputFileName, |
246 true, | 250 true, |
247 bootstrapDependencies(buildDir), | 251 bootstrapDependencies(buildDir), |
248 computeCompilerPath(buildDir), | 252 computeCompilerPath(buildDir), |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 List<String> vmOptions, | 364 List<String> vmOptions, |
361 List<String> sharedOptions, | 365 List<String> sharedOptions, |
362 List<String> originalArguments, | 366 List<String> originalArguments, |
363 CommandArtifact artifact) { | 367 CommandArtifact artifact) { |
364 final String suffix = isPrecompiler ? "/out.aotsnapshot" : ""; | 368 final String suffix = isPrecompiler ? "/out.aotsnapshot" : ""; |
365 return <String>["${artifact.filename}${suffix}"]; | 369 return <String>["${artifact.filename}${suffix}"]; |
366 } | 370 } |
367 | 371 |
368 static ComposedCompilerConfiguration createDartKPConfiguration( | 372 static ComposedCompilerConfiguration createDartKPConfiguration( |
369 {bool isHostChecked, String arch, bool useBlobs, bool isAndroid, | 373 {bool isHostChecked, String arch, bool useBlobs, bool isAndroid, |
370 bool useSdk, bool verify}) { | 374 bool useSdk, bool verify, bool strong}) { |
371 var nested = []; | 375 var nested = []; |
372 | 376 |
373 // Compile with dartk. | 377 // Compile with dartk. |
374 nested.add(new PipelineCommand.runWithGlobalArguments( | 378 nested.add(new PipelineCommand.runWithGlobalArguments( |
375 new DartKCompilerConfiguration(isHostChecked: isHostChecked, | 379 new DartKCompilerConfiguration(isHostChecked: isHostChecked, |
376 useSdk: useSdk, verify: verify))); | 380 useSdk: useSdk, verify: verify, strong: strong))); |
377 | 381 |
378 // Run the normal precompiler. | 382 // Run the normal precompiler. |
379 nested.add(new PipelineCommand.runWithPreviousKernelOutput( | 383 nested.add(new PipelineCommand.runWithPreviousKernelOutput( |
380 new PrecompilerCompilerConfiguration( | 384 new PrecompilerCompilerConfiguration( |
381 arch: arch, useBlobs: useBlobs, isAndroid: isAndroid))); | 385 arch: arch, useBlobs: useBlobs, isAndroid: isAndroid))); |
382 | 386 |
383 return new ComposedCompilerConfiguration(nested, isPrecompiler: true); | 387 return new ComposedCompilerConfiguration(nested, isPrecompiler: true); |
384 } | 388 } |
385 | 389 |
386 static ComposedCompilerConfiguration createDartKConfiguration( | 390 static ComposedCompilerConfiguration createDartKConfiguration( |
387 {bool isHostChecked, bool useSdk, bool verify}) { | 391 {bool isHostChecked, bool useSdk, bool verify, bool strong}) { |
388 var nested = []; | 392 var nested = []; |
389 | 393 |
390 // Compile with dartk. | 394 // Compile with dartk. |
391 nested.add(new PipelineCommand.runWithGlobalArguments( | 395 nested.add(new PipelineCommand.runWithGlobalArguments( |
392 new DartKCompilerConfiguration(isHostChecked: isHostChecked, | 396 new DartKCompilerConfiguration(isHostChecked: isHostChecked, |
393 useSdk: useSdk, verify: verify))); | 397 useSdk: useSdk, verify: verify, strong: strong))); |
394 | 398 |
395 return new ComposedCompilerConfiguration(nested, isPrecompiler: false); | 399 return new ComposedCompilerConfiguration(nested, isPrecompiler: false); |
396 } | 400 } |
397 } | 401 } |
398 | 402 |
399 /// Common configuration for dart2js-based tools, such as, dart2js | 403 /// Common configuration for dart2js-based tools, such as, dart2js |
400 class Dart2xCompilerConfiguration extends CompilerConfiguration { | 404 class Dart2xCompilerConfiguration extends CompilerConfiguration { |
401 final String moniker; | 405 final String moniker; |
402 static Map<String, List<Uri>> _bootstrapDependenciesCache = | 406 static Map<String, List<Uri>> _bootstrapDependenciesCache = |
403 new Map<String, List<Uri>>(); | 407 new Map<String, List<Uri>>(); |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 RuntimeConfiguration runtimeConfiguration, | 840 RuntimeConfiguration runtimeConfiguration, |
837 String buildDir, | 841 String buildDir, |
838 TestInformation info, | 842 TestInformation info, |
839 List<String> vmOptions, | 843 List<String> vmOptions, |
840 List<String> sharedOptions, | 844 List<String> sharedOptions, |
841 List<String> originalArguments, | 845 List<String> originalArguments, |
842 CommandArtifact artifact) { | 846 CommandArtifact artifact) { |
843 return <String>[]; | 847 return <String>[]; |
844 } | 848 } |
845 } | 849 } |
OLD | NEW |