mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1310147 - Rename AutoAssertOnGC to AutoAssertNoGC r=sfink
This commit is contained in:
parent
15cc9318be
commit
4f90a79a0c
@ -316,7 +316,7 @@ HangMonitorChild::InterruptCallback()
|
||||
if (forcePaint) {
|
||||
RefPtr<TabChild> tabChild = TabChild::FindTabChild(forcePaintTab);
|
||||
if (tabChild) {
|
||||
JS::AutoAssertOnGC nogc(mContext);
|
||||
JS::AutoAssertNoGC nogc(mContext);
|
||||
JS::AutoAssertOnBarrier nobarrier(mContext);
|
||||
tabChild->ForcePaint(forcePaintEpoch);
|
||||
}
|
||||
|
@ -496,18 +496,22 @@ class JS_PUBLIC_API(AutoRequireNoGC)
|
||||
};
|
||||
|
||||
/**
|
||||
* Release assert if a GC occurs while this class is live. This class does
|
||||
* not disable the static rooting hazard analysis.
|
||||
* Diagnostic assert (see MOZ_DIAGNOSTIC_ASSERT) that GC cannot occur while this
|
||||
* class is live. This class does not disable the static rooting hazard
|
||||
* analysis.
|
||||
*
|
||||
* This works by entering a GC unsafe region, which is checked on allocation and
|
||||
* on GC.
|
||||
*/
|
||||
class JS_PUBLIC_API(AutoAssertOnGC) : public AutoRequireNoGC
|
||||
class JS_PUBLIC_API(AutoAssertNoGC) : public AutoRequireNoGC
|
||||
{
|
||||
js::gc::GCRuntime* gc;
|
||||
size_t gcNumber;
|
||||
|
||||
public:
|
||||
AutoAssertOnGC();
|
||||
explicit AutoAssertOnGC(JSContext* cx);
|
||||
~AutoAssertOnGC();
|
||||
AutoAssertNoGC();
|
||||
explicit AutoAssertNoGC(JSContext* cx);
|
||||
~AutoAssertNoGC();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -583,7 +587,7 @@ class JS_PUBLIC_API(AutoAssertGCCallback) : public AutoSuppressGCAnalysis
|
||||
|
||||
/**
|
||||
* Place AutoCheckCannotGC in scopes that you believe can never GC. These
|
||||
* annotations will be verified both dynamically via AutoAssertOnGC, and
|
||||
* annotations will be verified both dynamically via AutoAssertNoGC, and
|
||||
* statically with the rooting hazard analysis (implemented by making the
|
||||
* analysis consider AutoCheckCannotGC to be a GC pointer, and therefore
|
||||
* complain if it is live across a GC call.) It is useful when dealing with
|
||||
@ -594,11 +598,11 @@ class JS_PUBLIC_API(AutoAssertGCCallback) : public AutoSuppressGCAnalysis
|
||||
* We only do the assertion checking in DEBUG builds.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
class JS_PUBLIC_API(AutoCheckCannotGC) : public AutoAssertOnGC
|
||||
class JS_PUBLIC_API(AutoCheckCannotGC) : public AutoAssertNoGC
|
||||
{
|
||||
public:
|
||||
AutoCheckCannotGC() : AutoAssertOnGC() {}
|
||||
explicit AutoCheckCannotGC(JSContext* cx) : AutoAssertOnGC(cx) {}
|
||||
AutoCheckCannotGC() : AutoAssertNoGC() {}
|
||||
explicit AutoCheckCannotGC(JSContext* cx) : AutoAssertNoGC(cx) {}
|
||||
} JS_HAZ_GC_INVALIDATED;
|
||||
#else
|
||||
class JS_PUBLIC_API(AutoCheckCannotGC) : public AutoRequireNoGC
|
||||
|
@ -739,7 +739,7 @@ class GCRuntime
|
||||
|
||||
void verifyIsSafeToGC() {
|
||||
MOZ_DIAGNOSTIC_ASSERT(!isInsideUnsafeRegion(),
|
||||
"[AutoAssertOnGC] possible GC in GC-unsafe region");
|
||||
"[AutoAssertNoGC] possible GC in GC-unsafe region");
|
||||
}
|
||||
|
||||
void setAlwaysPreserveCode() { alwaysPreserveCode = true; }
|
||||
|
@ -117,8 +117,8 @@ EnterBaseline(JSContext* cx, EnterJitData& data)
|
||||
// Assert we don't GC before entering JIT code. A GC could discard JIT code
|
||||
// or move the function stored in the CalleeToken (it won't be traced at
|
||||
// this point). We use Maybe<> here so we can call reset() to call the
|
||||
// AutoAssertOnGC destructor before we enter JIT code.
|
||||
mozilla::Maybe<JS::AutoAssertOnGC> nogc;
|
||||
// AutoAssertNoGC destructor before we enter JIT code.
|
||||
mozilla::Maybe<JS::AutoAssertNoGC> nogc;
|
||||
nogc.emplace(cx);
|
||||
#endif
|
||||
|
||||
|
@ -2824,7 +2824,7 @@ EnterIon(JSContext* cx, EnterJitData& data)
|
||||
|
||||
#ifdef DEBUG
|
||||
// See comment in EnterBaseline.
|
||||
mozilla::Maybe<JS::AutoAssertOnGC> nogc;
|
||||
mozilla::Maybe<JS::AutoAssertNoGC> nogc;
|
||||
nogc.emplace(cx);
|
||||
#endif
|
||||
|
||||
@ -2961,7 +2961,7 @@ jit::FastInvoke(JSContext* cx, HandleFunction fun, CallArgs& args)
|
||||
|
||||
#ifdef DEBUG
|
||||
// See comment in EnterBaseline.
|
||||
mozilla::Maybe<JS::AutoAssertOnGC> nogc;
|
||||
mozilla::Maybe<JS::AutoAssertNoGC> nogc;
|
||||
nogc.emplace(cx);
|
||||
#endif
|
||||
|
||||
|
@ -1259,7 +1259,7 @@ MacroAssembler::initGCThing(Register obj, Register temp, JSObject* templateObj,
|
||||
}
|
||||
}
|
||||
} else if (templateObj->is<InlineTypedObject>()) {
|
||||
JS::AutoAssertOnGC nogc; // off-thread, so cannot GC
|
||||
JS::AutoAssertNoGC nogc; // off-thread, so cannot GC
|
||||
size_t nbytes = templateObj->as<InlineTypedObject>().size();
|
||||
const uint8_t* memory = templateObj->as<InlineTypedObject>().inlineTypedMem(nogc);
|
||||
|
||||
|
@ -32,11 +32,11 @@ END_TEST(testGCExactRooting)
|
||||
|
||||
BEGIN_TEST(testGCSuppressions)
|
||||
{
|
||||
JS::AutoAssertOnGC nogc;
|
||||
JS::AutoAssertNoGC nogc;
|
||||
JS::AutoCheckCannotGC checkgc;
|
||||
JS::AutoSuppressGCAnalysis noanalysis;
|
||||
|
||||
JS::AutoAssertOnGC nogcCx(cx);
|
||||
JS::AutoAssertNoGC nogcCx(cx);
|
||||
JS::AutoCheckCannotGC checkgcCx(cx);
|
||||
JS::AutoSuppressGCAnalysis noanalysisCx(cx);
|
||||
|
||||
|
@ -6995,14 +6995,14 @@ JS::GetGCNumber()
|
||||
}
|
||||
#endif
|
||||
|
||||
JS::AutoAssertOnGC::AutoAssertOnGC()
|
||||
JS::AutoAssertNoGC::AutoAssertNoGC()
|
||||
: gc(nullptr), gcNumber(0)
|
||||
{
|
||||
js::PerThreadData* data = js::TlsPerThreadData.get();
|
||||
if (data) {
|
||||
/*
|
||||
* GC's from off-thread will always assert, so off-thread is implicitly
|
||||
* AutoAssertOnGC. We still need to allow AutoAssertOnGC to be used in
|
||||
* AutoAssertNoGC. We still need to allow AutoAssertNoGC to be used in
|
||||
* code that works from both threads, however. We also use this to
|
||||
* annotate the off thread run loops.
|
||||
*/
|
||||
@ -7015,13 +7015,13 @@ JS::AutoAssertOnGC::AutoAssertOnGC()
|
||||
}
|
||||
}
|
||||
|
||||
JS::AutoAssertOnGC::AutoAssertOnGC(JSContext* cx)
|
||||
JS::AutoAssertNoGC::AutoAssertNoGC(JSContext* cx)
|
||||
: gc(&cx->gc), gcNumber(cx->gc.gcNumber())
|
||||
{
|
||||
gc->enterUnsafeRegion();
|
||||
}
|
||||
|
||||
JS::AutoAssertOnGC::~AutoAssertOnGC()
|
||||
JS::AutoAssertNoGC::~AutoAssertNoGC()
|
||||
{
|
||||
if (gc) {
|
||||
gc->leaveUnsafeRegion();
|
||||
@ -7030,7 +7030,7 @@ JS::AutoAssertOnGC::~AutoAssertOnGC()
|
||||
* The following backstop assertion should never fire: if we bumped the
|
||||
* gcNumber, we should have asserted because inUnsafeRegion was true.
|
||||
*/
|
||||
MOZ_ASSERT(gcNumber == gc->gcNumber(), "GC ran inside an AutoAssertOnGC scope.");
|
||||
MOZ_ASSERT(gcNumber == gc->gcNumber(), "GC ran inside an AutoAssertNoGC scope.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -7723,7 +7723,7 @@ GCRuntime::invokeInterruptCallback(JSContext* cx)
|
||||
{
|
||||
interruptCallbackRequested = false;
|
||||
|
||||
JS::AutoAssertOnGC nogc(cx);
|
||||
JS::AutoAssertNoGC nogc(cx);
|
||||
JS::AutoAssertOnBarrier nobarrier(cx);
|
||||
JS::AutoSuppressGCAnalysis suppress(cx);
|
||||
for (JS::GCInterruptCallback callback : interruptCallbacks) {
|
||||
|
@ -2868,7 +2868,7 @@ nsCycleCollector::ForgetSkippable(bool aRemoveChildlessNodes,
|
||||
MOZ_NEVER_INLINE void
|
||||
nsCycleCollector::MarkRoots(SliceBudget& aBudget)
|
||||
{
|
||||
JS::AutoAssertOnGC nogc;
|
||||
JS::AutoAssertNoGC nogc;
|
||||
TimeLog timeLog;
|
||||
AutoRestore<bool> ar(mScanInProgress);
|
||||
MOZ_ASSERT(!mScanInProgress);
|
||||
@ -3190,7 +3190,7 @@ nsCycleCollector::ScanBlackNodes()
|
||||
void
|
||||
nsCycleCollector::ScanRoots(bool aFullySynchGraphBuild)
|
||||
{
|
||||
JS::AutoAssertOnGC nogc;
|
||||
JS::AutoAssertNoGC nogc;
|
||||
AutoRestore<bool> ar(mScanInProgress);
|
||||
MOZ_ASSERT(!mScanInProgress);
|
||||
mScanInProgress = true;
|
||||
@ -3281,7 +3281,7 @@ nsCycleCollector::CollectWhite()
|
||||
uint32_t numWhiteJSZones = 0;
|
||||
|
||||
{
|
||||
JS::AutoAssertOnGC nogc;
|
||||
JS::AutoAssertNoGC nogc;
|
||||
bool hasJSContext = !!mJSContext;
|
||||
nsCycleCollectionParticipant* zoneParticipant =
|
||||
hasJSContext ? mJSContext->ZoneParticipant() : nullptr;
|
||||
@ -3338,7 +3338,7 @@ nsCycleCollector::CollectWhite()
|
||||
}
|
||||
timeLog.Checkpoint("CollectWhite::Unlink");
|
||||
|
||||
JS::AutoAssertOnGC nogc;
|
||||
JS::AutoAssertNoGC nogc;
|
||||
for (auto iter = whiteNodes.Iter(); !iter.Done(); iter.Next()) {
|
||||
PtrInfo* pinfo = iter.Get();
|
||||
MOZ_ASSERT(pinfo->mParticipant,
|
||||
@ -3836,7 +3836,7 @@ nsCycleCollector::BeginCollection(ccType aCCType,
|
||||
timeLog.Checkpoint("Post-FreeSnowWhite finish IGC");
|
||||
|
||||
// Set up the data structures for building the graph.
|
||||
JS::AutoAssertOnGC nogc;
|
||||
JS::AutoAssertNoGC nogc;
|
||||
JS::AutoEnterCycleCollection autocc(mJSContext->Context());
|
||||
mGraph.Init();
|
||||
mResults.Init();
|
||||
|
Loading…
Reference in New Issue
Block a user