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