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

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

Issue 2183383004: Revert of [heap] Reland "Remove black pages and use black areas instead." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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/objects-inl.h ('k') | test/unittests/heap/marking-unittest.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 6769 matching lines...) Expand 10 before | Expand all | Expand 10 after
6780 } 6780 }
6781 } 6781 }
6782 CHECK(marking->IsComplete()); 6782 CHECK(marking->IsComplete());
6783 intptr_t size_before = heap->SizeOfObjects(); 6783 intptr_t size_before = heap->SizeOfObjects();
6784 CcTest::heap()->CollectAllGarbage(); 6784 CcTest::heap()->CollectAllGarbage();
6785 intptr_t size_after = heap->SizeOfObjects(); 6785 intptr_t size_after = heap->SizeOfObjects();
6786 // Live size does not increase after garbage collection. 6786 // Live size does not increase after garbage collection.
6787 CHECK_LE(size_after, size_before); 6787 CHECK_LE(size_after, size_before);
6788 } 6788 }
6789 6789
6790 TEST(LeftTrimFixedArrayInBlackArea) {
6791 FLAG_black_allocation = true;
6792 CcTest::InitializeVM();
6793 v8::HandleScope scope(CcTest::isolate());
6794 Heap* heap = CcTest::heap();
6795 Isolate* isolate = heap->isolate();
6796 heap->CollectAllGarbage();
6797
6798 i::MarkCompactCollector* collector = heap->mark_compact_collector();
6799 i::IncrementalMarking* marking = heap->incremental_marking();
6800 if (collector->sweeping_in_progress()) {
6801 collector->EnsureSweepingCompleted();
6802 }
6803 CHECK(marking->IsMarking() || marking->IsStopped());
6804 if (marking->IsStopped()) {
6805 heap->StartIncrementalMarking();
6806 }
6807 CHECK(marking->IsMarking());
6808 marking->StartBlackAllocationForTesting();
6809
6810 // Ensure that we allocate a new page, set up a bump pointer area, and
6811 // perform the allocation in a black area.
6812 heap::SimulateFullSpace(heap->old_space());
6813 isolate->factory()->NewFixedArray(4, TENURED);
6814 Handle<FixedArray> array = isolate->factory()->NewFixedArray(50, TENURED);
6815 CHECK(heap->old_space()->Contains(*array));
6816 CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(*array)));
6817
6818 // Now left trim the allocated black area. A filler has to be installed
6819 // for the trimmed area and all mark bits of the trimmed area have to be
6820 // cleared.
6821 FixedArrayBase* trimmed = heap->LeftTrimFixedArray(*array, 10);
6822 CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(trimmed)));
6823
6824 heap::GcAndSweep(heap, OLD_SPACE);
6825 }
6826
6827 TEST(Regress618958) { 6790 TEST(Regress618958) {
6828 CcTest::InitializeVM(); 6791 CcTest::InitializeVM();
6829 v8::HandleScope scope(CcTest::isolate()); 6792 v8::HandleScope scope(CcTest::isolate());
6830 Heap* heap = CcTest::heap(); 6793 Heap* heap = CcTest::heap();
6831 bool isolate_is_locked = true; 6794 bool isolate_is_locked = true;
6832 heap->update_external_memory(100 * MB); 6795 heap->update_external_memory(100 * MB);
6833 int mark_sweep_count_before = heap->ms_count(); 6796 int mark_sweep_count_before = heap->ms_count();
6834 heap->MemoryPressureNotification(MemoryPressureLevel::kCritical, 6797 heap->MemoryPressureNotification(MemoryPressureLevel::kCritical,
6835 isolate_is_locked); 6798 isolate_is_locked);
6836 int mark_sweep_count_after = heap->ms_count(); 6799 int mark_sweep_count_after = heap->ms_count();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
6922 chunk, chunk->area_end() - kPointerSize, chunk->area_end()); 6885 chunk, chunk->area_end() - kPointerSize, chunk->area_end());
6923 slots[chunk->area_end() - kPointerSize] = false; 6886 slots[chunk->area_end() - kPointerSize] = false;
6924 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { 6887 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) {
6925 CHECK(slots[addr]); 6888 CHECK(slots[addr]);
6926 return KEEP_SLOT; 6889 return KEEP_SLOT;
6927 }); 6890 });
6928 } 6891 }
6929 6892
6930 } // namespace internal 6893 } // namespace internal
6931 } // namespace v8 6894 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | test/unittests/heap/marking-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698