| 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 <stdio.h> | 5 #include <stdio.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 #include <string.h> | 7 #include <string.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 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1352 } | 1352 } |
| 1353 int64_t data[File::kStatSize]; | 1353 int64_t data[File::kStatSize]; |
| 1354 File::Stat(url + 7, data); | 1354 File::Stat(url + 7, data); |
| 1355 if (data[File::kType] == File::kDoesNotExist) { | 1355 if (data[File::kType] == File::kDoesNotExist) { |
| 1356 return true; | 1356 return true; |
| 1357 } | 1357 } |
| 1358 bool modified = data[File::kModifiedTime] > since; | 1358 bool modified = data[File::kModifiedTime] > since; |
| 1359 return modified; | 1359 return modified; |
| 1360 } | 1360 } |
| 1361 | 1361 |
| 1362 static void EmbedderInformationCallback(Dart_EmbedderInformation* info) { |
| 1363 int64_t max_rss = Process::MaxRSS(); |
| 1364 int64_t current_rss = Process::CurrentRSS(); |
| 1365 |
| 1366 info->version = DART_EMBEDDER_INFORMATION_CURRENT_VERSION; |
| 1367 info->name = "Dart VM"; |
| 1368 info->max_rss = max_rss >= 0 ? max_rss : 0; |
| 1369 info->current_rss = current_rss >= 0 ? current_rss : 0; |
| 1370 } |
| 1371 |
| 1362 static void GenerateAppAOTSnapshot() { | 1372 static void GenerateAppAOTSnapshot() { |
| 1363 if (use_blobs) { | 1373 if (use_blobs) { |
| 1364 Snapshot::GenerateAppAOTAsBlobs(snapshot_filename); | 1374 Snapshot::GenerateAppAOTAsBlobs(snapshot_filename); |
| 1365 } else { | 1375 } else { |
| 1366 Snapshot::GenerateAppAOTAsAssembly(snapshot_filename); | 1376 Snapshot::GenerateAppAOTAsAssembly(snapshot_filename); |
| 1367 } | 1377 } |
| 1368 } | 1378 } |
| 1369 | 1379 |
| 1370 #define CHECK_RESULT(result) \ | 1380 #define CHECK_RESULT(result) \ |
| 1371 if (Dart_IsError(result)) { \ | 1381 if (Dart_IsError(result)) { \ |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1801 if (error != NULL) { | 1811 if (error != NULL) { |
| 1802 EventHandler::Stop(); | 1812 EventHandler::Stop(); |
| 1803 Log::PrintErr("VM initialization failed: %s\n", error); | 1813 Log::PrintErr("VM initialization failed: %s\n", error); |
| 1804 free(error); | 1814 free(error); |
| 1805 Platform::Exit(kErrorExitCode); | 1815 Platform::Exit(kErrorExitCode); |
| 1806 } | 1816 } |
| 1807 | 1817 |
| 1808 Dart_SetServiceStreamCallbacks(&ServiceStreamListenCallback, | 1818 Dart_SetServiceStreamCallbacks(&ServiceStreamListenCallback, |
| 1809 &ServiceStreamCancelCallback); | 1819 &ServiceStreamCancelCallback); |
| 1810 Dart_SetFileModifiedCallback(&FileModifiedCallback); | 1820 Dart_SetFileModifiedCallback(&FileModifiedCallback); |
| 1821 Dart_SetEmbedderInformationCallback(&EmbedderInformationCallback); |
| 1811 | 1822 |
| 1812 // Run the main isolate until we aren't told to restart. | 1823 // Run the main isolate until we aren't told to restart. |
| 1813 while (RunMainIsolate(script_name, &dart_options)) { | 1824 while (RunMainIsolate(script_name, &dart_options)) { |
| 1814 Log::PrintErr("Restarting VM\n"); | 1825 Log::PrintErr("Restarting VM\n"); |
| 1815 } | 1826 } |
| 1816 | 1827 |
| 1817 // Terminate process exit-code handler. | 1828 // Terminate process exit-code handler. |
| 1818 Process::TerminateExitCodeHandler(); | 1829 Process::TerminateExitCodeHandler(); |
| 1819 | 1830 |
| 1820 error = Dart_Cleanup(); | 1831 error = Dart_Cleanup(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1848 Platform::Exit(Process::GlobalExitCode()); | 1859 Platform::Exit(Process::GlobalExitCode()); |
| 1849 } | 1860 } |
| 1850 | 1861 |
| 1851 } // namespace bin | 1862 } // namespace bin |
| 1852 } // namespace dart | 1863 } // namespace dart |
| 1853 | 1864 |
| 1854 int main(int argc, char** argv) { | 1865 int main(int argc, char** argv) { |
| 1855 dart::bin::main(argc, argv); | 1866 dart::bin::main(argc, argv); |
| 1856 UNREACHABLE(); | 1867 UNREACHABLE(); |
| 1857 } | 1868 } |
| OLD | NEW |