1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 13:37:10 +09:00

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

@ -19,11 +19,11 @@
namespace Web::WebAssembly {
JS_DEFINE_ALLOCATOR(Instance);
GC_DEFINE_ALLOCATOR(Instance);
WebIDL::ExceptionOr<JS::NonnullGCPtr<Instance>> Instance::construct_impl(JS::Realm& realm, Module& module, Optional<JS::Handle<JS::Object>>& import_object_handle)
WebIDL::ExceptionOr<GC::Ref<Instance>> Instance::construct_impl(JS::Realm& realm, Module& module, Optional<GC::Root<JS::Object>>& import_object_handle)
{
JS::GCPtr<JS::Object> import_object = import_object_handle.has_value() ? import_object_handle.value().ptr() : nullptr;
GC::Ptr<JS::Object> import_object = import_object_handle.has_value() ? import_object_handle.value().ptr() : nullptr;
auto& vm = realm.vm();
@ -48,7 +48,7 @@ void Instance::initialize(JS::Realm& realm)
for (auto& export_ : m_module_instance->exports()) {
export_.value().visit(
[&](Wasm::FunctionAddress const& address) {
Optional<JS::GCPtr<JS::FunctionObject>> object = m_function_instances.get(address);
Optional<GC::Ptr<JS::FunctionObject>> object = m_function_instances.get(address);
if (!object.has_value()) {
object = Detail::create_native_function(vm, address, export_.name(), this);
m_function_instances.set(address, *object);
@ -57,7 +57,7 @@ void Instance::initialize(JS::Realm& realm)
m_exports->define_direct_property(export_.name(), *object, JS::default_attributes);
},
[&](Wasm::MemoryAddress const& address) {
Optional<JS::GCPtr<Memory>> object = m_memory_instances.get(address);
Optional<GC::Ptr<Memory>> object = m_memory_instances.get(address);
if (!object.has_value()) {
object = realm.create<Memory>(realm, address);
m_memory_instances.set(address, *object);
@ -66,7 +66,7 @@ void Instance::initialize(JS::Realm& realm)
m_exports->define_direct_property(export_.name(), *object, JS::default_attributes);
},
[&](Wasm::TableAddress const& address) {
Optional<JS::GCPtr<Table>> object = m_table_instances.get(address);
Optional<GC::Ptr<Table>> object = m_table_instances.get(address);
if (!object.has_value()) {
object = realm.create<Table>(realm, address);
m_table_instances.set(address, *object);