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

Unified Diff: runtime/bin/gen_snapshot.cc

Issue 2405393002: Use a single file for app snapshots. (Closed)
Patch Set: gen_snapshot Created 4 years, 2 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 | « runtime/bin/file_win.cc ('k') | runtime/bin/main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/gen_snapshot.cc
diff --git a/runtime/bin/gen_snapshot.cc b/runtime/bin/gen_snapshot.cc
index 319a322d4d1a8e7302ca2fe41849088ae4d687e8..5f7f9b0e959f2d5b7a9fb065cb11f14bdb4905ae 100644
--- a/runtime/bin/gen_snapshot.cc
+++ b/runtime/bin/gen_snapshot.cc
@@ -1036,16 +1036,6 @@ static void CreateAndWritePrecompiledSnapshot(
Dart_QualifiedFunctionName* standalone_entry_points) {
ASSERT(IsSnapshottingForPrecompilation());
Dart_Handle result;
- uint8_t* vm_isolate_buffer = NULL;
- intptr_t vm_isolate_size = 0;
- uint8_t* isolate_buffer = NULL;
- intptr_t isolate_size = 0;
- uint8_t* assembly_buffer = NULL;
- intptr_t assembly_size = 0;
- uint8_t* instructions_blob_buffer = NULL;
- intptr_t instructions_blob_size = 0;
- uint8_t* rodata_blob_buffer = NULL;
- intptr_t rodata_blob_size = 0;
// Precompile with specified embedder entry points
result = Dart_Precompile(standalone_entry_points, true);
@@ -1054,14 +1044,23 @@ static void CreateAndWritePrecompiledSnapshot(
// Create a precompiled snapshot.
bool as_assembly = assembly_filename != NULL;
if (as_assembly) {
- result = Dart_CreatePrecompiledSnapshotAssembly(&vm_isolate_buffer,
- &vm_isolate_size,
- &isolate_buffer,
- &isolate_size,
- &assembly_buffer,
+ uint8_t* assembly_buffer = NULL;
+ intptr_t assembly_size = 0;
+ result = Dart_CreatePrecompiledSnapshotAssembly(&assembly_buffer,
&assembly_size);
CHECK_RESULT(result);
+ WriteSnapshotFile(assembly_filename,
+ assembly_buffer,
+ assembly_size);
} else {
+ uint8_t* vm_isolate_buffer = NULL;
+ intptr_t vm_isolate_size = 0;
+ uint8_t* isolate_buffer = NULL;
+ intptr_t isolate_size = 0;
+ uint8_t* instructions_blob_buffer = NULL;
+ intptr_t instructions_blob_size = 0;
+ uint8_t* rodata_blob_buffer = NULL;
+ intptr_t rodata_blob_size = 0;
result = Dart_CreatePrecompiledSnapshotBlob(&vm_isolate_buffer,
&vm_isolate_size,
&isolate_buffer,
@@ -1071,20 +1070,12 @@ static void CreateAndWritePrecompiledSnapshot(
&rodata_blob_buffer,
&rodata_blob_size);
CHECK_RESULT(result);
- }
-
- // Now write the snapshot pieces out to the specified files and exit.
- WriteSnapshotFile(vm_isolate_snapshot_filename,
- vm_isolate_buffer,
- vm_isolate_size);
- WriteSnapshotFile(isolate_snapshot_filename,
- isolate_buffer,
- isolate_size);
- if (as_assembly) {
- WriteSnapshotFile(assembly_filename,
- assembly_buffer,
- assembly_size);
- } else {
+ WriteSnapshotFile(vm_isolate_snapshot_filename,
+ vm_isolate_buffer,
+ vm_isolate_size);
+ WriteSnapshotFile(isolate_snapshot_filename,
+ isolate_buffer,
+ isolate_size);
WriteSnapshotFile(instructions_blob_filename,
instructions_blob_buffer,
instructions_blob_size);
@@ -1092,6 +1083,7 @@ static void CreateAndWritePrecompiledSnapshot(
rodata_blob_buffer,
rodata_blob_size);
}
+
Dart_ExitScope();
// Shutdown the isolate.
« no previous file with comments | « runtime/bin/file_win.cc ('k') | runtime/bin/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698