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

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

Issue 2410303008: Revert "Use a single file for app snapshots." (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « runtime/bin/file_win.cc ('k') | 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 <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 1029
1030 // Shutdown the isolate. 1030 // Shutdown the isolate.
1031 Dart_ShutdownIsolate(); 1031 Dart_ShutdownIsolate();
1032 } 1032 }
1033 1033
1034 1034
1035 static void CreateAndWritePrecompiledSnapshot( 1035 static void CreateAndWritePrecompiledSnapshot(
1036 Dart_QualifiedFunctionName* standalone_entry_points) { 1036 Dart_QualifiedFunctionName* standalone_entry_points) {
1037 ASSERT(IsSnapshottingForPrecompilation()); 1037 ASSERT(IsSnapshottingForPrecompilation());
1038 Dart_Handle result; 1038 Dart_Handle result;
1039 uint8_t* vm_isolate_buffer = NULL;
1040 intptr_t vm_isolate_size = 0;
1041 uint8_t* isolate_buffer = NULL;
1042 intptr_t isolate_size = 0;
1043 uint8_t* assembly_buffer = NULL;
1044 intptr_t assembly_size = 0;
1045 uint8_t* instructions_blob_buffer = NULL;
1046 intptr_t instructions_blob_size = 0;
1047 uint8_t* rodata_blob_buffer = NULL;
1048 intptr_t rodata_blob_size = 0;
1039 1049
1040 // Precompile with specified embedder entry points 1050 // Precompile with specified embedder entry points
1041 result = Dart_Precompile(standalone_entry_points, true); 1051 result = Dart_Precompile(standalone_entry_points, true);
1042 CHECK_RESULT(result); 1052 CHECK_RESULT(result);
1043 1053
1044 // Create a precompiled snapshot. 1054 // Create a precompiled snapshot.
1045 bool as_assembly = assembly_filename != NULL; 1055 bool as_assembly = assembly_filename != NULL;
1046 if (as_assembly) { 1056 if (as_assembly) {
1047 uint8_t* assembly_buffer = NULL; 1057 result = Dart_CreatePrecompiledSnapshotAssembly(&vm_isolate_buffer,
1048 intptr_t assembly_size = 0; 1058 &vm_isolate_size,
1049 result = Dart_CreatePrecompiledSnapshotAssembly(&assembly_buffer, 1059 &isolate_buffer,
1060 &isolate_size,
1061 &assembly_buffer,
1050 &assembly_size); 1062 &assembly_size);
1051 CHECK_RESULT(result); 1063 CHECK_RESULT(result);
1052 WriteSnapshotFile(assembly_filename,
1053 assembly_buffer,
1054 assembly_size);
1055 } else { 1064 } else {
1056 uint8_t* vm_isolate_buffer = NULL;
1057 intptr_t vm_isolate_size = 0;
1058 uint8_t* isolate_buffer = NULL;
1059 intptr_t isolate_size = 0;
1060 uint8_t* instructions_blob_buffer = NULL;
1061 intptr_t instructions_blob_size = 0;
1062 uint8_t* rodata_blob_buffer = NULL;
1063 intptr_t rodata_blob_size = 0;
1064 result = Dart_CreatePrecompiledSnapshotBlob(&vm_isolate_buffer, 1065 result = Dart_CreatePrecompiledSnapshotBlob(&vm_isolate_buffer,
1065 &vm_isolate_size, 1066 &vm_isolate_size,
1066 &isolate_buffer, 1067 &isolate_buffer,
1067 &isolate_size, 1068 &isolate_size,
1068 &instructions_blob_buffer, 1069 &instructions_blob_buffer,
1069 &instructions_blob_size, 1070 &instructions_blob_size,
1070 &rodata_blob_buffer, 1071 &rodata_blob_buffer,
1071 &rodata_blob_size); 1072 &rodata_blob_size);
1072 CHECK_RESULT(result); 1073 CHECK_RESULT(result);
1073 WriteSnapshotFile(vm_isolate_snapshot_filename, 1074 }
1074 vm_isolate_buffer, 1075
1075 vm_isolate_size); 1076 // Now write the snapshot pieces out to the specified files and exit.
1076 WriteSnapshotFile(isolate_snapshot_filename, 1077 WriteSnapshotFile(vm_isolate_snapshot_filename,
1077 isolate_buffer, 1078 vm_isolate_buffer,
1078 isolate_size); 1079 vm_isolate_size);
1080 WriteSnapshotFile(isolate_snapshot_filename,
1081 isolate_buffer,
1082 isolate_size);
1083 if (as_assembly) {
1084 WriteSnapshotFile(assembly_filename,
1085 assembly_buffer,
1086 assembly_size);
1087 } else {
1079 WriteSnapshotFile(instructions_blob_filename, 1088 WriteSnapshotFile(instructions_blob_filename,
1080 instructions_blob_buffer, 1089 instructions_blob_buffer,
1081 instructions_blob_size); 1090 instructions_blob_size);
1082 WriteSnapshotFile(rodata_blob_filename, 1091 WriteSnapshotFile(rodata_blob_filename,
1083 rodata_blob_buffer, 1092 rodata_blob_buffer,
1084 rodata_blob_size); 1093 rodata_blob_size);
1085 } 1094 }
1086
1087 Dart_ExitScope(); 1095 Dart_ExitScope();
1088 1096
1089 // Shutdown the isolate. 1097 // Shutdown the isolate.
1090 Dart_ShutdownIsolate(); 1098 Dart_ShutdownIsolate();
1091 } 1099 }
1092 1100
1093 1101
1094 static void SetupForUriResolution() { 1102 static void SetupForUriResolution() {
1095 // Set up the library tag handler for this isolate. 1103 // Set up the library tag handler for this isolate.
1096 Dart_Handle result = Dart_SetLibraryTagHandler(Loader::LibraryTagHandler); 1104 Dart_Handle result = Dart_SetLibraryTagHandler(Loader::LibraryTagHandler);
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 EventHandler::Stop(); 1354 EventHandler::Stop();
1347 return 0; 1355 return 0;
1348 } 1356 }
1349 1357
1350 } // namespace bin 1358 } // namespace bin
1351 } // namespace dart 1359 } // namespace dart
1352 1360
1353 int main(int argc, char** argv) { 1361 int main(int argc, char** argv) {
1354 return dart::bin::main(argc, argv); 1362 return dart::bin::main(argc, argv);
1355 } 1363 }
OLDNEW
« 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