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

Unified Diff: src/mark-compact.cc

Issue 7841036: Fix several bugs in compaction: (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Created 9 years, 3 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/mark-compact.h ('k') | src/objects-visiting-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 5359d8d3a2bb399086407b16a8bd6ca742c306d7..bdc891015fc0514e2dd6c86a67c215378174ee16 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -426,7 +426,6 @@ void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) {
void MarkCompactCollector::Prepare(GCTracer* tracer) {
FLAG_flush_code = false;
- FLAG_always_compact = false;
// Disable collection of maps if incremental marking is enabled.
// Map collection algorithm relies on a special map transition tree traversal
@@ -3415,16 +3414,19 @@ bool SlotsBuffer::AddTo(SlotsBufferAllocator* allocator,
SlotType type,
Address addr,
AdditionMode mode) {
- if(!AddTo(allocator,
- buffer_address,
- reinterpret_cast<ObjectSlot>(type),
- mode)) {
- return false;
+ 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;
}
- return AddTo(allocator,
- buffer_address,
- reinterpret_cast<ObjectSlot>(addr),
- mode);
+ ASSERT(buffer->HasSpaceForTypedSlot());
+ buffer->Add(reinterpret_cast<ObjectSlot>(type));
+ buffer->Add(reinterpret_cast<ObjectSlot>(addr));
+ return true;
}
@@ -3437,7 +3439,7 @@ static inline SlotsBuffer::SlotType SlotTypeForRMode(RelocInfo::Mode rmode) {
return SlotsBuffer::JS_RETURN_SLOT;
}
UNREACHABLE();
- return SlotsBuffer::NONE;
+ return SlotsBuffer::NUMBER_OF_SLOT_TYPES;
}
@@ -3445,7 +3447,8 @@ void MarkCompactCollector::RecordRelocSlot(RelocInfo* rinfo, Code* target) {
Page* target_page = Page::FromAddress(
reinterpret_cast<Address>(target));
if (target_page->IsEvacuationCandidate() &&
- !ShouldSkipEvacuationSlotRecording(rinfo->host())) {
+ (rinfo->host() == NULL ||
+ !ShouldSkipEvacuationSlotRecording(rinfo->host()))) {
if (!SlotsBuffer::AddTo(&slots_buffer_allocator_,
target_page->slots_buffer_address(),
SlotTypeForRMode(rinfo->rmode()),
@@ -3479,32 +3482,21 @@ static inline SlotsBuffer::SlotType DecodeSlotType(
}
-SlotsBuffer::SlotType SlotsBuffer::UpdateSlots(
- Heap* heap,
- SlotsBuffer::SlotType pending) {
+void SlotsBuffer::UpdateSlots(Heap* heap) {
PointersUpdatingVisitor v(heap);
- if (pending != NONE) {
- UpdateSlot(&v, pending, reinterpret_cast<Address>(slots_[0]));
- }
-
for (int slot_idx = 0; slot_idx < idx_; ++slot_idx) {
ObjectSlot slot = slots_[slot_idx];
if (!IsTypedSlot(slot)) {
UpdateSlot(slot);
} else {
++slot_idx;
- if (slot_idx < idx_) {
- UpdateSlot(&v,
- DecodeSlotType(slot),
- reinterpret_cast<Address>(slots_[slot_idx]));
- } else {
- return DecodeSlotType(slot);
- }
+ ASSERT(slot_idx < idx_);
+ UpdateSlot(&v,
+ DecodeSlotType(slot),
+ reinterpret_cast<Address>(slots_[slot_idx]));
}
}
-
- return SlotsBuffer::NONE;
}
« no previous file with comments | « src/mark-compact.h ('k') | src/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698