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 | |
1372 static void GenerateAppAOTSnapshot() { | 1362 static void GenerateAppAOTSnapshot() { |
1373 if (use_blobs) { | 1363 if (use_blobs) { |
1374 Snapshot::GenerateAppAOTAsBlobs(snapshot_filename); | 1364 Snapshot::GenerateAppAOTAsBlobs(snapshot_filename); |
1375 } else { | 1365 } else { |
1376 Snapshot::GenerateAppAOTAsAssembly(snapshot_filename); | 1366 Snapshot::GenerateAppAOTAsAssembly(snapshot_filename); |
1377 } | 1367 } |
1378 } | 1368 } |
1379 | 1369 |
1380 #define CHECK_RESULT(result) \ | 1370 #define CHECK_RESULT(result) \ |
1381 if (Dart_IsError(result)) { \ | 1371 if (Dart_IsError(result)) { \ |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1811 if (error != NULL) { | 1801 if (error != NULL) { |
1812 EventHandler::Stop(); | 1802 EventHandler::Stop(); |
1813 Log::PrintErr("VM initialization failed: %s\n", error); | 1803 Log::PrintErr("VM initialization failed: %s\n", error); |
1814 free(error); | 1804 free(error); |
1815 Platform::Exit(kErrorExitCode); | 1805 Platform::Exit(kErrorExitCode); |
1816 } | 1806 } |
1817 | 1807 |
1818 Dart_SetServiceStreamCallbacks(&ServiceStreamListenCallback, | 1808 Dart_SetServiceStreamCallbacks(&ServiceStreamListenCallback, |
1819 &ServiceStreamCancelCallback); | 1809 &ServiceStreamCancelCallback); |
1820 Dart_SetFileModifiedCallback(&FileModifiedCallback); | 1810 Dart_SetFileModifiedCallback(&FileModifiedCallback); |
1821 Dart_SetEmbedderInformationCallback(&EmbedderInformationCallback); | |
1822 | 1811 |
1823 // Run the main isolate until we aren't told to restart. | 1812 // Run the main isolate until we aren't told to restart. |
1824 while (RunMainIsolate(script_name, &dart_options)) { | 1813 while (RunMainIsolate(script_name, &dart_options)) { |
1825 Log::PrintErr("Restarting VM\n"); | 1814 Log::PrintErr("Restarting VM\n"); |
1826 } | 1815 } |
1827 | 1816 |
1828 // Terminate process exit-code handler. | 1817 // Terminate process exit-code handler. |
1829 Process::TerminateExitCodeHandler(); | 1818 Process::TerminateExitCodeHandler(); |
1830 | 1819 |
1831 error = Dart_Cleanup(); | 1820 error = Dart_Cleanup(); |
(...skipping 27 matching lines...) Expand all Loading... |
1859 Platform::Exit(Process::GlobalExitCode()); | 1848 Platform::Exit(Process::GlobalExitCode()); |
1860 } | 1849 } |
1861 | 1850 |
1862 } // namespace bin | 1851 } // namespace bin |
1863 } // namespace dart | 1852 } // namespace dart |
1864 | 1853 |
1865 int main(int argc, char** argv) { | 1854 int main(int argc, char** argv) { |
1866 dart::bin::main(argc, argv); | 1855 dart::bin::main(argc, argv); |
1867 UNREACHABLE(); | 1856 UNREACHABLE(); |
1868 } | 1857 } |
OLD | NEW |