diff --git a/js/public/ProfilingFrameIterator.h b/js/public/ProfilingFrameIterator.h index 46946c3715..1f9d52d04b 100644 --- a/js/public/ProfilingFrameIterator.h +++ b/js/public/ProfilingFrameIterator.h @@ -54,8 +54,6 @@ class JS_PUBLIC_API(ProfilingFrameIterator) // activation (if any) comes around. void* savedPrevJitTop_; - JS::AutoCheckCannotGC nogc_; - static const unsigned StorageSpace = 8 * sizeof(void*); mozilla::AlignedStorage storage_; js::wasm::ProfilingFrameIterator& wasmIter() { @@ -139,7 +137,7 @@ class JS_PUBLIC_API(ProfilingFrameIterator) void iteratorConstruct(); void iteratorDestroy(); bool iteratorDone(); -}; +} JS_HAZ_GC_INVALIDATED; JS_FRIEND_API(bool) IsProfilingEnabledForContext(JSContext* cx); diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index cf2f7b036a..b961130bdf 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -714,13 +714,18 @@ class GCRuntime #endif // DEBUG bool isInsideUnsafeRegion() { return inUnsafeRegion != 0; } - void enterUnsafeRegion() { ++inUnsafeRegion; } + void enterUnsafeRegion() { + MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); + ++inUnsafeRegion; + } void leaveUnsafeRegion() { + MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); MOZ_ASSERT(inUnsafeRegion > 0); --inUnsafeRegion; } void verifyIsSafeToGC() { + MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); MOZ_DIAGNOSTIC_ASSERT(!isInsideUnsafeRegion(), "[AutoAssertNoGC] possible GC in GC-unsafe region"); } diff --git a/js/src/vm/Stack.cpp b/js/src/vm/Stack.cpp index b1bb8a753a..36fd998bd1 100644 --- a/js/src/vm/Stack.cpp +++ b/js/src/vm/Stack.cpp @@ -1739,8 +1739,7 @@ JS::ProfilingFrameIterator::ProfilingFrameIterator(JSContext* cx, const Register : rt_(cx), sampleBufferGen_(sampleBufferGen), activation_(nullptr), - savedPrevJitTop_(nullptr), - nogc_(cx) + savedPrevJitTop_(nullptr) { if (!cx->spsProfiler.enabled()) MOZ_CRASH("ProfilingFrameIterator called when spsProfiler not enabled for runtime.");