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

Side by Side Diff: test/cctest/test-mark-compact.cc

Issue 3011009: Add a check that weak object handle is not in NEAR_DEATH state after weak callback invocation. (Closed)
Patch Set: Addressing Mads' comments Created 10 years, 5 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
« no previous file with comments | « test/cctest/test-heap.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 266
267 CHECK(Heap::CollectGarbage(0, OLD_POINTER_SPACE)); 267 CHECK(Heap::CollectGarbage(0, OLD_POINTER_SPACE));
268 CHECK_EQ(1, gc_starts); 268 CHECK_EQ(1, gc_starts);
269 CHECK_EQ(gc_ends, gc_starts); 269 CHECK_EQ(gc_ends, gc_starts);
270 } 270 }
271 271
272 272
273 static int NumberOfWeakCalls = 0; 273 static int NumberOfWeakCalls = 0;
274 static void WeakPointerCallback(v8::Persistent<v8::Value> handle, void* id) { 274 static void WeakPointerCallback(v8::Persistent<v8::Value> handle, void* id) {
275 NumberOfWeakCalls++; 275 NumberOfWeakCalls++;
276 handle.Dispose();
276 } 277 }
277 278
278 TEST(ObjectGroups) { 279 TEST(ObjectGroups) {
279 InitializeVM(); 280 InitializeVM();
280 281
281 NumberOfWeakCalls = 0; 282 NumberOfWeakCalls = 0;
282 v8::HandleScope handle_scope; 283 v8::HandleScope handle_scope;
283 284
284 Handle<Object> g1s1 = 285 Handle<Object> g1s1 =
285 GlobalHandles::Create(Heap::AllocateFixedArray(1)); 286 GlobalHandles::Create(Heap::AllocateFixedArray(1));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 Object** g2_objects[] = { g2s1.location(), g2s2.location() }; 333 Object** g2_objects[] = { g2s1.location(), g2s2.location() };
333 GlobalHandles::AddGroup(g1_objects, 2); 334 GlobalHandles::AddGroup(g1_objects, 2);
334 GlobalHandles::AddGroup(g2_objects, 2); 335 GlobalHandles::AddGroup(g2_objects, 2);
335 } 336 }
336 337
337 CHECK(Heap::CollectGarbage(0, OLD_POINTER_SPACE)); 338 CHECK(Heap::CollectGarbage(0, OLD_POINTER_SPACE));
338 339
339 // All objects should be gone. 5 global handles in total. 340 // All objects should be gone. 5 global handles in total.
340 CHECK_EQ(5, NumberOfWeakCalls); 341 CHECK_EQ(5, NumberOfWeakCalls);
341 } 342 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698