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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 // TODO(ahe): Move these booleans into a struction configuration object | 46 // TODO(ahe): Move these booleans into a struction configuration object |
47 // which can eventually completely replace the Map-based configuration | 47 // which can eventually completely replace the Map-based configuration |
48 // object. | 48 // object. |
49 bool isDebug = configuration['mode'] == 'debug'; | 49 bool isDebug = configuration['mode'] == 'debug'; |
50 bool isChecked = configuration['checked']; | 50 bool isChecked = configuration['checked']; |
51 bool isHostChecked = configuration['host_checked']; | 51 bool isHostChecked = configuration['host_checked']; |
52 bool useSdk = configuration['use_sdk']; | 52 bool useSdk = configuration['use_sdk']; |
53 bool isCsp = configuration['csp']; | 53 bool isCsp = configuration['csp']; |
54 bool useCps = configuration['cps_ir']; | 54 bool useCps = configuration['cps_ir']; |
55 // TODO(26060): Remove the browser multiplier when issue resolved. | |
56 bool isBrowser = configuration['browser']; | |
57 | 55 |
58 switch (compiler) { | 56 switch (compiler) { |
59 case 'dart2analyzer': | 57 case 'dart2analyzer': |
60 return new AnalyzerCompilerConfiguration( | 58 return new AnalyzerCompilerConfiguration( |
61 isDebug: isDebug, | 59 isDebug: isDebug, |
62 isChecked: isChecked, | 60 isChecked: isChecked, |
63 isHostChecked: isHostChecked, | 61 isHostChecked: isHostChecked, |
64 useSdk: useSdk); | 62 useSdk: useSdk); |
65 case 'dart2js': | 63 case 'dart2js': |
66 return new Dart2jsCompilerConfiguration( | 64 return new Dart2jsCompilerConfiguration( |
67 isDebug: isDebug, | 65 isDebug: isDebug, |
68 isChecked: isChecked, | 66 isChecked: isChecked, |
69 isHostChecked: isHostChecked, | 67 isHostChecked: isHostChecked, |
70 useCps: useCps, | 68 useCps: useCps, |
71 useSdk: useSdk, | 69 useSdk: useSdk, |
72 isCsp: isCsp, | 70 isCsp: isCsp, |
73 isBrowser: isBrowser, | |
74 extraDart2jsOptions: | 71 extraDart2jsOptions: |
75 TestUtils.getExtraOptions(configuration, 'dart2js_options')); | 72 TestUtils.getExtraOptions(configuration, 'dart2js_options')); |
76 case 'dart2app': | 73 case 'dart2app': |
77 return new Dart2AppSnapshotCompilerConfiguration( | 74 return new Dart2AppSnapshotCompilerConfiguration( |
78 isDebug: isDebug, isChecked: isChecked); | 75 isDebug: isDebug, isChecked: isChecked); |
79 case 'precompiler': | 76 case 'precompiler': |
80 return new PrecompilerCompilerConfiguration( | 77 return new PrecompilerCompilerConfiguration( |
81 isDebug: isDebug, | 78 isDebug: isDebug, |
82 isChecked: isChecked, | 79 isChecked: isChecked, |
83 arch: configuration['arch']); | 80 arch: configuration['arch']); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 .resolveUri(nativeDirectoryToUri(buildDir)) | 231 .resolveUri(nativeDirectoryToUri(buildDir)) |
235 .resolve('dart-sdk/bin/snapshots/dart2js.dart.snapshot') | 232 .resolve('dart-sdk/bin/snapshots/dart2js.dart.snapshot') |
236 ]); | 233 ]); |
237 } | 234 } |
238 } | 235 } |
239 | 236 |
240 /// Configuration for dart2js compiler. | 237 /// Configuration for dart2js compiler. |
241 class Dart2jsCompilerConfiguration extends Dart2xCompilerConfiguration { | 238 class Dart2jsCompilerConfiguration extends Dart2xCompilerConfiguration { |
242 final bool isCsp; | 239 final bool isCsp; |
243 final bool useCps; | 240 final bool useCps; |
244 final bool isBrowser; | |
245 final List<String> extraDart2jsOptions; | 241 final List<String> extraDart2jsOptions; |
246 // We cache the extended environment to save memory. | 242 // We cache the extended environment to save memory. |
247 static Map<String, String> cpsFlagCache; | 243 static Map<String, String> cpsFlagCache; |
248 static Map<String, String> environmentOverridesCacheObject; | 244 static Map<String, String> environmentOverridesCacheObject; |
249 | 245 |
250 Dart2jsCompilerConfiguration( | 246 Dart2jsCompilerConfiguration( |
251 {bool isDebug, | 247 {bool isDebug, |
252 bool isChecked, | 248 bool isChecked, |
253 bool isHostChecked, | 249 bool isHostChecked, |
254 bool useSdk, | 250 bool useSdk, |
255 bool this.useCps, | 251 bool this.useCps, |
256 bool this.isCsp, | 252 bool this.isCsp, |
257 bool this.isBrowser, | |
258 this.extraDart2jsOptions}) | 253 this.extraDart2jsOptions}) |
259 : super('dart2js', | 254 : super('dart2js', |
260 isDebug: isDebug, | 255 isDebug: isDebug, |
261 isChecked: isChecked, | 256 isChecked: isChecked, |
262 isHostChecked: isHostChecked, | 257 isHostChecked: isHostChecked, |
263 useSdk: useSdk); | 258 useSdk: useSdk); |
264 | 259 |
265 int computeTimeoutMultiplier() { | 260 int computeTimeoutMultiplier() { |
266 int multiplier = 1; | 261 int multiplier = 1; |
267 if (isDebug) multiplier *= 4; | 262 if (isDebug) multiplier *= 4; |
268 if (isChecked) multiplier *= 2; | 263 if (isChecked) multiplier *= 2; |
269 if (isHostChecked) multiplier *= 16; | 264 if (isHostChecked) multiplier *= 16; |
270 if (isBrowser) multiplier *= 2; // TODO(26060): Remove when issue fixed. | |
271 return multiplier; | 265 return multiplier; |
272 } | 266 } |
273 | 267 |
274 CommandArtifact computeCompilationArtifact( | 268 CommandArtifact computeCompilationArtifact( |
275 String buildDir, | 269 String buildDir, |
276 String tempDir, | 270 String tempDir, |
277 CommandBuilder commandBuilder, | 271 CommandBuilder commandBuilder, |
278 List arguments, | 272 List arguments, |
279 Map<String, String> environmentOverrides) { | 273 Map<String, String> environmentOverrides) { |
280 List compilerArguments = new List.from(arguments) | 274 List compilerArguments = new List.from(arguments) |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 RuntimeConfiguration runtimeConfiguration, | 589 RuntimeConfiguration runtimeConfiguration, |
596 String buildDir, | 590 String buildDir, |
597 TestInformation info, | 591 TestInformation info, |
598 List<String> vmOptions, | 592 List<String> vmOptions, |
599 List<String> sharedOptions, | 593 List<String> sharedOptions, |
600 List<String> originalArguments, | 594 List<String> originalArguments, |
601 CommandArtifact artifact) { | 595 CommandArtifact artifact) { |
602 return <String>[]; | 596 return <String>[]; |
603 } | 597 } |
604 } | 598 } |
OLD | NEW |