| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 | 6 |
| 7 #include "vm/assert.h" | 7 #include "vm/assert.h" |
| 8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
| 9 #include "vm/dart_api_state.h" | 9 #include "vm/dart_api_state.h" |
| 10 #include "vm/thread.h" | 10 #include "vm/thread.h" |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 | 757 |
| 758 // Make sure that the value transferred. | 758 // Make sure that the value transferred. |
| 759 EXPECT(Dart_IsBoolean(obj2)); | 759 EXPECT(Dart_IsBoolean(obj2)); |
| 760 bool value = false; | 760 bool value = false; |
| 761 Dart_Handle result = Dart_BooleanValue(obj2, &value); | 761 Dart_Handle result = Dart_BooleanValue(obj2, &value); |
| 762 EXPECT_VALID(result); | 762 EXPECT_VALID(result); |
| 763 EXPECT(value); | 763 EXPECT(value); |
| 764 } | 764 } |
| 765 | 765 |
| 766 | 766 |
| 767 #if defined(TARGET_ARCH_IA32) // only ia32 can run execution tests. |
| 768 |
| 767 TEST_CASE(WeakPersistentHandle) { | 769 TEST_CASE(WeakPersistentHandle) { |
| 768 Dart_Handle weak_new_ref = Dart_Null(); | 770 Dart_Handle weak_new_ref = Dart_Null(); |
| 769 EXPECT(Dart_IsNull(weak_new_ref)); | 771 EXPECT(Dart_IsNull(weak_new_ref)); |
| 770 | 772 |
| 771 Dart_Handle weak_old_ref = Dart_Null(); | 773 Dart_Handle weak_old_ref = Dart_Null(); |
| 772 EXPECT(Dart_IsNull(weak_old_ref)); | 774 EXPECT(Dart_IsNull(weak_old_ref)); |
| 773 | 775 |
| 774 bool is_same; | 776 bool is_same; |
| 775 | 777 |
| 776 { | 778 { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 // garbage collect old space again | 860 // garbage collect old space again |
| 859 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); | 861 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); |
| 860 | 862 |
| 861 // weak ref to old space object should now be cleared | 863 // weak ref to old space object should now be cleared |
| 862 EXPECT_VALID(weak_new_ref); | 864 EXPECT_VALID(weak_new_ref); |
| 863 EXPECT(Dart_IsNull(weak_new_ref)); | 865 EXPECT(Dart_IsNull(weak_new_ref)); |
| 864 EXPECT_VALID(weak_old_ref); | 866 EXPECT_VALID(weak_old_ref); |
| 865 EXPECT(Dart_IsNull(weak_old_ref)); | 867 EXPECT(Dart_IsNull(weak_old_ref)); |
| 866 } | 868 } |
| 867 | 869 |
| 870 #endif |
| 871 |
| 868 | 872 |
| 869 // Unit test for creating multiple scopes and local handles within them. | 873 // Unit test for creating multiple scopes and local handles within them. |
| 870 // Ensure that the local handles get all cleaned out when exiting the | 874 // Ensure that the local handles get all cleaned out when exiting the |
| 871 // scope. | 875 // scope. |
| 872 UNIT_TEST_CASE(LocalHandles) { | 876 UNIT_TEST_CASE(LocalHandles) { |
| 873 TestCase::CreateTestIsolate(); | 877 TestCase::CreateTestIsolate(); |
| 874 Isolate* isolate = Isolate::Current(); | 878 Isolate* isolate = Isolate::Current(); |
| 875 EXPECT(isolate != NULL); | 879 EXPECT(isolate != NULL); |
| 876 ApiState* state = isolate->api_state(); | 880 ApiState* state = isolate->api_state(); |
| 877 EXPECT(state != NULL); | 881 EXPECT(state != NULL); |
| (...skipping 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3068 EXPECT_EQ(3, interrupt_count); | 3072 EXPECT_EQ(3, interrupt_count); |
| 3069 | 3073 |
| 3070 // Give the spawned thread enough time to properly exit. | 3074 // Give the spawned thread enough time to properly exit. |
| 3071 OS::Sleep(20); | 3075 OS::Sleep(20); |
| 3072 Isolate::SetInterruptCallback(saved); | 3076 Isolate::SetInterruptCallback(saved); |
| 3073 } | 3077 } |
| 3074 | 3078 |
| 3075 #endif // TARGET_ARCH_IA32. | 3079 #endif // TARGET_ARCH_IA32. |
| 3076 | 3080 |
| 3077 } // namespace dart | 3081 } // namespace dart |
| OLD | NEW |