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

Unified Diff: src/heap/mark-compact.cc

Issue 1135353003: Factor out handling of mixed objects preprocessing after migration (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/mark-compact.h ('k') | src/objects.h » ('j') | src/objects.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index 0da364b621cb997370bbe9298d929146e59006f2..83d819b5d77af4b093882c17f9c1f40c226cf592 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -2793,6 +2793,46 @@ void MarkCompactCollector::RecordMigratedSlot(Object* value, Address slot) {
}
+void MarkCompactCollector::MigrateMixedObjectEpilog(HeapObject* dst) {
+ DCHECK(dst->MayContainMixedValues());
+ Address dst_addr = dst->address();
+ if (compacting_ && dst->IsJSFunction()) {
+ Address code_entry_slot = dst_addr + JSFunction::kCodeEntryOffset;
+ Address code_entry = Memory::Address_at(code_entry_slot);
+
+ if (Page::FromAddress(code_entry)->IsEvacuationCandidate()) {
+ SlotsBuffer::AddTo(&slots_buffer_allocator_, &migration_slots_buffer_,
+ SlotsBuffer::CODE_ENTRY_SLOT, code_entry_slot,
+ SlotsBuffer::IGNORE_OVERFLOW);
+ }
+ } else if (dst->IsConstantPoolArray()) {
+ // We special case ConstantPoolArrays since they could contain integers
+ // value entries which look like tagged pointers.
+ // TODO(mstarzinger): restructure this code to avoid this special-casing.
+ ConstantPoolArray* array = ConstantPoolArray::cast(dst);
+ ConstantPoolArray::Iterator code_iter(array, ConstantPoolArray::CODE_PTR);
+ while (!code_iter.is_finished()) {
+ Address code_entry_slot =
+ dst_addr + array->OffsetOfElementAt(code_iter.next_index());
+ Address code_entry = Memory::Address_at(code_entry_slot);
+
+ if (Page::FromAddress(code_entry)->IsEvacuationCandidate()) {
+ SlotsBuffer::AddTo(&slots_buffer_allocator_, &migration_slots_buffer_,
+ SlotsBuffer::CODE_ENTRY_SLOT, code_entry_slot,
+ SlotsBuffer::IGNORE_OVERFLOW);
+ }
+ }
+ ConstantPoolArray::Iterator heap_iter(array, ConstantPoolArray::HEAP_PTR);
+ while (!heap_iter.is_finished()) {
+ Address heap_slot =
+ dst_addr + array->OffsetOfElementAt(heap_iter.next_index());
+ Object* value = Memory::Object_at(heap_slot);
+ RecordMigratedSlot(value, heap_slot);
+ }
+ }
+}
+
+
// We scavenge new space simultaneously with sweeping. This is done in two
// passes.
//
@@ -2842,41 +2882,7 @@ void MarkCompactCollector::MigrateObject(HeapObject* dst, HeapObject* src,
src_slot += kPointerSize;
dst_slot += kPointerSize;
}
-
- if (compacting_ && dst->IsJSFunction()) {
- Address code_entry_slot = dst_addr + JSFunction::kCodeEntryOffset;
- Address code_entry = Memory::Address_at(code_entry_slot);
-
- if (Page::FromAddress(code_entry)->IsEvacuationCandidate()) {
- SlotsBuffer::AddTo(&slots_buffer_allocator_, &migration_slots_buffer_,
- SlotsBuffer::CODE_ENTRY_SLOT, code_entry_slot,
- SlotsBuffer::IGNORE_OVERFLOW);
- }
- } else if (dst->IsConstantPoolArray()) {
- // We special case ConstantPoolArrays since they could contain integers
- // value entries which look like tagged pointers.
- // TODO(mstarzinger): restructure this code to avoid this special-casing.
- ConstantPoolArray* array = ConstantPoolArray::cast(dst);
- ConstantPoolArray::Iterator code_iter(array, ConstantPoolArray::CODE_PTR);
- while (!code_iter.is_finished()) {
- Address code_entry_slot =
- dst_addr + array->OffsetOfElementAt(code_iter.next_index());
- Address code_entry = Memory::Address_at(code_entry_slot);
-
- if (Page::FromAddress(code_entry)->IsEvacuationCandidate()) {
- SlotsBuffer::AddTo(&slots_buffer_allocator_, &migration_slots_buffer_,
- SlotsBuffer::CODE_ENTRY_SLOT, code_entry_slot,
- SlotsBuffer::IGNORE_OVERFLOW);
- }
- }
- ConstantPoolArray::Iterator heap_iter(array, ConstantPoolArray::HEAP_PTR);
- while (!heap_iter.is_finished()) {
- Address heap_slot =
- dst_addr + array->OffsetOfElementAt(heap_iter.next_index());
- Object* value = Memory::Object_at(heap_slot);
- RecordMigratedSlot(value, heap_slot);
- }
- }
+ if (dst->MayContainMixedValues()) MigrateMixedObjectEpilog(dst);
Igor Sheludko 2015/05/13 12:22:59 Do we need MayContainMixedValues() at all given th
} else if (dest == CODE_SPACE) {
PROFILE(isolate(), CodeMoveEvent(src_addr, dst_addr));
heap()->MoveBlock(dst_addr, src_addr, size);
@@ -2887,6 +2893,9 @@ void MarkCompactCollector::MigrateObject(HeapObject* dst, HeapObject* src,
} else {
DCHECK(dest == NEW_SPACE);
heap()->MoveBlock(dst_addr, src_addr, size);
+ if (dst->MayContainMixedValues()) {
+ heap()->MigrateMixedObjectInNewSpaceEpilog(dst);
+ }
}
heap()->OnMoveEvent(dst, src, size);
Memory::Address_at(src_addr) = dst_addr;
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/objects.h » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698