OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #include <stdlib.h> | 5 #include <stdlib.h> |
6 #include <string.h> | 6 #include <string.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
10 #include "include/dart_tools_api.h" | 10 #include "include/dart_tools_api.h" |
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 } | 1290 } |
1291 | 1291 |
1292 void* read_only_buffer = | 1292 void* read_only_buffer = |
1293 file->Map(File::kReadOnly, vmisolate_position, | 1293 file->Map(File::kReadOnly, vmisolate_position, |
1294 instructions_position - vmisolate_position); | 1294 instructions_position - vmisolate_position); |
1295 if (read_only_buffer == NULL) { | 1295 if (read_only_buffer == NULL) { |
1296 Log::PrintErr("Failed to memory map snapshot\n"); | 1296 Log::PrintErr("Failed to memory map snapshot\n"); |
1297 Platform::Exit(kErrorExitCode); | 1297 Platform::Exit(kErrorExitCode); |
1298 } | 1298 } |
1299 | 1299 |
1300 *vmisolate_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) + | 1300 if (vmisolate_size != 0) { |
1301 (vmisolate_position - vmisolate_position); | 1301 *vmisolate_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) + |
| 1302 (vmisolate_position - vmisolate_position); |
| 1303 } |
1302 *isolate_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) + | 1304 *isolate_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) + |
1303 (isolate_position - vmisolate_position); | 1305 (isolate_position - vmisolate_position); |
1304 if (rodata_size == 0) { | 1306 if (rodata_size == 0) { |
1305 *rodata_buffer = NULL; | 1307 *rodata_buffer = NULL; |
1306 } else { | 1308 } else { |
1307 *rodata_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) + | 1309 *rodata_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) + |
1308 (rodata_position - vmisolate_position); | 1310 (rodata_position - vmisolate_position); |
1309 } | 1311 } |
1310 | 1312 |
1311 if (instructions_size == 0) { | 1313 if (instructions_size == 0) { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 static void GeneratePrecompiledJITSnapshot() { | 1502 static void GeneratePrecompiledJITSnapshot() { |
1501 uint8_t* vm_isolate_buffer = NULL; | 1503 uint8_t* vm_isolate_buffer = NULL; |
1502 intptr_t vm_isolate_size = 0; | 1504 intptr_t vm_isolate_size = 0; |
1503 uint8_t* isolate_buffer = NULL; | 1505 uint8_t* isolate_buffer = NULL; |
1504 intptr_t isolate_size = 0; | 1506 intptr_t isolate_size = 0; |
1505 uint8_t* instructions_blob_buffer = NULL; | 1507 uint8_t* instructions_blob_buffer = NULL; |
1506 intptr_t instructions_blob_size = 0; | 1508 intptr_t instructions_blob_size = 0; |
1507 uint8_t* rodata_blob_buffer = NULL; | 1509 uint8_t* rodata_blob_buffer = NULL; |
1508 intptr_t rodata_blob_size = 0; | 1510 intptr_t rodata_blob_size = 0; |
1509 Dart_Handle result = Dart_CreateAppJITSnapshot( | 1511 Dart_Handle result = Dart_CreateAppJITSnapshot( |
1510 &vm_isolate_buffer, &vm_isolate_size, &isolate_buffer, &isolate_size, | 1512 &isolate_buffer, &isolate_size, &instructions_blob_buffer, |
1511 &instructions_blob_buffer, &instructions_blob_size, &rodata_blob_buffer, | 1513 &instructions_blob_size, &rodata_blob_buffer, &rodata_blob_size); |
1512 &rodata_blob_size); | |
1513 if (Dart_IsError(result)) { | 1514 if (Dart_IsError(result)) { |
1514 ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); | 1515 ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); |
1515 } | 1516 } |
1516 WriteAppSnapshot(snapshot_filename, vm_isolate_buffer, vm_isolate_size, | 1517 WriteAppSnapshot(snapshot_filename, vm_isolate_buffer, vm_isolate_size, |
1517 isolate_buffer, isolate_size, instructions_blob_buffer, | 1518 isolate_buffer, isolate_size, instructions_blob_buffer, |
1518 instructions_blob_size, rodata_blob_buffer, | 1519 instructions_blob_size, rodata_blob_buffer, |
1519 rodata_blob_size); | 1520 rodata_blob_size); |
1520 } | 1521 } |
1521 #endif // defined(TARGET_ARCH_X64) | 1522 #endif // defined(TARGET_ARCH_X64) |
1522 | 1523 |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1984 Platform::Exit(Process::GlobalExitCode()); | 1985 Platform::Exit(Process::GlobalExitCode()); |
1985 } | 1986 } |
1986 | 1987 |
1987 } // namespace bin | 1988 } // namespace bin |
1988 } // namespace dart | 1989 } // namespace dart |
1989 | 1990 |
1990 int main(int argc, char** argv) { | 1991 int main(int argc, char** argv) { |
1991 dart::bin::main(argc, argv); | 1992 dart::bin::main(argc, argv); |
1992 UNREACHABLE(); | 1993 UNREACHABLE(); |
1993 } | 1994 } |
OLD | NEW |