Chromium Code Reviews| 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 | 7 import 'dart:io' show |
| 8 Platform; | 8 Platform; |
| 9 | 9 |
| 10 import 'runtime_configuration.dart' show | 10 import 'runtime_configuration.dart' show |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 String compiler = configuration['compiler']; | 53 String compiler = configuration['compiler']; |
| 54 | 54 |
| 55 // TODO(ahe): Move these booleans into a struction configuration object | 55 // TODO(ahe): Move these booleans into a struction configuration object |
| 56 // which can eventually completely replace the Map-based configuration | 56 // which can eventually completely replace the Map-based configuration |
| 57 // object. | 57 // object. |
| 58 bool isDebug = configuration['mode'] == 'debug'; | 58 bool isDebug = configuration['mode'] == 'debug'; |
| 59 bool isChecked = configuration['checked']; | 59 bool isChecked = configuration['checked']; |
| 60 bool isHostChecked = configuration['host_checked']; | 60 bool isHostChecked = configuration['host_checked']; |
| 61 bool useSdk = configuration['use_sdk']; | 61 bool useSdk = configuration['use_sdk']; |
| 62 bool isCsp = configuration['csp']; | 62 bool isCsp = configuration['csp']; |
| 63 bool useCps = configuration['cps_ir']; | |
| 63 | 64 |
| 64 switch (compiler) { | 65 switch (compiler) { |
| 65 case 'dartanalyzer': | 66 case 'dartanalyzer': |
| 66 return new AnalyzerCompilerConfiguration( | 67 return new AnalyzerCompilerConfiguration( |
| 67 'dartanalyzer', isDebug: isDebug, isChecked: isChecked, | 68 'dartanalyzer', isDebug: isDebug, isChecked: isChecked, |
| 68 isHostChecked: isHostChecked, useSdk: useSdk); | 69 isHostChecked: isHostChecked, useSdk: useSdk); |
| 69 case 'dart2analyzer': | 70 case 'dart2analyzer': |
| 70 return new DartBasedAnalyzerCompilerConfiguration( | 71 return new DartBasedAnalyzerCompilerConfiguration( |
| 71 isDebug: isDebug, isChecked: isChecked, | 72 isDebug: isDebug, isChecked: isChecked, |
| 72 isHostChecked: isHostChecked, useSdk: useSdk); | 73 isHostChecked: isHostChecked, useSdk: useSdk); |
| 73 case 'dart2js': | 74 case 'dart2js': |
| 74 return new Dart2jsCompilerConfiguration( | 75 return new Dart2jsCompilerConfiguration( |
| 75 isDebug: isDebug, isChecked: isChecked, | 76 isDebug: isDebug, isChecked: isChecked, |
| 76 isHostChecked: isHostChecked, useSdk: useSdk, isCsp: isCsp, | 77 isHostChecked: isHostChecked, useCps: useCps, useSdk: useSdk, |
| 77 extraDart2jsOptions: | 78 isCsp: isCsp, extraDart2jsOptions: |
| 78 TestUtils.getExtraOptions(configuration, 'dart2js_options')); | 79 TestUtils.getExtraOptions(configuration, 'dart2js_options')); |
| 79 case 'dart2dart': | 80 case 'dart2dart': |
| 80 return new Dart2dartCompilerConfiguration( | 81 return new Dart2dartCompilerConfiguration( |
| 81 isDebug: isDebug, isChecked: isChecked, | 82 isDebug: isDebug, isChecked: isChecked, |
| 82 isHostChecked: isHostChecked, useSdk: useSdk); | 83 isHostChecked: isHostChecked, useSdk: useSdk); |
| 83 case 'none': | 84 case 'none': |
| 84 return new NoneCompilerConfiguration( | 85 return new NoneCompilerConfiguration( |
| 85 isDebug: isDebug, isChecked: isChecked, | 86 isDebug: isDebug, isChecked: isChecked, |
| 86 isHostChecked: isHostChecked, useSdk: useSdk); | 87 isHostChecked: isHostChecked, useSdk: useSdk); |
| 87 default: | 88 default: |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 218 if (!useSdk) return const <Uri>[]; | 219 if (!useSdk) return const <Uri>[]; |
| 219 return _bootstrapDependenciesCache.putIfAbsent(buildDir, () => | 220 return _bootstrapDependenciesCache.putIfAbsent(buildDir, () => |
| 220 [Uri.base.resolveUri(nativeDirectoryToUri(buildDir)) | 221 [Uri.base.resolveUri(nativeDirectoryToUri(buildDir)) |
| 221 .resolve('dart-sdk/bin/snapshots/dart2js.dart.snapshot')]); | 222 .resolve('dart-sdk/bin/snapshots/dart2js.dart.snapshot')]); |
| 222 } | 223 } |
| 223 } | 224 } |
| 224 | 225 |
| 225 /// Configuration for dart2js compiler. | 226 /// Configuration for dart2js compiler. |
| 226 class Dart2jsCompilerConfiguration extends Dart2xCompilerConfiguration { | 227 class Dart2jsCompilerConfiguration extends Dart2xCompilerConfiguration { |
| 227 final bool isCsp; | 228 final bool isCsp; |
| 229 final bool useCps; | |
| 228 final List<String> extraDart2jsOptions; | 230 final List<String> extraDart2jsOptions; |
| 229 | 231 |
| 230 Dart2jsCompilerConfiguration({ | 232 Dart2jsCompilerConfiguration({ |
| 231 bool isDebug, | 233 bool isDebug, |
| 232 bool isChecked, | 234 bool isChecked, |
| 233 bool isHostChecked, | 235 bool isHostChecked, |
| 234 bool useSdk, | 236 bool useSdk, |
| 237 bool this.useCps, | |
| 235 bool this.isCsp, | 238 bool this.isCsp, |
| 236 this.extraDart2jsOptions}) | 239 this.extraDart2jsOptions}) |
| 237 : super( | 240 : super( |
| 238 'dart2js', | 241 'dart2js', |
| 239 isDebug: isDebug, isChecked: isChecked, | 242 isDebug: isDebug, isChecked: isChecked, |
| 240 isHostChecked: isHostChecked, useSdk: useSdk); | 243 isHostChecked: isHostChecked, useSdk: useSdk); |
| 241 | 244 |
| 242 int computeTimeoutMultiplier() { | 245 int computeTimeoutMultiplier() { |
| 243 int multiplier = 1; | 246 int multiplier = 1; |
| 244 if (isDebug) multiplier *= 4; | 247 if (isDebug) multiplier *= 4; |
| 245 if (isChecked) multiplier *= 2; | 248 if (isChecked) multiplier *= 2; |
| 246 if (isHostChecked) multiplier *= 16; | 249 if (isHostChecked) multiplier *= 16; |
| 247 return multiplier; | 250 return multiplier; |
| 248 } | 251 } |
| 249 | 252 |
| 250 CommandArtifact computeCompilationArtifact( | 253 CommandArtifact computeCompilationArtifact( |
| 251 String buildDir, | 254 String buildDir, |
| 252 String tempDir, | 255 String tempDir, |
| 253 CommandBuilder commandBuilder, | 256 CommandBuilder commandBuilder, |
| 254 List arguments, | 257 List arguments, |
| 255 Map<String, String> environmentOverrides) { | 258 Map<String, String> environmentOverrides) { |
| 259 var env = environmentOverrides; | |
| 260 if (useCps) { | |
| 261 var vmoption = { 'DART_VM_OPTIONS' : '-DUSE_CPS_IR=true' }; | |
|
Bill Hesse
2015/04/14 11:42:33
We do actually have a small problem with the memor
| |
| 262 env = {}..addAll(environmentOverrides)..addAll(vmoption); | |
|
karlklose
2015/04/14 08:56:03
Shouldn't this be 'env.addAll(...)' to preserve ot
ricow1
2015/04/14 08:59:10
I don preserve other overriddes, since I addAll en
| |
| 263 } | |
| 256 return new CommandArtifact( | 264 return new CommandArtifact( |
| 257 <Command>[ | 265 <Command>[ |
| 258 this.computeCompilationCommand( | 266 this.computeCompilationCommand( |
| 259 '$tempDir/out.js', | 267 '$tempDir/out.js', |
| 260 buildDir, | 268 buildDir, |
| 261 CommandBuilder.instance, | 269 CommandBuilder.instance, |
| 262 []..addAll(arguments)..addAll(extraDart2jsOptions), | 270 []..addAll(arguments)..addAll(extraDart2jsOptions), |
| 263 environmentOverrides)], | 271 env)], |
| 264 '$tempDir/out.js', | 272 '$tempDir/out.js', |
| 265 'application/javascript'); | 273 'application/javascript'); |
| 266 } | 274 } |
| 267 | 275 |
| 268 List<String> computeRuntimeArguments( | 276 List<String> computeRuntimeArguments( |
| 269 RuntimeConfiguration runtimeConfiguration, | 277 RuntimeConfiguration runtimeConfiguration, |
| 270 String buildDir, | 278 String buildDir, |
| 271 TestInformation info, | 279 TestInformation info, |
| 272 List<String> vmOptions, | 280 List<String> vmOptions, |
| 273 List<String> sharedOptions, | 281 List<String> sharedOptions, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 403 // shipped SDK, that is the script is not installed in | 411 // shipped SDK, that is the script is not installed in |
| 404 // "$buildDir/dart-sdk/bin/" | 412 // "$buildDir/dart-sdk/bin/" |
| 405 return '$prefix/dartanalyzer_developer$suffix'; | 413 return '$prefix/dartanalyzer_developer$suffix'; |
| 406 } | 414 } |
| 407 if (useSdk) { | 415 if (useSdk) { |
| 408 prefix = '$buildDir/dart-sdk/bin'; | 416 prefix = '$buildDir/dart-sdk/bin'; |
| 409 } | 417 } |
| 410 return '$prefix/dartanalyzer$suffix'; | 418 return '$prefix/dartanalyzer$suffix'; |
| 411 } | 419 } |
| 412 } | 420 } |
| OLD | NEW |