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

Unified Diff: utils/kernel-service/kernel-service.dart

Issue 2665753002: Reapply "Create an app snapshot of the Dart front end." (Closed)
Patch Set: merge Created 3 years, 11 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
« no previous file with comments | « utils/kernel-service/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/kernel-service/kernel-service.dart
diff --git a/runtime/tools/kernel-service.dart b/utils/kernel-service/kernel-service.dart
similarity index 92%
rename from runtime/tools/kernel-service.dart
rename to utils/kernel-service/kernel-service.dart
index e86e6c1acecabe8989733d7cc059709e61f64a9b..7477b420d21233a92eca3c03cba21971821c8e41 100644
--- a/runtime/tools/kernel-service.dart
+++ b/utils/kernel-service/kernel-service.dart
@@ -11,12 +11,12 @@ library runtime.tools.kernel_service;
// This is either invoked as the root script of the Kernel isolate when used
// as a part of
//
-// dart --dfe=runtime/tools/kernel-service.dart ...
+// dart --dfe=utils/kernel-service/kernel-service.dart ...
//
// invocation or it is invoked as a standalone script to perform batch mode
// compilation requested via an HTTP interface
//
-// dart runtime/tools/kernel-service.dart --batch
+// dart utils/kernel-service/kernel-service.dart --batch
//
// The port for the batch mode worker is controlled by DFE_WORKER_PORT
// environment declarations (set by -DDFE_WORKER_PORT=... command line flag).
@@ -312,9 +312,34 @@ void startBatchServer() {
});
}
+train(String scriptUri) {
+ // TODO(28532): Enable on Windows.
+ if (Platform.isWindows) return;
+
+ var tag = 1;
+ var responsePort = new RawReceivePort();
+ responsePort.handler = (response) {
+ if (response[0] == tag) {
+ // Success.
+ responsePort.close();
+ } else if (response[0] == -tag) {
+ // Compilation error.
+ throw response[4];
+ } else {
+ throw "Unexpected response: $response";
+ }
+ };
+ var request = [tag, responsePort.sendPort, scriptUri];
+ _processLoadRequest(request);
+}
+
main([args]) {
if (args?.length == 1 && args[0] == '--batch') {
startBatchServer();
+ } else if (args?.length == 2 && 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]);
} else {
// Entry point for the Kernel isolate.
return new RawReceivePort()..handler = _processLoadRequest;
« no previous file with comments | « utils/kernel-service/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698