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

Unified Diff: src/mark-compact.cc

Issue 187683002: Make sure that we grow the slots buffer when we are in evacuation scope. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 7aaad0e8d720bbbbd4e1f292e8a8dbc3da01e7ef..02d3553d5fec858d300e9a692a92237dac88b6f3 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -74,7 +74,8 @@ MarkCompactCollector::MarkCompactCollector(Heap* heap) : // NOLINT
heap_(heap),
code_flusher_(NULL),
encountered_weak_collections_(NULL),
- have_code_to_deoptimize_(false) { }
+ have_code_to_deoptimize_(false),
+ evacuation_scope_(0) { }
#ifdef VERIFY_HEAP
class VerifyMarkingVisitor: public ObjectVisitor {
@@ -2842,7 +2843,8 @@ void MarkCompactCollector::MigrateObject(Address dst,
if (heap_->InNewSpace(value)) {
heap_->store_buffer()->Mark(dst_slot);
} else if (value->IsHeapObject() && IsOnEvacuationCandidate(value)) {
- SlotsBuffer::AddTo(&slots_buffer_allocator_,
+ SlotsBuffer::AddTo(heap_,
+ &slots_buffer_allocator_,
&migration_slots_buffer_,
reinterpret_cast<Object**>(dst_slot),
SlotsBuffer::IGNORE_OVERFLOW);
@@ -2857,7 +2859,8 @@ void MarkCompactCollector::MigrateObject(Address dst,
Address code_entry = Memory::Address_at(code_entry_slot);
if (Page::FromAddress(code_entry)->IsEvacuationCandidate()) {
- SlotsBuffer::AddTo(&slots_buffer_allocator_,
+ SlotsBuffer::AddTo(heap_,
+ &slots_buffer_allocator_,
&migration_slots_buffer_,
SlotsBuffer::CODE_ENTRY_SLOT,
code_entry_slot,
@@ -2867,7 +2870,8 @@ void MarkCompactCollector::MigrateObject(Address dst,
} else if (dest == CODE_SPACE) {
PROFILE(isolate(), CodeMoveEvent(src, dst));
heap()->MoveBlock(dst, src, size);
- SlotsBuffer::AddTo(&slots_buffer_allocator_,
+ SlotsBuffer::AddTo(heap_,
+ &slots_buffer_allocator_,
&migration_slots_buffer_,
SlotsBuffer::RELOCATED_CODE_OBJECT,
dst,
@@ -3474,9 +3478,8 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() {
{ GCTracer::Scope gc_scope(tracer_,
GCTracer::Scope::MC_UPDATE_POINTERS_TO_EVACUATED);
- SlotsBuffer::UpdateSlotsRecordedIn(heap_,
- migration_slots_buffer_,
- code_slots_filtering_required);
+ migration_slots_buffer_->UpdateSlotsRecordedIn(
+ code_slots_filtering_required);
if (FLAG_trace_fragmentation) {
PrintF(" migration slots buffer: %d\n",
SlotsBuffer::SizeOfChain(migration_slots_buffer_));
@@ -3508,9 +3511,7 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() {
p->IsFlagSet(Page::RESCAN_ON_EVACUATION));
if (p->IsEvacuationCandidate()) {
- SlotsBuffer::UpdateSlotsRecordedIn(heap_,
- p->slots_buffer(),
- code_slots_filtering_required);
+ p->slots_buffer()->UpdateSlotsRecordedIn(code_slots_filtering_required);
if (FLAG_trace_fragmentation) {
PrintF(" page %p slots buffer: %d\n",
reinterpret_cast<void*>(p),
@@ -4214,6 +4215,7 @@ void MarkCompactCollector::SweepSpaces() {
}
if (sweep_precisely_) how_to_sweep = PRECISE;
+ EvacuationScope no_evacuation(this);
Michael Starzinger 2014/03/06 10:47:25 nit: The naming of this scope (the local variable,
// Unlink evacuation candidates before sweeper threads access the list of
// pages to avoid race condition.
UnlinkEvacuationCandidates();
@@ -4332,27 +4334,6 @@ bool SlotsBuffer::IsTypedSlot(ObjectSlot slot) {
}
-bool SlotsBuffer::AddTo(SlotsBufferAllocator* allocator,
- SlotsBuffer** buffer_address,
- SlotType type,
- Address addr,
- AdditionMode mode) {
- SlotsBuffer* buffer = *buffer_address;
- if (buffer == NULL || !buffer->HasSpaceForTypedSlot()) {
- if (mode == FAIL_ON_OVERFLOW && ChainLengthThresholdReached(buffer)) {
- allocator->DeallocateChain(buffer_address);
- return false;
- }
- buffer = allocator->AllocateBuffer(buffer);
- *buffer_address = buffer;
- }
- ASSERT(buffer->HasSpaceForTypedSlot());
- buffer->Add(reinterpret_cast<ObjectSlot>(type));
- buffer->Add(reinterpret_cast<ObjectSlot>(addr));
- return true;
-}
-
-
static inline SlotsBuffer::SlotType SlotTypeForRMode(RelocInfo::Mode rmode) {
if (RelocInfo::IsCodeTarget(rmode)) {
return SlotsBuffer::CODE_TARGET_SLOT;
@@ -4373,7 +4354,8 @@ void MarkCompactCollector::RecordRelocSlot(RelocInfo* rinfo, Object* target) {
if (target_page->IsEvacuationCandidate() &&
(rinfo->host() == NULL ||
!ShouldSkipEvacuationSlotRecording(rinfo->host()))) {
- if (!SlotsBuffer::AddTo(&slots_buffer_allocator_,
+ if (!SlotsBuffer::AddTo(heap_,
+ &slots_buffer_allocator_,
target_page->slots_buffer_address(),
SlotTypeForRMode(rinfo->rmode()),
rinfo->pc(),
@@ -4388,7 +4370,8 @@ void MarkCompactCollector::RecordCodeEntrySlot(Address slot, Code* target) {
Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target));
if (target_page->IsEvacuationCandidate() &&
!ShouldSkipEvacuationSlotRecording(reinterpret_cast<Object**>(slot))) {
- if (!SlotsBuffer::AddTo(&slots_buffer_allocator_,
+ if (!SlotsBuffer::AddTo(heap_,
+ &slots_buffer_allocator_,
target_page->slots_buffer_address(),
SlotsBuffer::CODE_ENTRY_SLOT,
slot,
@@ -4419,17 +4402,17 @@ static inline SlotsBuffer::SlotType DecodeSlotType(
}
-void SlotsBuffer::UpdateSlots(Heap* heap) {
- PointersUpdatingVisitor v(heap);
+void SlotsBuffer::UpdateSlots() {
+ PointersUpdatingVisitor v(heap_);
for (int slot_idx = 0; slot_idx < idx_; ++slot_idx) {
ObjectSlot slot = slots_[slot_idx];
if (!IsTypedSlot(slot)) {
- PointersUpdatingVisitor::UpdateSlot(heap, slot);
+ PointersUpdatingVisitor::UpdateSlot(heap_, slot);
} else {
++slot_idx;
ASSERT(slot_idx < idx_);
- UpdateSlot(heap->isolate(),
+ UpdateSlot(heap_->isolate(),
&v,
DecodeSlotType(slot),
reinterpret_cast<Address>(slots_[slot_idx]));
@@ -4438,21 +4421,21 @@ void SlotsBuffer::UpdateSlots(Heap* heap) {
}
-void SlotsBuffer::UpdateSlotsWithFilter(Heap* heap) {
- PointersUpdatingVisitor v(heap);
+void SlotsBuffer::UpdateSlotsWithFilter() {
+ PointersUpdatingVisitor v(heap_);
for (int slot_idx = 0; slot_idx < idx_; ++slot_idx) {
ObjectSlot slot = slots_[slot_idx];
if (!IsTypedSlot(slot)) {
if (!IsOnInvalidatedCodeObject(reinterpret_cast<Address>(slot))) {
- PointersUpdatingVisitor::UpdateSlot(heap, slot);
+ PointersUpdatingVisitor::UpdateSlot(heap_, slot);
}
} else {
++slot_idx;
ASSERT(slot_idx < idx_);
Address pc = reinterpret_cast<Address>(slots_[slot_idx]);
if (!IsOnInvalidatedCodeObject(pc)) {
- UpdateSlot(heap->isolate(),
+ UpdateSlot(heap_->isolate(),
&v,
DecodeSlotType(slot),
reinterpret_cast<Address>(slots_[slot_idx]));
@@ -4462,8 +4445,9 @@ void SlotsBuffer::UpdateSlotsWithFilter(Heap* heap) {
}
-SlotsBuffer* SlotsBufferAllocator::AllocateBuffer(SlotsBuffer* next_buffer) {
- return new SlotsBuffer(next_buffer);
+SlotsBuffer* SlotsBufferAllocator::AllocateBuffer(Heap* heap,
+ SlotsBuffer* next_buffer) {
+ return new SlotsBuffer(heap, next_buffer);
}

Powered by Google App Engine
This is Rietveld 408576698