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

Side by Side Diff: test/cctest/test-heap.cc

Issue 16160010: remove old MakeWeak (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 | « src/profile-generator.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 416
417 Handle<Object> i = factory->NewStringFromAscii(CStrVector("fisk")); 417 Handle<Object> i = factory->NewStringFromAscii(CStrVector("fisk"));
418 Handle<Object> u = factory->NewNumber(1.12344); 418 Handle<Object> u = factory->NewNumber(1.12344);
419 419
420 h1 = global_handles->Create(*i); 420 h1 = global_handles->Create(*i);
421 h2 = global_handles->Create(*u); 421 h2 = global_handles->Create(*u);
422 } 422 }
423 423
424 global_handles->MakeWeak(h2.location(), 424 global_handles->MakeWeak(h2.location(),
425 reinterpret_cast<void*>(1234), 425 reinterpret_cast<void*>(1234),
426 &TestWeakGlobalHandleCallback, 426 &TestWeakGlobalHandleCallback);
427 NULL);
428 427
429 // Scavenge treats weak pointers as normal roots. 428 // Scavenge treats weak pointers as normal roots.
430 heap->PerformScavenge(); 429 heap->PerformScavenge();
431 430
432 CHECK((*h1)->IsString()); 431 CHECK((*h1)->IsString());
433 CHECK((*h2)->IsHeapNumber()); 432 CHECK((*h2)->IsHeapNumber());
434 433
435 CHECK(!WeakPointerCleared); 434 CHECK(!WeakPointerCleared);
436 CHECK(!global_handles->IsNearDeath(h2.location())); 435 CHECK(!global_handles->IsNearDeath(h2.location()));
437 CHECK(!global_handles->IsNearDeath(h1.location())); 436 CHECK(!global_handles->IsNearDeath(h1.location()));
(...skipping 25 matching lines...) Expand all
463 h2 = global_handles->Create(*u); 462 h2 = global_handles->Create(*u);
464 } 463 }
465 464
466 // Make sure the objects are promoted. 465 // Make sure the objects are promoted.
467 heap->CollectGarbage(OLD_POINTER_SPACE); 466 heap->CollectGarbage(OLD_POINTER_SPACE);
468 heap->CollectGarbage(NEW_SPACE); 467 heap->CollectGarbage(NEW_SPACE);
469 CHECK(!heap->InNewSpace(*h1) && !heap->InNewSpace(*h2)); 468 CHECK(!heap->InNewSpace(*h1) && !heap->InNewSpace(*h2));
470 469
471 global_handles->MakeWeak(h2.location(), 470 global_handles->MakeWeak(h2.location(),
472 reinterpret_cast<void*>(1234), 471 reinterpret_cast<void*>(1234),
473 &TestWeakGlobalHandleCallback, 472 &TestWeakGlobalHandleCallback);
474 NULL);
475 CHECK(!GlobalHandles::IsNearDeath(h1.location())); 473 CHECK(!GlobalHandles::IsNearDeath(h1.location()));
476 CHECK(!GlobalHandles::IsNearDeath(h2.location())); 474 CHECK(!GlobalHandles::IsNearDeath(h2.location()));
477 475
478 // Incremental marking potentially marked handles before they turned weak. 476 // Incremental marking potentially marked handles before they turned weak.
479 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); 477 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
480 478
481 CHECK((*h1)->IsString()); 479 CHECK((*h1)->IsString());
482 480
483 CHECK(WeakPointerCleared); 481 CHECK(WeakPointerCleared);
484 CHECK(!GlobalHandles::IsNearDeath(h1.location())); 482 CHECK(!GlobalHandles::IsNearDeath(h1.location()));
(...skipping 15 matching lines...) Expand all
500 498
501 { 499 {
502 HandleScope scope(isolate); 500 HandleScope scope(isolate);
503 501
504 Handle<Object> i = factory->NewStringFromAscii(CStrVector("fisk")); 502 Handle<Object> i = factory->NewStringFromAscii(CStrVector("fisk"));
505 h = global_handles->Create(*i); 503 h = global_handles->Create(*i);
506 } 504 }
507 505
508 global_handles->MakeWeak(h.location(), 506 global_handles->MakeWeak(h.location(),
509 reinterpret_cast<void*>(1234), 507 reinterpret_cast<void*>(1234),
510 &TestWeakGlobalHandleCallback, 508 &TestWeakGlobalHandleCallback);
511 NULL);
512 509
513 // Scanvenge does not recognize weak reference. 510 // Scanvenge does not recognize weak reference.
514 heap->PerformScavenge(); 511 heap->PerformScavenge();
515 512
516 CHECK(!WeakPointerCleared); 513 CHECK(!WeakPointerCleared);
517 514
518 // Mark-compact treats weak reference properly. 515 // Mark-compact treats weak reference properly.
519 heap->CollectGarbage(OLD_POINTER_SPACE); 516 heap->CollectGarbage(OLD_POINTER_SPACE);
520 517
521 CHECK(WeakPointerCleared); 518 CHECK(WeakPointerCleared);
(...skipping 2578 matching lines...) Expand 10 before | Expand all | Expand 10 after
3100 } 3097 }
3101 // An entire block of handles has been filled. 3098 // An entire block of handles has been filled.
3102 // Next handle would require a new block. 3099 // Next handle would require a new block.
3103 ASSERT(data->next == data->limit); 3100 ASSERT(data->next == data->limit);
3104 3101
3105 DeferredHandleScope deferred(isolate); 3102 DeferredHandleScope deferred(isolate);
3106 DummyVisitor visitor; 3103 DummyVisitor visitor;
3107 isolate->handle_scope_implementer()->Iterate(&visitor); 3104 isolate->handle_scope_implementer()->Iterate(&visitor);
3108 deferred.Detach(); 3105 deferred.Detach();
3109 } 3106 }
OLDNEW
« no previous file with comments | « src/profile-generator.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698