зеркало из https://github.com/mozilla/gecko-dev.git
Bug 650161 - Add API to disable compacting GC r=terrence
This commit is contained in:
Родитель
879b2c99c0
Коммит
466d8ba130
|
@ -285,6 +285,21 @@ DisableIncrementalGC(JSRuntime *rt);
|
|||
extern JS_FRIEND_API(bool)
|
||||
IsIncrementalGCEnabled(JSRuntime *rt);
|
||||
|
||||
/*
|
||||
* Compacting GC defaults to enabled, but may be disabled for testing or in
|
||||
* embeddings that have not implemented the necessary object moved hooks or weak
|
||||
* pointer callbacks. There is not currently a way to re-enable compacting GC
|
||||
* once it has been disabled on the runtime.
|
||||
*/
|
||||
extern JS_FRIEND_API(void)
|
||||
DisableCompactingGC(JSRuntime *rt);
|
||||
|
||||
/*
|
||||
* Returns true if compacting GC is enabled.
|
||||
*/
|
||||
extern JS_FRIEND_API(bool)
|
||||
IsCompactingGCEnabled(JSRuntime *rt);
|
||||
|
||||
/*
|
||||
* Returns true while an incremental GC is ongoing, both when actively
|
||||
* collecting and between slices.
|
||||
|
|
|
@ -444,6 +444,7 @@ class GCRuntime
|
|||
#ifdef JSGC_COMPACTING
|
||||
void disableCompactingGC();
|
||||
void enableCompactingGC();
|
||||
bool isCompactingGCEnabled();
|
||||
#endif
|
||||
|
||||
void setGrayRootsTracer(JSTraceDataOp traceOp, void *data);
|
||||
|
|
|
@ -1125,6 +1125,24 @@ JS::DisableIncrementalGC(JSRuntime *rt)
|
|||
rt->gc.disallowIncrementalGC();
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
JS::DisableCompactingGC(JSRuntime *rt)
|
||||
{
|
||||
#ifdef JSGC_COMPACTING
|
||||
rt->gc.disableCompactingGC();
|
||||
#endif
|
||||
}
|
||||
|
||||
JS_FRIEND_API(bool)
|
||||
JS::IsCompactingGCEnabled(JSRuntime *rt)
|
||||
{
|
||||
#ifdef JSGC_COMPACTING
|
||||
return rt->gc.isCompactingGCEnabled();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
JS::AutoDisableGenerationalGC::AutoDisableGenerationalGC(JSRuntime *rt)
|
||||
: gc(&rt->gc)
|
||||
#if defined(JSGC_GENERATIONAL) && defined(JS_GC_ZEAL)
|
||||
|
|
|
@ -2005,7 +2005,7 @@ bool
|
|||
GCRuntime::shouldCompact()
|
||||
{
|
||||
#ifdef JSGC_COMPACTING
|
||||
return invocationKind == GC_SHRINK && !compactingDisabled;
|
||||
return invocationKind == GC_SHRINK && isCompactingGCEnabled();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
@ -2026,6 +2026,12 @@ GCRuntime::enableCompactingGC()
|
|||
--compactingDisabled;
|
||||
}
|
||||
|
||||
bool
|
||||
GCRuntime::isCompactingGCEnabled()
|
||||
{
|
||||
return rt->gc.compactingDisabled == 0;
|
||||
}
|
||||
|
||||
AutoDisableCompactingGC::AutoDisableCompactingGC(JSRuntime *rt)
|
||||
: gc(rt->gc)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче