| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 bool isChecked = configuration['checked']; | 51 bool isChecked = configuration['checked']; |
| 52 bool isStrong = configuration['strong']; | 52 bool isStrong = configuration['strong']; |
| 53 bool isHostChecked = configuration['host_checked']; | 53 bool isHostChecked = configuration['host_checked']; |
| 54 bool useSdk = configuration['use_sdk']; | 54 bool useSdk = configuration['use_sdk']; |
| 55 bool isCsp = configuration['csp']; | 55 bool isCsp = configuration['csp']; |
| 56 bool useCps = configuration['cps_ir']; | 56 bool useCps = configuration['cps_ir']; |
| 57 bool useBlobs = configuration['use_blobs']; | 57 bool useBlobs = configuration['use_blobs']; |
| 58 bool hotReload = configuration['hot_reload']; | 58 bool hotReload = configuration['hot_reload']; |
| 59 bool hotReloadRollback = configuration['hot_reload_rollback']; | 59 bool hotReloadRollback = configuration['hot_reload_rollback']; |
| 60 bool useFastStartup = configuration['fast_startup']; | 60 bool useFastStartup = configuration['fast_startup']; |
| 61 bool verifyKernel = configuration['verify-ir']; |
| 61 | 62 |
| 62 switch (compiler) { | 63 switch (compiler) { |
| 63 case 'dart2analyzer': | 64 case 'dart2analyzer': |
| 64 return new AnalyzerCompilerConfiguration( | 65 return new AnalyzerCompilerConfiguration( |
| 65 isDebug: isDebug, | 66 isDebug: isDebug, |
| 66 isChecked: isChecked, | 67 isChecked: isChecked, |
| 67 isStrong: isStrong, | 68 isStrong: isStrong, |
| 68 isHostChecked: isHostChecked, | 69 isHostChecked: isHostChecked, |
| 69 useSdk: useSdk); | 70 useSdk: useSdk); |
| 70 case 'dart2js': | 71 case 'dart2js': |
| (...skipping 14 matching lines...) Expand all Loading... |
| 85 case 'precompiler': | 86 case 'precompiler': |
| 86 return new PrecompilerCompilerConfiguration( | 87 return new PrecompilerCompilerConfiguration( |
| 87 isDebug: isDebug, | 88 isDebug: isDebug, |
| 88 isChecked: isChecked, | 89 isChecked: isChecked, |
| 89 arch: configuration['arch'], | 90 arch: configuration['arch'], |
| 90 useBlobs: useBlobs, | 91 useBlobs: useBlobs, |
| 91 isAndroid: configuration['system'] == 'android'); | 92 isAndroid: configuration['system'] == 'android'); |
| 92 case 'dartk': | 93 case 'dartk': |
| 93 return ComposedCompilerConfiguration.createDartKConfiguration( | 94 return ComposedCompilerConfiguration.createDartKConfiguration( |
| 94 isHostChecked: isHostChecked, | 95 isHostChecked: isHostChecked, |
| 95 useSdk: useSdk); | 96 useSdk: useSdk, |
| 97 verify: verifyKernel); |
| 96 case 'dartkp': | 98 case 'dartkp': |
| 97 return ComposedCompilerConfiguration.createDartKPConfiguration( | 99 return ComposedCompilerConfiguration.createDartKPConfiguration( |
| 98 isHostChecked: isHostChecked, | 100 isHostChecked: isHostChecked, |
| 99 arch: configuration['arch'], | 101 arch: configuration['arch'], |
| 100 useBlobs: useBlobs, | 102 useBlobs: useBlobs, |
| 101 isAndroid: configuration['system'] == 'android', | 103 isAndroid: configuration['system'] == 'android', |
| 102 useSdk: useSdk); | 104 useSdk: useSdk, |
| 105 verify: verifyKernel); |
| 103 case 'none': | 106 case 'none': |
| 104 return new NoneCompilerConfiguration( | 107 return new NoneCompilerConfiguration( |
| 105 isDebug: isDebug, | 108 isDebug: isDebug, |
| 106 isChecked: isChecked, | 109 isChecked: isChecked, |
| 107 isHostChecked: isHostChecked, | 110 isHostChecked: isHostChecked, |
| 108 useSdk: useSdk, | 111 useSdk: useSdk, |
| 109 hotReload: hotReload, | 112 hotReload: hotReload, |
| 110 hotReloadRollback: hotReloadRollback); | 113 hotReloadRollback: hotReloadRollback); |
| 111 default: | 114 default: |
| 112 throw "Unknown compiler '$compiler'"; | 115 throw "Unknown compiler '$compiler'"; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } | 208 } |
| 206 return args | 209 return args |
| 207 ..addAll(vmOptions) | 210 ..addAll(vmOptions) |
| 208 ..addAll(sharedOptions) | 211 ..addAll(sharedOptions) |
| 209 ..addAll(originalArguments); | 212 ..addAll(originalArguments); |
| 210 } | 213 } |
| 211 } | 214 } |
| 212 | 215 |
| 213 /// The "dartk" compiler. | 216 /// The "dartk" compiler. |
| 214 class DartKCompilerConfiguration extends CompilerConfiguration { | 217 class DartKCompilerConfiguration extends CompilerConfiguration { |
| 215 DartKCompilerConfiguration({bool isHostChecked, bool useSdk}) | 218 final bool verify; |
| 219 |
| 220 DartKCompilerConfiguration({bool isHostChecked, bool useSdk, this.verify}) |
| 216 : super._subclass(isHostChecked: isHostChecked, useSdk: useSdk); | 221 : super._subclass(isHostChecked: isHostChecked, useSdk: useSdk); |
| 217 | 222 |
| 218 @override | 223 @override |
| 219 String computeCompilerPath(String buildDir) { | 224 String computeCompilerPath(String buildDir) { |
| 220 return 'tools/dartk_wrappers/dartk$executableScriptSuffix'; | 225 return 'tools/dartk_wrappers/dartk$executableScriptSuffix'; |
| 221 } | 226 } |
| 222 | 227 |
| 223 CompilationCommand computeCompilationCommand( | 228 CompilationCommand computeCompilationCommand( |
| 224 String outputFileName, | 229 String outputFileName, |
| 225 String buildDir, | 230 String buildDir, |
| 226 CommandBuilder commandBuilder, | 231 CommandBuilder commandBuilder, |
| 227 List arguments, | 232 List arguments, |
| 228 Map<String, String> environmentOverrides) { | 233 Map<String, String> environmentOverrides) { |
| 229 var extraArguments = [ | 234 Iterable<String> extraArguments = [ |
| 230 '--sdk', | 235 '--sdk', |
| 231 '$buildDir/patched_sdk', | 236 '$buildDir/patched_sdk', |
| 232 '--link', | 237 '--link', |
| 233 '--target=vm', | 238 '--target=vm', |
| 239 verify ? '--verify-ir' : null, |
| 234 '--out', | 240 '--out', |
| 235 outputFileName | 241 outputFileName |
| 236 ]; | 242 ].where((x) => x != null); |
| 237 return commandBuilder.getKernelCompilationCommand( | 243 return commandBuilder.getKernelCompilationCommand( |
| 238 'dartk', | 244 'dartk', |
| 239 outputFileName, | 245 outputFileName, |
| 240 true, | 246 true, |
| 241 bootstrapDependencies(buildDir), | 247 bootstrapDependencies(buildDir), |
| 242 computeCompilerPath(buildDir), | 248 computeCompilerPath(buildDir), |
| 243 []..addAll(arguments)..addAll(extraArguments), | 249 []..addAll(arguments)..addAll(extraArguments), |
| 244 environmentOverrides); | 250 environmentOverrides); |
| 245 } | 251 } |
| 246 | 252 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 List<String> vmOptions, | 360 List<String> vmOptions, |
| 355 List<String> sharedOptions, | 361 List<String> sharedOptions, |
| 356 List<String> originalArguments, | 362 List<String> originalArguments, |
| 357 CommandArtifact artifact) { | 363 CommandArtifact artifact) { |
| 358 final String suffix = isPrecompiler ? "/out.aotsnapshot" : ""; | 364 final String suffix = isPrecompiler ? "/out.aotsnapshot" : ""; |
| 359 return <String>["${artifact.filename}${suffix}"]; | 365 return <String>["${artifact.filename}${suffix}"]; |
| 360 } | 366 } |
| 361 | 367 |
| 362 static ComposedCompilerConfiguration createDartKPConfiguration( | 368 static ComposedCompilerConfiguration createDartKPConfiguration( |
| 363 {bool isHostChecked, String arch, bool useBlobs, bool isAndroid, | 369 {bool isHostChecked, String arch, bool useBlobs, bool isAndroid, |
| 364 bool useSdk}) { | 370 bool useSdk, bool verify}) { |
| 365 var nested = []; | 371 var nested = []; |
| 366 | 372 |
| 367 // Compile with dartk. | 373 // Compile with dartk. |
| 368 nested.add(new PipelineCommand.runWithGlobalArguments( | 374 nested.add(new PipelineCommand.runWithGlobalArguments( |
| 369 new DartKCompilerConfiguration(isHostChecked: isHostChecked, | 375 new DartKCompilerConfiguration(isHostChecked: isHostChecked, |
| 370 useSdk: useSdk))); | 376 useSdk: useSdk, verify: verify))); |
| 371 | 377 |
| 372 // Run the normal precompiler. | 378 // Run the normal precompiler. |
| 373 nested.add(new PipelineCommand.runWithPreviousKernelOutput( | 379 nested.add(new PipelineCommand.runWithPreviousKernelOutput( |
| 374 new PrecompilerCompilerConfiguration( | 380 new PrecompilerCompilerConfiguration( |
| 375 arch: arch, useBlobs: useBlobs, isAndroid: isAndroid))); | 381 arch: arch, useBlobs: useBlobs, isAndroid: isAndroid))); |
| 376 | 382 |
| 377 return new ComposedCompilerConfiguration(nested, isPrecompiler: true); | 383 return new ComposedCompilerConfiguration(nested, isPrecompiler: true); |
| 378 } | 384 } |
| 379 | 385 |
| 380 static ComposedCompilerConfiguration createDartKConfiguration( | 386 static ComposedCompilerConfiguration createDartKConfiguration( |
| 381 {bool isHostChecked, bool useSdk}) { | 387 {bool isHostChecked, bool useSdk, bool verify}) { |
| 382 var nested = []; | 388 var nested = []; |
| 383 | 389 |
| 384 // Compile with dartk. | 390 // Compile with dartk. |
| 385 nested.add(new PipelineCommand.runWithGlobalArguments( | 391 nested.add(new PipelineCommand.runWithGlobalArguments( |
| 386 new DartKCompilerConfiguration(isHostChecked: isHostChecked, | 392 new DartKCompilerConfiguration(isHostChecked: isHostChecked, |
| 387 useSdk: useSdk))); | 393 useSdk: useSdk, verify: verify))); |
| 388 | 394 |
| 389 return new ComposedCompilerConfiguration(nested, isPrecompiler: false); | 395 return new ComposedCompilerConfiguration(nested, isPrecompiler: false); |
| 390 } | 396 } |
| 391 } | 397 } |
| 392 | 398 |
| 393 /// Common configuration for dart2js-based tools, such as, dart2js | 399 /// Common configuration for dart2js-based tools, such as, dart2js |
| 394 class Dart2xCompilerConfiguration extends CompilerConfiguration { | 400 class Dart2xCompilerConfiguration extends CompilerConfiguration { |
| 395 final String moniker; | 401 final String moniker; |
| 396 static Map<String, List<Uri>> _bootstrapDependenciesCache = | 402 static Map<String, List<Uri>> _bootstrapDependenciesCache = |
| 397 new Map<String, List<Uri>>(); | 403 new Map<String, List<Uri>>(); |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 RuntimeConfiguration runtimeConfiguration, | 836 RuntimeConfiguration runtimeConfiguration, |
| 831 String buildDir, | 837 String buildDir, |
| 832 TestInformation info, | 838 TestInformation info, |
| 833 List<String> vmOptions, | 839 List<String> vmOptions, |
| 834 List<String> sharedOptions, | 840 List<String> sharedOptions, |
| 835 List<String> originalArguments, | 841 List<String> originalArguments, |
| 836 CommandArtifact artifact) { | 842 CommandArtifact artifact) { |
| 837 return <String>[]; | 843 return <String>[]; |
| 838 } | 844 } |
| 839 } | 845 } |
| OLD | NEW |