Bug 961091 - Don't compact full store buffers so often after GC has been triggered r=terrence

This commit is contained in:
Jon Coppeard 2014-02-07 11:21:44 +00:00
parent 912f4637ff
commit ebca104c52
2 changed files with 26 additions and 5 deletions

View File

@ -82,6 +82,28 @@ StoreBuffer::WholeCellEdges::mark(JSTracer *trc)
/*** MonoTypeBuffer ***/ /*** MonoTypeBuffer ***/
template <typename T>
void
StoreBuffer::MonoTypeBuffer<T>::handleOverflow(StoreBuffer *owner)
{
if (!owner->isAboutToOverflow()) {
/*
* Compact the buffer now, and if that fails to free enough space then
* trigger a minor collection.
*/
compact(owner);
if (isAboutToOverflow())
owner->setAboutToOverflow();
} else {
/*
* A minor GC has already been triggered, so there's no point
* compacting unless the buffer is totally full.
*/
if (storage_->availableInCurrentChunk() < sizeof(T))
compact(owner);
}
}
template <typename T> template <typename T>
void void
StoreBuffer::MonoTypeBuffer<T>::compactRemoveDuplicates(StoreBuffer *owner) StoreBuffer::MonoTypeBuffer<T>::compactRemoveDuplicates(StoreBuffer *owner)

View File

@ -115,6 +115,8 @@ class StoreBuffer
return !storage_->isEmpty() && storage_->availableInCurrentChunk() < MinAvailableSize; return !storage_->isEmpty() && storage_->availableInCurrentChunk() < MinAvailableSize;
} }
void handleOverflow(StoreBuffer *owner);
/* Compaction algorithms. */ /* Compaction algorithms. */
void compactRemoveDuplicates(StoreBuffer *owner); void compactRemoveDuplicates(StoreBuffer *owner);
@ -135,11 +137,8 @@ class StoreBuffer
if (!tp) if (!tp)
CrashAtUnhandlableOOM("Failed to allocate for MonoTypeBuffer::put."); CrashAtUnhandlableOOM("Failed to allocate for MonoTypeBuffer::put.");
if (isAboutToOverflow()) { if (isAboutToOverflow())
compact(owner); handleOverflow(owner);
if (isAboutToOverflow())
owner->setAboutToOverflow();
}
} }
/* Mark the source of all edges in the store buffer. */ /* Mark the source of all edges in the store buffer. */