Bug 990336 - Deduplicate subsequent pushes to the store buffer; r=jonco

--HG--
extra : rebase_source : 7f7418c4e90ab292a39aa3931b25bb7a0a89634b
This commit is contained in:
Terrence Cole 2014-04-08 10:23:56 -07:00
parent c342de8dfe
commit 9043eb77b7
2 changed files with 5 additions and 1 deletions

View File

@ -142,7 +142,7 @@ class BumpChunk
} }
void *peek(size_t n) { void *peek(size_t n) {
if (bumpBase() - bump < ptrdiff_t(n)) if (bump - bumpBase() < ptrdiff_t(n))
return nullptr; return nullptr;
return bump - n; return bump - n;
} }

View File

@ -134,6 +134,10 @@ class StoreBuffer
void put(StoreBuffer *owner, const T &t) { void put(StoreBuffer *owner, const T &t) {
JS_ASSERT(storage_); JS_ASSERT(storage_);
T *tip = storage_->peek<T>();
if (tip && tip->canMergeWith(t))
return tip->mergeInplace(t);
T *tp = storage_->new_<T>(t); T *tp = storage_->new_<T>(t);
if (!tp) if (!tp)
CrashAtUnhandlableOOM("Failed to allocate for MonoTypeBuffer::put."); CrashAtUnhandlableOOM("Failed to allocate for MonoTypeBuffer::put.");