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

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

Issue 2236543002: [heap] Register end of black areas to support faster filtering of invalid slots. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix nit 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 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 d4ebd04898bea1c8e024c534115c3ab52faa6240..c53c77ebfa81ce80847e125e49af4f051e5198dd 100644
--- a/test/cctest/heap/test-heap.cc
+++ b/test/cctest/heap/test-heap.cc
@@ -6986,6 +6986,48 @@ TEST(ContinuousRightTrimFixedArrayInBlackArea) {
heap::GcAndSweep(heap, OLD_SPACE);
}
+TEST(SlotFilteringAfterBlackAreas) {
+ FLAG_black_allocation = true;
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ Heap* heap = CcTest::heap();
+ Isolate* isolate = heap->isolate();
+ MarkCompactCollector* mark_compact_collector = heap->mark_compact_collector();
+ heap->CollectAllGarbage();
+
+ i::MarkCompactCollector* collector = heap->mark_compact_collector();
+ i::IncrementalMarking* marking = heap->incremental_marking();
+ if (collector->sweeping_in_progress()) {
+ collector->EnsureSweepingCompleted();
+ }
+ CHECK(marking->IsMarking() || marking->IsStopped());
+ if (marking->IsStopped()) {
+ heap->StartIncrementalMarking();
+ }
+ CHECK(marking->IsMarking());
+ marking->StartBlackAllocationForTesting();
+
+ // Ensure that we allocate a new page, set up a bump pointer area, and
+ // perform the allocation in a black area.
+ heap::SimulateFullSpace(heap->old_space());
+ Handle<FixedArray> array = isolate->factory()->NewFixedArray(10, TENURED);
+ Page* page = Page::FromAddress(array->address());
+
+ // After allocation we empty the allocation info to limit the black area
+ // only on the allocated array.
+ heap->old_space()->EmptyAllocationInfo();
+
+ // Slots in the black area are part of the black object.
+ CHECK(mark_compact_collector->IsSlotInBlackObject(page, array->address()));
+ CHECK(mark_compact_collector->IsSlotInBlackObject(
+ page, array->address() + array->Size() - kPointerSize));
+
+ // Slots after the black area are not part of the black object and have to
+ // be filtered out.
+ CHECK(!mark_compact_collector->IsSlotInBlackObject(
+ page, array->address() + array->Size()));
+}
+
TEST(Regress618958) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
« 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