mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +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
|
||||
AutoAssertEmptyNursery::checkCondition(JSRuntime *rt) {
|
||||
if (!noAlloc)
|
||||
noAlloc.emplace(rt);
|
||||
this->rt = rt;
|
||||
MOZ_ASSERT(rt->gc.nursery.isEmpty());
|
||||
}
|
||||
|
@ -1385,6 +1385,8 @@ class MOZ_RAII AutoAssertEmptyNursery
|
||||
protected:
|
||||
JSRuntime* rt;
|
||||
|
||||
mozilla::Maybe<AutoAssertNoNurseryAlloc> noAlloc;
|
||||
|
||||
// Check that the nursery is empty.
|
||||
void checkCondition(JSRuntime *rt);
|
||||
|
||||
@ -1393,12 +1395,12 @@ class MOZ_RAII AutoAssertEmptyNursery
|
||||
}
|
||||
|
||||
public:
|
||||
explicit AutoAssertEmptyNursery(JSRuntime* rt) {
|
||||
explicit AutoAssertEmptyNursery(JSRuntime* rt) : rt(nullptr) {
|
||||
checkCondition(rt);
|
||||
}
|
||||
|
||||
~AutoAssertEmptyNursery() {
|
||||
checkCondition(rt);
|
||||
AutoAssertEmptyNursery(const AutoAssertEmptyNursery& other) : AutoAssertEmptyNursery(other.rt)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user