mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1310147 - Remove AutoAssertNoAlloc and replace with AutoAssertNoGC r=sfink
This commit is contained in:
parent
4f90a79a0c
commit
435bdeeaec
@ -510,6 +510,7 @@ class JS_PUBLIC_API(AutoAssertNoGC) : public AutoRequireNoGC
|
||||
|
||||
public:
|
||||
AutoAssertNoGC();
|
||||
explicit AutoAssertNoGC(JSRuntime* rt);
|
||||
explicit AutoAssertNoGC(JSContext* cx);
|
||||
~AutoAssertNoGC();
|
||||
};
|
||||
|
@ -3657,7 +3657,7 @@ SetPropertyIC::tryAttachAddSlot(JSContext* cx, HandleScript outerScript, IonScri
|
||||
// A GC may have caused cache.value() to become stale as it is not traced.
|
||||
// In this case the IonScript will have been invalidated, so check for that.
|
||||
// Assert no further GC is possible past this point.
|
||||
JS::AutoAssertNoAlloc nogc;
|
||||
JS::AutoAssertNoGC nogc;
|
||||
if (ion->invalidated())
|
||||
return true;
|
||||
|
||||
|
@ -7015,6 +7015,12 @@ JS::AutoAssertNoGC::AutoAssertNoGC()
|
||||
}
|
||||
}
|
||||
|
||||
JS::AutoAssertNoGC::AutoAssertNoGC(JSRuntime* rt)
|
||||
: gc(&rt->gc), gcNumber(rt->gc.gcNumber())
|
||||
{
|
||||
gc->enterUnsafeRegion();
|
||||
}
|
||||
|
||||
JS::AutoAssertNoGC::AutoAssertNoGC(JSContext* cx)
|
||||
: gc(&cx->gc), gcNumber(cx->gc.gcNumber())
|
||||
{
|
||||
|
@ -202,7 +202,7 @@ template <>
|
||||
class ZoneCellIter<TenuredCell> {
|
||||
ArenaIter arenaIter;
|
||||
ArenaCellIterImpl cellIter;
|
||||
JS::AutoAssertNoAlloc noAlloc;
|
||||
mozilla::Maybe<JS::AutoAssertNoGC> nogc;
|
||||
|
||||
protected:
|
||||
// For use when a subclass wants to insert some setup before init().
|
||||
@ -221,7 +221,7 @@ class ZoneCellIter<TenuredCell> {
|
||||
// that allows us to iterate.
|
||||
if (!rt->isHeapBusy()) {
|
||||
// Assert that no GCs can occur while a ZoneCellIter is live.
|
||||
noAlloc.disallowAlloc(rt);
|
||||
nogc.emplace(rt);
|
||||
}
|
||||
|
||||
// We have a single-threaded runtime, so there's no need to protect
|
||||
|
@ -1321,7 +1321,7 @@ GlobalHelperThreadState::mergeParseTaskCompartment(JSContext* cx, ParseTask* par
|
||||
// destination compartment. Finish any ongoing incremental GC first and
|
||||
// assert that no allocation can occur.
|
||||
gc::FinishGC(cx);
|
||||
JS::AutoAssertNoAlloc noAlloc(cx);
|
||||
JS::AutoAssertNoGC nogc(cx);
|
||||
|
||||
LeaveParseTaskZone(cx, parseTask);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user