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