mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 990336 - Deduplicate subsequent pushes to the store buffer; r=jonco
--HG-- extra : rebase_source : 7f7418c4e90ab292a39aa3931b25bb7a0a89634b
This commit is contained in:
parent
c342de8dfe
commit
9043eb77b7
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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.");
|
||||||
|
Loading…
Reference in New Issue
Block a user