зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1588302 - Move heap state accessors to public/HeapAPI.h r=sfink
jspubtd.h is for type definitions so this moves the heap state functions to somewhere more suitable. Depends on D49116 Differential Revision: https://phabricator.services.mozilla.com/D49117 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2f6638a21a
Коммит
a399d6ba14
|
@ -105,6 +105,46 @@ MOZ_ALWAYS_INLINE bool IsInsideNursery(const js::gc::Cell* cell);
|
|||
|
||||
namespace JS {
|
||||
|
||||
enum class HeapState {
|
||||
Idle, // doing nothing with the GC heap
|
||||
Tracing, // tracing the GC heap without collecting, e.g.
|
||||
// IterateCompartments()
|
||||
MajorCollecting, // doing a GC of the major heap
|
||||
MinorCollecting, // doing a GC of the minor heap (nursery)
|
||||
CycleCollecting // in the "Unlink" phase of cycle collection
|
||||
};
|
||||
|
||||
JS_PUBLIC_API HeapState RuntimeHeapState();
|
||||
|
||||
static inline bool RuntimeHeapIsBusy() {
|
||||
return RuntimeHeapState() != HeapState::Idle;
|
||||
}
|
||||
|
||||
static inline bool RuntimeHeapIsTracing() {
|
||||
return RuntimeHeapState() == HeapState::Tracing;
|
||||
}
|
||||
|
||||
static inline bool RuntimeHeapIsMajorCollecting() {
|
||||
return RuntimeHeapState() == HeapState::MajorCollecting;
|
||||
}
|
||||
|
||||
static inline bool RuntimeHeapIsMinorCollecting() {
|
||||
return RuntimeHeapState() == HeapState::MinorCollecting;
|
||||
}
|
||||
|
||||
static inline bool RuntimeHeapIsCollecting(HeapState state) {
|
||||
return state == HeapState::MajorCollecting ||
|
||||
state == HeapState::MinorCollecting;
|
||||
}
|
||||
|
||||
static inline bool RuntimeHeapIsCollecting() {
|
||||
return RuntimeHeapIsCollecting(RuntimeHeapState());
|
||||
}
|
||||
|
||||
static inline bool RuntimeHeapIsCycleCollecting() {
|
||||
return RuntimeHeapState() == HeapState::CycleCollecting;
|
||||
}
|
||||
|
||||
/*
|
||||
* This list enumerates the different types of conceptual stacks we have in
|
||||
* SpiderMonkey. In reality, they all share the C stack, but we allow different
|
||||
|
|
|
@ -92,46 +92,6 @@ namespace JS {
|
|||
|
||||
struct JS_PUBLIC_API PropertyDescriptor;
|
||||
|
||||
enum class HeapState {
|
||||
Idle, // doing nothing with the GC heap
|
||||
Tracing, // tracing the GC heap without collecting, e.g.
|
||||
// IterateCompartments()
|
||||
MajorCollecting, // doing a GC of the major heap
|
||||
MinorCollecting, // doing a GC of the minor heap (nursery)
|
||||
CycleCollecting // in the "Unlink" phase of cycle collection
|
||||
};
|
||||
|
||||
JS_PUBLIC_API HeapState RuntimeHeapState();
|
||||
|
||||
static inline bool RuntimeHeapIsBusy() {
|
||||
return RuntimeHeapState() != HeapState::Idle;
|
||||
}
|
||||
|
||||
static inline bool RuntimeHeapIsTracing() {
|
||||
return RuntimeHeapState() == HeapState::Tracing;
|
||||
}
|
||||
|
||||
static inline bool RuntimeHeapIsMajorCollecting() {
|
||||
return RuntimeHeapState() == HeapState::MajorCollecting;
|
||||
}
|
||||
|
||||
static inline bool RuntimeHeapIsMinorCollecting() {
|
||||
return RuntimeHeapState() == HeapState::MinorCollecting;
|
||||
}
|
||||
|
||||
static inline bool RuntimeHeapIsCollecting(HeapState state) {
|
||||
return state == HeapState::MajorCollecting ||
|
||||
state == HeapState::MinorCollecting;
|
||||
}
|
||||
|
||||
static inline bool RuntimeHeapIsCollecting() {
|
||||
return RuntimeHeapIsCollecting(RuntimeHeapState());
|
||||
}
|
||||
|
||||
static inline bool RuntimeHeapIsCycleCollecting() {
|
||||
return RuntimeHeapState() == HeapState::CycleCollecting;
|
||||
}
|
||||
|
||||
// Decorates the Unlinking phase of CycleCollection so that accidental use
|
||||
// of barriered accessors results in assertions instead of leaks.
|
||||
class MOZ_STACK_CLASS JS_PUBLIC_API AutoEnterCycleCollection {
|
||||
|
|
Загрузка…
Ссылка в новой задаче