LibGC: Rename MarkedVector => RootVector

Let's try to make it a bit more clear that this is a Vector of GC roots.
This commit is contained in:
Andreas Kling 2024-12-26 14:32:52 +01:00 committed by Andreas Kling
commit 3bfb0534be
Notes: github-actions[bot] 2024-12-26 18:11:36 +00:00
117 changed files with 281 additions and 281 deletions

View file

@ -97,7 +97,7 @@ ThrowCompletionOr<size_t> length_of_array_like(VM& vm, Object const& object)
}
// 7.3.20 CreateListFromArrayLike ( obj [ , elementTypes ] ), https://tc39.es/ecma262/#sec-createlistfromarraylike
ThrowCompletionOr<GC::MarkedVector<Value>> create_list_from_array_like(VM& vm, Value value, Function<ThrowCompletionOr<void>(Value)> check_value)
ThrowCompletionOr<GC::RootVector<Value>> create_list_from_array_like(VM& vm, Value value, Function<ThrowCompletionOr<void>(Value)> check_value)
{
// 1. If elementTypes is not present, set elementTypes to « Undefined, Null, Boolean, String, Symbol, Number, BigInt, Object ».
@ -111,7 +111,7 @@ ThrowCompletionOr<GC::MarkedVector<Value>> create_list_from_array_like(VM& vm, V
auto length = TRY(length_of_array_like(vm, array_like));
// 4. Let list be a new empty List.
auto list = GC::MarkedVector<Value> { vm.heap() };
auto list = GC::RootVector<Value> { vm.heap() };
list.ensure_capacity(length);
// 5. Let index be 0.

View file

@ -9,7 +9,7 @@
#include <AK/Concepts.h>
#include <AK/Forward.h>
#include <LibCrypto/Forward.h>
#include <LibGC/MarkedVector.h>
#include <LibGC/RootVector.h>
#include <LibJS/Forward.h>
#include <LibJS/Runtime/CanonicalIndex.h>
#include <LibJS/Runtime/FunctionObject.h>
@ -34,7 +34,7 @@ ThrowCompletionOr<Value> call_impl(VM&, Value function, Value this_value, Readon
ThrowCompletionOr<Value> call_impl(VM&, FunctionObject& function, Value this_value, ReadonlySpan<Value> arguments = {});
ThrowCompletionOr<GC::Ref<Object>> construct_impl(VM&, FunctionObject&, ReadonlySpan<Value> arguments = {}, FunctionObject* new_target = nullptr);
ThrowCompletionOr<size_t> length_of_array_like(VM&, Object const&);
ThrowCompletionOr<GC::MarkedVector<Value>> create_list_from_array_like(VM&, Value, Function<ThrowCompletionOr<void>(Value)> = {});
ThrowCompletionOr<GC::RootVector<Value>> create_list_from_array_like(VM&, Value, Function<ThrowCompletionOr<void>(Value)> = {});
ThrowCompletionOr<FunctionObject*> species_constructor(VM&, Object const&, FunctionObject& default_constructor);
ThrowCompletionOr<Realm*> get_function_realm(VM&, FunctionObject const&);
ThrowCompletionOr<void> initialize_bound_name(VM&, DeprecatedFlyString const&, Value, Environment*);
@ -199,7 +199,7 @@ void add_value_to_keyed_group(VM& vm, GroupsType& groups, KeyType key, Value val
}
// 2. Let group be the Record { [[Key]]: key, [[Elements]]: « value » }.
GC::MarkedVector<Value> new_elements { vm.heap() };
GC::RootVector<Value> new_elements { vm.heap() };
new_elements.append(value);
// 3. Append group as the last element of groups.

View file

@ -161,10 +161,10 @@ ThrowCompletionOr<bool> Array::set_length(PropertyDescriptor const& property_des
}
// 23.1.3.30.1 SortIndexedProperties ( obj, len, SortCompare, holes ), https://tc39.es/ecma262/#sec-sortindexedproperties
ThrowCompletionOr<GC::MarkedVector<Value>> sort_indexed_properties(VM& vm, Object const& object, size_t length, Function<ThrowCompletionOr<double>(Value, Value)> const& sort_compare, Holes holes)
ThrowCompletionOr<GC::RootVector<Value>> sort_indexed_properties(VM& vm, Object const& object, size_t length, Function<ThrowCompletionOr<double>(Value, Value)> const& sort_compare, Holes holes)
{
// 1. Let items be a new empty List.
auto items = GC::MarkedVector<Value> { vm.heap() };
auto items = GC::RootVector<Value> { vm.heap() };
// 2. Let k be 0.
// 3. Repeat, while k < len,
@ -330,7 +330,7 @@ ThrowCompletionOr<bool> Array::internal_delete(PropertyKey const& property_key)
}
// NON-STANDARD: Used to inject the ephemeral length property's key
ThrowCompletionOr<GC::MarkedVector<Value>> Array::internal_own_property_keys() const
ThrowCompletionOr<GC::RootVector<Value>> Array::internal_own_property_keys() const
{
auto& vm = this->vm();
auto keys = TRY(Object::internal_own_property_keys());

View file

@ -37,7 +37,7 @@ public:
template<typename T>
static GC::Ref<Array> create_from(Realm& realm, ReadonlySpan<T> elements, Function<Value(T const&)> map_fn)
{
auto values = GC::MarkedVector<Value> { realm.heap() };
auto values = GC::RootVector<Value> { realm.heap() };
values.ensure_capacity(elements.size());
for (auto const& element : elements)
values.append(map_fn(element));
@ -50,7 +50,7 @@ public:
virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyKey const&) const override final;
virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyKey const&, PropertyDescriptor const&, Optional<PropertyDescriptor>* precomputed_get_own_property = nullptr) override final;
virtual ThrowCompletionOr<bool> internal_delete(PropertyKey const&) override;
virtual ThrowCompletionOr<GC::MarkedVector<Value>> internal_own_property_keys() const override final;
virtual ThrowCompletionOr<GC::RootVector<Value>> internal_own_property_keys() const override final;
[[nodiscard]] bool length_is_writable() const { return m_length_writable; }
@ -68,7 +68,7 @@ enum class Holes {
ReadThroughHoles,
};
ThrowCompletionOr<GC::MarkedVector<Value>> sort_indexed_properties(VM&, Object const&, size_t length, Function<ThrowCompletionOr<double>(Value, Value)> const& sort_compare, Holes holes);
ThrowCompletionOr<GC::RootVector<Value>> sort_indexed_properties(VM&, Object const&, size_t length, Function<ThrowCompletionOr<double>(Value, Value)> const& sort_compare, Holes holes);
ThrowCompletionOr<double> compare_array_elements(VM&, Value x, Value y, FunctionObject* comparefn);
}

View file

@ -1339,15 +1339,15 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::some)
return Value(false);
}
ThrowCompletionOr<void> array_merge_sort(VM& vm, Function<ThrowCompletionOr<double>(Value, Value)> const& compare_func, GC::MarkedVector<Value>& arr_to_sort)
ThrowCompletionOr<void> array_merge_sort(VM& vm, Function<ThrowCompletionOr<double>(Value, Value)> const& compare_func, GC::RootVector<Value>& arr_to_sort)
{
// FIXME: it would probably be better to switch to insertion sort for small arrays for
// better performance
if (arr_to_sort.size() <= 1)
return {};
GC::MarkedVector<Value> left(vm.heap());
GC::MarkedVector<Value> right(vm.heap());
GC::RootVector<Value> left(vm.heap());
GC::RootVector<Value> right(vm.heap());
left.ensure_capacity(arr_to_sort.size() / 2);
right.ensure_capacity(arr_to_sort.size() / 2 + (arr_to_sort.size() & 1));

View file

@ -64,6 +64,6 @@ private:
JS_DECLARE_NATIVE_FUNCTION(with);
};
ThrowCompletionOr<void> array_merge_sort(VM&, Function<ThrowCompletionOr<double>(Value, Value)> const& compare_func, GC::MarkedVector<Value>& arr_to_sort);
ThrowCompletionOr<void> array_merge_sort(VM&, Function<ThrowCompletionOr<double>(Value, Value)> const& compare_func, GC::RootVector<Value>& arr_to_sort);
}

View file

@ -83,7 +83,7 @@ ThrowCompletionOr<GC::Ref<Object>> BoundFunction::internal_construct(ReadonlySpa
auto& bound_args = m_bound_arguments;
// 4. Let args be the list-concatenation of boundArgs and argumentsList.
auto args = GC::MarkedVector<Value> { heap() };
auto args = GC::RootVector<Value> { heap() };
args.extend(bound_args);
args.append(arguments_list.data(), arguments_list.size());

View file

@ -79,7 +79,7 @@ ThrowCompletionOr<void> FinalizationRegistry::cleanup(GC::Ptr<JobCallback> callb
continue;
// b. Remove cell from finalizationRegistry.[[Cells]].
GC::MarkedVector<Value> arguments(vm.heap());
GC::RootVector<Value> arguments(vm.heap());
arguments.append(it->held_value);
it.remove(m_records);

View file

@ -7,7 +7,7 @@
#include <AK/Function.h>
#include <AK/StringBuilder.h>
#include <AK/TypeCasts.h>
#include <LibGC/MarkedVector.h>
#include <LibGC/RootVector.h>
#include <LibJS/Runtime/AbstractOperations.h>
#include <LibJS/Runtime/BoundFunction.h>
#include <LibJS/Runtime/ECMAScriptFunctionObject.h>

View file

@ -52,12 +52,12 @@ template<typename... Args>
[[nodiscard]] ALWAYS_INLINE ThrowCompletionOr<Value> Value::invoke(VM& vm, PropertyKey const& property_key, Args... args)
{
if constexpr (sizeof...(Args) > 0) {
GC::MarkedVector<Value> arglist { vm.heap() };
GC::RootVector<Value> arglist { vm.heap() };
(..., arglist.append(move(args)));
return invoke_internal(vm, property_key, move(arglist));
}
return invoke_internal(vm, property_key, Optional<GC::MarkedVector<Value>> {});
return invoke_internal(vm, property_key, Optional<GC::RootVector<Value>> {});
}
}

View file

@ -72,7 +72,7 @@ JS_DEFINE_NATIVE_FUNCTION(Intl::get_canonical_locales)
// 1. Let ll be ? CanonicalizeLocaleList(locales).
auto locale_list = TRY(canonicalize_locale_list(vm, locales));
GC::MarkedVector<Value> marked_locale_list { vm.heap() };
GC::RootVector<Value> marked_locale_list { vm.heap() };
marked_locale_list.ensure_capacity(locale_list.size());
for (auto& locale : locale_list)

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibGC/MarkedVector.h>
#include <LibGC/RootVector.h>
#include <LibJS/Runtime/Array.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/Intl/PluralRulesPrototype.h>

View file

@ -345,10 +345,10 @@ GC::Ref<Object> create_iterator_result_object(VM& vm, Value value, bool done)
}
// 7.4.16 IteratorToList ( iteratorRecord ), https://tc39.es/ecma262/#sec-iteratortolist
ThrowCompletionOr<GC::MarkedVector<Value>> iterator_to_list(VM& vm, IteratorRecord& iterator_record)
ThrowCompletionOr<GC::RootVector<Value>> iterator_to_list(VM& vm, IteratorRecord& iterator_record)
{
// 1. Let values be a new empty List.
GC::MarkedVector<Value> values(vm.heap());
GC::RootVector<Value> values(vm.heap());
// 2. Repeat,
while (true) {

View file

@ -82,7 +82,7 @@ ThrowCompletionOr<Optional<Value>> iterator_step_value(VM&, IteratorRecord&);
Completion iterator_close(VM&, IteratorRecord const&, Completion);
Completion async_iterator_close(VM&, IteratorRecord const&, Completion);
GC::Ref<Object> create_iterator_result_object(VM&, Value, bool done);
ThrowCompletionOr<GC::MarkedVector<Value>> iterator_to_list(VM&, IteratorRecord&);
ThrowCompletionOr<GC::RootVector<Value>> iterator_to_list(VM&, IteratorRecord&);
ThrowCompletionOr<void> setter_that_ignores_prototype_properties(VM&, Value this_, Object const& home, PropertyKey const& property, Value value);
using IteratorValueCallback = Function<Optional<Completion>(Value)>;

View file

@ -717,7 +717,7 @@ JS_DEFINE_NATIVE_FUNCTION(IteratorPrototype::to_array)
auto iterated = TRY(get_iterator_direct(vm, object));
// 4. Let items be a new empty List.
GC::MarkedVector<Value> items(realm.heap());
GC::RootVector<Value> items(realm.heap());
// 5. Repeat,
while (true) {

View file

@ -94,7 +94,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapConstructor::group_by)
};
// 1. Let groups be ? GroupBy(items, callbackfn, zero).
auto groups = TRY((JS::group_by<OrderedHashMap<GC::Root<Value>, GC::MarkedVector<Value>, KeyedGroupTraits>, void>(vm, items, callback_function)));
auto groups = TRY((JS::group_by<OrderedHashMap<GC::Root<Value>, GC::RootVector<Value>, KeyedGroupTraits>, void>(vm, items, callback_function)));
// 2. Let map be ! Construct(%Map%).
auto map = Map::create(realm);

View file

@ -210,11 +210,11 @@ ThrowCompletionOr<bool> ModuleNamespaceObject::internal_delete(PropertyKey const
}
// 10.4.6.11 [[OwnPropertyKeys]] ( ), https://tc39.es/ecma262/#sec-module-namespace-exotic-objects-ownpropertykeys
ThrowCompletionOr<GC::MarkedVector<Value>> ModuleNamespaceObject::internal_own_property_keys() const
ThrowCompletionOr<GC::RootVector<Value>> ModuleNamespaceObject::internal_own_property_keys() const
{
// 1. Let exports be O.[[Exports]].
// NOTE: We only add the exports after we know the size of symbolKeys
GC::MarkedVector<Value> exports { vm().heap() };
GC::RootVector<Value> exports { vm().heap() };
// 2. Let symbolKeys be OrdinaryOwnPropertyKeys(O).
auto symbol_keys = MUST(Object::internal_own_property_keys());

View file

@ -29,7 +29,7 @@ public:
virtual ThrowCompletionOr<Value> internal_get(PropertyKey const&, Value receiver, CacheablePropertyMetadata* = nullptr, PropertyLookupPhase = PropertyLookupPhase::OwnProperty) const override;
virtual ThrowCompletionOr<bool> internal_set(PropertyKey const&, Value value, Value receiver, CacheablePropertyMetadata*) override;
virtual ThrowCompletionOr<bool> internal_delete(PropertyKey const&) override;
virtual ThrowCompletionOr<GC::MarkedVector<Value>> internal_own_property_keys() const override;
virtual ThrowCompletionOr<GC::RootVector<Value>> internal_own_property_keys() const override;
virtual void initialize(Realm&) override;
private:

View file

@ -371,7 +371,7 @@ ThrowCompletionOr<bool> Object::test_integrity_level(IntegrityLevel level) const
}
// 7.3.24 EnumerableOwnPropertyNames ( O, kind ), https://tc39.es/ecma262/#sec-enumerableownpropertynames
ThrowCompletionOr<GC::MarkedVector<Value>> Object::enumerable_own_property_names(PropertyKind kind) const
ThrowCompletionOr<GC::RootVector<Value>> Object::enumerable_own_property_names(PropertyKind kind) const
{
// NOTE: This has been flattened for readability, so some `else` branches in the
// spec text have been replaced with `continue`s in the loop below.
@ -383,7 +383,7 @@ ThrowCompletionOr<GC::MarkedVector<Value>> Object::enumerable_own_property_names
auto own_keys = TRY(internal_own_property_keys());
// 2. Let properties be a new empty List.
auto properties = GC::MarkedVector<Value> { heap() };
auto properties = GC::RootVector<Value> { heap() };
// 3. For each element key of ownKeys, do
for (auto& key : own_keys) {
@ -1070,12 +1070,12 @@ ThrowCompletionOr<bool> Object::internal_delete(PropertyKey const& property_key)
}
// 10.1.11 [[OwnPropertyKeys]] ( ), https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys
ThrowCompletionOr<GC::MarkedVector<Value>> Object::internal_own_property_keys() const
ThrowCompletionOr<GC::RootVector<Value>> Object::internal_own_property_keys() const
{
auto& vm = this->vm();
// 1. Let keys be a new empty List.
GC::MarkedVector<Value> keys { heap() };
GC::RootVector<Value> keys { heap() };
// 2. For each own property key P of O such that P is an array index, in ascending numeric index order, do
for (auto& entry : m_indexed_properties) {

View file

@ -10,7 +10,7 @@
#include <AK/Badge.h>
#include <AK/StringView.h>
#include <LibGC/CellAllocator.h>
#include <LibGC/MarkedVector.h>
#include <LibGC/RootVector.h>
#include <LibJS/Forward.h>
#include <LibJS/Heap/Cell.h>
#include <LibJS/Runtime/Completion.h>
@ -118,7 +118,7 @@ public:
ThrowCompletionOr<bool> has_own_property(PropertyKey const&) const;
ThrowCompletionOr<bool> set_integrity_level(IntegrityLevel);
ThrowCompletionOr<bool> test_integrity_level(IntegrityLevel) const;
ThrowCompletionOr<GC::MarkedVector<Value>> enumerable_own_property_names(PropertyKind kind) const;
ThrowCompletionOr<GC::RootVector<Value>> enumerable_own_property_names(PropertyKind kind) const;
ThrowCompletionOr<void> copy_data_properties(VM&, Value source, HashTable<PropertyKey> const& excluded_keys, HashTable<JS::Value> const& excluded_values = {});
ThrowCompletionOr<GC::Ref<Object>> snapshot_own_properties(VM&, GC::Ptr<Object> prototype, HashTable<PropertyKey> const& excluded_keys = {}, HashTable<Value> const& excluded_values = {});
@ -146,7 +146,7 @@ public:
virtual ThrowCompletionOr<Value> internal_get(PropertyKey const&, Value receiver, CacheablePropertyMetadata* = nullptr, PropertyLookupPhase = PropertyLookupPhase::OwnProperty) const;
virtual ThrowCompletionOr<bool> internal_set(PropertyKey const&, Value value, Value receiver, CacheablePropertyMetadata* = nullptr);
virtual ThrowCompletionOr<bool> internal_delete(PropertyKey const&);
virtual ThrowCompletionOr<GC::MarkedVector<Value>> internal_own_property_keys() const;
virtual ThrowCompletionOr<GC::RootVector<Value>> internal_own_property_keys() const;
// NOTE: Any subclass of Object that overrides property access slots ([[Get]], [[Set]] etc)
// to customize access to indexed properties (properties where the name is a positive integer)

View file

@ -93,7 +93,7 @@ enum class GetOwnPropertyKeysType {
};
// 20.1.2.11.1 GetOwnPropertyKeys ( O, type ), https://tc39.es/ecma262/#sec-getownpropertykeys
static ThrowCompletionOr<GC::MarkedVector<Value>> get_own_property_keys(VM& vm, Value value, GetOwnPropertyKeysType type)
static ThrowCompletionOr<GC::RootVector<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<GC::MarkedVector<Value>> get_own_property_keys(VM& vm,
auto keys = TRY(object->internal_own_property_keys());
// 3. Let nameList be a new empty List.
auto name_list = GC::MarkedVector<Value> { vm.heap() };
auto name_list = GC::RootVector<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, GC::MarkedVector<Value>>, PropertyKey>(vm, items, callback_function)));
auto groups = TRY((JS::group_by<OrderedHashMap<PropertyKey, GC::RootVector<Value>>, PropertyKey>(vm, items, callback_function)));
// 2. Let obj be OrdinaryObjectCreate(null).
auto object = Object::create(realm, nullptr);

View file

@ -681,7 +681,7 @@ ThrowCompletionOr<bool> ProxyObject::internal_delete(PropertyKey const& property
}
// 10.5.11 [[OwnPropertyKeys]] ( ), https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
ThrowCompletionOr<GC::MarkedVector<Value>> ProxyObject::internal_own_property_keys() const
ThrowCompletionOr<GC::RootVector<Value>> ProxyObject::internal_own_property_keys() const
{
LIMIT_PROXY_RECURSION_DEPTH();
@ -732,10 +732,10 @@ ThrowCompletionOr<GC::MarkedVector<Value>> ProxyObject::internal_own_property_ke
// 13. Assert: targetKeys contains no duplicate entries.
// 14. Let targetConfigurableKeys be a new empty List.
auto target_configurable_keys = GC::MarkedVector<Value> { heap() };
auto target_configurable_keys = GC::RootVector<Value> { heap() };
// 15. Let targetNonconfigurableKeys be a new empty List.
auto target_nonconfigurable_keys = GC::MarkedVector<Value> { heap() };
auto target_nonconfigurable_keys = GC::RootVector<Value> { heap() };
// 16. For each element key of targetKeys, do
for (auto& key : target_keys) {
@ -763,7 +763,7 @@ ThrowCompletionOr<GC::MarkedVector<Value>> ProxyObject::internal_own_property_ke
}
// 18. Let uncheckedResultKeys be a List whose elements are the elements of trapResult.
auto unchecked_result_keys = GC::MarkedVector<Value> { heap() };
auto unchecked_result_keys = GC::RootVector<Value> { heap() };
unchecked_result_keys.extend(trap_result);
// 19. For each element key of targetNonconfigurableKeys, do

View file

@ -42,7 +42,7 @@ public:
virtual ThrowCompletionOr<Value> internal_get(PropertyKey const&, Value receiver, CacheablePropertyMetadata*, PropertyLookupPhase) const override;
virtual ThrowCompletionOr<bool> internal_set(PropertyKey const&, Value value, Value receiver, CacheablePropertyMetadata*) override;
virtual ThrowCompletionOr<bool> internal_delete(PropertyKey const&) override;
virtual ThrowCompletionOr<GC::MarkedVector<Value>> internal_own_property_keys() const override;
virtual ThrowCompletionOr<GC::RootVector<Value>> internal_own_property_keys() const override;
virtual ThrowCompletionOr<Value> internal_call(Value this_argument, ReadonlySpan<Value> arguments_list) override;
virtual ThrowCompletionOr<GC::Ref<Object>> internal_construct(ReadonlySpan<Value> arguments_list, FunctionObject& new_target) override;

View file

@ -669,7 +669,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace)
}
// 10. Let results be a new empty List.
GC::MarkedVector<Object*> results(vm.heap());
GC::RootVector<Object*> results(vm.heap());
// 11. Let done be false.
// 12. Repeat, while done is false,
@ -735,7 +735,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace)
position = clamp(position, static_cast<double>(0), static_cast<double>(string.length_in_code_units()));
// g. Let captures be a new empty List.
GC::MarkedVector<Value> captures(vm.heap());
GC::RootVector<Value> captures(vm.heap());
// h. Let n be 1.
// i. Repeat, while n ≤ nCaptures,
@ -764,7 +764,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace)
// k. If functionalReplace is true, then
if (replace_value.is_function()) {
// i. Let replacerArgs be the list-concatenation of « matched », captures, and « 𝔽(position), S ».
GC::MarkedVector<Value> replacer_args(vm.heap());
GC::RootVector<Value> replacer_args(vm.heap());
replacer_args.append(PrimitiveString::create(vm, move(matched)));
replacer_args.extend(move(captures));
replacer_args.append(Value(position));

View file

@ -128,12 +128,12 @@ ThrowCompletionOr<bool> StringObject::internal_define_own_property(PropertyKey c
}
// 10.4.3.3 [[OwnPropertyKeys]] ( ), https://tc39.es/ecma262/#sec-string-exotic-objects-ownpropertykeys
ThrowCompletionOr<GC::MarkedVector<Value>> StringObject::internal_own_property_keys() const
ThrowCompletionOr<GC::RootVector<Value>> StringObject::internal_own_property_keys() const
{
auto& vm = this->vm();
// 1. Let keys be a new empty List.
auto keys = GC::MarkedVector<Value> { heap() };
auto keys = GC::RootVector<Value> { heap() };
// 2. Let str be O.[[StringData]].
auto str = m_string->utf16_string_view();

View file

@ -29,7 +29,7 @@ protected:
private:
virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyKey const&) const override;
virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyKey const&, PropertyDescriptor const&, Optional<PropertyDescriptor>* precomputed_get_own_property = nullptr) override;
virtual ThrowCompletionOr<GC::MarkedVector<Value>> internal_own_property_keys() const override;
virtual ThrowCompletionOr<GC::RootVector<Value>> internal_own_property_keys() const override;
virtual bool is_string_object() const final { return true; }
virtual void visit_edges(Visitor&) override;

View file

@ -288,7 +288,7 @@ static ThrowCompletionOr<void> initialize_typed_array_from_array_like(VM& vm, Ty
// 23.2.5.1.4 InitializeTypedArrayFromList, https://tc39.es/ecma262/#sec-initializetypedarrayfromlist
template<typename T>
static ThrowCompletionOr<void> initialize_typed_array_from_list(VM& vm, TypedArray<T>& typed_array, GC::MarkedVector<Value> const& list)
static ThrowCompletionOr<void> initialize_typed_array_from_list(VM& vm, TypedArray<T>& typed_array, GC::RootVector<Value> const& list)
{
// 1. Let len be the number of elements in values.
auto length = list.size();
@ -315,7 +315,7 @@ static ThrowCompletionOr<void> initialize_typed_array_from_list(VM& vm, TypedArr
}
// 23.2.4.2 TypedArrayCreate ( constructor, argumentList ), https://tc39.es/ecma262/#typedarray-create
ThrowCompletionOr<TypedArrayBase*> typed_array_create(VM& vm, FunctionObject& constructor, GC::MarkedVector<Value> arguments)
ThrowCompletionOr<TypedArrayBase*> typed_array_create(VM& vm, FunctionObject& constructor, GC::RootVector<Value> arguments)
{
Optional<double> first_argument;
if (arguments.size() == 1 && arguments[0].is_number())
@ -346,7 +346,7 @@ ThrowCompletionOr<TypedArrayBase*> typed_array_create(VM& vm, FunctionObject& co
}
// 23.2.4.3 TypedArrayCreateSameType ( exemplar, argumentList ), https://tc39.es/ecma262/#sec-typedarray-create-same-type
ThrowCompletionOr<TypedArrayBase*> typed_array_create_same_type(VM& vm, TypedArrayBase const& exemplar, GC::MarkedVector<Value> arguments)
ThrowCompletionOr<TypedArrayBase*> typed_array_create_same_type(VM& vm, TypedArrayBase const& exemplar, GC::RootVector<Value> arguments)
{
auto& realm = *vm.current_realm();

View file

@ -413,7 +413,7 @@ public:
}
// 10.4.5.8 [[OwnPropertyKeys]] ( ), https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects-ownpropertykeys
virtual ThrowCompletionOr<GC::MarkedVector<Value>> internal_own_property_keys() const override
virtual ThrowCompletionOr<GC::RootVector<Value>> internal_own_property_keys() const override
{
auto& vm = this->vm();
@ -421,7 +421,7 @@ public:
auto typed_array_record = make_typed_array_with_buffer_witness_record(*this, ArrayBuffer::Order::SeqCst);
// 2. Let keys be a new empty List.
auto keys = GC::MarkedVector<Value> { heap() };
auto keys = GC::RootVector<Value> { heap() };
// 3. If IsTypedArrayOutOfBounds(taRecord) is false, then
if (!is_typed_array_out_of_bounds(typed_array_record)) {
@ -511,8 +511,8 @@ protected:
};
ThrowCompletionOr<TypedArrayBase*> typed_array_from(VM&, Value);
ThrowCompletionOr<TypedArrayBase*> typed_array_create(VM&, FunctionObject& constructor, GC::MarkedVector<Value> arguments);
ThrowCompletionOr<TypedArrayBase*> typed_array_create_same_type(VM&, TypedArrayBase const& exemplar, GC::MarkedVector<Value> arguments);
ThrowCompletionOr<TypedArrayBase*> typed_array_create(VM&, FunctionObject& constructor, GC::RootVector<Value> arguments);
ThrowCompletionOr<TypedArrayBase*> typed_array_create_same_type(VM&, TypedArrayBase const& exemplar, GC::RootVector<Value> arguments);
ThrowCompletionOr<TypedArrayWithBufferWitness> validate_typed_array(VM&, Object const&, ArrayBuffer::Order);
ThrowCompletionOr<double> compare_typed_array_elements(VM&, Value x, Value y, FunctionObject* comparefn);

View file

@ -92,7 +92,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::from)
auto length = values.size();
// c. Let targetObj be ? TypedArrayCreate(C, « 𝔽(len) »).
GC::MarkedVector<Value> arguments(vm.heap());
GC::RootVector<Value> arguments(vm.heap());
arguments.empend(length);
auto* target_object = TRY(typed_array_create(vm, constructor.as_function(), move(arguments)));
@ -139,7 +139,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::from)
auto length = TRY(length_of_array_like(vm, array_like));
// 10. Let targetObj be ? TypedArrayCreate(C, « 𝔽(len) »).
GC::MarkedVector<Value> arguments(vm.heap());
GC::RootVector<Value> arguments(vm.heap());
arguments.empend(length);
auto* target_object = TRY(typed_array_create(vm, constructor.as_function(), move(arguments)));
@ -188,7 +188,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::of)
return vm.throw_completion<TypeError>(ErrorType::NotAConstructor, constructor.to_string_without_side_effects());
// 4. Let newObj be ? TypedArrayCreate(C, « 𝔽(len) »).
GC::MarkedVector<Value> arguments(vm.heap());
GC::RootVector<Value> arguments(vm.heap());
arguments.append(Value(length));
auto* new_object = TRY(typed_array_create(vm, constructor.as_function(), move(arguments)));

View file

@ -92,7 +92,7 @@ static ThrowCompletionOr<GC::Ref<FunctionObject>> callback_from_args(VM& vm, Str
}
// 23.2.4.1 TypedArraySpeciesCreate ( exemplar, argumentList ), https://tc39.es/ecma262/#typedarray-species-create
static ThrowCompletionOr<TypedArrayBase*> typed_array_species_create(VM& vm, TypedArrayBase const& exemplar, GC::MarkedVector<Value> arguments)
static ThrowCompletionOr<TypedArrayBase*> typed_array_species_create(VM& vm, TypedArrayBase const& exemplar, GC::RootVector<Value> arguments)
{
auto& realm = *vm.current_realm();
@ -634,7 +634,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::filter)
auto callback_function = TRY(callback_from_args(vm, "filter"sv));
// 5. Let kept be a new empty List.
GC::MarkedVector<Value> kept { vm.heap() };
GC::RootVector<Value> kept { vm.heap() };
// 6. Let captured be 0.
size_t captured = 0;
@ -664,7 +664,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::filter)
}
// 9. Let A be ? TypedArraySpeciesCreate(O, « 𝔽(captured) »).
GC::MarkedVector<Value> arguments(vm.heap());
GC::RootVector<Value> arguments(vm.heap());
arguments.empend(captured);
auto* filter_array = TRY(typed_array_species_create(vm, *typed_array, move(arguments)));
@ -1186,7 +1186,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::map)
auto callback_function = TRY(callback_from_args(vm, "map"sv));
// 5. Let A be ? TypedArraySpeciesCreate(O, « 𝔽(len) »).
GC::MarkedVector<Value> arguments(vm.heap());
GC::RootVector<Value> arguments(vm.heap());
arguments.empend(length);
auto* array = TRY(typed_array_species_create(vm, *typed_array, move(arguments)));
@ -1660,7 +1660,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::slice)
auto count = max(final - k, 0);
// 13. Let A be ? TypedArraySpeciesCreate(O, « 𝔽(count) »).
GC::MarkedVector<Value> arguments(vm.heap());
GC::RootVector<Value> arguments(vm.heap());
arguments.empend(count);
auto* array = TRY(typed_array_species_create(vm, *typed_array, move(arguments)));
@ -1905,7 +1905,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::subarray)
return typed_array;
}
GC::MarkedVector<Value> arguments(vm.heap());
GC::RootVector<Value> arguments(vm.heap());
// 15. If O.[[ArrayLength]] is auto and end is undefined, then
if (typed_array->array_length().is_auto() && end.is_undefined()) {
@ -2013,7 +2013,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::to_reversed)
auto length = typed_array_length(typed_array_record);
// 4. Let A be ? TypedArrayCreateSameType(O, « 𝔽(length) »).
GC::MarkedVector<Value> arguments(vm.heap());
GC::RootVector<Value> arguments(vm.heap());
arguments.empend(length);
auto* array = TRY(typed_array_create_same_type(vm, *typed_array, move(arguments)));
@ -2058,7 +2058,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::to_sorted)
auto length = typed_array_length(typed_array_record);
// 5. Let A be ? TypedArrayCreateSameType(O, « 𝔽(len) »).
GC::MarkedVector<Value> arguments(vm.heap());
GC::RootVector<Value> arguments(vm.heap());
arguments.empend(length);
auto* array = TRY(typed_array_create_same_type(vm, *typed_array, move(arguments)));
@ -2138,7 +2138,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::with)
return vm.throw_completion<RangeError>(ErrorType::TypedArrayInvalidIntegerIndex, actual_index);
// 10. Let A be ? TypedArrayCreateSameType(O, « 𝔽(len) »).
GC::MarkedVector<Value> arguments(vm.heap());
GC::RootVector<Value> arguments(vm.heap());
arguments.empend(length);
auto* array = TRY(typed_array_create_same_type(vm, *typed_array, move(arguments)));

View file

@ -18,7 +18,7 @@
#include <LibCrypto/Forward.h>
#include <LibGC/Function.h>
#include <LibGC/Heap.h>
#include <LibGC/MarkedVector.h>
#include <LibGC/RootVector.h>
#include <LibJS/CyclicModule.h>
#include <LibJS/ModuleLoading.h>
#include <LibJS/Runtime/CommonPropertyNames.h>

View file

@ -2493,7 +2493,7 @@ ThrowCompletionOr<TriState> is_less_than(VM& vm, Value lhs, Value rhs, bool left
}
// 7.3.21 Invoke ( V, P [ , argumentsList ] ), https://tc39.es/ecma262/#sec-invoke
ThrowCompletionOr<Value> Value::invoke_internal(VM& vm, PropertyKey const& property_key, Optional<GC::MarkedVector<Value>> arguments)
ThrowCompletionOr<Value> Value::invoke_internal(VM& vm, PropertyKey const& property_key, Optional<GC::RootVector<Value>> arguments)
{
// 1. If argumentsList is not present, set argumentsList to a new empty List.

View file

@ -449,7 +449,7 @@ private:
}
}
[[nodiscard]] ThrowCompletionOr<Value> invoke_internal(VM&, PropertyKey const&, Optional<GC::MarkedVector<Value>> arguments);
[[nodiscard]] ThrowCompletionOr<Value> invoke_internal(VM&, PropertyKey const&, Optional<GC::RootVector<Value>> arguments);
ThrowCompletionOr<i32> to_i32_slow_case(VM&) const;

View file

@ -99,7 +99,7 @@ ThrowCompletionOr<Value> ordinary_wrapped_function_call(WrappedFunction const& f
auto* target_realm = TRY(get_function_realm(vm, target));
// 6. Let wrappedArgs be a new empty List.
auto wrapped_args = GC::MarkedVector<Value> { vm.heap() };
auto wrapped_args = GC::RootVector<Value> { vm.heap() };
wrapped_args.ensure_capacity(arguments_list.size());
// 7. For each element arg of argumentsList, do