LibGC+Everywhere: Factor out a LibGC from LibJS

Resulting in a massive rename across almost everywhere! Alongside the
namespace change, we now have the following names:

 * JS::NonnullGCPtr -> GC::Ref
 * JS::GCPtr -> GC::Ptr
 * JS::HeapFunction -> GC::Function
 * JS::CellImpl -> GC::Cell
 * JS::Handle -> GC::Root
This commit is contained in:
Shannon Booth 2024-11-15 04:01:23 +13:00 committed by Andreas Kling
parent ce23efc5f6
commit f87041bf3a
Notes: github-actions[bot] 2024-11-15 13:50:17 +00:00
1722 changed files with 9939 additions and 9906 deletions

View file

@ -9,9 +9,9 @@
namespace JS {
JS_DEFINE_ALLOCATOR(FinalizationRegistry);
GC_DEFINE_ALLOCATOR(FinalizationRegistry);
FinalizationRegistry::FinalizationRegistry(Realm& realm, NonnullGCPtr<JobCallback> cleanup_callback, Object& prototype)
FinalizationRegistry::FinalizationRegistry(Realm& realm, GC::Ref<JobCallback> cleanup_callback, Object& prototype)
: Object(ConstructWithPrototypeTag::Tag, prototype)
, WeakContainer(heap())
, m_realm(realm)
@ -47,7 +47,7 @@ bool FinalizationRegistry::remove_by_token(Cell& unregister_token)
return removed;
}
void FinalizationRegistry::remove_dead_cells(Badge<Heap>)
void FinalizationRegistry::remove_dead_cells(Badge<GC::Heap>)
{
auto any_cells_were_removed = false;
for (auto& record : m_records) {
@ -62,7 +62,7 @@ void FinalizationRegistry::remove_dead_cells(Badge<Heap>)
}
// 9.13 CleanupFinalizationRegistry ( finalizationRegistry ), https://tc39.es/ecma262/#sec-cleanup-finalization-registry
ThrowCompletionOr<void> FinalizationRegistry::cleanup(JS::GCPtr<JobCallback> callback)
ThrowCompletionOr<void> FinalizationRegistry::cleanup(GC::Ptr<JobCallback> callback)
{
auto& vm = this->vm();
@ -79,7 +79,7 @@ ThrowCompletionOr<void> FinalizationRegistry::cleanup(JS::GCPtr<JobCallback> cal
continue;
// b. Remove cell from finalizationRegistry.[[Cells]].
MarkedVector<Value> arguments(vm.heap());
GC::MarkedVector<Value> arguments(vm.heap());
arguments.append(it->held_value);
it.remove(m_records);