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

Unified Diff: test/cctest/heap/test-heap.cc

Issue 2110213003: Fix clearing of slots on large page uncommit (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: x 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/spaces.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/heap/test-heap.cc
diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc
index cc89c68cfa12820735e4b7201370507c8fef61ec..deaa6fbdf57e8f927bc9dfa8f3bca69c7b16310e 100644
--- a/test/cctest/heap/test-heap.cc
+++ b/test/cctest/heap/test-heap.cc
@@ -6814,5 +6814,67 @@ TEST(UncommitUnusedLargeObjectMemory) {
base::OS::CommitPageSize());
CHECK_EQ(shrinked_size, chunk->CommittedPhysicalMemory());
}
+
+TEST(RememberedSetRemoveRange) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ Heap* heap = CcTest::heap();
+ Isolate* isolate = heap->isolate();
+
+ Handle<FixedArray> array = isolate->factory()->NewFixedArray(500000);
+ MemoryChunk* chunk = MemoryChunk::FromAddress(array->address());
+ CHECK(chunk->owner()->identity() == LO_SPACE);
+ Address start = array->address();
+ // Maps slot to boolean indicator of whether the slot should be in the set.
+ std::map<Address, bool> slots;
+ slots[start + 0] = true;
+ slots[start + kPointerSize] = true;
+ slots[start + Page::kPageSize - kPointerSize] = true;
+ slots[start + Page::kPageSize] = true;
+ slots[start + Page::kPageSize + kPointerSize] = true;
+ slots[chunk->area_end() - kPointerSize] = true;
+
+ for (auto x : slots) {
+ RememberedSet<OLD_TO_NEW>::Insert(chunk, x.first);
+ }
+
+ RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) {
+ CHECK(slots[addr]);
+ return KEEP_SLOT;
+ });
+
+ RememberedSet<OLD_TO_NEW>::RemoveRange(chunk, start, start + kPointerSize);
+ slots[start] = false;
+ RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) {
+ CHECK(slots[addr]);
+ return KEEP_SLOT;
+ });
+
+ RememberedSet<OLD_TO_NEW>::RemoveRange(chunk, start + kPointerSize,
+ start + Page::kPageSize);
+ slots[start + kPointerSize] = false;
+ slots[start + Page::kPageSize - kPointerSize] = false;
+ RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) {
+ CHECK(slots[addr]);
+ return KEEP_SLOT;
+ });
+
+ RememberedSet<OLD_TO_NEW>::RemoveRange(
+ chunk, start, start + Page::kPageSize + kPointerSize);
+ slots[start + Page::kPageSize] = false;
+ RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) {
+ CHECK(slots[addr]);
+ return KEEP_SLOT;
+ });
+
+ RememberedSet<OLD_TO_NEW>::RemoveRange(
+ chunk, chunk->area_end() - kPointerSize, chunk->area_end());
+ slots[chunk->area_end() - kPointerSize] = false;
+ RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) {
+ CHECK(slots[addr]);
+ return KEEP_SLOT;
+ });
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/heap/spaces.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698