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

@ -17,7 +17,7 @@
namespace JS {
JS_DEFINE_ALLOCATOR(ObjectConstructor);
GC_DEFINE_ALLOCATOR(ObjectConstructor);
ObjectConstructor::ObjectConstructor(Realm& realm)
: NativeFunction(realm.vm().names.Object.as_string(), realm.intrinsics().function_prototype())
@ -67,7 +67,7 @@ ThrowCompletionOr<Value> ObjectConstructor::call()
}
// 20.1.1.1 Object ( [ value ] ), https://tc39.es/ecma262/#sec-object-value
ThrowCompletionOr<NonnullGCPtr<Object>> ObjectConstructor::construct(FunctionObject& new_target)
ThrowCompletionOr<GC::Ref<Object>> ObjectConstructor::construct(FunctionObject& new_target)
{
auto& vm = this->vm();
auto& realm = *vm.current_realm();
@ -93,7 +93,7 @@ enum class GetOwnPropertyKeysType {
};
// 20.1.2.11.1 GetOwnPropertyKeys ( O, type ), https://tc39.es/ecma262/#sec-getownpropertykeys
static ThrowCompletionOr<MarkedVector<Value>> get_own_property_keys(VM& vm, Value value, GetOwnPropertyKeysType type)
static ThrowCompletionOr<GC::MarkedVector<Value>> get_own_property_keys(VM& vm, Value value, GetOwnPropertyKeysType type)
{
// 1. Let obj be ? ToObject(O).
auto object = TRY(value.to_object(vm));
@ -102,7 +102,7 @@ static ThrowCompletionOr<MarkedVector<Value>> get_own_property_keys(VM& vm, Valu
auto keys = TRY(object->internal_own_property_keys());
// 3. Let nameList be a new empty List.
auto name_list = MarkedVector<Value> { vm.heap() };
auto name_list = GC::MarkedVector<Value> { vm.heap() };
// 4. For each element nextKey of keys, do
for (auto& next_key : keys) {
@ -382,7 +382,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::group_by)
auto callback_function = vm.argument(1);
// 1. Let groups be ? GroupBy(items, callbackfn, property).
auto groups = TRY((JS::group_by<OrderedHashMap<PropertyKey, MarkedVector<Value>>, PropertyKey>(vm, items, callback_function)));
auto groups = TRY((JS::group_by<OrderedHashMap<PropertyKey, GC::MarkedVector<Value>>, PropertyKey>(vm, items, callback_function)));
// 2. Let obj be OrdinaryObjectCreate(null).
auto object = Object::create(realm, nullptr);