Bug 1782095 part 2 - Remove JSContext::freeLists_. r=jonco

We needed this to support off-thread atom allocation, but we no longer do that
since Stencil.

Depends on D153143

Differential Revision: https://phabricator.services.mozilla.com/D153144
This commit is contained in:
Jan de Mooij 2022-07-29 08:03:18 +00:00
Родитель 1e6378bece
Коммит 2b91483487
4 изменённых файлов: 5 добавлений и 13 удалений

Просмотреть файл

@ -349,7 +349,8 @@ template <typename T, AllowGC allowGC>
T* GCRuntime::tryNewTenuredThing(JSContext* cx, AllocKind kind,
size_t thingSize) {
// Bump allocate in the arena's current free-list span.
auto* t = reinterpret_cast<T*>(cx->freeLists().allocate(kind));
Zone* zone = cx->zone();
auto* t = reinterpret_cast<T*>(zone->arenas.freeLists().allocate(kind));
if (MOZ_UNLIKELY(!t)) {
// Get the next available free list and allocate out of it. This may
// acquire a new arena, which will lock the chunk list. If there are no
@ -490,7 +491,7 @@ void GCRuntime::startBackgroundAllocTaskIfIdle() {
/* static */
TenuredCell* GCRuntime::refillFreeList(JSContext* cx, AllocKind thingKind) {
MOZ_ASSERT(cx->freeLists().isEmpty(thingKind));
MOZ_ASSERT(cx->zone()->arenas.freeLists().isEmpty(thingKind));
MOZ_ASSERT(!cx->isHelperThreadContext());
// It should not be possible to allocate on the main thread while we are
@ -498,7 +499,8 @@ TenuredCell* GCRuntime::refillFreeList(JSContext* cx, AllocKind thingKind) {
MOZ_ASSERT(!JS::RuntimeHeapIsBusy(), "allocating while under GC");
return cx->zone()->arenas.refillFreeListAndAllocate(
cx->freeLists(), thingKind, ShouldCheckThresholds::CheckThresholds);
cx->zone()->arenas.freeLists(), thingKind,
ShouldCheckThresholds::CheckThresholds);
}
/* static */

Просмотреть файл

@ -309,7 +309,6 @@ inline void JSContext::setZone(js::Zone* zone) {
allocsThisZoneSinceMinorGC_ = 0;
zone_ = zone;
freeLists_ = zone ? &zone_->arenas.freeLists() : nullptr;
}
inline void JSContext::enterRealmOf(JSObject* target) {

Просмотреть файл

@ -952,7 +952,6 @@ JSContext::JSContext(JSRuntime* runtime, const JS::ContextOptions& options)
kind_(ContextKind::Uninitialized),
nurserySuppressions_(this),
options_(this, options),
freeLists_(this, nullptr),
freeUnusedMemory(false),
measuringExecutionTime_(this, false),
jitActivation(this, nullptr),

Просмотреть файл

@ -179,9 +179,6 @@ struct JS_PUBLIC_API JSContext : public JS::RootingContext,
js::ContextData<JS::ContextOptions> options_;
// Free lists for allocating in the current zone.
js::ContextData<js::gc::FreeLists*> freeLists_;
// This is reset each time we switch zone, then added to the variable in the
// zone when we switch away from it. This would be a js::ThreadData but we
// need to take its address.
@ -250,11 +247,6 @@ struct JS_PUBLIC_API JSContext : public JS::RootingContext,
return kind_ == js::ContextKind::HelperThread;
}
js::gc::FreeLists& freeLists() {
MOZ_ASSERT(freeLists_);
return *freeLists_;
}
template <typename T>
bool isInsideCurrentZone(T thing) const {
return thing->zoneFromAnyThread() == zone_;