Bug 1023035 - Improve checking for whether we are on the main thread when triggering malloc GCs, r=billm.

This commit is contained in:
Brian Hackett 2014-06-11 09:28:50 -06:00
Родитель c30e9aef10
Коммит a184af95d5
2 изменённых файлов: 7 добавлений и 4 удалений

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

@ -2145,12 +2145,17 @@ GCRuntime::triggerGC(JS::gcreason::Reason reason)
return true;
}
/*
* Don't trigger GCs if this is being called off the main thread from
* onTooMuchMalloc().
*/
if (!CurrentThreadCanAccessRuntime(rt))
return false;
/* Don't trigger GCs when allocating under the interrupt callback lock. */
if (rt->currentThreadOwnsInterruptLock())
return false;
JS_ASSERT(CurrentThreadCanAccessRuntime(rt));
/* GC is already running. */
if (rt->isHeapCollecting())
return false;

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

@ -710,8 +710,6 @@ JSRuntime::updateMallocCounter(JS::Zone *zone, size_t nbytes)
JS_FRIEND_API(void)
JSRuntime::onTooMuchMalloc()
{
if (!CurrentThreadCanAccessRuntime(this))
return;
gc.onTooMuchMalloc();
}