Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: runtime/vm/dart_api_impl_test.cc

Issue 9398014: Ignore deleted handles when processing weak roots. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/gc_marker.cc » ('j') | runtime/vm/gc_marker.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "platform/utils.h" 7 #include "platform/utils.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 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); 1116 Isolate::Current()->heap()->CollectGarbage(Heap::kOld);
1117 1117
1118 // weak ref to old space object should now be cleared 1118 // weak ref to old space object should now be cleared
1119 EXPECT_VALID(weak_new_ref); 1119 EXPECT_VALID(weak_new_ref);
1120 EXPECT(Dart_IsNull(weak_new_ref)); 1120 EXPECT(Dart_IsNull(weak_new_ref));
1121 EXPECT_VALID(weak_old_ref); 1121 EXPECT_VALID(weak_old_ref);
1122 EXPECT(Dart_IsNull(weak_old_ref)); 1122 EXPECT(Dart_IsNull(weak_old_ref));
1123 1123
1124 Dart_DeletePersistentHandle(weak_new_ref); 1124 Dart_DeletePersistentHandle(weak_new_ref);
1125 Dart_DeletePersistentHandle(weak_old_ref); 1125 Dart_DeletePersistentHandle(weak_old_ref);
1126
1127 // garbage collect one last time to revisit deleted handles
1128 Isolate::Current()->heap()->CollectGarbage(Heap::kNew);
1129 Isolate::Current()->heap()->CollectGarbage(Heap::kOld);
1126 } 1130 }
1127 1131
1128 1132
1129 static void WeakPersistentHandlePeerFinalizer(Dart_Handle handle, void* peer) { 1133 static void WeakPersistentHandlePeerFinalizer(Dart_Handle handle, void* peer) {
1130 *static_cast<int*>(peer) = 42; 1134 *static_cast<int*>(peer) = 42;
1131 } 1135 }
1132 1136
1133 1137
1134 TEST_CASE(WeakPersistentHandleCallback) { 1138 TEST_CASE(WeakPersistentHandleCallback) {
1135 Dart_Handle weak_ref = Dart_Null(); 1139 Dart_Handle weak_ref = Dart_Null();
(...skipping 2241 matching lines...) Expand 10 before | Expand all | Expand 10 after
3377 // We should have received the expected number of interrupts. 3381 // We should have received the expected number of interrupts.
3378 EXPECT_EQ(kInterruptCount, interrupt_count); 3382 EXPECT_EQ(kInterruptCount, interrupt_count);
3379 3383
3380 // Give the spawned thread enough time to properly exit. 3384 // Give the spawned thread enough time to properly exit.
3381 Isolate::SetInterruptCallback(saved); 3385 Isolate::SetInterruptCallback(saved);
3382 } 3386 }
3383 3387
3384 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 3388 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
3385 3389
3386 } // namespace dart 3390 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/gc_marker.cc » ('j') | runtime/vm/gc_marker.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698