Reviewers: Michael Lippautz,
Description:
Record slots in large objects.
BUG=
Please review this at https://codereview.chromium.org/1296713007/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+47, -28 lines):
M src/heap/gc-tracer.h
M src/heap/gc-tracer.cc
M src/heap/incremental-marking.cc
M src/heap/mark-compact.cc
M test/cctest/cctest.h
M test/cctest/test-heap.cc
Index: src/heap/gc-tracer.cc
diff --git a/src/heap/gc-tracer.cc b/src/heap/gc-tracer.cc
index
3b8e24b4743980f58d14f88c79eea07b5fe57c86..a8e0134e7975ca10d2a81af460260a98e1471eb0
100644
--- a/src/heap/gc-tracer.cc
+++ b/src/heap/gc-tracer.cc
@@ -429,8 +429,6 @@ void GCTracer::PrintNVP() const {
PrintF("sweepcode=%.2f ", current_.scopes[Scope::MC_SWEEP_CODE]);
PrintF("sweepcell=%.2f ", current_.scopes[Scope::MC_SWEEP_CELL]);
PrintF("sweepmap=%.2f ", current_.scopes[Scope::MC_SWEEP_MAP]);
- PrintF("rescan_lo=%.2f ",
- current_.scopes[Scope::MC_RESCAN_LARGE_OBJECTS]);
PrintF("evacuate=%.1f ", current_.scopes[Scope::MC_EVACUATE_PAGES]);
PrintF("new_new=%.1f ",
current_.scopes[Scope::MC_UPDATE_NEW_TO_NEW_POINTERS]);
Index: src/heap/gc-tracer.h
diff --git a/src/heap/gc-tracer.h b/src/heap/gc-tracer.h
index
7572059dc980626c696b6ab9f15e749b9d94a292..e1f5199bbb64e194481b3cf3b15c049d03795ba0
100644
--- a/src/heap/gc-tracer.h
+++ b/src/heap/gc-tracer.h
@@ -105,7 +105,6 @@ class GCTracer {
MC_SWEEP_CODE,
MC_SWEEP_CELL,
MC_SWEEP_MAP,
- MC_RESCAN_LARGE_OBJECTS,
MC_EVACUATE_PAGES,
MC_UPDATE_NEW_TO_NEW_POINTERS,
MC_UPDATE_ROOT_TO_NEW_POINTERS,
Index: src/heap/incremental-marking.cc
diff --git a/src/heap/incremental-marking.cc
b/src/heap/incremental-marking.cc
index
544ee7458baf075324f7f5220506171bfc44289f..305373f05651dbbec29d8dd8a1983a8174e85c1d
100644
--- a/src/heap/incremental-marking.cc
+++ b/src/heap/incremental-marking.cc
@@ -297,12 +297,6 @@ void
IncrementalMarking::SetOldSpacePageFlags(MemoryChunk* chunk,
if (is_marking) {
chunk->SetFlag(MemoryChunk::POINTERS_TO_HERE_ARE_INTERESTING);
chunk->SetFlag(MemoryChunk::POINTERS_FROM_HERE_ARE_INTERESTING);
-
- // It's difficult to filter out slots recorded for large objects.
- if (chunk->owner()->identity() == LO_SPACE &&
- chunk->size() > static_cast<size_t>(Page::kPageSize) &&
is_compacting) {
- chunk->SetFlag(MemoryChunk::RESCAN_ON_EVACUATION);
- }
} else {
chunk->ClearFlag(MemoryChunk::POINTERS_TO_HERE_ARE_INTERESTING);
chunk->SetFlag(MemoryChunk::POINTERS_FROM_HERE_ARE_INTERESTING);
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index
6a0c9d58cd3d852f7a8f4228d339b3127a1e99fa..a930b5d1b3a623924e90378c070f67612422ac34
100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -3636,24 +3636,6 @@ void
MarkCompactCollector::EvacuateNewSpaceAndCandidates() {
PrintF(" migration slots buffer: %d\n",
SlotsBuffer::SizeOfChain(migration_slots_buffer_));
}
-
- if (compacting_ && was_marked_incrementally_) {
- GCTracer::Scope gc_scope(heap()->tracer(),
- GCTracer::Scope::MC_RESCAN_LARGE_OBJECTS);
- // It's difficult to filter out slots recorded for large objects.
- LargeObjectIterator it(heap_->lo_space());
- for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) {
- // LargeObjectSpace is not swept yet thus we have to skip
- // dead objects explicitly.
- if (!IsMarked(obj)) continue;
-
- Page* p = Page::FromAddress(obj->address());
- if (p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) {
- obj->Iterate(&updating_visitor);
- p->ClearFlag(Page::RESCAN_ON_EVACUATION);
- }
- }
- }
}
int npages = evacuation_candidates_.length();
Index: test/cctest/cctest.h
diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h
index
5c19195208eaaa88b3647c0559dab2691ce9f2f3..98719f938f2d4c75e13007834c6b1da974f62911
100644
--- a/test/cctest/cctest.h
+++ b/test/cctest/cctest.h
@@ -555,7 +555,8 @@ static inline void
SimulateFullSpace(v8::internal::PagedSpace* space) {
// Helper function that simulates many incremental marking steps until
// marking is completed.
-static inline void SimulateIncrementalMarking(i::Heap* heap) {
+static inline void SimulateIncrementalMarking(i::Heap* heap,
+ bool complete = true) {
i::MarkCompactCollector* collector = heap->mark_compact_collector();
i::IncrementalMarking* marking = heap->incremental_marking();
if (collector->sweeping_in_progress()) {
@@ -566,6 +567,8 @@ static inline void SimulateIncrementalMarking(i::Heap*
heap) {
marking->Start(i::Heap::kNoGCFlags);
}
CHECK(marking->IsMarking());
+ if (!complete) return;
+
while (!marking->IsComplete()) {
marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD);
if (marking->IsReadyToOverApproximateWeakClosure()) {
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index
1c09752b726e4a2cfe32ff36b698086edc60b78c..e6e13147bb0364c74a0089f3ad401f5c36d93a1d
100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -4648,6 +4648,49 @@ TEST(Regress514122) {
}
+TEST(LargeObjectSlotRecording) {
+ CcTest::InitializeVM();
+ Isolate* isolate = CcTest::i_isolate();
+ Heap* heap = isolate->heap();
+ HandleScope scope(isolate);
+
+ // Create an object on an evacuation candidate.
+ SimulateFullSpace(heap->old_space());
+ Handle<FixedArray> lit = isolate->factory()->NewFixedArray(4, TENURED);
+ Page* evac_page = Page::FromAddress(lit->address());
+ FLAG_manual_evacuation_candidates_selection = true;
+ evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING);
+ FixedArray* old_location = *lit;
+
+ // Allocate a large object.
+ const int kSize = 1000000;
+ Handle<FixedArray> lo = isolate->factory()->NewFixedArray(kSize,
TENURED);
+ CHECK(heap->lo_space()->Contains(*lo));
+
+ // Start incremental marking to active write barrier.
+ SimulateIncrementalMarking(heap, false);
+ heap->AdvanceIncrementalMarking(10000000, 10000000,
+ IncrementalMarking::IdleStepActions());
+
+ // Create references from the large object to the object on the
evacuation
+ // candidate.
+ const int kStep = kSize / 10;
+ for (int i = 0; i < kSize; i += kStep) {
+ lo->set(i, *lit);
+ CHECK(lo->get(i) == old_location);
+ }
+
+ // Move the evaucation candidate object.
+ CcTest::heap()->CollectAllGarbage();
+
+ // Verify that the pointers in the large object got updated.
+ for (int i = 0; i < kSize; i += kStep) {
+ CHECK_EQ(lo->get(i), *lit);
+ CHECK(lo->get(i) != old_location);
+ }
+}
+
+
class DummyVisitor : public ObjectVisitor {
public:
void VisitPointers(Object** start, Object** end) { }
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.