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

Unified Diff: src/mark-compact-inl.h

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
« src/mark-compact.cc ('K') | « src/mark-compact.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mark-compact-inl.h
diff --git a/src/mark-compact-inl.h b/src/mark-compact-inl.h
index a42e0f7f12eed9e1ba4caae546f0c5a9ea35ae3b..1777097251a984bd5adf1949d09b305279bbf82f 100644
--- a/src/mark-compact-inl.h
+++ b/src/mark-compact-inl.h
@@ -86,7 +86,8 @@ void MarkCompactCollector::RecordSlot(Object** anchor_slot,
Page* object_page = Page::FromAddress(reinterpret_cast<Address>(object));
if (object_page->IsEvacuationCandidate() &&
!ShouldSkipEvacuationSlotRecording(anchor_slot)) {
- if (!SlotsBuffer::AddTo(&slots_buffer_allocator_,
+ if (!SlotsBuffer::AddTo(heap_,
+ &slots_buffer_allocator_,
object_page->slots_buffer_address(),
slot,
mode)) {
@@ -96,6 +97,55 @@ void MarkCompactCollector::RecordSlot(Object** anchor_slot,
}
+bool SlotsBuffer::AddTo(Heap* heap,
+ SlotsBufferAllocator* allocator,
+ SlotsBuffer** buffer_address,
+ ObjectSlot slot,
+ AdditionMode mode) {
+ ASSERT(!heap->mark_compact_collector()->IsInsideEvacuationScope() ||
+ mode == IGNORE_OVERFLOW);
+ ASSERT(heap->mark_compact_collector()->IsInsideEvacuationScope() ||
+ mode == FAIL_ON_OVERFLOW);
Michael Starzinger 2014/03/06 10:47:25 This invariant can be expressed in one expression
+ SlotsBuffer* buffer = *buffer_address;
+ if (buffer == NULL || buffer->IsFull()) {
+ if (mode == FAIL_ON_OVERFLOW && ChainLengthThresholdReached(buffer)) {
+ allocator->DeallocateChain(buffer_address);
+ return false;
+ }
+ buffer = allocator->AllocateBuffer(heap, buffer);
+ *buffer_address = buffer;
+ }
+ buffer->Add(slot);
+ return true;
+}
+
+
+bool SlotsBuffer::AddTo(Heap* heap,
+ SlotsBufferAllocator* allocator,
+ SlotsBuffer** buffer_address,
+ SlotType type,
+ Address addr,
+ AdditionMode mode) {
+ ASSERT(!heap->mark_compact_collector()->IsInsideEvacuationScope() ||
+ mode == IGNORE_OVERFLOW);
+ ASSERT(heap->mark_compact_collector()->IsInsideEvacuationScope() ||
+ mode == FAIL_ON_OVERFLOW);
Michael Starzinger 2014/03/06 10:47:25 Likewise.
+ 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(heap, buffer);
+ *buffer_address = buffer;
+ }
+ ASSERT(buffer->HasSpaceForTypedSlot());
+ buffer->Add(reinterpret_cast<ObjectSlot>(type));
+ buffer->Add(reinterpret_cast<ObjectSlot>(addr));
+ return true;
+}
+
+
} } // namespace v8::internal
#endif // V8_MARK_COMPACT_INL_H_
« src/mark-compact.cc ('K') | « src/mark-compact.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698