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

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

Issue 1922163002: Initial support to test.dart for running precompiler tests on android devices (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanup of CL and of existing code. Created 4 years, 7 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
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 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 extraDart2jsOptions: 72 extraDart2jsOptions:
73 TestUtils.getExtraOptions(configuration, 'dart2js_options')); 73 TestUtils.getExtraOptions(configuration, 'dart2js_options'));
74 case 'dart2app': 74 case 'dart2app':
75 return new Dart2AppSnapshotCompilerConfiguration( 75 return new Dart2AppSnapshotCompilerConfiguration(
76 isDebug: isDebug, isChecked: isChecked); 76 isDebug: isDebug, isChecked: isChecked);
77 case 'precompiler': 77 case 'precompiler':
78 return new PrecompilerCompilerConfiguration( 78 return new PrecompilerCompilerConfiguration(
79 isDebug: isDebug, 79 isDebug: isDebug,
80 isChecked: isChecked, 80 isChecked: isChecked,
81 arch: configuration['arch'], 81 arch: configuration['arch'],
82 useBlobs: useBlobs); 82 useBlobs: useBlobs,
83 isAndroid: configuration['system'] == 'android');
83 case 'none': 84 case 'none':
84 return new NoneCompilerConfiguration( 85 return new NoneCompilerConfiguration(
85 isDebug: isDebug, 86 isDebug: isDebug,
86 isChecked: isChecked, 87 isChecked: isChecked,
87 isHostChecked: isHostChecked, 88 isHostChecked: isHostChecked,
88 useSdk: useSdk); 89 useSdk: useSdk);
89 default: 90 default:
90 throw "Unknown compiler '$compiler'"; 91 throw "Unknown compiler '$compiler'";
91 } 92 }
92 } 93 }
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 .resolve('sdk/'); 296 .resolve('sdk/');
296 Uri preambleDir = sdk.resolve('lib/_internal/js_runtime/lib/preambles/'); 297 Uri preambleDir = sdk.resolve('lib/_internal/js_runtime/lib/preambles/');
297 return runtimeConfiguration.dart2jsPreambles(preambleDir) 298 return runtimeConfiguration.dart2jsPreambles(preambleDir)
298 ..add(artifact.filename); 299 ..add(artifact.filename);
299 } 300 }
300 } 301 }
301 302
302 class PrecompilerCompilerConfiguration extends CompilerConfiguration { 303 class PrecompilerCompilerConfiguration extends CompilerConfiguration {
303 final String arch; 304 final String arch;
304 final bool useBlobs; 305 final bool useBlobs;
306 final bool isAndroid;
305 307
306 PrecompilerCompilerConfiguration({bool isDebug, bool isChecked, String arch, b ool useBlobs}) 308 PrecompilerCompilerConfiguration({bool isDebug, bool isChecked,
307 : super._subclass(isDebug: isDebug, isChecked: isChecked), 309 this.arch, this.useBlobs, this.isAndroid})
308 arch = arch, 310 : super._subclass(isDebug: isDebug, isChecked: isChecked);
309 useBlobs = useBlobs;
310 311
311 int computeTimeoutMultiplier() { 312 int computeTimeoutMultiplier() {
312 int multiplier = 2; 313 int multiplier = 2;
313 if (isDebug) multiplier *= 4; 314 if (isDebug) multiplier *= 4;
314 if (isChecked) multiplier *= 2; 315 if (isChecked) multiplier *= 2;
315 return multiplier; 316 return multiplier;
316 } 317 }
317 318
318 CommandArtifact computeCompilationArtifact( 319 CommandArtifact computeCompilationArtifact(
319 String buildDir, 320 String buildDir,
(...skipping 18 matching lines...) Expand all
338 String buildDir, 339 String buildDir,
339 CommandBuilder commandBuilder, 340 CommandBuilder commandBuilder,
340 List arguments, 341 List arguments,
341 Map<String, String> environmentOverrides) { 342 Map<String, String> environmentOverrides) {
342 var exec = "$buildDir/dart_bootstrap"; 343 var exec = "$buildDir/dart_bootstrap";
343 var args = new List(); 344 var args = new List();
344 args.add("--gen-precompiled-snapshot=$tempDir"); 345 args.add("--gen-precompiled-snapshot=$tempDir");
345 if (useBlobs) { 346 if (useBlobs) {
346 args.add("--use_blobs"); 347 args.add("--use_blobs");
347 } 348 }
349 if (isAndroid && arch == 'arm') {
350 args.add('--no-sim-use-hardfp');
351 }
348 args.addAll(arguments); 352 args.addAll(arguments);
349 353
350 return commandBuilder.getCompilationCommand('precompiler', tempDir, !useSdk, 354 return commandBuilder.getCompilationCommand('precompiler', tempDir, !useSdk,
351 bootstrapDependencies(buildDir), exec, args, environmentOverrides); 355 bootstrapDependencies(buildDir), exec, args, environmentOverrides);
352 } 356 }
353 357
354 CompilationCommand computeAssembleCommand( 358 CompilationCommand computeAssembleCommand(
355 String tempDir, 359 String tempDir,
356 String buildDir, 360 String buildDir,
357 CommandBuilder commandBuilder, 361 CommandBuilder commandBuilder,
358 List arguments, 362 List arguments,
359 Map<String, String> environmentOverrides) { 363 Map<String, String> environmentOverrides) {
360 var cc, cc_flags, shared, libname; 364
365 var cc, shared, libname;
361 if (Platform.isLinux) { 366 if (Platform.isLinux) {
362 cc = 'gcc'; 367 cc = 'gcc';
363 shared = '-shared'; 368 shared = '-shared';
364 libname = 'libprecompiled.so'; 369 libname = 'libprecompiled.so';
365 } else if (Platform.isMacOS) { 370 } else if (Platform.isMacOS) {
366 cc = 'clang'; 371 cc = 'clang';
367 shared = '-dynamiclib'; 372 shared = '-dynamiclib';
368 libname = 'libprecompiled.dylib'; 373 libname = 'libprecompiled.dylib';
369 } else { 374 } else {
370 throw "Platform not supported: ${Platform.operatingSystem}"; 375 throw "Platform not supported: ${Platform.operatingSystem}";
371 } 376 }
377 if (isAndroid) {
378 // TODO: If we're not using "--use_blobs" we need to use the arm cross
379 // compiler instead of just 'gcc' for .
380 }
372 381
382 var cc_flags;
373 if (arch == 'x64') { 383 if (arch == 'x64') {
374 cc_flags = "-m64"; 384 cc_flags = "-m64";
375 } else if (arch == 'simarm64') { 385 } else if (arch == 'simarm64') {
376 cc_flags = "-m64"; 386 cc_flags = "-m64";
387 } else if (arch == 'ia32') {
388 cc_flags = "-m32";
377 } else if (arch == 'simarm') { 389 } else if (arch == 'simarm') {
378 cc_flags = "-m32"; 390 cc_flags = "-m32";
379 } else if (arch == 'simmips') { 391 } else if (arch == 'simmips') {
380 cc_flags = "-m32"; 392 cc_flags = "-m32";
381 } else if (arch == 'arm') { 393 } else if (arch == 'arm') {
382 cc_flags = ""; 394 cc_flags = null;
383 } else if (arch == 'mips') { 395 } else if (arch == 'mips') {
384 cc_flags = "-EL"; 396 cc_flags = "-EL";
385 } else { 397 } else {
386 throw "Architecture not supported: $arch"; 398 throw "Architecture not supported: $arch";
387 } 399 }
388 400
389 var exec = cc; 401 var exec = cc;
390 var args = [ 402 var args = (cc_flags != null) ? [ shared, cc_flags ] : [ shared ];
Bill Hesse 2016/04/27 13:54:40 I like this better.
kustermann 2016/05/02 10:40:23 Acknowledged.
391 shared, 403 args.addAll([
392 cc_flags,
393 '-o', 404 '-o',
394 '$tempDir/$libname', 405 '$tempDir/$libname',
395 '$tempDir/precompiled.S' 406 '$tempDir/precompiled.S'
396 ]; 407 ]);
397 408
398 return commandBuilder.getCompilationCommand('assemble', tempDir, !useSdk, 409 return commandBuilder.getCompilationCommand('assemble', tempDir, !useSdk,
399 bootstrapDependencies(buildDir), exec, args, environmentOverrides); 410 bootstrapDependencies(buildDir), exec, args, environmentOverrides);
400 } 411 }
401 412
402 // This step reduces the amount of space needed to run the precompilation 413 // This step reduces the amount of space needed to run the precompilation
403 // tests by 60%. 414 // tests by 60%.
404 CompilationCommand computeRemoveAssemblyCommand( 415 CompilationCommand computeRemoveAssemblyCommand(
405 String tempDir, 416 String tempDir,
406 String buildDir, 417 String buildDir,
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 RuntimeConfiguration runtimeConfiguration, 609 RuntimeConfiguration runtimeConfiguration,
599 String buildDir, 610 String buildDir,
600 TestInformation info, 611 TestInformation info,
601 List<String> vmOptions, 612 List<String> vmOptions,
602 List<String> sharedOptions, 613 List<String> sharedOptions,
603 List<String> originalArguments, 614 List<String> originalArguments,
604 CommandArtifact artifact) { 615 CommandArtifact artifact) {
605 return <String>[]; 616 return <String>[];
606 } 617 }
607 } 618 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698