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

Unified Diff: tools/testing/dart/compiler_configuration.dart

Issue 1732323005: Toward a green tools/build.py -cprecompiler -rdart_precompiled: (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: tools/testing/dart/compiler_configuration.dart
diff --git a/tools/testing/dart/compiler_configuration.dart b/tools/testing/dart/compiler_configuration.dart
index 11730dd17531aed30bfd23d73173eab7b8ec0fc4..d4153c2d9b43d711300cfeb70ef5a3b8bde8dec2 100644
--- a/tools/testing/dart/compiler_configuration.dart
+++ b/tools/testing/dart/compiler_configuration.dart
@@ -78,7 +78,8 @@ abstract class CompilerConfiguration {
isDebug: isDebug, isChecked: isChecked);
case 'precompiler':
return new PrecompilerCompilerConfiguration(
- isDebug: isDebug, isChecked: isChecked);
+ isDebug: isDebug, isChecked: isChecked,
+ arch: configuration['arch']);
case 'none':
return new NoneCompilerConfiguration(
isDebug: isDebug, isChecked: isChecked,
@@ -302,10 +303,13 @@ class Dart2jsCompilerConfiguration extends Dart2xCompilerConfiguration {
class PrecompilerCompilerConfiguration extends CompilerConfiguration {
+ final String arch;
+
PrecompilerCompilerConfiguration({
bool isDebug,
- bool isChecked})
- : super._subclass(isDebug: isDebug, isChecked: isChecked);
+ bool isChecked,
+ String arch})
+ : super._subclass(isDebug: isDebug, isChecked: isChecked), arch = arch;
int computeTimeoutMultiplier() {
int multiplier = 2;
@@ -327,6 +331,18 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration {
buildDir,
CommandBuilder.instance,
arguments,
+ environmentOverrides),
+ this.computeAssembleCommand(
+ tempDir,
+ buildDir,
+ CommandBuilder.instance,
+ arguments,
+ environmentOverrides),
+ this.computeRemoveAssemblyCommand(
+ tempDir,
+ buildDir,
+ CommandBuilder.instance,
+ arguments,
environmentOverrides)],
'$tempDir',
'application/dart-precompiled');
@@ -338,19 +354,91 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration {
CommandBuilder commandBuilder,
List arguments,
Map<String, String> environmentOverrides) {
- var exec = "$buildDir/dart";
+ var exec = "$buildDir/dart_no_snapshot";
var args = new List();
- args.add("tools/precompilation/precompiler.dart");
- args.add("$buildDir/dart_no_snapshot");
args.add("--gen-precompiled-snapshot=$tempDir");
args.addAll(arguments);
return commandBuilder.getCompilationCommand(
- 'precompiler.dart', tempDir, !useSdk,
+ 'precompiler', tempDir, !useSdk,
+ bootstrapDependencies(buildDir),
+ exec, args, environmentOverrides);
+ }
+
+ CompilationCommand computeAssembleCommand(
+ String tempDir,
+ String buildDir,
+ CommandBuilder commandBuilder,
+ List arguments,
+ Map<String, String> environmentOverrides) {
+ var cc, cc_flags, shared, libname;
+ if (Platform.isLinux) {
+ cc = 'gcc';
+ shared = '-shared';
+ libname = 'libprecompiled.so';
+ } else if (Platform.isMacOS) {
+ cc = 'clang';
+ shared = '-dynamiclib';
+ libname = 'libprecompiled.dylib';
+ } else {
+ throw "Platform not supported: ${Platform.name}";
+ }
+
+ if (arch == 'x64') {
+ cc_flags = "-m64";
+ } else if (arch == 'simarm64') {
+ cc_flags = "-m64";
+ } else if (arch == 'simarm') {
+ cc_flags = "-m32";
+ } else if (arch == 'simmips') {
+ cc_flags = "-m32";
+ } else if (arch == 'arm') {
+ cc_flags = "";
+ } else if (arch == 'mips') {
+ cc_flags = "-EL";
+ } else {
+ throw "Architecture not supported: $arch";
+ }
+
+ var exec = cc;
+ var args = [shared,
+ cc_flags,
+ '-o',
+ '$tempDir/$libname',
+ '$tempDir/precompiled.S'];
+
+ return commandBuilder.getCompilationCommand(
+ 'assemble', tempDir, !useSdk,
bootstrapDependencies(buildDir),
exec, args, environmentOverrides);
}
+ // This step reduces the amount of space needed to run the precompilation
+ // tests by 60%.
+ CompilationCommand computeRemoveAssemblyCommand(
+ String tempDir,
+ String buildDir,
+ CommandBuilder commandBuilder,
+ List arguments,
+ Map<String, String> environmentOverrides) {
+ var exec = 'rm';
+ var args = ['$tempDir/precompiled.S'];
+
+ return commandBuilder.getCompilationCommand(
+ 'remove_assembly', tempDir, !useSdk,
+ bootstrapDependencies(buildDir),
+ exec, args, environmentOverrides);
+ }
+
+ List<String> filterVmOptions(List<String> vmOptions) {
+ var filtered = new List.from(vmOptions);
+ filtered.removeWhere(
+ (option) => option.startsWith("--optimization-counter-threshold"));
+ filtered.removeWhere(
+ (option) => option.startsWith("--optimization_counter_threshold"));
+ return filtered;
+ }
+
List<String> computeCompilerArguments(vmOptions,
sharedOptions,
originalArguments) {
@@ -360,7 +448,7 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration {
args.add('--enable_type_checks');
}
return args
- ..addAll(vmOptions)
+ ..addAll(filterVmOptions(vmOptions))
..addAll(sharedOptions)
..addAll(originalArguments);
}

Powered by Google App Engine
This is Rietveld 408576698