| OLD | NEW |
| 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 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1503 const char* main, | 1503 const char* main, |
| 1504 const char* package_root, | 1504 const char* package_root, |
| 1505 const char* package_config, | 1505 const char* package_config, |
| 1506 Dart_IsolateFlags* flags, | 1506 Dart_IsolateFlags* flags, |
| 1507 void* data, | 1507 void* data, |
| 1508 char** error) { | 1508 char** error) { |
| 1509 IsolateData* isolate_data = | 1509 IsolateData* isolate_data = |
| 1510 new IsolateData(script_uri, package_root, package_config, NULL); | 1510 new IsolateData(script_uri, package_root, package_config, NULL); |
| 1511 Dart_Isolate isolate = NULL; | 1511 Dart_Isolate isolate = NULL; |
| 1512 isolate = Dart_CreateIsolate(script_uri, main, isolate_snapshot_data, | 1512 isolate = Dart_CreateIsolate(script_uri, main, isolate_snapshot_data, |
| 1513 isolate_snapshot_instructions, NULL, | 1513 isolate_snapshot_instructions, flags, |
| 1514 isolate_data, error); | 1514 isolate_data, error); |
| 1515 | 1515 |
| 1516 if (isolate == NULL) { | 1516 if (isolate == NULL) { |
| 1517 Log::PrintErr("Error: Could not create service isolate\n"); | 1517 Log::PrintErr("Error: Could not create service isolate\n"); |
| 1518 return NULL; | 1518 return NULL; |
| 1519 } | 1519 } |
| 1520 | 1520 |
| 1521 Dart_EnterScope(); | 1521 Dart_EnterScope(); |
| 1522 if (!Dart_IsServiceIsolate(isolate)) { | 1522 if (!Dart_IsServiceIsolate(isolate)) { |
| 1523 Log::PrintErr("Error: We only expect to create the service isolate\n"); | 1523 Log::PrintErr("Error: We only expect to create the service isolate\n"); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 memset(&init_params, 0, sizeof(init_params)); | 1622 memset(&init_params, 0, sizeof(init_params)); |
| 1623 init_params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION; | 1623 init_params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION; |
| 1624 if (app_script_name != NULL) { | 1624 if (app_script_name != NULL) { |
| 1625 init_params.create = CreateServiceIsolate; | 1625 init_params.create = CreateServiceIsolate; |
| 1626 } | 1626 } |
| 1627 init_params.file_open = DartUtils::OpenFile; | 1627 init_params.file_open = DartUtils::OpenFile; |
| 1628 init_params.file_read = DartUtils::ReadFile; | 1628 init_params.file_read = DartUtils::ReadFile; |
| 1629 init_params.file_write = DartUtils::WriteFile; | 1629 init_params.file_write = DartUtils::WriteFile; |
| 1630 init_params.file_close = DartUtils::CloseFile; | 1630 init_params.file_close = DartUtils::CloseFile; |
| 1631 init_params.entropy_source = DartUtils::EntropySource; | 1631 init_params.entropy_source = DartUtils::EntropySource; |
| 1632 init_params.start_kernel_isolate = false; |
| 1632 | 1633 |
| 1633 MappedMemory* mapped_vm_snapshot_data = NULL; | 1634 MappedMemory* mapped_vm_snapshot_data = NULL; |
| 1634 MappedMemory* mapped_vm_snapshot_instructions = NULL; | 1635 MappedMemory* mapped_vm_snapshot_instructions = NULL; |
| 1635 MappedMemory* mapped_isolate_snapshot_data = NULL; | 1636 MappedMemory* mapped_isolate_snapshot_data = NULL; |
| 1636 MappedMemory* mapped_isolate_snapshot_instructions = NULL; | 1637 MappedMemory* mapped_isolate_snapshot_instructions = NULL; |
| 1637 if (snapshot_kind == kScript) { | 1638 if (snapshot_kind == kScript) { |
| 1638 mapped_vm_snapshot_data = | 1639 mapped_vm_snapshot_data = |
| 1639 MapFile(vm_snapshot_data_filename, File::kReadOnly, | 1640 MapFile(vm_snapshot_data_filename, File::kReadOnly, |
| 1640 &init_params.vm_snapshot_data); | 1641 &init_params.vm_snapshot_data); |
| 1641 | 1642 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1839 delete mapped_isolate_snapshot_instructions; | 1840 delete mapped_isolate_snapshot_instructions; |
| 1840 return 0; | 1841 return 0; |
| 1841 } | 1842 } |
| 1842 | 1843 |
| 1843 } // namespace bin | 1844 } // namespace bin |
| 1844 } // namespace dart | 1845 } // namespace dart |
| 1845 | 1846 |
| 1846 int main(int argc, char** argv) { | 1847 int main(int argc, char** argv) { |
| 1847 return dart::bin::main(argc, argv); | 1848 return dart::bin::main(argc, argv); |
| 1848 } | 1849 } |
| OLD | NEW |