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

Side by Side Diff: runtime/bin/gen_snapshot.cc

Issue 1418833004: VM: Service isolate under precompilation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | runtime/bin/main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Generate a snapshot file after loading all the scripts specified on the 5 // Generate a snapshot file after loading all the scripts specified on the
6 // command line. 6 // command line.
7 7
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 Dart_Handle lib; 461 Dart_Handle lib;
462 // Load the builtin library to make it available in the snapshot 462 // Load the builtin library to make it available in the snapshot
463 // for importing. 463 // for importing.
464 lib = Builtin::LoadAndCheckLibrary(id); 464 lib = Builtin::LoadAndCheckLibrary(id);
465 ASSERT(!Dart_IsError(lib)); 465 ASSERT(!Dart_IsError(lib));
466 return lib; 466 return lib;
467 } 467 }
468 468
469 469
470 static void PrintUsage() { 470 static void PrintUsage() {
471 #define STRINGERIZE(...) #__VA_ARGS__ 471 Log::PrintErr(
472 // clang-format off 472 "Usage: \n"
473 Log::PrintErr(STRINGERIZE( 473 " gen_snapshot [<vm-flags>] [<options>] [<dart-script-file>] \n"
474 Usage: \n 474 " \n"
475 gen_snapshot [<vm-flags>] [<options>] [<dart-script-file>] \n 475 " Writes a snapshot of <dart-script-file> to the specified snapshot files. \n"
476 \n 476 " If no <dart-script-file> is passed, a generic snapshot of all the corelibs\n"
477 Writes a snapshot of <dart-script-file> to the specified snapshot files. If \n 477 " is created. It is required to specify the VM isolate snapshot and the \n"
478 no <dart-script-file> is passed, a generic snapshot of all the corelibs is \n 478 " isolate snapshot. The other flags are related to precompilation and are \n"
479 created. It is required to specify the VM isolate snapshot and the isolate \n 479 " optional. \n"
480 snapshot. The other flags are related to precompilation and are optional. \n 480 " \n"
481 \n 481 " Precompilation: \n"
482 Precompilation: \n 482 " In order to configure the snapshotter for precompilation, both the \n"
483 In order to configure the snapshotter for precompilation, both the \n 483 " instructions snapshot and embedder entry points manifest must be \n"
484 instructions snapshot and embedder entry points manifest must be specified. \n 484 " specified. Assembly for the target architecture will be dumped into the \n"
485 Machine code for the target architecture will be dumped into the \n 485 " instructions snapshot. This must be linked into the target binary in a \n"
486 instructions snapshot. This must be linked into the target binary in a \n 486 " separate step. The embedder entry points manifest lists the standalone \n"
487 separate step. The embedder entry points manifest lists the standalone entry\n 487 " entry points into the VM. Not specifying these will cause the tree shaker \n"
488 points into the VM. Not specifying these will cause the tree shaker to \n 488 " to disregard the same as being used. The format of this manifest is as \n"
489 disregard the same as being used. The format of this manifest is as follows.\n 489 " follows. Each line in the manifest is a comma separated list of three \n"
490 Each line in the manifest is a comma separated list of three elements. The \n 490 " elements. The first entry is the library URI, the second entry is the \n"
491 first entry is the library URI, the second entry is the class name and the \n 491 " class name and the final entry the function name. The file must be \n"
492 final entry the function name. The file must be terminated with a newline \n 492 " terminated with a newline charater. \n"
493 charater. \n 493 " \n"
494 \n 494 " Example: \n"
495 Example: \n 495 " dart:something,SomeClass,doSomething \n"
496 dart:something,SomeClass,doSomething \n 496 " \n"
497 \n 497 " Supported options: \n"
498 Supported options: \n 498 " --vm_isolate_snapshot=<file> A full snapshot is a compact \n"
499 --vm_isolate_snapshot=<file> A full snapshot is a compact \n 499 " --isolate_snapshot=<file> representation of the dart vm isolate \n"
500 --isolate_snapshot=<file> representation of the dart vm isolate \n 500 " heap and dart isolate heap states. \n"
501 heap and dart isolate heap states. \n 501 " Both these options are required \n"
502 Both these options are required \n 502 " \n"
503 \n 503 " --package_root=<path> Where to find packages, that is, \n"
504 --package_root=<path> Where to find packages, that is, \n 504 " package:... imports. \n"
505 package:... imports. \n 505 " \n"
506 \n 506 " --url_mapping=<mapping> Uses the URL mapping(s) specified on \n"
507 --url_mapping=<mapping> Uses the URL mapping(s) specified on the\n 507 " the command line to load the \n"
508 command line to load the libraries. \n 508 " libraries. \n"
509 \n 509 " \n"
510 --instructions_snapshot=<file> (Precompilation only) Contains the \n 510 " --instructions_snapshot=<file> (Precompilation only) Contains the \n"
511 assembly that must be linked into \n 511 " assembly that must be linked into \n"
512 the target binary \n 512 " the target binary \n"
513 \n 513 " \n"
514 --embedder_entry_points_manifest=<file> (Precompilation only) Contains the\n 514 " --embedder_entry_points_manifest=<file> (Precompilation only) Contains \n"
515 stanalone embedder entry points \n 515 " the stanalone embedder entry points\n");
516 ));
517 // clang-format on
518 #undef STRINGERIZE
519 } 516 }
520 517
521 518
522 static void VerifyLoaded(Dart_Handle library) { 519 static void VerifyLoaded(Dart_Handle library) {
523 if (Dart_IsError(library)) { 520 if (Dart_IsError(library)) {
524 const char* err_msg = Dart_GetError(library); 521 const char* err_msg = Dart_GetError(library);
525 Log::PrintErr("Errors encountered while loading: %s\n", err_msg); 522 Log::PrintErr("Errors encountered while loading: %s\n", err_msg);
526 Dart_ExitScope(); 523 Dart_ExitScope();
527 Dart_ShutdownIsolate(); 524 Dart_ShutdownIsolate();
528 exit(255); 525 exit(255);
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 // Setup the native resolver. 980 // Setup the native resolver.
984 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); 981 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
985 Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary); 982 Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary);
986 if (Dart_IsError(result)) { 983 if (Dart_IsError(result)) {
987 Log::PrintErr("Error: Could not set tag handler for service isolate"); 984 Log::PrintErr("Error: Could not set tag handler for service isolate");
988 return NULL; 985 return NULL;
989 } 986 }
990 CHECK_RESULT(result); 987 CHECK_RESULT(result);
991 ASSERT(Dart_IsServiceIsolate(isolate)); 988 ASSERT(Dart_IsServiceIsolate(isolate));
992 // Load embedder specific bits and return. Will not start http server. 989 // Load embedder specific bits and return. Will not start http server.
993 if (!VmService::Setup("127.0.0.1", -1)) { 990 if (!VmService::Setup("127.0.0.1", -1, false /* running_precompiled */)) {
994 *error = strdup(VmService::GetErrorMessage()); 991 *error = strdup(VmService::GetErrorMessage());
995 return NULL; 992 return NULL;
996 } 993 }
997 Dart_ExitScope(); 994 Dart_ExitScope();
998 Dart_ExitIsolate(); 995 Dart_ExitIsolate();
999 return isolate; 996 return isolate;
1000 } 997 }
1001 998
1002 999
1003 int main(int argc, char** argv) { 1000 int main(int argc, char** argv) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 EventHandler::Stop(); 1150 EventHandler::Stop();
1154 return 0; 1151 return 0;
1155 } 1152 }
1156 1153
1157 } // namespace bin 1154 } // namespace bin
1158 } // namespace dart 1155 } // namespace dart
1159 1156
1160 int main(int argc, char** argv) { 1157 int main(int argc, char** argv) {
1161 return dart::bin::main(argc, argv); 1158 return dart::bin::main(argc, argv);
1162 } 1159 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698