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 "bin/builtin.h" | 5 #include "bin/builtin.h" |
6 #include "vm/compiler.h" | 6 #include "vm/compiler.h" |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "include/dart_mirrors_api.h" | 8 #include "include/dart_mirrors_api.h" |
9 #include "include/dart_native_api.h" | 9 #include "include/dart_native_api.h" |
10 #include "include/dart_tools_api.h" | 10 #include "include/dart_tools_api.h" |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 &utf8_encoded_reversed, &utf8_length_reversed); | 1199 &utf8_encoded_reversed, &utf8_length_reversed); |
1200 EXPECT_VALID(result); | 1200 EXPECT_VALID(result); |
1201 EXPECT_EQ(6, utf8_length_reversed); | 1201 EXPECT_EQ(6, utf8_length_reversed); |
1202 uint8_t expected[6] = {237, 180, 158, 237, 160, 180}; | 1202 uint8_t expected[6] = {237, 180, 158, 237, 160, 180}; |
1203 for (int i = 0; i < 6; i++) { | 1203 for (int i = 0; i < 6; i++) { |
1204 EXPECT_EQ(expected[i], utf8_encoded_reversed[i]); | 1204 EXPECT_EQ(expected[i], utf8_encoded_reversed[i]); |
1205 } | 1205 } |
1206 } | 1206 } |
1207 | 1207 |
1208 | 1208 |
| 1209 // Helper class to ensure new gen GC is triggered without any side effects. |
| 1210 // The normal call to CollectGarbage(Heap::kNew) could potentially trigger |
| 1211 // an old gen collection if there is a promotion failure and this could |
| 1212 // perturb the test. |
| 1213 class GCTestHelper : public AllStatic { |
| 1214 public: |
| 1215 static void CollectNewSpace(Heap::ApiCallbacks api_callbacks) { |
| 1216 bool invoke_api_callbacks = (api_callbacks == Heap::kInvokeApiCallbacks); |
| 1217 Isolate::Current()->heap()->new_space()->Scavenge(invoke_api_callbacks); |
| 1218 } |
| 1219 |
| 1220 static void WaitForFinalizationTasks() { |
| 1221 Thread* thread = Thread::Current(); |
| 1222 Heap* heap = thread->isolate()->heap(); |
| 1223 MonitorLocker ml(heap->finalization_tasks_lock()); |
| 1224 while (heap->finalization_tasks() > 0) { |
| 1225 ml.WaitWithSafepointCheck(thread); |
| 1226 } |
| 1227 } |
| 1228 }; |
| 1229 |
| 1230 |
1209 static void ExternalStringCallbackFinalizer(void* peer) { | 1231 static void ExternalStringCallbackFinalizer(void* peer) { |
1210 *static_cast<int*>(peer) *= 2; | 1232 *static_cast<int*>(peer) *= 2; |
1211 } | 1233 } |
1212 | 1234 |
1213 | 1235 |
1214 TEST_CASE(ExternalStringCallback) { | 1236 TEST_CASE(ExternalStringCallback) { |
1215 int peer8 = 40; | 1237 int peer8 = 40; |
1216 int peer16 = 41; | 1238 int peer16 = 41; |
1217 | 1239 |
1218 { | 1240 { |
(...skipping 16 matching lines...) Expand all Loading... |
1235 EXPECT_VALID(obj16); | 1257 EXPECT_VALID(obj16); |
1236 | 1258 |
1237 Dart_ExitScope(); | 1259 Dart_ExitScope(); |
1238 } | 1260 } |
1239 | 1261 |
1240 { | 1262 { |
1241 TransitionNativeToVM transition(thread); | 1263 TransitionNativeToVM transition(thread); |
1242 EXPECT_EQ(40, peer8); | 1264 EXPECT_EQ(40, peer8); |
1243 EXPECT_EQ(41, peer16); | 1265 EXPECT_EQ(41, peer16); |
1244 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); | 1266 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); |
| 1267 GCTestHelper::WaitForFinalizationTasks(); |
1245 EXPECT_EQ(40, peer8); | 1268 EXPECT_EQ(40, peer8); |
1246 EXPECT_EQ(41, peer16); | 1269 EXPECT_EQ(41, peer16); |
1247 Isolate::Current()->heap()->CollectGarbage(Heap::kNew); | 1270 Isolate::Current()->heap()->CollectGarbage(Heap::kNew); |
| 1271 GCTestHelper::WaitForFinalizationTasks(); |
1248 EXPECT_EQ(80, peer8); | 1272 EXPECT_EQ(80, peer8); |
1249 EXPECT_EQ(82, peer16); | 1273 EXPECT_EQ(82, peer16); |
1250 } | 1274 } |
1251 } | 1275 } |
1252 | 1276 |
1253 | 1277 |
1254 TEST_CASE(ExternalStringPretenure) { | 1278 TEST_CASE(ExternalStringPretenure) { |
1255 { | 1279 { |
1256 Dart_EnterScope(); | 1280 Dart_EnterScope(); |
1257 static const uint8_t big_data8[16*MB] = {0, }; | 1281 static const uint8_t big_data8[16*MB] = {0, }; |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2374 ARRAY_SIZE(data)); | 2398 ARRAY_SIZE(data)); |
2375 Dart_NewWeakPersistentHandle( | 2399 Dart_NewWeakPersistentHandle( |
2376 obj, &peer, sizeof(data), ExternalTypedDataFinalizer); | 2400 obj, &peer, sizeof(data), ExternalTypedDataFinalizer); |
2377 EXPECT_VALID(obj); | 2401 EXPECT_VALID(obj); |
2378 Dart_ExitScope(); | 2402 Dart_ExitScope(); |
2379 } | 2403 } |
2380 { | 2404 { |
2381 TransitionNativeToVM transition(thread); | 2405 TransitionNativeToVM transition(thread); |
2382 EXPECT(peer == 0); | 2406 EXPECT(peer == 0); |
2383 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); | 2407 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); |
| 2408 GCTestHelper::WaitForFinalizationTasks(); |
2384 EXPECT(peer == 0); | 2409 EXPECT(peer == 0); |
2385 Isolate::Current()->heap()->CollectGarbage(Heap::kNew); | 2410 Isolate::Current()->heap()->CollectGarbage(Heap::kNew); |
| 2411 GCTestHelper::WaitForFinalizationTasks(); |
2386 EXPECT(peer == 42); | 2412 EXPECT(peer == 42); |
2387 } | 2413 } |
2388 } | 2414 } |
2389 | 2415 |
2390 | 2416 |
2391 static void CheckFloat32x4Data(Dart_Handle obj) { | 2417 static void CheckFloat32x4Data(Dart_Handle obj) { |
2392 void* raw_data = NULL; | 2418 void* raw_data = NULL; |
2393 intptr_t len; | 2419 intptr_t len; |
2394 Dart_TypedData_Type type; | 2420 Dart_TypedData_Type type; |
2395 EXPECT_VALID(Dart_TypedDataAcquireData(obj, &type, &raw_data, &len)); | 2421 EXPECT_VALID(Dart_TypedDataAcquireData(obj, &type, &raw_data, &len)); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2432 Dart_Handle lcl = Dart_NewExternalTypedData( | 2458 Dart_Handle lcl = Dart_NewExternalTypedData( |
2433 Dart_TypedData_kFloat32x4, data, 10); | 2459 Dart_TypedData_kFloat32x4, data, 10); |
2434 Dart_NewWeakPersistentHandle( | 2460 Dart_NewWeakPersistentHandle( |
2435 lcl, &peer, sizeof(data), ExternalTypedDataFinalizer); | 2461 lcl, &peer, sizeof(data), ExternalTypedDataFinalizer); |
2436 CheckFloat32x4Data(lcl); | 2462 CheckFloat32x4Data(lcl); |
2437 } | 2463 } |
2438 Dart_ExitScope(); | 2464 Dart_ExitScope(); |
2439 { | 2465 { |
2440 TransitionNativeToVM transition(thread); | 2466 TransitionNativeToVM transition(thread); |
2441 Isolate::Current()->heap()->CollectGarbage(Heap::kNew); | 2467 Isolate::Current()->heap()->CollectGarbage(Heap::kNew); |
| 2468 GCTestHelper::WaitForFinalizationTasks(); |
2442 EXPECT(peer == 42); | 2469 EXPECT(peer == 42); |
2443 } | 2470 } |
2444 } | 2471 } |
2445 | 2472 |
2446 | 2473 |
2447 // Unit test for entering a scope, creating a local handle and exiting | 2474 // Unit test for entering a scope, creating a local handle and exiting |
2448 // the scope. | 2475 // the scope. |
2449 UNIT_TEST_CASE(EnterExitScope) { | 2476 UNIT_TEST_CASE(EnterExitScope) { |
2450 TestIsolateScope __test_isolate__; | 2477 TestIsolateScope __test_isolate__; |
2451 | 2478 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2594 Dart_SetPersistentHandle(obj, ref2); | 2621 Dart_SetPersistentHandle(obj, ref2); |
2595 str ^= PersistentHandle::Cast(obj)->raw(); | 2622 str ^= PersistentHandle::Cast(obj)->raw(); |
2596 EXPECT(str.Equals(kTestString2)); | 2623 EXPECT(str.Equals(kTestString2)); |
2597 | 2624 |
2598 // Now assign Null to the persistent handle and check. | 2625 // Now assign Null to the persistent handle and check. |
2599 Dart_SetPersistentHandle(obj, Dart_Null()); | 2626 Dart_SetPersistentHandle(obj, Dart_Null()); |
2600 EXPECT(Dart_IsNull(obj)); | 2627 EXPECT(Dart_IsNull(obj)); |
2601 } | 2628 } |
2602 | 2629 |
2603 | 2630 |
2604 // Helper class to ensure new gen GC is triggered without any side effects. | |
2605 // The normal call to CollectGarbage(Heap::kNew) could potentially trigger | |
2606 // an old gen collection if there is a promotion failure and this could | |
2607 // perturb the test. | |
2608 class GCTestHelper : public AllStatic { | |
2609 public: | |
2610 static void CollectNewSpace(Heap::ApiCallbacks api_callbacks) { | |
2611 bool invoke_api_callbacks = (api_callbacks == Heap::kInvokeApiCallbacks); | |
2612 Isolate::Current()->heap()->new_space()->Scavenge(invoke_api_callbacks); | |
2613 } | |
2614 }; | |
2615 | |
2616 | |
2617 static Dart_Handle AsHandle(Dart_PersistentHandle weak) { | 2631 static Dart_Handle AsHandle(Dart_PersistentHandle weak) { |
2618 return Dart_HandleFromPersistent(weak); | 2632 return Dart_HandleFromPersistent(weak); |
2619 } | 2633 } |
2620 | 2634 |
2621 | 2635 |
2622 static Dart_Handle AsHandle(Dart_WeakPersistentHandle weak) { | 2636 static Dart_Handle AsHandle(Dart_WeakPersistentHandle weak) { |
2623 return Dart_HandleFromWeakPersistent(weak); | 2637 return Dart_HandleFromWeakPersistent(weak); |
2624 } | 2638 } |
2625 | 2639 |
2626 | 2640 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2721 EXPECT(Dart_IdentityEquals(old_ref, AsHandle(weak_old_ref))); | 2735 EXPECT(Dart_IdentityEquals(old_ref, AsHandle(weak_old_ref))); |
2722 | 2736 |
2723 // Delete local (strong) references. | 2737 // Delete local (strong) references. |
2724 Dart_ExitScope(); | 2738 Dart_ExitScope(); |
2725 } | 2739 } |
2726 | 2740 |
2727 { | 2741 { |
2728 TransitionNativeToVM transition(thread); | 2742 TransitionNativeToVM transition(thread); |
2729 // Garbage collect new space again. | 2743 // Garbage collect new space again. |
2730 GCTestHelper::CollectNewSpace(Heap::kIgnoreApiCallbacks); | 2744 GCTestHelper::CollectNewSpace(Heap::kIgnoreApiCallbacks); |
| 2745 GCTestHelper::WaitForFinalizationTasks(); |
2731 } | 2746 } |
2732 | 2747 |
2733 { | 2748 { |
2734 Dart_EnterScope(); | 2749 Dart_EnterScope(); |
2735 // Weak ref to new space object should now be cleared. | 2750 // Weak ref to new space object should now be cleared. |
2736 EXPECT(weak_new_ref == NULL); | 2751 EXPECT(weak_new_ref == NULL); |
2737 EXPECT_VALID(AsHandle(weak_old_ref)); | 2752 EXPECT_VALID(AsHandle(weak_old_ref)); |
2738 EXPECT(!Dart_IsNull(AsHandle(weak_old_ref))); | 2753 EXPECT(!Dart_IsNull(AsHandle(weak_old_ref))); |
2739 Dart_ExitScope(); | 2754 Dart_ExitScope(); |
2740 } | 2755 } |
2741 | 2756 |
2742 { | 2757 { |
2743 TransitionNativeToVM transition(thread); | 2758 TransitionNativeToVM transition(thread); |
2744 // Garbage collect old space again. | 2759 // Garbage collect old space again. |
2745 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); | 2760 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); |
| 2761 GCTestHelper::WaitForFinalizationTasks(); |
2746 } | 2762 } |
2747 | 2763 |
2748 { | 2764 { |
2749 Dart_EnterScope(); | 2765 Dart_EnterScope(); |
2750 // Weak ref to old space object should now be cleared. | 2766 // Weak ref to old space object should now be cleared. |
2751 EXPECT(weak_new_ref == NULL); | 2767 EXPECT(weak_new_ref == NULL); |
2752 EXPECT(weak_old_ref == NULL); | 2768 EXPECT(weak_old_ref == NULL); |
2753 Dart_ExitScope(); | 2769 Dart_ExitScope(); |
2754 } | 2770 } |
2755 | 2771 |
(...skipping 24 matching lines...) Expand all Loading... |
2780 WeakPersistentHandlePeerFinalizer); | 2796 WeakPersistentHandlePeerFinalizer); |
2781 EXPECT_VALID(AsHandle(weak_ref)); | 2797 EXPECT_VALID(AsHandle(weak_ref)); |
2782 EXPECT(peer == 0); | 2798 EXPECT(peer == 0); |
2783 Dart_ExitScope(); | 2799 Dart_ExitScope(); |
2784 } | 2800 } |
2785 { | 2801 { |
2786 TransitionNativeToVM transition(thread); | 2802 TransitionNativeToVM transition(thread); |
2787 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); | 2803 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); |
2788 EXPECT(peer == 0); | 2804 EXPECT(peer == 0); |
2789 GCTestHelper::CollectNewSpace(Heap::kIgnoreApiCallbacks); | 2805 GCTestHelper::CollectNewSpace(Heap::kIgnoreApiCallbacks); |
| 2806 GCTestHelper::WaitForFinalizationTasks(); |
2790 EXPECT(peer == 42); | 2807 EXPECT(peer == 42); |
2791 } | 2808 } |
2792 } | 2809 } |
2793 | 2810 |
2794 | 2811 |
2795 TEST_CASE(WeakPersistentHandleNoCallback) { | 2812 TEST_CASE(WeakPersistentHandleNoCallback) { |
2796 Dart_WeakPersistentHandle weak_ref = NULL; | 2813 Dart_WeakPersistentHandle weak_ref = NULL; |
2797 int peer = 0; | 2814 int peer = 0; |
2798 { | 2815 { |
2799 Dart_EnterScope(); | 2816 Dart_EnterScope(); |
2800 Dart_Handle obj = NewString("new string"); | 2817 Dart_Handle obj = NewString("new string"); |
2801 EXPECT_VALID(obj); | 2818 EXPECT_VALID(obj); |
2802 weak_ref = Dart_NewWeakPersistentHandle(obj, &peer, 0, | 2819 weak_ref = Dart_NewWeakPersistentHandle(obj, &peer, 0, |
2803 WeakPersistentHandlePeerFinalizer); | 2820 WeakPersistentHandlePeerFinalizer); |
2804 Dart_ExitScope(); | 2821 Dart_ExitScope(); |
2805 } | 2822 } |
2806 // A finalizer is not invoked on a deleted handle. Therefore, the | 2823 // A finalizer is not invoked on a deleted handle. Therefore, the |
2807 // peer value should not change after the referent is collected. | 2824 // peer value should not change after the referent is collected. |
2808 Dart_Isolate isolate = reinterpret_cast<Dart_Isolate>(Isolate::Current()); | 2825 Dart_Isolate isolate = reinterpret_cast<Dart_Isolate>(Isolate::Current()); |
2809 Dart_DeleteWeakPersistentHandle(isolate, weak_ref); | 2826 Dart_DeleteWeakPersistentHandle(isolate, weak_ref); |
2810 EXPECT(peer == 0); | 2827 EXPECT(peer == 0); |
2811 { | 2828 { |
2812 TransitionNativeToVM transition(thread); | 2829 TransitionNativeToVM transition(thread); |
2813 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); | 2830 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); |
2814 EXPECT(peer == 0); | 2831 EXPECT(peer == 0); |
2815 GCTestHelper::CollectNewSpace(Heap::kIgnoreApiCallbacks); | 2832 GCTestHelper::CollectNewSpace(Heap::kIgnoreApiCallbacks); |
| 2833 GCTestHelper::WaitForFinalizationTasks(); |
2816 EXPECT(peer == 0); | 2834 EXPECT(peer == 0); |
2817 } | 2835 } |
2818 } | 2836 } |
2819 | 2837 |
2820 | 2838 |
2821 UNIT_TEST_CASE(WeakPersistentHandlesCallbackShutdown) { | 2839 UNIT_TEST_CASE(WeakPersistentHandlesCallbackShutdown) { |
2822 TestCase::CreateTestIsolate(); | 2840 TestCase::CreateTestIsolate(); |
2823 Dart_EnterScope(); | 2841 Dart_EnterScope(); |
2824 Dart_Handle ref = Dart_True(); | 2842 Dart_Handle ref = Dart_True(); |
2825 int peer = 1234; | 2843 int peer = 1234; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2866 Dart_ExitScope(); | 2884 Dart_ExitScope(); |
2867 } | 2885 } |
2868 { | 2886 { |
2869 TransitionNativeToVM transition(thread); | 2887 TransitionNativeToVM transition(thread); |
2870 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); | 2888 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); |
2871 EXPECT(heap->ExternalInWords(Heap::kNew) == | 2889 EXPECT(heap->ExternalInWords(Heap::kNew) == |
2872 (kWeak1ExternalSize + kWeak2ExternalSize) / kWordSize); | 2890 (kWeak1ExternalSize + kWeak2ExternalSize) / kWordSize); |
2873 // Collect weakly referenced string, and promote strongly referenced string. | 2891 // Collect weakly referenced string, and promote strongly referenced string. |
2874 GCTestHelper::CollectNewSpace(Heap::kIgnoreApiCallbacks); | 2892 GCTestHelper::CollectNewSpace(Heap::kIgnoreApiCallbacks); |
2875 GCTestHelper::CollectNewSpace(Heap::kIgnoreApiCallbacks); | 2893 GCTestHelper::CollectNewSpace(Heap::kIgnoreApiCallbacks); |
| 2894 GCTestHelper::WaitForFinalizationTasks(); |
2876 EXPECT(heap->ExternalInWords(Heap::kNew) == 0); | 2895 EXPECT(heap->ExternalInWords(Heap::kNew) == 0); |
2877 EXPECT(heap->ExternalInWords(Heap::kOld) == kWeak2ExternalSize / kWordSize); | 2896 EXPECT(heap->ExternalInWords(Heap::kOld) == kWeak2ExternalSize / kWordSize); |
2878 } | 2897 } |
2879 Dart_Isolate isolate = reinterpret_cast<Dart_Isolate>(Isolate::Current()); | 2898 Dart_Isolate isolate = reinterpret_cast<Dart_Isolate>(Isolate::Current()); |
2880 Dart_DeleteWeakPersistentHandle(isolate, weak1); | 2899 Dart_DeleteWeakPersistentHandle(isolate, weak1); |
2881 Dart_DeleteWeakPersistentHandle(isolate, weak2); | 2900 Dart_DeleteWeakPersistentHandle(isolate, weak2); |
2882 Dart_DeletePersistentHandle(strong_ref); | 2901 Dart_DeletePersistentHandle(strong_ref); |
2883 { | 2902 { |
2884 TransitionNativeToVM transition(thread); | 2903 TransitionNativeToVM transition(thread); |
2885 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); | 2904 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); |
| 2905 GCTestHelper::WaitForFinalizationTasks(); |
2886 EXPECT(heap->ExternalInWords(Heap::kOld) == 0); | 2906 EXPECT(heap->ExternalInWords(Heap::kOld) == 0); |
2887 } | 2907 } |
2888 } | 2908 } |
2889 | 2909 |
2890 | 2910 |
2891 TEST_CASE(WeakPersistentHandleExternalAllocationSizeNewspaceGC) { | 2911 TEST_CASE(WeakPersistentHandleExternalAllocationSizeNewspaceGC) { |
2892 Dart_Isolate isolate = reinterpret_cast<Dart_Isolate>(Isolate::Current()); | 2912 Dart_Isolate isolate = reinterpret_cast<Dart_Isolate>(Isolate::Current()); |
2893 Heap* heap = Isolate::Current()->heap(); | 2913 Heap* heap = Isolate::Current()->heap(); |
2894 Dart_WeakPersistentHandle weak1 = NULL; | 2914 Dart_WeakPersistentHandle weak1 = NULL; |
2895 // Large enough to exceed any new space limit. Not actually allocated. | 2915 // Large enough to exceed any new space limit. Not actually allocated. |
(...skipping 25 matching lines...) Expand all Loading... |
2921 EXPECT(handle.IsOld()); | 2941 EXPECT(handle.IsOld()); |
2922 } | 2942 } |
2923 EXPECT(heap->ExternalInWords(Heap::kNew) == 0); | 2943 EXPECT(heap->ExternalInWords(Heap::kNew) == 0); |
2924 EXPECT(heap->ExternalInWords(Heap::kOld) == kWeak1ExternalSize / kWordSize); | 2944 EXPECT(heap->ExternalInWords(Heap::kOld) == kWeak1ExternalSize / kWordSize); |
2925 Dart_ExitScope(); | 2945 Dart_ExitScope(); |
2926 } | 2946 } |
2927 Dart_DeleteWeakPersistentHandle(isolate, weak1); | 2947 Dart_DeleteWeakPersistentHandle(isolate, weak1); |
2928 { | 2948 { |
2929 TransitionNativeToVM transition(thread); | 2949 TransitionNativeToVM transition(thread); |
2930 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); | 2950 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); |
| 2951 GCTestHelper::WaitForFinalizationTasks(); |
2931 EXPECT(heap->ExternalInWords(Heap::kOld) == 0); | 2952 EXPECT(heap->ExternalInWords(Heap::kOld) == 0); |
2932 } | 2953 } |
2933 } | 2954 } |
2934 | 2955 |
2935 | 2956 |
2936 TEST_CASE(WeakPersistentHandleExternalAllocationSizeOldspaceGC) { | 2957 TEST_CASE(WeakPersistentHandleExternalAllocationSizeOldspaceGC) { |
2937 // Check that external allocation in old space can trigger GC. | 2958 // Check that external allocation in old space can trigger GC. |
2938 Isolate* isolate = Isolate::Current(); | 2959 Isolate* isolate = Isolate::Current(); |
2939 Dart_EnterScope(); | 2960 Dart_EnterScope(); |
2940 Dart_Handle live = Api::NewHandle(thread, String::New("live", Heap::kOld)); | 2961 Dart_Handle live = Api::NewHandle(thread, String::New("live", Heap::kOld)); |
(...skipping 7140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10081 result = Dart_Invoke(lib, | 10102 result = Dart_Invoke(lib, |
10082 NewString("foozoo"), | 10103 NewString("foozoo"), |
10083 0, | 10104 0, |
10084 NULL); | 10105 NULL); |
10085 EXPECT(Dart_IsError(result)); | 10106 EXPECT(Dart_IsError(result)); |
10086 } | 10107 } |
10087 | 10108 |
10088 #endif // !PRODUCT | 10109 #endif // !PRODUCT |
10089 | 10110 |
10090 } // namespace dart | 10111 } // namespace dart |
OLD | NEW |