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
Родитель fe4db66203
Коммит 1438060ab1
2 изменённых файлов: 26 добавлений и 5 удалений

Просмотреть файл

@ -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)

Просмотреть файл

@ -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()) {
compact(owner);
if (isAboutToOverflow()) if (isAboutToOverflow())
owner->setAboutToOverflow(); handleOverflow(owner);
}
} }
/* Mark the source of all edges in the store buffer. */ /* Mark the source of all edges in the store buffer. */