Index: utils/kernel-service/kernel-service.dart |
diff --git a/runtime/tools/kernel-service.dart b/utils/kernel-service/kernel-service.dart |
similarity index 79% |
rename from runtime/tools/kernel-service.dart |
rename to utils/kernel-service/kernel-service.dart |
index f473c154775f0376174f49614e7eb7ace589ec48..1351f97091ce1051bcce0b1901f8f4e92bd4f8d8 100644 |
--- a/runtime/tools/kernel-service.dart |
+++ b/utils/kernel-service/kernel-service.dart |
@@ -92,4 +92,26 @@ Future _processLoadRequest(request) async { |
port.send([tag, inputFileUrl, inputFileUrl, null, result]); |
} |
-main() => new RawReceivePort()..handler = _processLoadRequest; |
+// This entry point is used when running in the kernel isolate. |
+start() => new RawReceivePort()..handler = _processLoadRequest; |
+ |
+// This entry point is used when creating an app snapshot. The argument provides |
+// a script to compile to warm-up generated code. |
+main(args) { |
+ var tag = 1; |
+ var scriptUri = args[0]; |
+ 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); |
+} |