| Index: bin/gen_snapshot.cc
|
| ===================================================================
|
| --- bin/gen_snapshot.cc (revision 1545)
|
| +++ bin/gen_snapshot.cc (working copy)
|
| @@ -93,36 +93,26 @@
|
| static void* SnapshotCreateCallback(void* data) {
|
| const char* script_name = reinterpret_cast<const char*>(data);
|
| Dart_Handle result;
|
| + Dart_Handle library;
|
| Dart_EnterScope();
|
|
|
| ASSERT(snapshot_filename != NULL);
|
|
|
| - // If a file is specified on the command line, load it up before a snapshot
|
| - // is created.
|
| + // Load up the script before a snapshot is created.
|
| if (script_name != NULL) {
|
| // Load the specified script.
|
| - Dart_Handle library = LoadSnapshotCreationScript(script_name);
|
| - if (Dart_IsError(library)) {
|
| - const char* err_msg = Dart_GetError(library);
|
| - fprintf(stderr, "Errors encountered while loading script: %s\n", err_msg);
|
| - Dart_ExitScope();
|
| - exit(255);
|
| - }
|
| -
|
| - if (!Dart_IsLibrary(library)) {
|
| - fprintf(stderr,
|
| - "Expected a library when loading script: %s",
|
| - script_name);
|
| - Dart_ExitScope();
|
| - exit(255);
|
| - }
|
| + library = LoadSnapshotCreationScript(script_name);
|
| } else {
|
| - // Implicitly load builtin library.
|
| - Builtin_LoadLibrary();
|
| - // Setup the native resolver for built in library functions.
|
| - Builtin_SetNativeResolver();
|
| + // This is a generic dart snapshot which needs builtin library setup.
|
| + library = Builtin_LoadLibrary();
|
| }
|
| -
|
| + if (Dart_IsError(library)) {
|
| + const char* err_msg = Dart_GetError(library);
|
| + fprintf(stderr, "Errors encountered while loading script: %s\n", err_msg);
|
| + Dart_ExitScope();
|
| + exit(255);
|
| + }
|
| + ASSERT(Dart_IsLibrary(library));
|
| uint8_t* buffer = NULL;
|
| intptr_t size = 0;
|
| // First create the snapshot.
|
|
|