Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: tools/testing/dart/compiler_configuration.dart

Issue 1085803002: Add a --cps-ir flag to the testing script to allow us to run with the new cps based backend in dart… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: more foobar Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/testing/dart/test_options.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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;
231 // We cache the extended environment to save memory.
232 static Map<String, String> cpsFlagCache;
233 static Map<String, String> environmentOverridesCacheObject;
229 234
230 Dart2jsCompilerConfiguration({ 235 Dart2jsCompilerConfiguration({
231 bool isDebug, 236 bool isDebug,
232 bool isChecked, 237 bool isChecked,
233 bool isHostChecked, 238 bool isHostChecked,
234 bool useSdk, 239 bool useSdk,
240 bool this.useCps,
235 bool this.isCsp, 241 bool this.isCsp,
236 this.extraDart2jsOptions}) 242 this.extraDart2jsOptions})
237 : super( 243 : super(
238 'dart2js', 244 'dart2js',
239 isDebug: isDebug, isChecked: isChecked, 245 isDebug: isDebug, isChecked: isChecked,
240 isHostChecked: isHostChecked, useSdk: useSdk); 246 isHostChecked: isHostChecked, useSdk: useSdk);
241 247
242 int computeTimeoutMultiplier() { 248 int computeTimeoutMultiplier() {
243 int multiplier = 1; 249 int multiplier = 1;
244 if (isDebug) multiplier *= 4; 250 if (isDebug) multiplier *= 4;
245 if (isChecked) multiplier *= 2; 251 if (isChecked) multiplier *= 2;
246 if (isHostChecked) multiplier *= 16; 252 if (isHostChecked) multiplier *= 16;
247 return multiplier; 253 return multiplier;
248 } 254 }
249 255
256 Map<String, String> envWithCpsFlag(Map<String, String> env) {
257 if (env != environmentOverridesCacheObject || cpsFlagCache == null) {
258 cpsFlagCache = { 'DART_VM_OPTIONS' : '-DUSE_CPS_IR=true' };
259 if (env != null) {
260 cpsFlagCache.addAll(env);
261 }
262 environmentOverridesCacheObject = env;
263 }
264 return cpsFlagCache;
265 }
266
250 CommandArtifact computeCompilationArtifact( 267 CommandArtifact computeCompilationArtifact(
251 String buildDir, 268 String buildDir,
252 String tempDir, 269 String tempDir,
253 CommandBuilder commandBuilder, 270 CommandBuilder commandBuilder,
254 List arguments, 271 List arguments,
255 Map<String, String> environmentOverrides) { 272 Map<String, String> environmentOverrides) {
273 var env = useCps ? envWithCpsFlag(environmentOverrides) :
274 environmentOverrides;
256 return new CommandArtifact( 275 return new CommandArtifact(
257 <Command>[ 276 <Command>[
258 this.computeCompilationCommand( 277 this.computeCompilationCommand(
259 '$tempDir/out.js', 278 '$tempDir/out.js',
260 buildDir, 279 buildDir,
261 CommandBuilder.instance, 280 CommandBuilder.instance,
262 []..addAll(arguments)..addAll(extraDart2jsOptions), 281 []..addAll(arguments)..addAll(extraDart2jsOptions),
263 environmentOverrides)], 282 env)],
264 '$tempDir/out.js', 283 '$tempDir/out.js',
265 'application/javascript'); 284 'application/javascript');
266 } 285 }
267 286
268 List<String> computeRuntimeArguments( 287 List<String> computeRuntimeArguments(
269 RuntimeConfiguration runtimeConfiguration, 288 RuntimeConfiguration runtimeConfiguration,
270 String buildDir, 289 String buildDir,
271 TestInformation info, 290 TestInformation info,
272 List<String> vmOptions, 291 List<String> vmOptions,
273 List<String> sharedOptions, 292 List<String> sharedOptions,
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 // shipped SDK, that is the script is not installed in 422 // shipped SDK, that is the script is not installed in
404 // "$buildDir/dart-sdk/bin/" 423 // "$buildDir/dart-sdk/bin/"
405 return '$prefix/dartanalyzer_developer$suffix'; 424 return '$prefix/dartanalyzer_developer$suffix';
406 } 425 }
407 if (useSdk) { 426 if (useSdk) {
408 prefix = '$buildDir/dart-sdk/bin'; 427 prefix = '$buildDir/dart-sdk/bin';
409 } 428 }
410 return '$prefix/dartanalyzer$suffix'; 429 return '$prefix/dartanalyzer$suffix';
411 } 430 }
412 } 431 }
OLDNEW
« no previous file with comments | « no previous file | tools/testing/dart/test_options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698