mirror of
https://github.com/dart-lang/sdk
synced 2024-09-04 16:03:44 +00:00
[vm/bytecode] Train kernel service with bytecode generation
If Dart SDK is built with --bytecode, kernel service will generate bytecode, so it should be trained with bytecode generation as well. Change-Id: I1a7914c78dfcbd51425585b5600b299fee4c6506 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113381 Reviewed-by: Régis Crelier <regis@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
parent
b2b74e6312
commit
1644d4b178
|
@ -731,7 +731,7 @@ FileSystem _buildFileSystem(List sourceFiles, List<int> platformKernel,
|
|||
return fileSystem;
|
||||
}
|
||||
|
||||
train(String scriptUri, String platformKernelPath) {
|
||||
train(String scriptUri, String platformKernelPath, bool bytecode) {
|
||||
var tag = kTrainTag;
|
||||
var responsePort = new RawReceivePort();
|
||||
responsePort.handler = (response) {
|
||||
|
@ -757,7 +757,7 @@ train(String scriptUri, String platformKernelPath) {
|
|||
false /* suppress warnings */,
|
||||
false /* enable asserts */,
|
||||
null /* experimental_flags */,
|
||||
false /* generate bytecode */,
|
||||
bytecode,
|
||||
null /* package_config */,
|
||||
null /* multirootFilepaths */,
|
||||
null /* multirootScheme */,
|
||||
|
@ -767,9 +767,20 @@ train(String scriptUri, String platformKernelPath) {
|
|||
|
||||
main([args]) {
|
||||
if ((args?.length ?? 0) > 1 && args[0] == '--train') {
|
||||
// This entry point is used when creating an app snapshot. The argument
|
||||
// provides a script to compile to warm-up generated code.
|
||||
train(args[1], args.length > 2 ? args[2] : null);
|
||||
// This entry point is used when creating an app snapshot.
|
||||
// It takes the following extra arguments:
|
||||
// 1) Script to compile.
|
||||
// 2) Optional '--bytecode' argument to train bytecode generation.
|
||||
// 3) Optional platform kernel path.
|
||||
int argIndex = 1;
|
||||
final String script = args[argIndex++];
|
||||
bool bytecode = false;
|
||||
if ((argIndex < args.length) && (args[argIndex] == '--bytecode')) {
|
||||
bytecode = true;
|
||||
++argIndex;
|
||||
}
|
||||
final String platform = (argIndex < args.length) ? args[argIndex] : null;
|
||||
train(script, platform, bytecode);
|
||||
} else {
|
||||
// Entry point for the Kernel isolate.
|
||||
return new RawReceivePort()..handler = _processLoadRequest;
|
||||
|
|
|
@ -31,6 +31,9 @@ kernel_application_snapshot("kernel-service_snapshot") {
|
|||
"--train",
|
||||
"file:///" + rebase_path("../../pkg/compiler/lib/src/dart2js.dart"),
|
||||
]
|
||||
if (dart_platform_bytecode) {
|
||||
training_args += [ "--bytecode" ]
|
||||
}
|
||||
output = "$root_gen_dir/kernel-service.dart.snapshot"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue