mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 778993 - Separate runtime's gcMallocBytes from compartment's gcMallocBytes Bug 778993 - Separate runtime's gcMallocBytes from compartment's gcMallocBytes (r=gwagner)
This commit is contained in:
parent
ee625140f8
commit
2f97ce9b6a
@ -1161,14 +1161,15 @@ JSRuntime::setGCMaxMallocBytes(size_t value)
|
||||
void
|
||||
JSRuntime::updateMallocCounter(JSContext *cx, size_t nbytes)
|
||||
{
|
||||
/* We tolerate any thread races when updating gcMallocBytes. */
|
||||
ptrdiff_t oldCount = gcMallocBytes;
|
||||
ptrdiff_t newCount = oldCount - ptrdiff_t(nbytes);
|
||||
gcMallocBytes = newCount;
|
||||
if (JS_UNLIKELY(newCount <= 0 && oldCount > 0))
|
||||
onTooMuchMalloc();
|
||||
else if (cx && cx->compartment)
|
||||
if (cx && cx->compartment) {
|
||||
cx->compartment->updateMallocCounter(nbytes);
|
||||
} else {
|
||||
ptrdiff_t oldCount = gcMallocBytes;
|
||||
ptrdiff_t newCount = oldCount - ptrdiff_t(nbytes);
|
||||
gcMallocBytes = newCount;
|
||||
if (JS_UNLIKELY(newCount <= 0 && oldCount > 0))
|
||||
onTooMuchMalloc();
|
||||
}
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
|
@ -70,7 +70,7 @@ JSCompartment::JSCompartment(JSRuntime *rt)
|
||||
sourceMapMap(NULL),
|
||||
debugScriptMap(NULL)
|
||||
{
|
||||
setGCMaxMallocBytes(rt->gcMaxMallocBytes * 0.9);
|
||||
setGCMaxMallocBytes(rt->gcMaxMallocBytes);
|
||||
}
|
||||
|
||||
JSCompartment::~JSCompartment()
|
||||
|
Loading…
Reference in New Issue
Block a user