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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 static const char* precompiled_snapshot_directory = NULL; | 77 static const char* precompiled_snapshot_directory = NULL; |
78 | 78 |
79 | 79 |
80 // Global flag that is used to indicate that we want to compile everything in | 80 // Global flag that is used to indicate that we want to compile everything in |
81 // the same way as precompilation before main, then continue running in the | 81 // the same way as precompilation before main, then continue running in the |
82 // same process. | 82 // same process. |
83 static bool has_noopt = false; | 83 static bool has_noopt = false; |
84 | 84 |
85 | 85 |
86 extern const char* kPrecompiledLibraryName; | 86 extern const char* kPrecompiledLibraryName; |
87 extern const char* kPrecompiledSymbolName; | 87 extern const char* kPrecompiledInstructionsSymbolName; |
| 88 extern const char* kPrecompiledDataSymbolName; |
88 static const char* kPrecompiledVmIsolateName = "precompiled.vmisolate"; | 89 static const char* kPrecompiledVmIsolateName = "precompiled.vmisolate"; |
89 static const char* kPrecompiledIsolateName = "precompiled.isolate"; | 90 static const char* kPrecompiledIsolateName = "precompiled.isolate"; |
90 static const char* kPrecompiledInstructionsName = "precompiled.S"; | 91 static const char* kPrecompiledInstructionsName = "precompiled.S"; |
91 | 92 |
92 | 93 |
93 // Global flag that is used to indicate that we want to trace resolution of | 94 // Global flag that is used to indicate that we want to trace resolution of |
94 // URIs and the loading of libraries, parts and scripts. | 95 // URIs and the loading of libraries, parts and scripts. |
95 static bool has_trace_loading = false; | 96 static bool has_trace_loading = false; |
96 | 97 |
97 | 98 |
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1454 vm_options.AddArgument("--load_deferred_eagerly"); | 1455 vm_options.AddArgument("--load_deferred_eagerly"); |
1455 } | 1456 } |
1456 | 1457 |
1457 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 1458 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
1458 | 1459 |
1459 // Start event handler. | 1460 // Start event handler. |
1460 TimerUtils::InitOnce(); | 1461 TimerUtils::InitOnce(); |
1461 EventHandler::Start(); | 1462 EventHandler::Start(); |
1462 | 1463 |
1463 const uint8_t* instructions_snapshot = NULL; | 1464 const uint8_t* instructions_snapshot = NULL; |
| 1465 const uint8_t* data_snapshot = NULL; |
1464 if (has_run_precompiled_snapshot) { | 1466 if (has_run_precompiled_snapshot) { |
1465 instructions_snapshot = reinterpret_cast<const uint8_t*>( | 1467 instructions_snapshot = reinterpret_cast<const uint8_t*>( |
1466 LoadLibrarySymbol(kPrecompiledLibraryName, kPrecompiledSymbolName)); | 1468 LoadLibrarySymbol(kPrecompiledLibraryName, |
| 1469 kPrecompiledInstructionsSymbolName)); |
| 1470 data_snapshot = reinterpret_cast<const uint8_t*>( |
| 1471 LoadLibrarySymbol(kPrecompiledLibraryName, kPrecompiledDataSymbolName)); |
1467 ReadPrecompiledSnapshotFile(kPrecompiledVmIsolateName, | 1472 ReadPrecompiledSnapshotFile(kPrecompiledVmIsolateName, |
1468 &vm_isolate_snapshot_buffer); | 1473 &vm_isolate_snapshot_buffer); |
1469 ReadPrecompiledSnapshotFile(kPrecompiledIsolateName, | 1474 ReadPrecompiledSnapshotFile(kPrecompiledIsolateName, |
1470 &isolate_snapshot_buffer); | 1475 &isolate_snapshot_buffer); |
1471 } | 1476 } |
1472 | 1477 |
1473 // Initialize the Dart VM. | 1478 // Initialize the Dart VM. |
1474 char* error = Dart_Initialize( | 1479 char* error = Dart_Initialize( |
1475 vm_isolate_snapshot_buffer, instructions_snapshot, | 1480 vm_isolate_snapshot_buffer, instructions_snapshot, data_snapshot, |
1476 CreateIsolateAndSetup, NULL, NULL, ShutdownIsolate, | 1481 CreateIsolateAndSetup, NULL, NULL, ShutdownIsolate, |
1477 DartUtils::OpenFile, | 1482 DartUtils::OpenFile, |
1478 DartUtils::ReadFile, | 1483 DartUtils::ReadFile, |
1479 DartUtils::WriteFile, | 1484 DartUtils::WriteFile, |
1480 DartUtils::CloseFile, | 1485 DartUtils::CloseFile, |
1481 DartUtils::EntropySource, | 1486 DartUtils::EntropySource, |
1482 GetVMServiceAssetsArchiveCallback); | 1487 GetVMServiceAssetsArchiveCallback); |
1483 if (error != NULL) { | 1488 if (error != NULL) { |
1484 if (do_vm_shutdown) { | 1489 if (do_vm_shutdown) { |
1485 EventHandler::Stop(); | 1490 EventHandler::Stop(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 Platform::Exit(Process::GlobalExitCode()); | 1536 Platform::Exit(Process::GlobalExitCode()); |
1532 } | 1537 } |
1533 | 1538 |
1534 } // namespace bin | 1539 } // namespace bin |
1535 } // namespace dart | 1540 } // namespace dart |
1536 | 1541 |
1537 int main(int argc, char** argv) { | 1542 int main(int argc, char** argv) { |
1538 dart::bin::main(argc, argv); | 1543 dart::bin::main(argc, argv); |
1539 UNREACHABLE(); | 1544 UNREACHABLE(); |
1540 } | 1545 } |
OLD | NEW |