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

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

Issue 2005173003: Immediatelly promote marked objects (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Really should concentrate more Created 4 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
« no previous file with comments | « src/heap/scavenger-inl.h ('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 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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 heap->CollectGarbage(NEW_SPACE); 704 heap->CollectGarbage(NEW_SPACE);
705 705
706 CHECK(!WeakPointerCleared); 706 CHECK(!WeakPointerCleared);
707 707
708 // Mark-compact treats weak reference properly. 708 // Mark-compact treats weak reference properly.
709 heap->CollectGarbage(OLD_SPACE); 709 heap->CollectGarbage(OLD_SPACE);
710 710
711 CHECK(WeakPointerCleared); 711 CHECK(WeakPointerCleared);
712 } 712 }
713 713
714 TEST(DoNotPromoteWhiteObjectsOnScavenge) {
715 CcTest::InitializeVM();
716 Isolate* isolate = CcTest::i_isolate();
717 Heap* heap = isolate->heap();
718 Factory* factory = isolate->factory();
719
720 HandleScope scope(isolate);
721 Handle<Object> white = factory->NewStringFromStaticChars("white");
722
723 CHECK(Marking::IsWhite(Marking::MarkBitFrom(HeapObject::cast(*white))));
724
725 heap->CollectGarbage(NEW_SPACE);
726
727 CHECK(heap->InNewSpace(*white));
728 }
729
730 TEST(PromoteGreyOrBlackObjectsOnScavenge) {
731 CcTest::InitializeVM();
732 Isolate* isolate = CcTest::i_isolate();
733 Heap* heap = isolate->heap();
734 Factory* factory = isolate->factory();
735
736 HandleScope scope(isolate);
737 Handle<Object> marked = factory->NewStringFromStaticChars("marked");
738
739 IncrementalMarking* marking = heap->incremental_marking();
740 marking->Stop();
741 heap->StartIncrementalMarking();
742 while (Marking::IsWhite(Marking::MarkBitFrom(HeapObject::cast(*marked)))) {
743 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
744 IncrementalMarking::FORCE_MARKING,
745 IncrementalMarking::DO_NOT_FORCE_COMPLETION);
746 }
747
748 heap->CollectGarbage(NEW_SPACE);
749
750 CHECK(!heap->InNewSpace(*marked));
751 }
714 752
715 TEST(BytecodeArray) { 753 TEST(BytecodeArray) {
716 static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a}; 754 static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a};
717 static const int kRawBytesSize = sizeof(kRawBytes); 755 static const int kRawBytesSize = sizeof(kRawBytes);
718 static const int kFrameSize = 32; 756 static const int kFrameSize = 32;
719 static const int kParameterCount = 2; 757 static const int kParameterCount = 2;
720 758
721 i::FLAG_manual_evacuation_candidates_selection = true; 759 i::FLAG_manual_evacuation_candidates_selection = true;
722 CcTest::InitializeVM(); 760 CcTest::InitializeVM();
723 Isolate* isolate = CcTest::i_isolate(); 761 Isolate* isolate = CcTest::i_isolate();
(...skipping 5955 matching lines...) Expand 10 before | Expand all | Expand 10 after
6679 6717
6680 intptr_t size_before = heap->SizeOfObjects(); 6718 intptr_t size_before = heap->SizeOfObjects();
6681 Handle<FixedArray> array = isolate->factory()->NewFixedArray(200000); 6719 Handle<FixedArray> array = isolate->factory()->NewFixedArray(200000);
6682 array->Shrink(1); 6720 array->Shrink(1);
6683 intptr_t size_after = heap->SizeOfObjects(); 6721 intptr_t size_after = heap->SizeOfObjects();
6684 CHECK_EQ(size_after, size_before + array->Size()); 6722 CHECK_EQ(size_after, size_before + array->Size());
6685 } 6723 }
6686 6724
6687 } // namespace internal 6725 } // namespace internal
6688 } // namespace v8 6726 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/scavenger-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698