summaryrefslogtreecommitdiffstats
path: root/js/src/jsapi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jsapi.cpp')
-rw-r--r--js/src/jsapi.cpp24
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();