mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
Bug 1277174 - Forbid nursery allocations within AutoAssertEmptyNursery, r=jonco
MozReview-Commit-ID: BY3ZQt9ax6a --HG-- extra : rebase_source : 7001aaefe1590a903508fa6fe5186dff848319a8
This commit is contained in:
parent
1eb9cc2888
commit
735d4c52b9
@ -7635,6 +7635,8 @@ AutoAssertHeapBusy::checkCondition(JSRuntime *rt)
|
|||||||
|
|
||||||
void
|
void
|
||||||
AutoAssertEmptyNursery::checkCondition(JSRuntime *rt) {
|
AutoAssertEmptyNursery::checkCondition(JSRuntime *rt) {
|
||||||
|
if (!noAlloc)
|
||||||
|
noAlloc.emplace(rt);
|
||||||
this->rt = rt;
|
this->rt = rt;
|
||||||
MOZ_ASSERT(rt->gc.nursery.isEmpty());
|
MOZ_ASSERT(rt->gc.nursery.isEmpty());
|
||||||
}
|
}
|
||||||
|
@ -1385,6 +1385,8 @@ class MOZ_RAII AutoAssertEmptyNursery
|
|||||||
protected:
|
protected:
|
||||||
JSRuntime* rt;
|
JSRuntime* rt;
|
||||||
|
|
||||||
|
mozilla::Maybe<AutoAssertNoNurseryAlloc> noAlloc;
|
||||||
|
|
||||||
// Check that the nursery is empty.
|
// Check that the nursery is empty.
|
||||||
void checkCondition(JSRuntime *rt);
|
void checkCondition(JSRuntime *rt);
|
||||||
|
|
||||||
@ -1393,12 +1395,12 @@ class MOZ_RAII AutoAssertEmptyNursery
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AutoAssertEmptyNursery(JSRuntime* rt) {
|
explicit AutoAssertEmptyNursery(JSRuntime* rt) : rt(nullptr) {
|
||||||
checkCondition(rt);
|
checkCondition(rt);
|
||||||
}
|
}
|
||||||
|
|
||||||
~AutoAssertEmptyNursery() {
|
AutoAssertEmptyNursery(const AutoAssertEmptyNursery& other) : AutoAssertEmptyNursery(other.rt)
|
||||||
checkCondition(rt);
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user