Chromium Code Reviews| Index: src/heap/mark-compact.cc |
| diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc |
| index 77d084266264fbd78f56bc16115818a92b223ff4..be9f9a971c8fdd513f8138b7ef4c9714734bd7f8 100644 |
| --- a/src/heap/mark-compact.cc |
| +++ b/src/heap/mark-compact.cc |
| @@ -712,6 +712,7 @@ void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) { |
| int count = 0; |
| int fragmentation = 0; |
| + int page_number = 0; |
| Candidate* least = NULL; |
| PageIterator it(space); |
| @@ -726,9 +727,16 @@ void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) { |
| CHECK(p->slots_buffer() == NULL); |
| if (FLAG_stress_compaction) { |
| - unsigned int counter = space->heap()->ms_count(); |
| - uintptr_t page_number = reinterpret_cast<uintptr_t>(p) >> kPageSizeBits; |
| - if ((counter & 1) == (page_number & 1)) fragmentation = 1; |
| + if (FLAG_manual_evacuation_candidates_selection) { |
| + if (p->IsFlagSet(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING)) { |
| + p->ClearFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); |
| + fragmentation = 1; |
| + } |
| + } else { |
| + unsigned int counter = space->heap()->ms_count(); |
| + if ((counter & 1) == (page_number & 1)) fragmentation = 1; |
| + page_number++; |
| + } |
| } else if (mode == REDUCE_MEMORY_FOOTPRINT) { |
| // Don't try to release too many pages. |
| if (estimated_release >= over_reserved) { |
| @@ -4281,6 +4289,40 @@ bool SlotsBuffer::AddTo(SlotsBufferAllocator* allocator, |
| } |
| +void SlotsBuffer::RemoveSlot(SlotsBuffer* buffer, ObjectSlot slot_to_remove) { |
|
Hannes Payer (out of office)
2015/03/03 09:48:53
I think it would be more efficient to just clear t
Igor Sheludko
2015/03/04 14:54:19
Done.
|
| + DCHECK(!IsTypedSlot(slot_to_remove)); |
| + while (buffer != NULL) { |
| + intptr_t written = 0; |
| + intptr_t length = buffer->idx_; |
| + |
| + ObjectSlot* slots = buffer->slots_; |
| + for (int slot_idx = 0; slot_idx < length; ++slot_idx) { |
| + ObjectSlot slot = slots[slot_idx]; |
| + if (!IsTypedSlot(slot)) { |
| + if (slot != slot_to_remove) { |
| + if (written != slot_idx) slots[written] = slot; |
| + ++written; |
| + } |
| + } else { |
| + ++slot_idx; |
| + DCHECK(slot_idx < length); |
| + ObjectSlot typed_slot = slots[slot_idx]; |
| + if (typed_slot != slot_to_remove) { |
| + if (written != slot_idx - 1) { |
| + slots[written++] = slot; |
| + slots[written++] = typed_slot; |
| + } else { |
| + written += 2; |
| + } |
| + } |
| + } |
| + } |
| + buffer->idx_ = written; |
| + buffer = buffer->next_; |
| + } |
| +} |
| + |
| + |
| static inline SlotsBuffer::SlotType SlotTypeForRMode(RelocInfo::Mode rmode) { |
| if (RelocInfo::IsCodeTarget(rmode)) { |
| return SlotsBuffer::CODE_TARGET_SLOT; |