mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 23:37:33 +09:00
Assert GCRuntime::enter/leaveUnsafe region is main-thread only
This commit is contained in:
parent
37f37bd489
commit
fc206f5ab1
3 changed files with 8 additions and 6 deletions
|
|
@ -54,8 +54,6 @@ class JS_PUBLIC_API(ProfilingFrameIterator)
|
||||||
// activation (if any) comes around.
|
// activation (if any) comes around.
|
||||||
void* savedPrevJitTop_;
|
void* savedPrevJitTop_;
|
||||||
|
|
||||||
JS::AutoCheckCannotGC nogc_;
|
|
||||||
|
|
||||||
static const unsigned StorageSpace = 8 * sizeof(void*);
|
static const unsigned StorageSpace = 8 * sizeof(void*);
|
||||||
mozilla::AlignedStorage<StorageSpace> storage_;
|
mozilla::AlignedStorage<StorageSpace> storage_;
|
||||||
js::wasm::ProfilingFrameIterator& wasmIter() {
|
js::wasm::ProfilingFrameIterator& wasmIter() {
|
||||||
|
|
@ -139,7 +137,7 @@ class JS_PUBLIC_API(ProfilingFrameIterator)
|
||||||
void iteratorConstruct();
|
void iteratorConstruct();
|
||||||
void iteratorDestroy();
|
void iteratorDestroy();
|
||||||
bool iteratorDone();
|
bool iteratorDone();
|
||||||
};
|
} JS_HAZ_GC_INVALIDATED;
|
||||||
|
|
||||||
JS_FRIEND_API(bool)
|
JS_FRIEND_API(bool)
|
||||||
IsProfilingEnabledForContext(JSContext* cx);
|
IsProfilingEnabledForContext(JSContext* cx);
|
||||||
|
|
|
||||||
|
|
@ -714,13 +714,18 @@ class GCRuntime
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
bool isInsideUnsafeRegion() { return inUnsafeRegion != 0; }
|
bool isInsideUnsafeRegion() { return inUnsafeRegion != 0; }
|
||||||
void enterUnsafeRegion() { ++inUnsafeRegion; }
|
void enterUnsafeRegion() {
|
||||||
|
MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt));
|
||||||
|
++inUnsafeRegion;
|
||||||
|
}
|
||||||
void leaveUnsafeRegion() {
|
void leaveUnsafeRegion() {
|
||||||
|
MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt));
|
||||||
MOZ_ASSERT(inUnsafeRegion > 0);
|
MOZ_ASSERT(inUnsafeRegion > 0);
|
||||||
--inUnsafeRegion;
|
--inUnsafeRegion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void verifyIsSafeToGC() {
|
void verifyIsSafeToGC() {
|
||||||
|
MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt));
|
||||||
MOZ_DIAGNOSTIC_ASSERT(!isInsideUnsafeRegion(),
|
MOZ_DIAGNOSTIC_ASSERT(!isInsideUnsafeRegion(),
|
||||||
"[AutoAssertNoGC] possible GC in GC-unsafe region");
|
"[AutoAssertNoGC] possible GC in GC-unsafe region");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1739,8 +1739,7 @@ JS::ProfilingFrameIterator::ProfilingFrameIterator(JSContext* cx, const Register
|
||||||
: rt_(cx),
|
: rt_(cx),
|
||||||
sampleBufferGen_(sampleBufferGen),
|
sampleBufferGen_(sampleBufferGen),
|
||||||
activation_(nullptr),
|
activation_(nullptr),
|
||||||
savedPrevJitTop_(nullptr),
|
savedPrevJitTop_(nullptr)
|
||||||
nogc_(cx)
|
|
||||||
{
|
{
|
||||||
if (!cx->spsProfiler.enabled())
|
if (!cx->spsProfiler.enabled())
|
||||||
MOZ_CRASH("ProfilingFrameIterator called when spsProfiler not enabled for runtime.");
|
MOZ_CRASH("ProfilingFrameIterator called when spsProfiler not enabled for runtime.");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue