diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
commit | 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch) | |
tree | a4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /js/src/jsapi.cpp | |
parent | Adding debian version 124.0.1-1. (diff) | |
download | firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jsapi.cpp')
-rw-r--r-- | js/src/jsapi.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 356a5687a2..77c3ae5f09 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -1289,7 +1289,7 @@ JS_PUBLIC_API void JS_RemoveExtraGCRootsTracer(JSContext* cx, } JS_PUBLIC_API JS::GCReason JS::WantEagerMinorGC(JSRuntime* rt) { - if (rt->gc.nursery().shouldCollect()) { + if (rt->gc.nursery().wantEagerCollection()) { return JS::GCReason::EAGER_NURSERY_COLLECTION; } return JS::GCReason::NO_REASON; @@ -1302,7 +1302,7 @@ JS_PUBLIC_API JS::GCReason JS::WantEagerMajorGC(JSRuntime* rt) { JS_PUBLIC_API void JS::MaybeRunNurseryCollection(JSRuntime* rt, JS::GCReason reason) { gc::GCRuntime& gc = rt->gc; - if (gc.nursery().shouldCollect()) { + if (gc.nursery().wantEagerCollection()) { gc.minorGC(reason); } } @@ -4966,7 +4966,25 @@ JS_PUBLIC_API bool JS::CopyAsyncStack(JSContext* cx, return true; } -JS_PUBLIC_API Zone* JS::GetObjectZone(JSObject* obj) { return obj->zone(); } +JS_PUBLIC_API Zone* JS::GetObjectZone(JSObject* obj) { + Zone* zone = obj->zone(); + + // Check zone pointer is valid and not a poison value. See bug 1878421. + MOZ_RELEASE_ASSERT(zone->runtimeFromMainThread()); + + return zone; +} + +JS_PUBLIC_API Zone* JS::GetTenuredGCThingZone(GCCellPtr thing) { + js::gc::Cell* cell = thing.asCell(); + MOZ_ASSERT(!js::gc::IsInsideNursery(cell)); + Zone* zone = js::gc::detail::GetTenuredGCThingZone(cell); + + // Check zone pointer is valid and not a poison value. See bug 1878421. + MOZ_RELEASE_ASSERT(zone->runtimeFromMainThread()); + + return zone; +} JS_PUBLIC_API Zone* JS::GetNurseryCellZone(gc::Cell* cell) { return cell->nurseryZone(); |