| 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 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 Dart_Handle result = | 734 Dart_Handle result = |
| 735 Dart_SetNativeResolver(library, &StubNativeLookup, &StubNativeSymbol); | 735 Dart_SetNativeResolver(library, &StubNativeLookup, &StubNativeSymbol); |
| 736 DART_CHECK_VALID(result); | 736 DART_CHECK_VALID(result); |
| 737 } | 737 } |
| 738 | 738 |
| 739 | 739 |
| 740 // Iterate over all libraries and setup the stub native lookup. This must be | 740 // Iterate over all libraries and setup the stub native lookup. This must be |
| 741 // run after |SetupStubNativeResolversForPrecompilation| because the former | 741 // run after |SetupStubNativeResolversForPrecompilation| because the former |
| 742 // loads some libraries. | 742 // loads some libraries. |
| 743 static void SetupStubNativeResolvers() { | 743 static void SetupStubNativeResolvers() { |
| 744 Dart_Handle library_ids = Dart_GetLibraryIds(); | 744 Dart_Handle libraries = Dart_GetLoadedLibraries(); |
| 745 intptr_t library_ids_length; | 745 intptr_t libraries_length; |
| 746 Dart_ListLength(library_ids, &library_ids_length); | 746 Dart_ListLength(libraries, &libraries_length); |
| 747 for (intptr_t i = 0; i < library_ids_length; i++) { | 747 for (intptr_t i = 0; i < libraries_length; i++) { |
| 748 Dart_Handle library_id_handle = Dart_ListGetAt(library_ids, i); | 748 Dart_Handle library = Dart_ListGetAt(libraries, i); |
| 749 DART_CHECK_VALID(library_id_handle); | |
| 750 int64_t library_id; | |
| 751 Dart_IntegerToInt64(library_id_handle, &library_id); | |
| 752 Dart_Handle library = Dart_GetLibraryFromId(library_id); | |
| 753 DART_CHECK_VALID(library); | 749 DART_CHECK_VALID(library); |
| 754 Dart_NativeEntryResolver old_resolver = NULL; | 750 Dart_NativeEntryResolver old_resolver = NULL; |
| 755 Dart_GetNativeResolver(library, &old_resolver); | 751 Dart_GetNativeResolver(library, &old_resolver); |
| 756 if (old_resolver == NULL) { | 752 if (old_resolver == NULL) { |
| 757 Dart_Handle result = | 753 Dart_Handle result = |
| 758 Dart_SetNativeResolver(library, &StubNativeLookup, &StubNativeSymbol); | 754 Dart_SetNativeResolver(library, &StubNativeLookup, &StubNativeSymbol); |
| 759 DART_CHECK_VALID(result); | 755 DART_CHECK_VALID(result); |
| 760 } | 756 } |
| 761 } | 757 } |
| 762 } | 758 } |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 EventHandler::Stop(); | 1365 EventHandler::Stop(); |
| 1370 return 0; | 1366 return 0; |
| 1371 } | 1367 } |
| 1372 | 1368 |
| 1373 } // namespace bin | 1369 } // namespace bin |
| 1374 } // namespace dart | 1370 } // namespace dart |
| 1375 | 1371 |
| 1376 int main(int argc, char** argv) { | 1372 int main(int argc, char** argv) { |
| 1377 return dart::bin::main(argc, argv); | 1373 return dart::bin::main(argc, argv); |
| 1378 } | 1374 } |
| OLD | NEW |