diff --git a/Libraries/LibGC/CMakeLists.txt b/Libraries/LibGC/CMakeLists.txt index 7d93203ab70..e5518077a55 100644 --- a/Libraries/LibGC/CMakeLists.txt +++ b/Libraries/LibGC/CMakeLists.txt @@ -5,9 +5,9 @@ set(SOURCES ConservativeVector.cpp ForeignCell.cpp Root.cpp + RootVector.cpp Heap.cpp HeapBlock.cpp - MarkedVector.cpp WeakContainer.cpp ) diff --git a/Libraries/LibGC/Forward.h b/Libraries/LibGC/Forward.h index 8b33eb57523..265d5d5a81b 100644 --- a/Libraries/LibGC/Forward.h +++ b/Libraries/LibGC/Forward.h @@ -30,6 +30,6 @@ template class ConservativeVector; template -class MarkedVector; +class RootVector; } diff --git a/Libraries/LibGC/Heap.cpp b/Libraries/LibGC/Heap.cpp index 2617b04c77f..53481599ae0 100644 --- a/Libraries/LibGC/Heap.cpp +++ b/Libraries/LibGC/Heap.cpp @@ -187,8 +187,8 @@ public: case HeapRoot::Type::Root: node.set("root"sv, ByteString::formatted("Root {} {}:{}", location->function_name(), location->filename(), location->line_number())); break; - case HeapRoot::Type::MarkedVector: - node.set("root"sv, "MarkedVector"); + case HeapRoot::Type::RootVector: + node.set("root"sv, "RootVector"); break; case HeapRoot::Type::RegisterPointer: node.set("root"sv, "RegisterPointer"); diff --git a/Libraries/LibGC/Heap.h b/Libraries/LibGC/Heap.h index b84362fea23..43e25877cc8 100644 --- a/Libraries/LibGC/Heap.h +++ b/Libraries/LibGC/Heap.h @@ -23,8 +23,8 @@ #include #include #include -#include #include +#include #include namespace GC { @@ -61,8 +61,8 @@ public: void did_create_root(Badge, RootImpl&); void did_destroy_root(Badge, RootImpl&); - void did_create_marked_vector(Badge, MarkedVectorBase&); - void did_destroy_marked_vector(Badge, MarkedVectorBase&); + void did_create_marked_vector(Badge, RootVectorBase&); + void did_destroy_marked_vector(Badge, RootVectorBase&); void did_create_conservative_vector(Badge, ConservativeVectorBase&); void did_destroy_conservative_vector(Badge, ConservativeVectorBase&); @@ -139,7 +139,7 @@ private: CellAllocator::List m_all_cell_allocators; RootImpl::List m_roots; - MarkedVectorBase::List m_marked_vectors; + RootVectorBase::List m_marked_vectors; ConservativeVectorBase::List m_conservative_vectors; WeakContainer::List m_weak_containers; @@ -165,13 +165,13 @@ inline void Heap::did_destroy_root(Badge, RootImpl& impl) m_roots.remove(impl); } -inline void Heap::did_create_marked_vector(Badge, MarkedVectorBase& vector) +inline void Heap::did_create_marked_vector(Badge, RootVectorBase& vector) { VERIFY(!m_marked_vectors.contains(vector)); m_marked_vectors.append(vector); } -inline void Heap::did_destroy_marked_vector(Badge, MarkedVectorBase& vector) +inline void Heap::did_destroy_marked_vector(Badge, RootVectorBase& vector) { VERIFY(m_marked_vectors.contains(vector)); m_marked_vectors.remove(vector); diff --git a/Libraries/LibGC/HeapRoot.h b/Libraries/LibGC/HeapRoot.h index f4205185ab5..26f03ef26ef 100644 --- a/Libraries/LibGC/HeapRoot.h +++ b/Libraries/LibGC/HeapRoot.h @@ -14,7 +14,7 @@ struct HeapRoot { enum class Type { HeapFunctionCapturedPointer, Root, - MarkedVector, + RootVector, ConservativeVector, RegisterPointer, StackPointer, diff --git a/Libraries/LibGC/MarkedVector.cpp b/Libraries/LibGC/RootVector.cpp similarity index 62% rename from Libraries/LibGC/MarkedVector.cpp rename to Libraries/LibGC/RootVector.cpp index e03960d3108..a3ca558cacb 100644 --- a/Libraries/LibGC/MarkedVector.cpp +++ b/Libraries/LibGC/RootVector.cpp @@ -6,27 +6,27 @@ */ #include -#include +#include namespace GC { -MarkedVectorBase::MarkedVectorBase(Heap& heap) +RootVectorBase::RootVectorBase(Heap& heap) : m_heap(&heap) { m_heap->did_create_marked_vector({}, *this); } -MarkedVectorBase::~MarkedVectorBase() +RootVectorBase::~RootVectorBase() { m_heap->did_destroy_marked_vector({}, *this); } -MarkedVectorBase& MarkedVectorBase::operator=(MarkedVectorBase const& other) +RootVectorBase& RootVectorBase::operator=(RootVectorBase const& other) { if (m_heap != other.m_heap) { m_heap = other.m_heap; - // NOTE: IntrusiveList will remove this MarkedVectorBase from the old heap it was part of. + // NOTE: IntrusiveList will remove this RootVectorBase from the old heap it was part of. m_heap->did_create_marked_vector({}, *this); } diff --git a/Libraries/LibGC/MarkedVector.h b/Libraries/LibGC/RootVector.h similarity index 62% rename from Libraries/LibGC/MarkedVector.h rename to Libraries/LibGC/RootVector.h index b1e191a28a1..5e05bf4fd68 100644 --- a/Libraries/LibGC/MarkedVector.h +++ b/Libraries/LibGC/RootVector.h @@ -16,52 +16,52 @@ namespace GC { -class MarkedVectorBase { +class RootVectorBase { public: virtual void gather_roots(HashMap&) const = 0; protected: - explicit MarkedVectorBase(Heap&); - ~MarkedVectorBase(); + explicit RootVectorBase(Heap&); + ~RootVectorBase(); - MarkedVectorBase& operator=(MarkedVectorBase const&); + RootVectorBase& operator=(RootVectorBase const&); Heap* m_heap { nullptr }; - IntrusiveListNode m_list_node; + IntrusiveListNode m_list_node; public: - using List = IntrusiveList<&MarkedVectorBase::m_list_node>; + using List = IntrusiveList<&RootVectorBase::m_list_node>; }; template -class MarkedVector final - : public MarkedVectorBase +class RootVector final + : public RootVectorBase , public Vector { public: - explicit MarkedVector(Heap& heap) - : MarkedVectorBase(heap) + explicit RootVector(Heap& heap) + : RootVectorBase(heap) { } - virtual ~MarkedVector() = default; + virtual ~RootVector() = default; - MarkedVector(MarkedVector const& other) - : MarkedVectorBase(*other.m_heap) + RootVector(RootVector const& other) + : RootVectorBase(*other.m_heap) , Vector(other) { } - MarkedVector(MarkedVector&& other) - : MarkedVectorBase(*other.m_heap) + RootVector(RootVector&& other) + : RootVectorBase(*other.m_heap) , Vector(move(static_cast&>(other))) { } - MarkedVector& operator=(MarkedVector const& other) + RootVector& operator=(RootVector const& other) { Vector::operator=(other); - MarkedVectorBase::operator=(other); + RootVectorBase::operator=(other); return *this; } @@ -70,9 +70,9 @@ public: for (auto& value : *this) { if constexpr (IsBaseOf) { if (value.is_cell()) - roots.set(&const_cast(value).as_cell(), HeapRoot { .type = HeapRoot::Type::MarkedVector }); + roots.set(&const_cast(value).as_cell(), HeapRoot { .type = HeapRoot::Type::RootVector }); } else { - roots.set(value, HeapRoot { .type = HeapRoot::Type::MarkedVector }); + roots.set(value, HeapRoot { .type = HeapRoot::Type::RootVector }); } } } diff --git a/Libraries/LibIDL/Types.h b/Libraries/LibIDL/Types.h index 92dcb440cc7..36bd68ae615 100644 --- a/Libraries/LibIDL/Types.h +++ b/Libraries/LibIDL/Types.h @@ -32,8 +32,8 @@ static size_t get_function_shortest_length(FunctionType& function) } enum class SequenceStorageType { - Vector, // Used to safely store non-JS values - MarkedVector, // Used to safely store JS::Value and anything that inherits JS::Cell, e.g. JS::Object + Vector, // Used to safely store non-JS values + RootVector, // Used to safely store JS::Value and anything that inherits JS::Cell, e.g. JS::Object }; struct CppType { diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp index d08433cc55c..d0de6f95904 100644 --- a/Libraries/LibJS/AST.cpp +++ b/Libraries/LibJS/AST.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Libraries/LibJS/Bytecode/Generator.h b/Libraries/LibJS/Bytecode/Generator.h index bb496898914..166eb1fc981 100644 --- a/Libraries/LibJS/Bytecode/Generator.h +++ b/Libraries/LibJS/Bytecode/Generator.h @@ -373,7 +373,7 @@ private: NonnullOwnPtr m_string_table; NonnullOwnPtr m_identifier_table; NonnullOwnPtr m_regex_table; - GC::MarkedVector m_constants; + GC::RootVector m_constants; mutable Optional m_true_constant; mutable Optional m_false_constant; diff --git a/Libraries/LibJS/Bytecode/Interpreter.cpp b/Libraries/LibJS/Bytecode/Interpreter.cpp index 7e790626952..65f721d69b6 100644 --- a/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -1458,13 +1458,13 @@ inline Value new_regexp(VM& vm, ParsedRegex const& parsed_regex, ByteString cons } // 13.3.8.1 https://tc39.es/ecma262/#sec-runtime-semantics-argumentlistevaluation -inline GC::MarkedVector argument_list_evaluation(VM& vm, Value arguments) +inline GC::RootVector argument_list_evaluation(VM& vm, Value arguments) { // Note: Any spreading and actual evaluation is handled in preceding opcodes // Note: The spec uses the concept of a list, while we create a temporary array // in the preceding opcodes, so we have to convert in a manner that is not // visible to the user - GC::MarkedVector argument_values { vm.heap() }; + GC::RootVector argument_values { vm.heap() }; auto& argument_array = arguments.as_array(); auto array_length = argument_array.indexed_properties().array_like_size(); @@ -1541,7 +1541,7 @@ inline ThrowCompletionOr> super_call_with_argument_array(VM& vm, auto* func = get_super_constructor(vm); // 4. Let argList be ? ArgumentListEvaluation of Arguments. - GC::MarkedVector arg_list { vm.heap() }; + GC::RootVector arg_list { vm.heap() }; if (is_synthetic) { VERIFY(argument_array.is_object() && is(argument_array.as_object())); auto const& array_value = static_cast(argument_array.as_object()); diff --git a/Libraries/LibJS/Console.cpp b/Libraries/LibJS/Console.cpp index cbf83c130fc..1327ee1bb22 100644 --- a/Libraries/LibJS/Console.cpp +++ b/Libraries/LibJS/Console.cpp @@ -51,7 +51,7 @@ ThrowCompletionOr Console::assert_() auto message = PrimitiveString::create(vm, "Assertion failed"_string); // NOTE: Assemble `data` from the function arguments. - GC::MarkedVector data { vm.heap() }; + GC::RootVector data { vm.heap() }; if (vm.argument_count() > 1) { data.ensure_capacity(vm.argument_count() - 1); for (size_t i = 1; i < vm.argument_count(); ++i) { @@ -143,7 +143,7 @@ ThrowCompletionOr Console::log() } // To [create table row] given tabularDataItem, rowIndex, list finalColumns, and optional list properties, perform the following steps: -static ThrowCompletionOr> create_table_row(Realm& realm, Value row_index, Value tabular_data_item, GC::MarkedVector& final_columns, HashMap& visited_columns, HashMap& properties) +static ThrowCompletionOr> create_table_row(Realm& realm, Value row_index, Value tabular_data_item, GC::RootVector& final_columns, HashMap& visited_columns, HashMap& properties) { auto& vm = realm.vm(); @@ -264,10 +264,10 @@ ThrowCompletionOr Console::table() } // 1. Let `finalRows` be the new list, initially empty - GC::MarkedVector final_rows(vm.heap()); + GC::RootVector final_rows(vm.heap()); // 2. Let `finalColumns` be the new list, initially empty - GC::MarkedVector final_columns(vm.heap()); + GC::RootVector final_columns(vm.heap()); HashMap visited_columns; @@ -327,7 +327,7 @@ ThrowCompletionOr Console::table() TRY(final_data->set(vm.names.columns, table_cols, Object::ShouldThrowExceptions::No)); // 5.4. Perform `Printer("table", finalData)` - GC::MarkedVector args(vm.heap()); + GC::RootVector args(vm.heap()); args.append(Value(final_data)); return m_client->printer(LogLevel::Table, args); } @@ -389,7 +389,7 @@ ThrowCompletionOr Console::dir() // 2. Perform Printer("dir", « object », options). if (m_client) { - GC::MarkedVector printer_arguments { vm.heap() }; + GC::RootVector printer_arguments { vm.heap() }; TRY_OR_THROW_OOM(vm, printer_arguments.try_append(object)); return m_client->printer(LogLevel::Dir, move(printer_arguments)); @@ -429,7 +429,7 @@ ThrowCompletionOr Console::count() auto concat = TRY_OR_THROW_OOM(vm, String::formatted("{}: {}", label, map.get(label).value())); // 5. Perform Logger("count", « concat »). - GC::MarkedVector concat_as_vector { vm.heap() }; + GC::RootVector concat_as_vector { vm.heap() }; concat_as_vector.append(PrimitiveString::create(vm, move(concat))); if (m_client) TRY(m_client->logger(LogLevel::Count, concat_as_vector)); @@ -457,7 +457,7 @@ ThrowCompletionOr Console::count_reset() // that the given label does not have an associated count. auto message = TRY_OR_THROW_OOM(vm, String::formatted("\"{}\" doesn't have a count", label)); // 2. Perform Logger("countReset", « message »); - GC::MarkedVector message_as_vector { vm.heap() }; + GC::RootVector message_as_vector { vm.heap() }; message_as_vector.append(PrimitiveString::create(vm, move(message))); if (m_client) TRY(m_client->logger(LogLevel::CountReset, message_as_vector)); @@ -560,7 +560,7 @@ ThrowCompletionOr Console::time() // a warning to the console indicating that a timer with label `label` has already been started. if (m_timer_table.contains(label)) { if (m_client) { - GC::MarkedVector timer_already_exists_warning_message_as_vector { vm.heap() }; + GC::RootVector timer_already_exists_warning_message_as_vector { vm.heap() }; auto message = TRY_OR_THROW_OOM(vm, String::formatted("Timer '{}' already exists.", label)); timer_already_exists_warning_message_as_vector.append(PrimitiveString::create(vm, move(message))); @@ -591,7 +591,7 @@ ThrowCompletionOr Console::time_log() // NOTE: Warn if the timer doesn't exist. Not part of the spec yet, but discussed here: https://github.com/whatwg/console/issues/134 if (maybe_start_time == m_timer_table.end()) { if (m_client) { - GC::MarkedVector timer_does_not_exist_warning_message_as_vector { vm.heap() }; + GC::RootVector timer_does_not_exist_warning_message_as_vector { vm.heap() }; auto message = TRY_OR_THROW_OOM(vm, String::formatted("Timer '{}' does not exist.", label)); timer_does_not_exist_warning_message_as_vector.append(PrimitiveString::create(vm, move(message))); @@ -609,7 +609,7 @@ ThrowCompletionOr Console::time_log() auto concat = TRY_OR_THROW_OOM(vm, String::formatted("{}: {}", label, duration)); // 5. Prepend concat to data. - GC::MarkedVector data { vm.heap() }; + GC::RootVector data { vm.heap() }; data.ensure_capacity(vm.argument_count()); data.append(PrimitiveString::create(vm, move(concat))); for (size_t i = 1; i < vm.argument_count(); ++i) @@ -637,7 +637,7 @@ ThrowCompletionOr Console::time_end() // NOTE: Warn if the timer doesn't exist. Not part of the spec yet, but discussed here: https://github.com/whatwg/console/issues/134 if (maybe_start_time == m_timer_table.end()) { if (m_client) { - GC::MarkedVector timer_does_not_exist_warning_message_as_vector { vm.heap() }; + GC::RootVector timer_does_not_exist_warning_message_as_vector { vm.heap() }; auto message = TRY_OR_THROW_OOM(vm, String::formatted("Timer '{}' does not exist.", label)); timer_does_not_exist_warning_message_as_vector.append(PrimitiveString::create(vm, move(message))); @@ -659,18 +659,18 @@ ThrowCompletionOr Console::time_end() // 6. Perform Printer("timeEnd", « concat »). if (m_client) { - GC::MarkedVector concat_as_vector { vm.heap() }; + GC::RootVector concat_as_vector { vm.heap() }; concat_as_vector.append(PrimitiveString::create(vm, move(concat))); TRY(m_client->printer(LogLevel::TimeEnd, move(concat_as_vector))); } return js_undefined(); } -GC::MarkedVector Console::vm_arguments() +GC::RootVector Console::vm_arguments() { auto& vm = realm().vm(); - GC::MarkedVector arguments { vm.heap() }; + GC::RootVector arguments { vm.heap() }; arguments.ensure_capacity(vm.argument_count()); for (size_t i = 0; i < vm.argument_count(); ++i) { arguments.append(vm.argument(i)); @@ -708,7 +708,7 @@ void Console::report_exception(JS::Error const& exception, bool in_promise) cons m_client->report_exception(exception, in_promise); } -ThrowCompletionOr Console::value_vector_to_string(GC::MarkedVector const& values) +ThrowCompletionOr Console::value_vector_to_string(GC::RootVector const& values) { auto& vm = realm().vm(); StringBuilder builder; @@ -737,7 +737,7 @@ void ConsoleClient::visit_edges(Visitor& visitor) } // 2.1. Logger(logLevel, args), https://console.spec.whatwg.org/#logger -ThrowCompletionOr ConsoleClient::logger(Console::LogLevel log_level, GC::MarkedVector const& args) +ThrowCompletionOr ConsoleClient::logger(Console::LogLevel log_level, GC::RootVector const& args) { auto& vm = m_console->realm().vm(); @@ -753,7 +753,7 @@ ThrowCompletionOr ConsoleClient::logger(Console::LogLevel log_level, GC:: // 4. If rest is empty, perform Printer(logLevel, « first ») and return. if (rest_size == 0) { - GC::MarkedVector first_as_vector { vm.heap() }; + GC::RootVector first_as_vector { vm.heap() }; first_as_vector.append(first); return printer(log_level, move(first_as_vector)); } @@ -769,7 +769,7 @@ ThrowCompletionOr ConsoleClient::logger(Console::LogLevel log_level, GC:: } // 2.2. Formatter(args), https://console.spec.whatwg.org/#formatter -ThrowCompletionOr> ConsoleClient::formatter(GC::MarkedVector const& args) +ThrowCompletionOr> ConsoleClient::formatter(GC::RootVector const& args) { auto& realm = m_console->realm(); auto& vm = realm.vm(); @@ -871,7 +871,7 @@ ThrowCompletionOr> ConsoleClient::formatter(GC::MarkedVe } // 7. Let result be a list containing target together with the elements of args starting from the third onward. - GC::MarkedVector result { vm.heap() }; + GC::RootVector result { vm.heap() }; result.ensure_capacity(args.size() - 1); result.empend(PrimitiveString::create(vm, move(target))); for (size_t i = 2; i < args.size(); ++i) @@ -881,7 +881,7 @@ ThrowCompletionOr> ConsoleClient::formatter(GC::MarkedVe return formatter(result); } -ThrowCompletionOr ConsoleClient::generically_format_values(GC::MarkedVector const& values) +ThrowCompletionOr ConsoleClient::generically_format_values(GC::RootVector const& values) { AllocatingMemoryStream stream; auto& vm = m_console->realm().vm(); diff --git a/Libraries/LibJS/Console.h b/Libraries/LibJS/Console.h index 1fa86424ead..3f799e55a44 100644 --- a/Libraries/LibJS/Console.h +++ b/Libraries/LibJS/Console.h @@ -63,7 +63,7 @@ public: Realm& realm() const { return m_realm; } - GC::MarkedVector vm_arguments(); + GC::RootVector vm_arguments(); HashMap& counters() { return m_counters; } HashMap const& counters() const { return m_counters; } @@ -95,7 +95,7 @@ private: virtual void visit_edges(Visitor&) override; - ThrowCompletionOr value_vector_to_string(GC::MarkedVector const&); + ThrowCompletionOr value_vector_to_string(GC::RootVector const&); GC::Ref m_realm; GC::Ptr m_client; @@ -110,10 +110,10 @@ class ConsoleClient : public Cell { GC_DECLARE_ALLOCATOR(ConsoleClient); public: - using PrinterArguments = Variant>; + using PrinterArguments = Variant>; - ThrowCompletionOr logger(Console::LogLevel log_level, GC::MarkedVector const& args); - ThrowCompletionOr> formatter(GC::MarkedVector const& args); + ThrowCompletionOr logger(Console::LogLevel log_level, GC::RootVector const& args); + ThrowCompletionOr> formatter(GC::RootVector const& args); virtual ThrowCompletionOr printer(Console::LogLevel log_level, PrinterArguments) = 0; virtual void add_css_style_to_current_message(StringView) { } @@ -122,7 +122,7 @@ public: virtual void clear() = 0; virtual void end_group() = 0; - ThrowCompletionOr generically_format_values(GC::MarkedVector const&); + ThrowCompletionOr generically_format_values(GC::RootVector const&); protected: explicit ConsoleClient(Console&); diff --git a/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Libraries/LibJS/Runtime/AbstractOperations.cpp index ca56fde0c04..a30fa650a88 100644 --- a/Libraries/LibJS/Runtime/AbstractOperations.cpp +++ b/Libraries/LibJS/Runtime/AbstractOperations.cpp @@ -97,7 +97,7 @@ ThrowCompletionOr length_of_array_like(VM& vm, Object const& object) } // 7.3.20 CreateListFromArrayLike ( obj [ , elementTypes ] ), https://tc39.es/ecma262/#sec-createlistfromarraylike -ThrowCompletionOr> create_list_from_array_like(VM& vm, Value value, Function(Value)> check_value) +ThrowCompletionOr> create_list_from_array_like(VM& vm, Value value, Function(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> 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 { vm.heap() }; + auto list = GC::RootVector { vm.heap() }; list.ensure_capacity(length); // 5. Let index be 0. diff --git a/Libraries/LibJS/Runtime/AbstractOperations.h b/Libraries/LibJS/Runtime/AbstractOperations.h index c082d99c83a..793a0cf6dc9 100644 --- a/Libraries/LibJS/Runtime/AbstractOperations.h +++ b/Libraries/LibJS/Runtime/AbstractOperations.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include @@ -34,7 +34,7 @@ ThrowCompletionOr call_impl(VM&, Value function, Value this_value, Readon ThrowCompletionOr call_impl(VM&, FunctionObject& function, Value this_value, ReadonlySpan arguments = {}); ThrowCompletionOr> construct_impl(VM&, FunctionObject&, ReadonlySpan arguments = {}, FunctionObject* new_target = nullptr); ThrowCompletionOr length_of_array_like(VM&, Object const&); -ThrowCompletionOr> create_list_from_array_like(VM&, Value, Function(Value)> = {}); +ThrowCompletionOr> create_list_from_array_like(VM&, Value, Function(Value)> = {}); ThrowCompletionOr species_constructor(VM&, Object const&, FunctionObject& default_constructor); ThrowCompletionOr get_function_realm(VM&, FunctionObject const&); ThrowCompletionOr 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 new_elements { vm.heap() }; + GC::RootVector new_elements { vm.heap() }; new_elements.append(value); // 3. Append group as the last element of groups. diff --git a/Libraries/LibJS/Runtime/Array.cpp b/Libraries/LibJS/Runtime/Array.cpp index 7aef99beb5a..b9ff8b60932 100644 --- a/Libraries/LibJS/Runtime/Array.cpp +++ b/Libraries/LibJS/Runtime/Array.cpp @@ -161,10 +161,10 @@ ThrowCompletionOr Array::set_length(PropertyDescriptor const& property_des } // 23.1.3.30.1 SortIndexedProperties ( obj, len, SortCompare, holes ), https://tc39.es/ecma262/#sec-sortindexedproperties -ThrowCompletionOr> sort_indexed_properties(VM& vm, Object const& object, size_t length, Function(Value, Value)> const& sort_compare, Holes holes) +ThrowCompletionOr> sort_indexed_properties(VM& vm, Object const& object, size_t length, Function(Value, Value)> const& sort_compare, Holes holes) { // 1. Let items be a new empty List. - auto items = GC::MarkedVector { vm.heap() }; + auto items = GC::RootVector { vm.heap() }; // 2. Let k be 0. // 3. Repeat, while k < len, @@ -330,7 +330,7 @@ ThrowCompletionOr Array::internal_delete(PropertyKey const& property_key) } // NON-STANDARD: Used to inject the ephemeral length property's key -ThrowCompletionOr> Array::internal_own_property_keys() const +ThrowCompletionOr> Array::internal_own_property_keys() const { auto& vm = this->vm(); auto keys = TRY(Object::internal_own_property_keys()); diff --git a/Libraries/LibJS/Runtime/Array.h b/Libraries/LibJS/Runtime/Array.h index faf9bb20f0d..6ae77de113b 100644 --- a/Libraries/LibJS/Runtime/Array.h +++ b/Libraries/LibJS/Runtime/Array.h @@ -37,7 +37,7 @@ public: template static GC::Ref create_from(Realm& realm, ReadonlySpan elements, Function map_fn) { - auto values = GC::MarkedVector { realm.heap() }; + auto values = GC::RootVector { realm.heap() }; values.ensure_capacity(elements.size()); for (auto const& element : elements) values.append(map_fn(element)); @@ -50,7 +50,7 @@ public: virtual ThrowCompletionOr> internal_get_own_property(PropertyKey const&) const override final; virtual ThrowCompletionOr internal_define_own_property(PropertyKey const&, PropertyDescriptor const&, Optional* precomputed_get_own_property = nullptr) override final; virtual ThrowCompletionOr internal_delete(PropertyKey const&) override; - virtual ThrowCompletionOr> internal_own_property_keys() const override final; + virtual ThrowCompletionOr> 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> sort_indexed_properties(VM&, Object const&, size_t length, Function(Value, Value)> const& sort_compare, Holes holes); +ThrowCompletionOr> sort_indexed_properties(VM&, Object const&, size_t length, Function(Value, Value)> const& sort_compare, Holes holes); ThrowCompletionOr compare_array_elements(VM&, Value x, Value y, FunctionObject* comparefn); } diff --git a/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Libraries/LibJS/Runtime/ArrayPrototype.cpp index e566edc9cdf..2d9b432419e 100644 --- a/Libraries/LibJS/Runtime/ArrayPrototype.cpp +++ b/Libraries/LibJS/Runtime/ArrayPrototype.cpp @@ -1339,15 +1339,15 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::some) return Value(false); } -ThrowCompletionOr array_merge_sort(VM& vm, Function(Value, Value)> const& compare_func, GC::MarkedVector& arr_to_sort) +ThrowCompletionOr array_merge_sort(VM& vm, Function(Value, Value)> const& compare_func, GC::RootVector& 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 left(vm.heap()); - GC::MarkedVector right(vm.heap()); + GC::RootVector left(vm.heap()); + GC::RootVector right(vm.heap()); left.ensure_capacity(arr_to_sort.size() / 2); right.ensure_capacity(arr_to_sort.size() / 2 + (arr_to_sort.size() & 1)); diff --git a/Libraries/LibJS/Runtime/ArrayPrototype.h b/Libraries/LibJS/Runtime/ArrayPrototype.h index c19f51839ed..b0091574b3b 100644 --- a/Libraries/LibJS/Runtime/ArrayPrototype.h +++ b/Libraries/LibJS/Runtime/ArrayPrototype.h @@ -64,6 +64,6 @@ private: JS_DECLARE_NATIVE_FUNCTION(with); }; -ThrowCompletionOr array_merge_sort(VM&, Function(Value, Value)> const& compare_func, GC::MarkedVector& arr_to_sort); +ThrowCompletionOr array_merge_sort(VM&, Function(Value, Value)> const& compare_func, GC::RootVector& arr_to_sort); } diff --git a/Libraries/LibJS/Runtime/BoundFunction.cpp b/Libraries/LibJS/Runtime/BoundFunction.cpp index 85f8ef701b1..723e19688c0 100644 --- a/Libraries/LibJS/Runtime/BoundFunction.cpp +++ b/Libraries/LibJS/Runtime/BoundFunction.cpp @@ -83,7 +83,7 @@ ThrowCompletionOr> 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 { heap() }; + auto args = GC::RootVector { heap() }; args.extend(bound_args); args.append(arguments_list.data(), arguments_list.size()); diff --git a/Libraries/LibJS/Runtime/FinalizationRegistry.cpp b/Libraries/LibJS/Runtime/FinalizationRegistry.cpp index 8e5047ea481..47e03a64607 100644 --- a/Libraries/LibJS/Runtime/FinalizationRegistry.cpp +++ b/Libraries/LibJS/Runtime/FinalizationRegistry.cpp @@ -79,7 +79,7 @@ ThrowCompletionOr FinalizationRegistry::cleanup(GC::Ptr callb continue; // b. Remove cell from finalizationRegistry.[[Cells]]. - GC::MarkedVector arguments(vm.heap()); + GC::RootVector arguments(vm.heap()); arguments.append(it->held_value); it.remove(m_records); diff --git a/Libraries/LibJS/Runtime/FunctionPrototype.cpp b/Libraries/LibJS/Runtime/FunctionPrototype.cpp index 5cbb5ce19f0..0f56ec76f44 100644 --- a/Libraries/LibJS/Runtime/FunctionPrototype.cpp +++ b/Libraries/LibJS/Runtime/FunctionPrototype.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Libraries/LibJS/Runtime/GlobalObject.h b/Libraries/LibJS/Runtime/GlobalObject.h index 2c527799604..d21e4839e82 100644 --- a/Libraries/LibJS/Runtime/GlobalObject.h +++ b/Libraries/LibJS/Runtime/GlobalObject.h @@ -52,12 +52,12 @@ template [[nodiscard]] ALWAYS_INLINE ThrowCompletionOr Value::invoke(VM& vm, PropertyKey const& property_key, Args... args) { if constexpr (sizeof...(Args) > 0) { - GC::MarkedVector arglist { vm.heap() }; + GC::RootVector arglist { vm.heap() }; (..., arglist.append(move(args))); return invoke_internal(vm, property_key, move(arglist)); } - return invoke_internal(vm, property_key, Optional> {}); + return invoke_internal(vm, property_key, Optional> {}); } } diff --git a/Libraries/LibJS/Runtime/Intl/Intl.cpp b/Libraries/LibJS/Runtime/Intl/Intl.cpp index 849dd0963d4..4ecdce638ee 100644 --- a/Libraries/LibJS/Runtime/Intl/Intl.cpp +++ b/Libraries/LibJS/Runtime/Intl/Intl.cpp @@ -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 marked_locale_list { vm.heap() }; + GC::RootVector marked_locale_list { vm.heap() }; marked_locale_list.ensure_capacity(locale_list.size()); for (auto& locale : locale_list) diff --git a/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp b/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp index b48b24f522e..00e0283fae0 100644 --- a/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp +++ b/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include diff --git a/Libraries/LibJS/Runtime/Iterator.cpp b/Libraries/LibJS/Runtime/Iterator.cpp index 1c03b5221da..5e082e01d27 100644 --- a/Libraries/LibJS/Runtime/Iterator.cpp +++ b/Libraries/LibJS/Runtime/Iterator.cpp @@ -345,10 +345,10 @@ GC::Ref create_iterator_result_object(VM& vm, Value value, bool done) } // 7.4.16 IteratorToList ( iteratorRecord ), https://tc39.es/ecma262/#sec-iteratortolist -ThrowCompletionOr> iterator_to_list(VM& vm, IteratorRecord& iterator_record) +ThrowCompletionOr> iterator_to_list(VM& vm, IteratorRecord& iterator_record) { // 1. Let values be a new empty List. - GC::MarkedVector values(vm.heap()); + GC::RootVector values(vm.heap()); // 2. Repeat, while (true) { diff --git a/Libraries/LibJS/Runtime/Iterator.h b/Libraries/LibJS/Runtime/Iterator.h index 893d41ba4f3..efbabb901f8 100644 --- a/Libraries/LibJS/Runtime/Iterator.h +++ b/Libraries/LibJS/Runtime/Iterator.h @@ -82,7 +82,7 @@ ThrowCompletionOr> iterator_step_value(VM&, IteratorRecord&); Completion iterator_close(VM&, IteratorRecord const&, Completion); Completion async_iterator_close(VM&, IteratorRecord const&, Completion); GC::Ref create_iterator_result_object(VM&, Value, bool done); -ThrowCompletionOr> iterator_to_list(VM&, IteratorRecord&); +ThrowCompletionOr> iterator_to_list(VM&, IteratorRecord&); ThrowCompletionOr setter_that_ignores_prototype_properties(VM&, Value this_, Object const& home, PropertyKey const& property, Value value); using IteratorValueCallback = Function(Value)>; diff --git a/Libraries/LibJS/Runtime/IteratorPrototype.cpp b/Libraries/LibJS/Runtime/IteratorPrototype.cpp index 3e152582d19..75865592e54 100644 --- a/Libraries/LibJS/Runtime/IteratorPrototype.cpp +++ b/Libraries/LibJS/Runtime/IteratorPrototype.cpp @@ -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 items(realm.heap()); + GC::RootVector items(realm.heap()); // 5. Repeat, while (true) { diff --git a/Libraries/LibJS/Runtime/MapConstructor.cpp b/Libraries/LibJS/Runtime/MapConstructor.cpp index db2bb7f77c1..bd57d3c876a 100644 --- a/Libraries/LibJS/Runtime/MapConstructor.cpp +++ b/Libraries/LibJS/Runtime/MapConstructor.cpp @@ -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, GC::MarkedVector, KeyedGroupTraits>, void>(vm, items, callback_function))); + auto groups = TRY((JS::group_by, GC::RootVector, KeyedGroupTraits>, void>(vm, items, callback_function))); // 2. Let map be ! Construct(%Map%). auto map = Map::create(realm); diff --git a/Libraries/LibJS/Runtime/ModuleNamespaceObject.cpp b/Libraries/LibJS/Runtime/ModuleNamespaceObject.cpp index 3043312b2ed..e36c953741b 100644 --- a/Libraries/LibJS/Runtime/ModuleNamespaceObject.cpp +++ b/Libraries/LibJS/Runtime/ModuleNamespaceObject.cpp @@ -210,11 +210,11 @@ ThrowCompletionOr ModuleNamespaceObject::internal_delete(PropertyKey const } // 10.4.6.11 [[OwnPropertyKeys]] ( ), https://tc39.es/ecma262/#sec-module-namespace-exotic-objects-ownpropertykeys -ThrowCompletionOr> ModuleNamespaceObject::internal_own_property_keys() const +ThrowCompletionOr> 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 exports { vm().heap() }; + GC::RootVector exports { vm().heap() }; // 2. Let symbolKeys be OrdinaryOwnPropertyKeys(O). auto symbol_keys = MUST(Object::internal_own_property_keys()); diff --git a/Libraries/LibJS/Runtime/ModuleNamespaceObject.h b/Libraries/LibJS/Runtime/ModuleNamespaceObject.h index dba75fe9609..96faec68046 100644 --- a/Libraries/LibJS/Runtime/ModuleNamespaceObject.h +++ b/Libraries/LibJS/Runtime/ModuleNamespaceObject.h @@ -29,7 +29,7 @@ public: virtual ThrowCompletionOr internal_get(PropertyKey const&, Value receiver, CacheablePropertyMetadata* = nullptr, PropertyLookupPhase = PropertyLookupPhase::OwnProperty) const override; virtual ThrowCompletionOr internal_set(PropertyKey const&, Value value, Value receiver, CacheablePropertyMetadata*) override; virtual ThrowCompletionOr internal_delete(PropertyKey const&) override; - virtual ThrowCompletionOr> internal_own_property_keys() const override; + virtual ThrowCompletionOr> internal_own_property_keys() const override; virtual void initialize(Realm&) override; private: diff --git a/Libraries/LibJS/Runtime/Object.cpp b/Libraries/LibJS/Runtime/Object.cpp index 16b14613df3..b761873aeda 100644 --- a/Libraries/LibJS/Runtime/Object.cpp +++ b/Libraries/LibJS/Runtime/Object.cpp @@ -371,7 +371,7 @@ ThrowCompletionOr Object::test_integrity_level(IntegrityLevel level) const } // 7.3.24 EnumerableOwnPropertyNames ( O, kind ), https://tc39.es/ecma262/#sec-enumerableownpropertynames -ThrowCompletionOr> Object::enumerable_own_property_names(PropertyKind kind) const +ThrowCompletionOr> 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> 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 { heap() }; + auto properties = GC::RootVector { heap() }; // 3. For each element key of ownKeys, do for (auto& key : own_keys) { @@ -1070,12 +1070,12 @@ ThrowCompletionOr 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> Object::internal_own_property_keys() const +ThrowCompletionOr> Object::internal_own_property_keys() const { auto& vm = this->vm(); // 1. Let keys be a new empty List. - GC::MarkedVector keys { heap() }; + GC::RootVector 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) { diff --git a/Libraries/LibJS/Runtime/Object.h b/Libraries/LibJS/Runtime/Object.h index e1032884c66..1ffc7f16ac1 100644 --- a/Libraries/LibJS/Runtime/Object.h +++ b/Libraries/LibJS/Runtime/Object.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include @@ -118,7 +118,7 @@ public: ThrowCompletionOr has_own_property(PropertyKey const&) const; ThrowCompletionOr set_integrity_level(IntegrityLevel); ThrowCompletionOr test_integrity_level(IntegrityLevel) const; - ThrowCompletionOr> enumerable_own_property_names(PropertyKind kind) const; + ThrowCompletionOr> enumerable_own_property_names(PropertyKind kind) const; ThrowCompletionOr copy_data_properties(VM&, Value source, HashTable const& excluded_keys, HashTable const& excluded_values = {}); ThrowCompletionOr> snapshot_own_properties(VM&, GC::Ptr prototype, HashTable const& excluded_keys = {}, HashTable const& excluded_values = {}); @@ -146,7 +146,7 @@ public: virtual ThrowCompletionOr internal_get(PropertyKey const&, Value receiver, CacheablePropertyMetadata* = nullptr, PropertyLookupPhase = PropertyLookupPhase::OwnProperty) const; virtual ThrowCompletionOr internal_set(PropertyKey const&, Value value, Value receiver, CacheablePropertyMetadata* = nullptr); virtual ThrowCompletionOr internal_delete(PropertyKey const&); - virtual ThrowCompletionOr> internal_own_property_keys() const; + virtual ThrowCompletionOr> 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) diff --git a/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Libraries/LibJS/Runtime/ObjectConstructor.cpp index 1bcfe4d7d08..4eb098bd0fe 100644 --- a/Libraries/LibJS/Runtime/ObjectConstructor.cpp +++ b/Libraries/LibJS/Runtime/ObjectConstructor.cpp @@ -93,7 +93,7 @@ enum class GetOwnPropertyKeysType { }; // 20.1.2.11.1 GetOwnPropertyKeys ( O, type ), https://tc39.es/ecma262/#sec-getownpropertykeys -static ThrowCompletionOr> get_own_property_keys(VM& vm, Value value, GetOwnPropertyKeysType type) +static ThrowCompletionOr> 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> 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 { vm.heap() }; + auto name_list = GC::RootVector { 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>, PropertyKey>(vm, items, callback_function))); + auto groups = TRY((JS::group_by>, PropertyKey>(vm, items, callback_function))); // 2. Let obj be OrdinaryObjectCreate(null). auto object = Object::create(realm, nullptr); diff --git a/Libraries/LibJS/Runtime/ProxyObject.cpp b/Libraries/LibJS/Runtime/ProxyObject.cpp index 73a148e941f..39abfc399ce 100644 --- a/Libraries/LibJS/Runtime/ProxyObject.cpp +++ b/Libraries/LibJS/Runtime/ProxyObject.cpp @@ -681,7 +681,7 @@ ThrowCompletionOr ProxyObject::internal_delete(PropertyKey const& property } // 10.5.11 [[OwnPropertyKeys]] ( ), https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys -ThrowCompletionOr> ProxyObject::internal_own_property_keys() const +ThrowCompletionOr> ProxyObject::internal_own_property_keys() const { LIMIT_PROXY_RECURSION_DEPTH(); @@ -732,10 +732,10 @@ ThrowCompletionOr> 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 { heap() }; + auto target_configurable_keys = GC::RootVector { heap() }; // 15. Let targetNonconfigurableKeys be a new empty List. - auto target_nonconfigurable_keys = GC::MarkedVector { heap() }; + auto target_nonconfigurable_keys = GC::RootVector { heap() }; // 16. For each element key of targetKeys, do for (auto& key : target_keys) { @@ -763,7 +763,7 @@ ThrowCompletionOr> ProxyObject::internal_own_property_ke } // 18. Let uncheckedResultKeys be a List whose elements are the elements of trapResult. - auto unchecked_result_keys = GC::MarkedVector { heap() }; + auto unchecked_result_keys = GC::RootVector { heap() }; unchecked_result_keys.extend(trap_result); // 19. For each element key of targetNonconfigurableKeys, do diff --git a/Libraries/LibJS/Runtime/ProxyObject.h b/Libraries/LibJS/Runtime/ProxyObject.h index e289ba2b4e0..6ba319d4900 100644 --- a/Libraries/LibJS/Runtime/ProxyObject.h +++ b/Libraries/LibJS/Runtime/ProxyObject.h @@ -42,7 +42,7 @@ public: virtual ThrowCompletionOr internal_get(PropertyKey const&, Value receiver, CacheablePropertyMetadata*, PropertyLookupPhase) const override; virtual ThrowCompletionOr internal_set(PropertyKey const&, Value value, Value receiver, CacheablePropertyMetadata*) override; virtual ThrowCompletionOr internal_delete(PropertyKey const&) override; - virtual ThrowCompletionOr> internal_own_property_keys() const override; + virtual ThrowCompletionOr> internal_own_property_keys() const override; virtual ThrowCompletionOr internal_call(Value this_argument, ReadonlySpan arguments_list) override; virtual ThrowCompletionOr> internal_construct(ReadonlySpan arguments_list, FunctionObject& new_target) override; diff --git a/Libraries/LibJS/Runtime/RegExpPrototype.cpp b/Libraries/LibJS/Runtime/RegExpPrototype.cpp index 60c505f79b3..e73987b6041 100644 --- a/Libraries/LibJS/Runtime/RegExpPrototype.cpp +++ b/Libraries/LibJS/Runtime/RegExpPrototype.cpp @@ -669,7 +669,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace) } // 10. Let results be a new empty List. - GC::MarkedVector results(vm.heap()); + GC::RootVector 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(0), static_cast(string.length_in_code_units())); // g. Let captures be a new empty List. - GC::MarkedVector captures(vm.heap()); + GC::RootVector 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 replacer_args(vm.heap()); + GC::RootVector replacer_args(vm.heap()); replacer_args.append(PrimitiveString::create(vm, move(matched))); replacer_args.extend(move(captures)); replacer_args.append(Value(position)); diff --git a/Libraries/LibJS/Runtime/StringObject.cpp b/Libraries/LibJS/Runtime/StringObject.cpp index ca1e32e5265..469bb188086 100644 --- a/Libraries/LibJS/Runtime/StringObject.cpp +++ b/Libraries/LibJS/Runtime/StringObject.cpp @@ -128,12 +128,12 @@ ThrowCompletionOr StringObject::internal_define_own_property(PropertyKey c } // 10.4.3.3 [[OwnPropertyKeys]] ( ), https://tc39.es/ecma262/#sec-string-exotic-objects-ownpropertykeys -ThrowCompletionOr> StringObject::internal_own_property_keys() const +ThrowCompletionOr> StringObject::internal_own_property_keys() const { auto& vm = this->vm(); // 1. Let keys be a new empty List. - auto keys = GC::MarkedVector { heap() }; + auto keys = GC::RootVector { heap() }; // 2. Let str be O.[[StringData]]. auto str = m_string->utf16_string_view(); diff --git a/Libraries/LibJS/Runtime/StringObject.h b/Libraries/LibJS/Runtime/StringObject.h index d6ca35b1523..9d95a91e17f 100644 --- a/Libraries/LibJS/Runtime/StringObject.h +++ b/Libraries/LibJS/Runtime/StringObject.h @@ -29,7 +29,7 @@ protected: private: virtual ThrowCompletionOr> internal_get_own_property(PropertyKey const&) const override; virtual ThrowCompletionOr internal_define_own_property(PropertyKey const&, PropertyDescriptor const&, Optional* precomputed_get_own_property = nullptr) override; - virtual ThrowCompletionOr> internal_own_property_keys() const override; + virtual ThrowCompletionOr> internal_own_property_keys() const override; virtual bool is_string_object() const final { return true; } virtual void visit_edges(Visitor&) override; diff --git a/Libraries/LibJS/Runtime/TypedArray.cpp b/Libraries/LibJS/Runtime/TypedArray.cpp index dfcca083bc2..0e70e4e7d52 100644 --- a/Libraries/LibJS/Runtime/TypedArray.cpp +++ b/Libraries/LibJS/Runtime/TypedArray.cpp @@ -288,7 +288,7 @@ static ThrowCompletionOr initialize_typed_array_from_array_like(VM& vm, Ty // 23.2.5.1.4 InitializeTypedArrayFromList, https://tc39.es/ecma262/#sec-initializetypedarrayfromlist template -static ThrowCompletionOr initialize_typed_array_from_list(VM& vm, TypedArray& typed_array, GC::MarkedVector const& list) +static ThrowCompletionOr initialize_typed_array_from_list(VM& vm, TypedArray& typed_array, GC::RootVector const& list) { // 1. Let len be the number of elements in values. auto length = list.size(); @@ -315,7 +315,7 @@ static ThrowCompletionOr initialize_typed_array_from_list(VM& vm, TypedArr } // 23.2.4.2 TypedArrayCreate ( constructor, argumentList ), https://tc39.es/ecma262/#typedarray-create -ThrowCompletionOr typed_array_create(VM& vm, FunctionObject& constructor, GC::MarkedVector arguments) +ThrowCompletionOr typed_array_create(VM& vm, FunctionObject& constructor, GC::RootVector arguments) { Optional first_argument; if (arguments.size() == 1 && arguments[0].is_number()) @@ -346,7 +346,7 @@ ThrowCompletionOr typed_array_create(VM& vm, FunctionObject& co } // 23.2.4.3 TypedArrayCreateSameType ( exemplar, argumentList ), https://tc39.es/ecma262/#sec-typedarray-create-same-type -ThrowCompletionOr typed_array_create_same_type(VM& vm, TypedArrayBase const& exemplar, GC::MarkedVector arguments) +ThrowCompletionOr typed_array_create_same_type(VM& vm, TypedArrayBase const& exemplar, GC::RootVector arguments) { auto& realm = *vm.current_realm(); diff --git a/Libraries/LibJS/Runtime/TypedArray.h b/Libraries/LibJS/Runtime/TypedArray.h index ec6aeba8a68..9986df7bcb6 100644 --- a/Libraries/LibJS/Runtime/TypedArray.h +++ b/Libraries/LibJS/Runtime/TypedArray.h @@ -413,7 +413,7 @@ public: } // 10.4.5.8 [[OwnPropertyKeys]] ( ), https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects-ownpropertykeys - virtual ThrowCompletionOr> internal_own_property_keys() const override + virtual ThrowCompletionOr> 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 { heap() }; + auto keys = GC::RootVector { heap() }; // 3. If IsTypedArrayOutOfBounds(taRecord) is false, then if (!is_typed_array_out_of_bounds(typed_array_record)) { @@ -511,8 +511,8 @@ protected: }; ThrowCompletionOr typed_array_from(VM&, Value); -ThrowCompletionOr typed_array_create(VM&, FunctionObject& constructor, GC::MarkedVector arguments); -ThrowCompletionOr typed_array_create_same_type(VM&, TypedArrayBase const& exemplar, GC::MarkedVector arguments); +ThrowCompletionOr typed_array_create(VM&, FunctionObject& constructor, GC::RootVector arguments); +ThrowCompletionOr typed_array_create_same_type(VM&, TypedArrayBase const& exemplar, GC::RootVector arguments); ThrowCompletionOr validate_typed_array(VM&, Object const&, ArrayBuffer::Order); ThrowCompletionOr compare_typed_array_elements(VM&, Value x, Value y, FunctionObject* comparefn); diff --git a/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp b/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp index 7509772cf70..9d16b623b1f 100644 --- a/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp +++ b/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp @@ -92,7 +92,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::from) auto length = values.size(); // c. Let targetObj be ? TypedArrayCreate(C, « 𝔽(len) »). - GC::MarkedVector arguments(vm.heap()); + GC::RootVector 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 arguments(vm.heap()); + GC::RootVector 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(ErrorType::NotAConstructor, constructor.to_string_without_side_effects()); // 4. Let newObj be ? TypedArrayCreate(C, « 𝔽(len) »). - GC::MarkedVector arguments(vm.heap()); + GC::RootVector arguments(vm.heap()); arguments.append(Value(length)); auto* new_object = TRY(typed_array_create(vm, constructor.as_function(), move(arguments))); diff --git a/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp b/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp index a0f6af2ca94..1c150ec9e4f 100644 --- a/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp +++ b/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp @@ -92,7 +92,7 @@ static ThrowCompletionOr> callback_from_args(VM& vm, Str } // 23.2.4.1 TypedArraySpeciesCreate ( exemplar, argumentList ), https://tc39.es/ecma262/#typedarray-species-create -static ThrowCompletionOr typed_array_species_create(VM& vm, TypedArrayBase const& exemplar, GC::MarkedVector arguments) +static ThrowCompletionOr typed_array_species_create(VM& vm, TypedArrayBase const& exemplar, GC::RootVector 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 kept { vm.heap() }; + GC::RootVector 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 arguments(vm.heap()); + GC::RootVector 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 arguments(vm.heap()); + GC::RootVector 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 arguments(vm.heap()); + GC::RootVector 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 arguments(vm.heap()); + GC::RootVector 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 arguments(vm.heap()); + GC::RootVector 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 arguments(vm.heap()); + GC::RootVector 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(ErrorType::TypedArrayInvalidIntegerIndex, actual_index); // 10. Let A be ? TypedArrayCreateSameType(O, « 𝔽(len) »). - GC::MarkedVector arguments(vm.heap()); + GC::RootVector arguments(vm.heap()); arguments.empend(length); auto* array = TRY(typed_array_create_same_type(vm, *typed_array, move(arguments))); diff --git a/Libraries/LibJS/Runtime/VM.h b/Libraries/LibJS/Runtime/VM.h index fe588aadb5c..d1575cea11e 100644 --- a/Libraries/LibJS/Runtime/VM.h +++ b/Libraries/LibJS/Runtime/VM.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Libraries/LibJS/Runtime/Value.cpp b/Libraries/LibJS/Runtime/Value.cpp index cd7d1bc8b20..22ac7e74331 100644 --- a/Libraries/LibJS/Runtime/Value.cpp +++ b/Libraries/LibJS/Runtime/Value.cpp @@ -2493,7 +2493,7 @@ ThrowCompletionOr 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::invoke_internal(VM& vm, PropertyKey const& property_key, Optional> arguments) +ThrowCompletionOr Value::invoke_internal(VM& vm, PropertyKey const& property_key, Optional> arguments) { // 1. If argumentsList is not present, set argumentsList to a new empty List. diff --git a/Libraries/LibJS/Runtime/Value.h b/Libraries/LibJS/Runtime/Value.h index 11cc0cb8908..045066fa430 100644 --- a/Libraries/LibJS/Runtime/Value.h +++ b/Libraries/LibJS/Runtime/Value.h @@ -449,7 +449,7 @@ private: } } - [[nodiscard]] ThrowCompletionOr invoke_internal(VM&, PropertyKey const&, Optional> arguments); + [[nodiscard]] ThrowCompletionOr invoke_internal(VM&, PropertyKey const&, Optional> arguments); ThrowCompletionOr to_i32_slow_case(VM&) const; diff --git a/Libraries/LibJS/Runtime/WrappedFunction.cpp b/Libraries/LibJS/Runtime/WrappedFunction.cpp index 5b25fa7f287..19a2260b3ba 100644 --- a/Libraries/LibJS/Runtime/WrappedFunction.cpp +++ b/Libraries/LibJS/Runtime/WrappedFunction.cpp @@ -99,7 +99,7 @@ ThrowCompletionOr 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 { vm.heap() }; + auto wrapped_args = GC::RootVector { vm.heap() }; wrapped_args.ensure_capacity(arguments_list.size()); // 7. For each element arg of argumentsList, do diff --git a/Libraries/LibWeb/Animations/KeyframeEffect.cpp b/Libraries/LibWeb/Animations/KeyframeEffect.cpp index 8d0986c261a..ac843dda7f8 100644 --- a/Libraries/LibWeb/Animations/KeyframeEffect.cpp +++ b/Libraries/LibWeb/Animations/KeyframeEffect.cpp @@ -797,7 +797,7 @@ Optional KeyframeEffect::pseudo_element_type } // https://www.w3.org/TR/web-animations-1/#dom-keyframeeffect-getkeyframes -WebIDL::ExceptionOr> KeyframeEffect::get_keyframes() +WebIDL::ExceptionOr> KeyframeEffect::get_keyframes() { if (m_keyframe_objects.size() != m_keyframes.size()) { auto& vm = this->vm(); @@ -832,7 +832,7 @@ WebIDL::ExceptionOr> KeyframeEffect::get_keyframes } } - GC::MarkedVector keyframes { heap() }; + GC::RootVector keyframes { heap() }; for (auto const& keyframe : m_keyframe_objects) keyframes.append(keyframe); return keyframes; diff --git a/Libraries/LibWeb/Animations/KeyframeEffect.h b/Libraries/LibWeb/Animations/KeyframeEffect.h index 405773dd943..3951a53e0c9 100644 --- a/Libraries/LibWeb/Animations/KeyframeEffect.h +++ b/Libraries/LibWeb/Animations/KeyframeEffect.h @@ -97,7 +97,7 @@ public: Bindings::CompositeOperation composite() const { return m_composite; } void set_composite(Bindings::CompositeOperation value) { m_composite = value; } - WebIDL::ExceptionOr> get_keyframes(); + WebIDL::ExceptionOr> get_keyframes(); WebIDL::ExceptionOr set_keyframes(Optional> const&); KeyFrameSet const* key_frame_set() { return m_key_frame_set; } diff --git a/Libraries/LibWeb/Bindings/MainThreadVM.cpp b/Libraries/LibWeb/Bindings/MainThreadVM.cpp index 2f56b3c0f12..b7b894dfe6f 100644 --- a/Libraries/LibWeb/Bindings/MainThreadVM.cpp +++ b/Libraries/LibWeb/Bindings/MainThreadVM.cpp @@ -709,7 +709,7 @@ void queue_mutation_observer_microtask(DOM::Document const& document) custom_data.mutation_observer_microtask_queued = false; // 2. Let notifySet be a clone of the surrounding agent’s mutation observers. - GC::MarkedVector notify_set(heap); + GC::RootVector notify_set(heap); for (auto& observer : custom_data.mutation_observers) notify_set.append(observer); diff --git a/Libraries/LibWeb/Bindings/PlatformObject.cpp b/Libraries/LibWeb/Bindings/PlatformObject.cpp index 21db9d458ab..252aa137e50 100644 --- a/Libraries/LibWeb/Bindings/PlatformObject.cpp +++ b/Libraries/LibWeb/Bindings/PlatformObject.cpp @@ -400,7 +400,7 @@ JS::ThrowCompletionOr PlatformObject::internal_prevent_extensions() } // https://webidl.spec.whatwg.org/#legacy-platform-object-ownpropertykeys -JS::ThrowCompletionOr> PlatformObject::internal_own_property_keys() const +JS::ThrowCompletionOr> PlatformObject::internal_own_property_keys() const { if (!m_legacy_platform_object_flags.has_value() || m_legacy_platform_object_flags->has_global_interface_extended_attribute) return Base::internal_own_property_keys(); @@ -408,7 +408,7 @@ JS::ThrowCompletionOr> PlatformObject::internal_own_ auto& vm = this->vm(); // 1. Let keys be a new empty list of ECMAScript String and Symbol values. - GC::MarkedVector keys { heap() }; + GC::RootVector keys { heap() }; // 2. If O supports indexed properties, then for each index of O’s supported property indices, in ascending numerical order, append ! ToString(index) to keys. if (m_legacy_platform_object_flags->supports_indexed_properties) { diff --git a/Libraries/LibWeb/Bindings/PlatformObject.h b/Libraries/LibWeb/Bindings/PlatformObject.h index 16089d87d46..99bbc35f0aa 100644 --- a/Libraries/LibWeb/Bindings/PlatformObject.h +++ b/Libraries/LibWeb/Bindings/PlatformObject.h @@ -40,7 +40,7 @@ public: virtual JS::ThrowCompletionOr internal_define_own_property(JS::PropertyKey const&, JS::PropertyDescriptor const&, Optional* precomputed_get_own_property = nullptr) override; virtual JS::ThrowCompletionOr internal_delete(JS::PropertyKey const&) override; virtual JS::ThrowCompletionOr internal_prevent_extensions() override; - virtual JS::ThrowCompletionOr> internal_own_property_keys() const override; + virtual JS::ThrowCompletionOr> internal_own_property_keys() const override; JS::ThrowCompletionOr is_named_property_exposed_on_object(JS::PropertyKey const&) const; diff --git a/Libraries/LibWeb/CSS/CSSRuleList.cpp b/Libraries/LibWeb/CSS/CSSRuleList.cpp index c688cf45b74..39aa50fcd20 100644 --- a/Libraries/LibWeb/CSS/CSSRuleList.cpp +++ b/Libraries/LibWeb/CSS/CSSRuleList.cpp @@ -21,7 +21,7 @@ namespace Web::CSS { GC_DEFINE_ALLOCATOR(CSSRuleList); -GC::Ref CSSRuleList::create(JS::Realm& realm, GC::MarkedVector const& rules) +GC::Ref CSSRuleList::create(JS::Realm& realm, GC::RootVector const& rules) { auto rule_list = realm.create(realm); for (auto* rule : rules) diff --git a/Libraries/LibWeb/CSS/CSSRuleList.h b/Libraries/LibWeb/CSS/CSSRuleList.h index 8b1f395116a..561fa9838b0 100644 --- a/Libraries/LibWeb/CSS/CSSRuleList.h +++ b/Libraries/LibWeb/CSS/CSSRuleList.h @@ -25,7 +25,7 @@ class CSSRuleList : public Bindings::PlatformObject { GC_DECLARE_ALLOCATOR(CSSRuleList); public: - [[nodiscard]] static GC::Ref create(JS::Realm&, GC::MarkedVector const&); + [[nodiscard]] static GC::Ref create(JS::Realm&, GC::RootVector const&); [[nodiscard]] static GC::Ref create_empty(JS::Realm&); ~CSSRuleList() = default; diff --git a/Libraries/LibWeb/CSS/CSSStyleSheet.cpp b/Libraries/LibWeb/CSS/CSSStyleSheet.cpp index 7fa0765379e..c4b51b88beb 100644 --- a/Libraries/LibWeb/CSS/CSSStyleSheet.cpp +++ b/Libraries/LibWeb/CSS/CSSStyleSheet.cpp @@ -218,7 +218,7 @@ GC::Ref CSSStyleSheet::replace(String text) auto& rules = parsed_stylesheet->rules(); // 2. If rules contains one or more @import rules, remove those rules from rules. - GC::MarkedVector> rules_without_import(realm.heap()); + GC::RootVector> rules_without_import(realm.heap()); for (auto rule : rules) { if (rule->type() != CSSRule::Type::Import) rules_without_import.append(rule); @@ -252,7 +252,7 @@ WebIDL::ExceptionOr CSSStyleSheet::replace_sync(StringView text) auto& rules = parsed_stylesheet->rules(); // 3. If rules contains one or more @import rules, remove those rules from rules. - GC::MarkedVector> rules_without_import(realm().heap()); + GC::RootVector> rules_without_import(realm().heap()); for (auto rule : rules) { if (rule->type() != CSSRule::Type::Import) rules_without_import.append(rule); diff --git a/Libraries/LibWeb/CSS/FontFaceSet.cpp b/Libraries/LibWeb/CSS/FontFaceSet.cpp index f06e277a152..d904de11602 100644 --- a/Libraries/LibWeb/CSS/FontFaceSet.cpp +++ b/Libraries/LibWeb/CSS/FontFaceSet.cpp @@ -249,7 +249,7 @@ JS::ThrowCompletionOr> FontFaceSet::load(String const& // 4. Queue a task to run the following steps synchronously: HTML::queue_a_task(HTML::Task::Source::FontLoading, nullptr, nullptr, GC::create_function(realm.heap(), [&realm, promise, matched_font_faces] { - GC::MarkedVector> promises(realm.heap()); + GC::RootVector> promises(realm.heap()); // 1. For all of the font faces in the font face list, call their load() method. for (auto font_face_value : *matched_font_faces) { diff --git a/Libraries/LibWeb/CSS/Parser/MediaParsing.cpp b/Libraries/LibWeb/CSS/Parser/MediaParsing.cpp index 713b16c400a..611e42c795e 100644 --- a/Libraries/LibWeb/CSS/Parser/MediaParsing.cpp +++ b/Libraries/LibWeb/CSS/Parser/MediaParsing.cpp @@ -624,7 +624,7 @@ GC::Ptr Parser::convert_to_media_rule(AtRule const& rule, Nested n auto media_query_list = parse_a_media_query_list(media_query_tokens); auto media_list = MediaList::create(m_context.realm(), move(media_query_list)); - GC::MarkedVector child_rules { m_context.realm().heap() }; + GC::RootVector child_rules { m_context.realm().heap() }; for (auto const& child : rule.child_rules_and_lists_of_declarations) { child.visit( [&](Rule const& rule) { diff --git a/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Libraries/LibWeb/CSS/Parser/Parser.cpp index 3e0d160daa9..0a36ae00611 100644 --- a/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -158,7 +158,7 @@ CSSStyleSheet* Parser::parse_as_css_stylesheet(Optional location) auto const& style_sheet = parse_a_stylesheet(m_token_stream, {}); // Interpret all of the resulting top-level qualified rules as style rules, defined below. - GC::MarkedVector rules(m_context.realm().heap()); + GC::RootVector rules(m_context.realm().heap()); for (auto const& raw_rule : style_sheet.rules) { auto rule = convert_to_rule(raw_rule, Nested::No); // If any style rule is invalid, or any at-rule is not recognized or is invalid according to its grammar or context, it’s a parse error. diff --git a/Libraries/LibWeb/CSS/Parser/RuleParsing.cpp b/Libraries/LibWeb/CSS/Parser/RuleParsing.cpp index b52e9e0bfc9..0daa2d48b09 100644 --- a/Libraries/LibWeb/CSS/Parser/RuleParsing.cpp +++ b/Libraries/LibWeb/CSS/Parser/RuleParsing.cpp @@ -107,7 +107,7 @@ GC::Ptr Parser::convert_to_style_rule(QualifiedRule const& qualifi return {}; } - GC::MarkedVector child_rules { m_context.realm().heap() }; + GC::RootVector child_rules { m_context.realm().heap() }; for (auto& child : qualified_rule.child_rules) { child.visit( [&](Rule const& rule) { @@ -246,7 +246,7 @@ GC::Ptr Parser::convert_to_layer_rule(AtRule const& rule, Nested nested } // Then the rules - GC::MarkedVector child_rules { m_context.realm().heap() }; + GC::RootVector child_rules { m_context.realm().heap() }; for (auto const& child : rule.child_rules_and_lists_of_declarations) { child.visit( [&](Rule const& rule) { @@ -341,7 +341,7 @@ GC::Ptr Parser::convert_to_keyframes_rule(AtRule const& rule) auto name = name_token.to_string(); - GC::MarkedVector keyframes(m_context.realm().heap()); + GC::RootVector keyframes(m_context.realm().heap()); rule.for_each_as_qualified_rule_list([&](auto& qualified_rule) { if (!qualified_rule.child_rules.is_empty()) { dbgln_if(CSS_PARSER_DEBUG, "CSSParser: @keyframes keyframe rule contains at-rules; discarding them."); @@ -468,7 +468,7 @@ GC::Ptr Parser::convert_to_supports_rule(AtRule const& rule, Ne return {}; } - GC::MarkedVector child_rules { m_context.realm().heap() }; + GC::RootVector child_rules { m_context.realm().heap() }; for (auto const& child : rule.child_rules_and_lists_of_declarations) { child.visit( [&](Rule const& rule) { diff --git a/Libraries/LibWeb/DOM/Attr.cpp b/Libraries/LibWeb/DOM/Attr.cpp index d556b699db7..df6878855bf 100644 --- a/Libraries/LibWeb/DOM/Attr.cpp +++ b/Libraries/LibWeb/DOM/Attr.cpp @@ -106,7 +106,7 @@ void Attr::handle_attribute_changes(Element& element, Optional const& ol if (element.is_custom()) { auto& vm = this->vm(); - GC::MarkedVector arguments { vm.heap() }; + GC::RootVector arguments { vm.heap() }; arguments.append(JS::PrimitiveString::create(vm, local_name())); arguments.append(!old_value.has_value() ? JS::js_null() : JS::PrimitiveString::create(vm, old_value.value())); arguments.append(!new_value.has_value() ? JS::js_null() : JS::PrimitiveString::create(vm, new_value.value())); diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp index 108c16e6526..306f0cfe14d 100644 --- a/Libraries/LibWeb/DOM/Document.cpp +++ b/Libraries/LibWeb/DOM/Document.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include @@ -1973,7 +1973,7 @@ void Document::adopt_node(Node& node) if (element.is_custom()) { auto& vm = this->vm(); - GC::MarkedVector arguments { vm.heap() }; + GC::RootVector arguments { vm.heap() }; arguments.append(&old_document); arguments.append(this); @@ -4208,7 +4208,7 @@ void Document::run_the_update_intersection_observations_steps(HighResolutionTime // 2. For each observer in observer list: // NOTE: We make a copy of the intersection observers list to avoid modifying it while iterating. - GC::MarkedVector> intersection_observers(heap()); + GC::RootVector> intersection_observers(heap()); intersection_observers.ensure_capacity(m_intersection_observers.size()); for (auto& observer : m_intersection_observers) intersection_observers.append(observer); @@ -5058,10 +5058,10 @@ Element const* Document::element_from_point(double x, double y) } // https://drafts.csswg.org/cssom-view/#dom-document-elementsfrompoint -GC::MarkedVector> Document::elements_from_point(double x, double y) +GC::RootVector> Document::elements_from_point(double x, double y) { // 1. Let sequence be a new empty sequence. - GC::MarkedVector> sequence(heap()); + GC::RootVector> sequence(heap()); // 2. If either argument is negative, x is greater than the viewport width excluding the size of a rendered scroll bar (if any), // or y is greater than the viewport height excluding the size of a rendered scroll bar (if any), @@ -5288,7 +5288,7 @@ size_t Document::broadcast_active_resize_observations() // 2. For each observer in document.[[resizeObservers]] run these steps: // NOTE: We make a copy of the resize observers list to avoid modifying it while iterating. - GC::MarkedVector> resize_observers(heap()); + GC::RootVector> resize_observers(heap()); resize_observers.ensure_capacity(m_resize_observers.size()); for (auto const& observer : m_resize_observers) resize_observers.append(observer); @@ -5300,7 +5300,7 @@ size_t Document::broadcast_active_resize_observations() } // 2. Let entries be an empty list of ResizeObserverEntryies. - GC::MarkedVector> entries(heap()); + GC::RootVector> entries(heap()); // 3. For each observation in [[activeTargets]] perform these steps: for (auto const& observation : observer->active_targets()) { diff --git a/Libraries/LibWeb/DOM/Document.h b/Libraries/LibWeb/DOM/Document.h index 58e190fcd36..a2e67af1c7e 100644 --- a/Libraries/LibWeb/DOM/Document.h +++ b/Libraries/LibWeb/DOM/Document.h @@ -662,7 +662,7 @@ public: WebIDL::ExceptionOr set_design_mode(String const&); Element const* element_from_point(double x, double y); - GC::MarkedVector> elements_from_point(double x, double y); + GC::RootVector> elements_from_point(double x, double y); GC::Ptr scrolling_element() const; void set_needs_to_resolve_paint_only_properties() { m_needs_to_resolve_paint_only_properties = true; } diff --git a/Libraries/LibWeb/DOM/Element.cpp b/Libraries/LibWeb/DOM/Element.cpp index 64b817b6d72..3e723cea0f4 100644 --- a/Libraries/LibWeb/DOM/Element.cpp +++ b/Libraries/LibWeb/DOM/Element.cpp @@ -2107,7 +2107,7 @@ void Element::enqueue_a_custom_element_upgrade_reaction(HTML::CustomElementDefin enqueue_an_element_on_the_appropriate_element_queue(); } -void Element::enqueue_a_custom_element_callback_reaction(FlyString const& callback_name, GC::MarkedVector arguments) +void Element::enqueue_a_custom_element_callback_reaction(FlyString const& callback_name, GC::RootVector arguments) { // 1. Let definition be element's custom element definition. auto& definition = m_custom_element_definition; @@ -2164,7 +2164,7 @@ JS::ThrowCompletionOr Element::upgrade_element(GC::Refitem(attribute_index); VERIFY(attribute); - GC::MarkedVector arguments { vm.heap() }; + GC::RootVector arguments { vm.heap() }; arguments.append(JS::PrimitiveString::create(vm, attribute->local_name())); arguments.append(JS::js_null()); @@ -2176,7 +2176,7 @@ JS::ThrowCompletionOr Element::upgrade_element(GC::Ref empty_arguments { vm.heap() }; + GC::RootVector empty_arguments { vm.heap() }; enqueue_a_custom_element_callback_reaction(HTML::CustomElementReactionNames::connectedCallback, move(empty_arguments)); } diff --git a/Libraries/LibWeb/DOM/Element.h b/Libraries/LibWeb/DOM/Element.h index 7b20d286950..b7e8bedc006 100644 --- a/Libraries/LibWeb/DOM/Element.h +++ b/Libraries/LibWeb/DOM/Element.h @@ -72,7 +72,7 @@ struct CustomElementUpgradeReaction { // A callback reaction, which will call a lifecycle callback, and contains a callback function as well as a list of arguments. struct CustomElementCallbackReaction { GC::Root callback; - GC::MarkedVector arguments; + GC::RootVector arguments; }; // https://dom.spec.whatwg.org/#concept-element-custom-element-state @@ -306,7 +306,7 @@ public: bool has_referenced_and_hidden_ancestor() const; void enqueue_a_custom_element_upgrade_reaction(HTML::CustomElementDefinition& custom_element_definition); - void enqueue_a_custom_element_callback_reaction(FlyString const& callback_name, GC::MarkedVector arguments); + void enqueue_a_custom_element_callback_reaction(FlyString const& callback_name, GC::RootVector arguments); using CustomElementReactionQueue = Vector>; CustomElementReactionQueue* custom_element_reaction_queue() { return m_custom_element_reaction_queue; } diff --git a/Libraries/LibWeb/DOM/HTMLCollection.cpp b/Libraries/LibWeb/DOM/HTMLCollection.cpp index 397abcd4000..b896eab4e86 100644 --- a/Libraries/LibWeb/DOM/HTMLCollection.cpp +++ b/Libraries/LibWeb/DOM/HTMLCollection.cpp @@ -98,10 +98,10 @@ void HTMLCollection::update_cache_if_needed() const m_cached_dom_tree_version = root()->document().dom_tree_version(); } -GC::MarkedVector> HTMLCollection::collect_matching_elements() const +GC::RootVector> HTMLCollection::collect_matching_elements() const { update_cache_if_needed(); - GC::MarkedVector> elements(heap()); + GC::RootVector> elements(heap()); for (auto& element : m_cached_elements) elements.append(element); return elements; diff --git a/Libraries/LibWeb/DOM/HTMLCollection.h b/Libraries/LibWeb/DOM/HTMLCollection.h index fd4f3ebc978..e5765ad2bdd 100644 --- a/Libraries/LibWeb/DOM/HTMLCollection.h +++ b/Libraries/LibWeb/DOM/HTMLCollection.h @@ -38,7 +38,7 @@ public: Element* item(size_t index) const; Element* named_item(FlyString const& key) const; - GC::MarkedVector> collect_matching_elements() const; + GC::RootVector> collect_matching_elements() const; virtual Optional item_value(size_t index) const override; virtual JS::Value named_item_value(FlyString const& name) const override; diff --git a/Libraries/LibWeb/DOM/LiveNodeList.cpp b/Libraries/LibWeb/DOM/LiveNodeList.cpp index 4355fe9d2dd..5c3fca30da6 100644 --- a/Libraries/LibWeb/DOM/LiveNodeList.cpp +++ b/Libraries/LibWeb/DOM/LiveNodeList.cpp @@ -35,9 +35,9 @@ void LiveNodeList::visit_edges(Cell::Visitor& visitor) visitor.visit(m_root); } -GC::MarkedVector LiveNodeList::collection() const +GC::RootVector LiveNodeList::collection() const { - GC::MarkedVector nodes(heap()); + GC::RootVector nodes(heap()); if (m_scope == Scope::Descendants) { m_root->for_each_in_subtree([&](auto& node) { if (m_filter(node)) diff --git a/Libraries/LibWeb/DOM/LiveNodeList.h b/Libraries/LibWeb/DOM/LiveNodeList.h index 466694314b5..5e83cff60d1 100644 --- a/Libraries/LibWeb/DOM/LiveNodeList.h +++ b/Libraries/LibWeb/DOM/LiveNodeList.h @@ -38,7 +38,7 @@ protected: private: virtual void visit_edges(Cell::Visitor&) override; - GC::MarkedVector collection() const; + GC::RootVector collection() const; GC::Ref m_root; Function m_filter; diff --git a/Libraries/LibWeb/DOM/Node.cpp b/Libraries/LibWeb/DOM/Node.cpp index ade0af01b85..9fbde31321c 100644 --- a/Libraries/LibWeb/DOM/Node.cpp +++ b/Libraries/LibWeb/DOM/Node.cpp @@ -673,7 +673,7 @@ void Node::insert_before(GC::Ref node, GC::Ptr child, bool suppress_ // 1. If inclusiveDescendant is custom, then enqueue a custom element callback reaction with inclusiveDescendant, // callback name "connectedCallback", and an empty argument list. if (element.is_custom()) { - GC::MarkedVector empty_arguments { vm().heap() }; + GC::RootVector empty_arguments { vm().heap() }; element.enqueue_a_custom_element_callback_reaction(HTML::CustomElementReactionNames::connectedCallback, move(empty_arguments)); } @@ -702,7 +702,7 @@ void Node::insert_before(GC::Ref node, GC::Ptr child, bool suppress_ // the post-connection steps while we’re traversing the node tree. This is because the post-connection // steps can modify the tree’s structure, making live traversal unsafe, possibly leading to the // post-connection steps being called multiple times on the same node. - GC::MarkedVector> static_node_list(heap()); + GC::RootVector> static_node_list(heap()); // 11. For each node of nodes, in tree order: for (auto& node : nodes) { @@ -882,7 +882,7 @@ void Node::remove(bool suppress_observers) auto& element = static_cast(*this); if (element.is_custom() && is_parent_connected) { - GC::MarkedVector empty_arguments { vm().heap() }; + GC::RootVector empty_arguments { vm().heap() }; element.enqueue_a_custom_element_callback_reaction(HTML::CustomElementReactionNames::disconnectedCallback, move(empty_arguments)); } } @@ -898,7 +898,7 @@ void Node::remove(bool suppress_observers) auto& element = static_cast(descendant); if (element.is_custom() && is_parent_connected) { - GC::MarkedVector empty_arguments { vm().heap() }; + GC::RootVector empty_arguments { vm().heap() }; element.enqueue_a_custom_element_callback_reaction(HTML::CustomElementReactionNames::disconnectedCallback, move(empty_arguments)); } } diff --git a/Libraries/LibWeb/DOM/Range.cpp b/Libraries/LibWeb/DOM/Range.cpp index 1c1dc239c93..ea4c56449bf 100644 --- a/Libraries/LibWeb/DOM/Range.cpp +++ b/Libraries/LibWeb/DOM/Range.cpp @@ -1105,7 +1105,7 @@ WebIDL::ExceptionOr Range::delete_contents() } // 4. Let nodes to remove be a list of all the nodes that are contained in this, in tree order, omitting any node whose parent is also contained in this. - GC::MarkedVector nodes_to_remove(heap()); + GC::RootVector nodes_to_remove(heap()); for (GC::Ptr node = start_container(); node != end_container()->next_sibling(); node = node->next_in_pre_order()) { if (contains_node(*node) && (!node->parent_node() || !contains_node(*node->parent_node()))) nodes_to_remove.append(node); diff --git a/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp b/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp index 463e6fa3bac..a12e3f28bdc 100644 --- a/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp +++ b/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp @@ -1645,7 +1645,7 @@ WebIDL::ExceptionOr> http_network_or_cache_fetch(JS::Re // 5. Let storedResponse be null. GC::Ptr stored_response; - GC::MarkedVector> initial_set_of_stored_responses(realm.heap()); + GC::RootVector> initial_set_of_stored_responses(realm.heap()); // 6. Let httpCache be null. // (Typeless until we actually implement it, needed for checks below) diff --git a/Libraries/LibWeb/HTML/AudioTrackList.h b/Libraries/LibWeb/HTML/AudioTrackList.h index 5b0ff080e59..16b54ebbb18 100644 --- a/Libraries/LibWeb/HTML/AudioTrackList.h +++ b/Libraries/LibWeb/HTML/AudioTrackList.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include diff --git a/Libraries/LibWeb/HTML/BroadcastChannel.cpp b/Libraries/LibWeb/HTML/BroadcastChannel.cpp index ccd7a9d5c2f..9af6fd122d1 100644 --- a/Libraries/LibWeb/HTML/BroadcastChannel.cpp +++ b/Libraries/LibWeb/HTML/BroadcastChannel.cpp @@ -121,7 +121,7 @@ WebIDL::ExceptionOr BroadcastChannel::post_message(JS::Value message) auto source_storage_key = Web::StorageAPI::obtain_a_storage_key_for_non_storage_purposes(relevant_settings_object(*this)); // 6. Let destinations be a list of BroadcastChannel objects that match the following criteria: - GC::MarkedVector> destinations(vm.heap()); + GC::RootVector> destinations(vm.heap()); // * The result of running obtain a storage key for non-storage purposes with their relevant settings object equals sourceStorageKey. auto same_origin_broadcast_channels = s_broadcast_channel_repository.registered_channels_for_key(source_storage_key); diff --git a/Libraries/LibWeb/HTML/CloseWatcherManager.cpp b/Libraries/LibWeb/HTML/CloseWatcherManager.cpp index dedb66a4623..bf3ea88ac65 100644 --- a/Libraries/LibWeb/HTML/CloseWatcherManager.cpp +++ b/Libraries/LibWeb/HTML/CloseWatcherManager.cpp @@ -31,7 +31,7 @@ void CloseWatcherManager::add(GC::Ref close_watcher) // If manager's groups's size is less than manager's allowed number of groups if (m_groups.size() < m_allowed_number_of_groups) { // then append « closeWatcher » to manager's groups. - GC::MarkedVector> new_group(realm().heap()); + GC::RootVector> new_group(realm().heap()); new_group.append(close_watcher); m_groups.append(move(new_group)); } else { @@ -68,7 +68,7 @@ bool CloseWatcherManager::process_close_watchers() auto& group = m_groups.last(); // Ambiguous spec wording. We copy the groups to avoid modifying the original while iterating. // See https://github.com/whatwg/html/issues/10240 - GC::MarkedVector> group_copy(realm().heap()); + GC::RootVector> group_copy(realm().heap()); group_copy.ensure_capacity(group.size()); for (auto& close_watcher : group) { group_copy.append(close_watcher); diff --git a/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.cpp b/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.cpp index b1791c71e61..f20acc43c13 100644 --- a/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.cpp +++ b/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.cpp @@ -237,13 +237,13 @@ JS::ThrowCompletionOr cross_origin_set(JS::VM& vm, JS::Object& object, JS: } // 7.2.3.7 CrossOriginOwnPropertyKeys ( O ), https://html.spec.whatwg.org/multipage/browsers.html#crossoriginownpropertykeys-(-o-) -GC::MarkedVector cross_origin_own_property_keys(Variant const& object) +GC::RootVector cross_origin_own_property_keys(Variant const& object) { auto& event_loop = HTML::main_thread_event_loop(); auto& vm = event_loop.vm(); // 1. Let keys be a new empty List. - auto keys = GC::MarkedVector { vm.heap() }; + auto keys = GC::RootVector { vm.heap() }; // 2. For each e of CrossOriginProperties(O), append e.[[Property]] to keys. for (auto& entry : cross_origin_properties(object)) diff --git a/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.h b/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.h index d2a60fcfc70..1a0adee71a5 100644 --- a/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.h +++ b/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.h @@ -21,6 +21,6 @@ bool is_platform_object_same_origin(JS::Object const&); Optional cross_origin_get_own_property_helper(Variant const&, JS::PropertyKey const&); JS::ThrowCompletionOr cross_origin_get(JS::VM&, JS::Object const&, JS::PropertyKey const&, JS::Value receiver); JS::ThrowCompletionOr cross_origin_set(JS::VM&, JS::Object&, JS::PropertyKey const&, JS::Value, JS::Value receiver); -GC::MarkedVector cross_origin_own_property_keys(Variant const&); +GC::RootVector cross_origin_own_property_keys(Variant const&); } diff --git a/Libraries/LibWeb/HTML/EventLoop/TaskQueue.cpp b/Libraries/LibWeb/HTML/EventLoop/TaskQueue.cpp index ea31788859a..c811305a9c7 100644 --- a/Libraries/LibWeb/HTML/EventLoop/TaskQueue.cpp +++ b/Libraries/LibWeb/HTML/EventLoop/TaskQueue.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include @@ -63,9 +63,9 @@ void TaskQueue::remove_tasks_matching(Function filter) }); } -GC::MarkedVector> TaskQueue::take_tasks_matching(Function filter) +GC::RootVector> TaskQueue::take_tasks_matching(Function filter) { - GC::MarkedVector> matching_tasks(heap()); + GC::RootVector> matching_tasks(heap()); for (size_t i = 0; i < m_tasks.size();) { auto& task = m_tasks.at(i); diff --git a/Libraries/LibWeb/HTML/EventLoop/TaskQueue.h b/Libraries/LibWeb/HTML/EventLoop/TaskQueue.h index c14bcf9aeb2..eb6e8dca78a 100644 --- a/Libraries/LibWeb/HTML/EventLoop/TaskQueue.h +++ b/Libraries/LibWeb/HTML/EventLoop/TaskQueue.h @@ -37,7 +37,7 @@ public: } void remove_tasks_matching(Function); - GC::MarkedVector> take_tasks_matching(Function); + GC::RootVector> take_tasks_matching(Function); Task const* last_added_task() const; diff --git a/Libraries/LibWeb/HTML/HTMLAllCollection.cpp b/Libraries/LibWeb/HTML/HTMLAllCollection.cpp index 5201a3d0492..1c0b5e5ca12 100644 --- a/Libraries/LibWeb/HTML/HTMLAllCollection.cpp +++ b/Libraries/LibWeb/HTML/HTMLAllCollection.cpp @@ -84,9 +84,9 @@ static bool is_all_named_element(DOM::Element const& element) || is(element); } -GC::MarkedVector> HTMLAllCollection::collect_matching_elements() const +GC::RootVector> HTMLAllCollection::collect_matching_elements() const { - GC::MarkedVector> elements(m_root->heap()); + GC::RootVector> elements(m_root->heap()); if (m_scope == Scope::Descendants) { m_root->for_each_in_subtree_of_type([&](auto& element) { if (m_filter(element)) diff --git a/Libraries/LibWeb/HTML/HTMLAllCollection.h b/Libraries/LibWeb/HTML/HTMLAllCollection.h index 460dab98e8e..0f61373a11b 100644 --- a/Libraries/LibWeb/HTML/HTMLAllCollection.h +++ b/Libraries/LibWeb/HTML/HTMLAllCollection.h @@ -32,7 +32,7 @@ public: Variant, GC::Ref, Empty> item(Optional const& name_or_index) const; Variant, GC::Ref, Empty> named_item(FlyString const& name) const; - GC::MarkedVector> collect_matching_elements() const; + GC::RootVector> collect_matching_elements() const; virtual Optional item_value(size_t index) const override; virtual JS::Value named_item_value(FlyString const& name) const override; diff --git a/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Libraries/LibWeb/HTML/HTMLImageElement.cpp index 48d4ea23394..5295b1bdb63 100644 --- a/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -1037,7 +1037,7 @@ static void update_the_source_set(DOM::Element& element) TODO(); // 2. Let elements be « el ». - GC::MarkedVector elements(element.heap()); + GC::RootVector elements(element.heap()); elements.append(&element); // 3. If el is an img element whose parent node is a picture element, diff --git a/Libraries/LibWeb/HTML/HTMLMediaElement.cpp b/Libraries/LibWeb/HTML/HTMLMediaElement.cpp index 02ad329cd16..3769bc2b0cf 100644 --- a/Libraries/LibWeb/HTML/HTMLMediaElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLMediaElement.cpp @@ -1863,12 +1863,12 @@ void HTMLMediaElement::time_marches_on(TimeMarchesOnReason reason) } // https://html.spec.whatwg.org/multipage/media.html#take-pending-play-promises -GC::MarkedVector> HTMLMediaElement::take_pending_play_promises() +GC::RootVector> HTMLMediaElement::take_pending_play_promises() { // 1. Let promises be an empty list of promises. // 2. Copy the media element's list of pending play promises to promises. // 3. Clear the media element's list of pending play promises. - GC::MarkedVector> promises(heap()); + GC::RootVector> promises(heap()); promises.extend(move(m_pending_play_promises)); // 4. Return promises. diff --git a/Libraries/LibWeb/HTML/HTMLMediaElement.h b/Libraries/LibWeb/HTML/HTMLMediaElement.h index 3ff78fdf19e..70eebf3cd3d 100644 --- a/Libraries/LibWeb/HTML/HTMLMediaElement.h +++ b/Libraries/LibWeb/HTML/HTMLMediaElement.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include @@ -207,7 +207,7 @@ private: }; void time_marches_on(TimeMarchesOnReason = TimeMarchesOnReason::NormalPlayback); - GC::MarkedVector> take_pending_play_promises(); + GC::RootVector> take_pending_play_promises(); void resolve_pending_play_promises(ReadonlySpan> promises); void reject_pending_play_promises(ReadonlySpan> promises, GC::Ref error); diff --git a/Libraries/LibWeb/HTML/Location.cpp b/Libraries/LibWeb/HTML/Location.cpp index cf0d054f72c..d561cb3a6ee 100644 --- a/Libraries/LibWeb/HTML/Location.cpp +++ b/Libraries/LibWeb/HTML/Location.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include #include @@ -596,7 +596,7 @@ JS::ThrowCompletionOr Location::internal_delete(JS::PropertyKey const& pro } // 7.10.5.10 [[OwnPropertyKeys]] ( ), https://html.spec.whatwg.org/multipage/history.html#location-ownpropertykeys -JS::ThrowCompletionOr> Location::internal_own_property_keys() const +JS::ThrowCompletionOr> Location::internal_own_property_keys() const { // 1. If IsPlatformObjectSameOrigin(this) is true, then return OrdinaryOwnPropertyKeys(this). if (HTML::is_platform_object_same_origin(*this)) diff --git a/Libraries/LibWeb/HTML/Location.h b/Libraries/LibWeb/HTML/Location.h index 6981745a8a4..44a4f486965 100644 --- a/Libraries/LibWeb/HTML/Location.h +++ b/Libraries/LibWeb/HTML/Location.h @@ -63,7 +63,7 @@ public: virtual JS::ThrowCompletionOr internal_get(JS::PropertyKey const&, JS::Value receiver, JS::CacheablePropertyMetadata*, PropertyLookupPhase) const override; virtual JS::ThrowCompletionOr internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver, JS::CacheablePropertyMetadata*) override; virtual JS::ThrowCompletionOr internal_delete(JS::PropertyKey const&) override; - virtual JS::ThrowCompletionOr> internal_own_property_keys() const override; + virtual JS::ThrowCompletionOr> internal_own_property_keys() const override; HTML::CrossOriginPropertyDescriptorMap const& cross_origin_property_descriptor_map() const { return m_cross_origin_property_descriptor_map; } HTML::CrossOriginPropertyDescriptorMap& cross_origin_property_descriptor_map() { return m_cross_origin_property_descriptor_map; } diff --git a/Libraries/LibWeb/HTML/MessageEvent.cpp b/Libraries/LibWeb/HTML/MessageEvent.cpp index 8f9584c6179..8cff57aa8f8 100644 --- a/Libraries/LibWeb/HTML/MessageEvent.cpp +++ b/Libraries/LibWeb/HTML/MessageEvent.cpp @@ -66,7 +66,7 @@ Variant, GC::Root, Empty> MessageEvent::sourc GC::Ref MessageEvent::ports() const { if (!m_ports_array) { - GC::MarkedVector port_vector(heap()); + GC::RootVector port_vector(heap()); for (auto const& port : m_ports) port_vector.append(port); diff --git a/Libraries/LibWeb/HTML/Navigation.cpp b/Libraries/LibWeb/HTML/Navigation.cpp index cee329954b5..48632157ae6 100644 --- a/Libraries/LibWeb/HTML/Navigation.cpp +++ b/Libraries/LibWeb/HTML/Navigation.cpp @@ -1131,7 +1131,7 @@ bool Navigation::inner_navigate_event_firing_algorithm( // 33. If endResultIsSameDocument is true: if (end_result_is_same_document) { // 1. Let promisesList be an empty list. - GC::MarkedVector> promises_list(realm.heap()); + GC::RootVector> promises_list(realm.heap()); // 2. For each handler of event's navigation handler list: for (auto const& handler : event->navigation_handler_list()) { diff --git a/Libraries/LibWeb/HTML/StructuredSerialize.cpp b/Libraries/LibWeb/HTML/StructuredSerialize.cpp index f91980a5442..e0c6d6f634d 100644 --- a/Libraries/LibWeb/HTML/StructuredSerialize.cpp +++ b/Libraries/LibWeb/HTML/StructuredSerialize.cpp @@ -1040,7 +1040,7 @@ public: private: JS::VM& m_vm; ReadonlySpan m_serialized; - GC::MarkedVector m_memory; // Index -> JS value + GC::RootVector m_memory; // Index -> JS value size_t m_position { 0 }; static GC::Ref create_serialized_type(StringView interface_name, JS::Realm& realm) diff --git a/Libraries/LibWeb/HTML/StructuredSerializeTypes.h b/Libraries/LibWeb/HTML/StructuredSerializeTypes.h index 094152b2a93..6d444900990 100644 --- a/Libraries/LibWeb/HTML/StructuredSerializeTypes.h +++ b/Libraries/LibWeb/HTML/StructuredSerializeTypes.h @@ -10,7 +10,7 @@ namespace Web::HTML { -using DeserializationMemory = GC::MarkedVector; +using DeserializationMemory = GC::RootVector; using SerializationRecord = Vector; using SerializationMemory = HashMap, u32>; diff --git a/Libraries/LibWeb/HTML/TextTrackCue.h b/Libraries/LibWeb/HTML/TextTrackCue.h index 4f8ce6e5a99..42159f08350 100644 --- a/Libraries/LibWeb/HTML/TextTrackCue.h +++ b/Libraries/LibWeb/HTML/TextTrackCue.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include diff --git a/Libraries/LibWeb/HTML/TextTrackCueList.h b/Libraries/LibWeb/HTML/TextTrackCueList.h index 4d33a0441df..535277b451d 100644 --- a/Libraries/LibWeb/HTML/TextTrackCueList.h +++ b/Libraries/LibWeb/HTML/TextTrackCueList.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include diff --git a/Libraries/LibWeb/HTML/TextTrackList.h b/Libraries/LibWeb/HTML/TextTrackList.h index c1c820d12e8..4850406e2c0 100644 --- a/Libraries/LibWeb/HTML/TextTrackList.h +++ b/Libraries/LibWeb/HTML/TextTrackList.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include diff --git a/Libraries/LibWeb/HTML/VideoTrackList.h b/Libraries/LibWeb/HTML/VideoTrackList.h index 46481a1bbad..3b5492fb214 100644 --- a/Libraries/LibWeb/HTML/VideoTrackList.h +++ b/Libraries/LibWeb/HTML/VideoTrackList.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include diff --git a/Libraries/LibWeb/HTML/Window.cpp b/Libraries/LibWeb/HTML/Window.cpp index 45acef00cad..a5e29eecb02 100644 --- a/Libraries/LibWeb/HTML/Window.cpp +++ b/Libraries/LibWeb/HTML/Window.cpp @@ -526,7 +526,7 @@ void Window::consume_history_action_user_activation() auto navigables = top->active_document()->inclusive_descendant_navigables(); // 4. Let windows be the list of Window objects constructed by taking the active window of each item in navigables. - GC::MarkedVector> windows(heap()); + GC::RootVector> windows(heap()); for (auto& n : navigables) windows.append(n->active_window()); @@ -551,7 +551,7 @@ void Window::consume_user_activation() auto navigables = top->active_document()->inclusive_descendant_navigables(); // 4. Let windows be the list of Window objects constructed by taking the active window of each item in navigables. - GC::MarkedVector> windows(heap()); + GC::RootVector> windows(heap()); for (auto& n : navigables) windows.append(n->active_window()); diff --git a/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp b/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp index 0773f7ff0a6..019b91ffd94 100644 --- a/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp +++ b/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp @@ -218,13 +218,13 @@ GC::Ref WindowOrWorkerGlobalScopeMixin::fetch(Fetch::RequestInf } // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout -i32 WindowOrWorkerGlobalScopeMixin::set_timeout(TimerHandler handler, i32 timeout, GC::MarkedVector arguments) +i32 WindowOrWorkerGlobalScopeMixin::set_timeout(TimerHandler handler, i32 timeout, GC::RootVector arguments) { return run_timer_initialization_steps(move(handler), timeout, move(arguments), Repeat::No); } // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval -i32 WindowOrWorkerGlobalScopeMixin::set_interval(TimerHandler handler, i32 timeout, GC::MarkedVector arguments) +i32 WindowOrWorkerGlobalScopeMixin::set_interval(TimerHandler handler, i32 timeout, GC::RootVector arguments) { return run_timer_initialization_steps(move(handler), timeout, move(arguments), Repeat::Yes); } @@ -254,7 +254,7 @@ void WindowOrWorkerGlobalScopeMixin::clear_map_of_active_timers() // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timer-initialisation-steps // With no active script fix from https://github.com/whatwg/html/pull/9712 -i32 WindowOrWorkerGlobalScopeMixin::run_timer_initialization_steps(TimerHandler handler, i32 timeout, GC::MarkedVector arguments, Repeat repeat, Optional previous_id) +i32 WindowOrWorkerGlobalScopeMixin::run_timer_initialization_steps(TimerHandler handler, i32 timeout, GC::RootVector arguments, Repeat repeat, Optional previous_id) { // 1. Let thisArg be global if that is a WorkerGlobalScope object; otherwise let thisArg be the WindowProxy that corresponds to global. @@ -697,7 +697,7 @@ GC::Ref WindowOrWorkerGlobalScopeMixin::supported_entry_types() cons auto& realm = this_impl().realm(); if (!m_supported_entry_types_array) { - GC::MarkedVector supported_entry_types(vm.heap()); + GC::RootVector supported_entry_types(vm.heap()); #define __ENUMERATE_SUPPORTED_PERFORMANCE_ENTRY_TYPES(entry_type, cpp_class) \ supported_entry_types.append(JS::PrimitiveString::create(vm, entry_type)); diff --git a/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.h b/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.h index 7f7e352c16a..b9582733269 100644 --- a/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.h +++ b/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.h @@ -40,8 +40,8 @@ public: GC::Ref create_image_bitmap(ImageBitmapSource image, WebIDL::Long sx, WebIDL::Long sy, WebIDL::Long sw, WebIDL::Long sh, Optional options = {}) const; GC::Ref fetch(Fetch::RequestInfo const&, Fetch::RequestInit const&) const; - i32 set_timeout(TimerHandler, i32 timeout, GC::MarkedVector arguments); - i32 set_interval(TimerHandler, i32 timeout, GC::MarkedVector arguments); + i32 set_timeout(TimerHandler, i32 timeout, GC::RootVector arguments); + i32 set_interval(TimerHandler, i32 timeout, GC::RootVector arguments); void clear_timeout(i32); void clear_interval(i32); void clear_map_of_active_timers(); @@ -86,7 +86,7 @@ private: Yes, No, }; - i32 run_timer_initialization_steps(TimerHandler handler, i32 timeout, GC::MarkedVector arguments, Repeat repeat, Optional previous_id = {}); + i32 run_timer_initialization_steps(TimerHandler handler, i32 timeout, GC::RootVector arguments, Repeat repeat, Optional previous_id = {}); void run_steps_after_a_timeout_impl(i32 timeout, Function completion_step, Optional timer_key = {}); GC::Ref create_image_bitmap_impl(ImageBitmapSource& image, Optional sx, Optional sy, Optional sw, Optional sh, Optional& options) const; diff --git a/Libraries/LibWeb/HTML/WindowProxy.cpp b/Libraries/LibWeb/HTML/WindowProxy.cpp index cb97e51a9d1..b8b21df704c 100644 --- a/Libraries/LibWeb/HTML/WindowProxy.cpp +++ b/Libraries/LibWeb/HTML/WindowProxy.cpp @@ -5,7 +5,7 @@ */ #include -#include +#include #include #include #include @@ -228,7 +228,7 @@ JS::ThrowCompletionOr WindowProxy::internal_delete(JS::PropertyKey const& } // 7.4.10 [[OwnPropertyKeys]] ( ), https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-ownpropertykeys -JS::ThrowCompletionOr> WindowProxy::internal_own_property_keys() const +JS::ThrowCompletionOr> WindowProxy::internal_own_property_keys() const { auto& event_loop = main_thread_event_loop(); auto& vm = event_loop.vm(); @@ -236,7 +236,7 @@ JS::ThrowCompletionOr> WindowProxy::internal_own_pro // 1. Let W be the value of the [[Window]] internal slot of this. // 2. Let keys be a new empty List. - auto keys = GC::MarkedVector { vm.heap() }; + auto keys = GC::RootVector { vm.heap() }; // 3. Let maxProperties be W's associated Document's document-tree child navigables's size. auto max_properties = m_window->associated_document().document_tree_child_navigables().size(); diff --git a/Libraries/LibWeb/HTML/WindowProxy.h b/Libraries/LibWeb/HTML/WindowProxy.h index 3b6f0a49d04..562f6b9404a 100644 --- a/Libraries/LibWeb/HTML/WindowProxy.h +++ b/Libraries/LibWeb/HTML/WindowProxy.h @@ -30,7 +30,7 @@ public: virtual JS::ThrowCompletionOr internal_get(JS::PropertyKey const&, JS::Value receiver, JS::CacheablePropertyMetadata*, PropertyLookupPhase) const override; virtual JS::ThrowCompletionOr internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver, JS::CacheablePropertyMetadata*) override; virtual JS::ThrowCompletionOr internal_delete(JS::PropertyKey const&) override; - virtual JS::ThrowCompletionOr> internal_own_property_keys() const override; + virtual JS::ThrowCompletionOr> internal_own_property_keys() const override; GC::Ptr window() const { return m_window; } void set_window(GC::Ref); diff --git a/Libraries/LibWeb/HTML/WorkerDebugConsoleClient.cpp b/Libraries/LibWeb/HTML/WorkerDebugConsoleClient.cpp index b8524524db6..fe513a76986 100644 --- a/Libraries/LibWeb/HTML/WorkerDebugConsoleClient.cpp +++ b/Libraries/LibWeb/HTML/WorkerDebugConsoleClient.cpp @@ -5,7 +5,7 @@ */ #include -#include +#include #include #include #include @@ -60,7 +60,7 @@ JS::ThrowCompletionOr WorkerDebugConsoleClient::printer(JS::Console:: return JS::js_undefined(); } - auto output = TRY(generically_format_values(arguments.get>())); + auto output = TRY(generically_format_values(arguments.get>())); m_console->output_debug_message(log_level, output); return JS::js_undefined(); } diff --git a/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.cpp b/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.cpp index 504a3a9acdc..2edba71a368 100644 --- a/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.cpp +++ b/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.cpp @@ -76,7 +76,7 @@ void ResizeObserverEntry::visit_edges(JS::Cell::Visitor& visitor) static GC::Ref to_js_array(JS::Realm& realm, Vector> const& sizes) { - GC::MarkedVector vector(realm.heap()); + GC::RootVector vector(realm.heap()); for (auto const& size : sizes) vector.append(JS::Value(size.ptr())); diff --git a/Libraries/LibWeb/ServiceWorker/Job.h b/Libraries/LibWeb/ServiceWorker/Job.h index 8b0cb72782c..932ee2d7b3b 100644 --- a/Libraries/LibWeb/ServiceWorker/Job.h +++ b/Libraries/LibWeb/ServiceWorker/Job.h @@ -15,7 +15,7 @@ namespace Web::ServiceWorker { struct Job; -using JobQueue = GC::MarkedVector>; +using JobQueue = GC::RootVector>; // https://w3c.github.io/ServiceWorker/#dfn-job // FIXME: Consider not making this GC allocated, and give a special JobQueue class responsibility for its referenced GC objects diff --git a/Libraries/LibWeb/WebAssembly/WebAssembly.cpp b/Libraries/LibWeb/WebAssembly/WebAssembly.cpp index abbf47be433..847ed351602 100644 --- a/Libraries/LibWeb/WebAssembly/WebAssembly.cpp +++ b/Libraries/LibWeb/WebAssembly/WebAssembly.cpp @@ -208,7 +208,7 @@ JS::ThrowCompletionOr> instantiate_module(JS cache.add_imported_object(function); Wasm::HostFunction host_function { [&](auto&, auto& arguments) -> Wasm::Result { - GC::MarkedVector argument_values { vm.heap() }; + GC::RootVector argument_values { vm.heap() }; size_t index = 0; for (auto& entry : arguments) { argument_values.append(to_js_value(vm, entry, type.parameters()[index])); @@ -425,7 +425,7 @@ JS::NativeFunction* create_native_function(JS::VM& vm, Wasm::FunctionAddress add return to_js_value(vm, result.values().first(), type.results().first()); // Put result values into a JS::Array in reverse order. - auto js_result_values = GC::MarkedVector { realm.heap() }; + auto js_result_values = GC::RootVector { realm.heap() }; js_result_values.ensure_capacity(result.values().size()); for (size_t i = result.values().size(); i > 0; i--) { diff --git a/Libraries/LibWeb/WebDriver/ElementReference.cpp b/Libraries/LibWeb/WebDriver/ElementReference.cpp index 5d116a4edb4..597b7acdc91 100644 --- a/Libraries/LibWeb/WebDriver/ElementReference.cpp +++ b/Libraries/LibWeb/WebDriver/ElementReference.cpp @@ -381,18 +381,18 @@ bool is_element_obscured(ReadonlySpan> paint_tree, We } // https://w3c.github.io/webdriver/#dfn-pointer-interactable-paint-tree -GC::MarkedVector> pointer_interactable_tree(Web::HTML::BrowsingContext& browsing_context, Web::DOM::Element& element) +GC::RootVector> pointer_interactable_tree(Web::HTML::BrowsingContext& browsing_context, Web::DOM::Element& element) { // 1. If element is not in the same tree as session's current browsing context's active document, return an empty sequence. if (!browsing_context.active_document()->contains(element)) - return GC::MarkedVector>(browsing_context.heap()); + return GC::RootVector>(browsing_context.heap()); // 2. Let rectangles be the DOMRect sequence returned by calling getClientRects(). auto rectangles = element.get_client_rects(); // 3. If rectangles has the length of 0, return an empty sequence. if (rectangles->length() == 0) - return GC::MarkedVector>(browsing_context.heap()); + return GC::RootVector>(browsing_context.heap()); // 4. Let center point be the in-view center point of the first indexed element in rectangles. auto viewport = browsing_context.page().top_level_traversable()->viewport_rect(); diff --git a/Libraries/LibWeb/WebDriver/ElementReference.h b/Libraries/LibWeb/WebDriver/ElementReference.h index fd6038d8714..ac0c6c52974 100644 --- a/Libraries/LibWeb/WebDriver/ElementReference.h +++ b/Libraries/LibWeb/WebDriver/ElementReference.h @@ -44,7 +44,7 @@ bool is_element_non_typeable_form_control(Web::DOM::Element const&); bool is_element_in_view(ReadonlySpan> paint_tree, Web::DOM::Element&); bool is_element_obscured(ReadonlySpan> paint_tree, Web::DOM::Element&); -GC::MarkedVector> pointer_interactable_tree(Web::HTML::BrowsingContext&, Web::DOM::Element&); +GC::RootVector> pointer_interactable_tree(Web::HTML::BrowsingContext&, Web::DOM::Element&); ByteString get_or_create_a_shadow_root_reference(HTML::BrowsingContext const&, Web::DOM::ShadowRoot const&); JsonObject shadow_root_reference_object(HTML::BrowsingContext const&, Web::DOM::ShadowRoot const&); diff --git a/Libraries/LibWeb/WebDriver/ExecuteScript.cpp b/Libraries/LibWeb/WebDriver/ExecuteScript.cpp index fd8a3ce1e5e..6db760332a6 100644 --- a/Libraries/LibWeb/WebDriver/ExecuteScript.cpp +++ b/Libraries/LibWeb/WebDriver/ExecuteScript.cpp @@ -84,7 +84,7 @@ static JS::ThrowCompletionOr execute_a_function_body(HTML::BrowsingCo return completion; } -void execute_script(HTML::BrowsingContext const& browsing_context, ByteString body, GC::MarkedVector arguments, Optional const& timeout_ms, GC::Ref on_complete) +void execute_script(HTML::BrowsingContext const& browsing_context, ByteString body, GC::RootVector arguments, Optional const& timeout_ms, GC::Ref on_complete) { auto const* document = browsing_context.active_document(); auto& realm = document->realm(); @@ -142,7 +142,7 @@ void execute_script(HTML::BrowsingContext const& browsing_context, ByteString bo } // https://w3c.github.io/webdriver/#execute-async-script -void execute_async_script(HTML::BrowsingContext const& browsing_context, ByteString body, GC::MarkedVector arguments, Optional const& timeout_ms, GC::Ref on_complete) +void execute_async_script(HTML::BrowsingContext const& browsing_context, ByteString body, GC::RootVector arguments, Optional const& timeout_ms, GC::Ref on_complete) { auto const* document = browsing_context.active_document(); auto& realm = document->realm(); diff --git a/Libraries/LibWeb/WebDriver/ExecuteScript.h b/Libraries/LibWeb/WebDriver/ExecuteScript.h index 7ffc1bcc96b..f6c35998953 100644 --- a/Libraries/LibWeb/WebDriver/ExecuteScript.h +++ b/Libraries/LibWeb/WebDriver/ExecuteScript.h @@ -23,7 +23,7 @@ struct ExecutionResult { using OnScriptComplete = GC::Function; -void execute_script(HTML::BrowsingContext const&, ByteString body, GC::MarkedVector arguments, Optional const& timeout_ms, GC::Ref on_complete); -void execute_async_script(HTML::BrowsingContext const&, ByteString body, GC::MarkedVector arguments, Optional const& timeout_ms, GC::Ref on_complete); +void execute_script(HTML::BrowsingContext const&, ByteString body, GC::RootVector arguments, Optional const& timeout_ms, GC::Ref on_complete); +void execute_async_script(HTML::BrowsingContext const&, ByteString body, GC::RootVector arguments, Optional const& timeout_ms, GC::Ref on_complete); } diff --git a/Libraries/LibWeb/WebDriver/JSON.cpp b/Libraries/LibWeb/WebDriver/JSON.cpp index c8da822014c..fde387030ad 100644 --- a/Libraries/LibWeb/WebDriver/JSON.cpp +++ b/Libraries/LibWeb/WebDriver/JSON.cpp @@ -253,7 +253,7 @@ static Response internal_json_clone(HTML::BrowsingContext const& browsing_contex // -> has an own property named "toJSON" that is a Function if (auto to_json = object.get_without_side_effects(vm.names.toJSON); to_json.is_function()) { // Return success with the value returned by Function.[[Call]](toJSON) with value as the this value. - auto to_json_result = TRY_OR_JS_ERROR(to_json.as_function().internal_call(value, GC::MarkedVector { vm.heap() })); + auto to_json_result = TRY_OR_JS_ERROR(to_json.as_function().internal_call(value, GC::RootVector { vm.heap() })); if (!to_json_result.is_string()) return WebDriver::Error::from_code(ErrorCode::JavascriptError, "toJSON did not return a String"sv); diff --git a/Libraries/LibWeb/WebIDL/AbstractOperations.cpp b/Libraries/LibWeb/WebIDL/AbstractOperations.cpp index 0ac9b95b25f..9e645f6c8c4 100644 --- a/Libraries/LibWeb/WebIDL/AbstractOperations.cpp +++ b/Libraries/LibWeb/WebIDL/AbstractOperations.cpp @@ -153,7 +153,7 @@ inline JS::Completion clean_up_on_return(JS::Realm& stored_realm, JS::Realm& rel // https://webidl.spec.whatwg.org/#call-a-user-objects-operation // https://whatpr.org/webidl/1437.html#call-a-user-objects-operation -JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, String const& operation_name, Optional this_argument, GC::MarkedVector args) +JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, String const& operation_name, Optional this_argument, GC::RootVector args) { // 1. Let completion be an uninitialized variable. JS::Completion completion; @@ -255,7 +255,7 @@ JS::ThrowCompletionOr to_usv_string(JS::VM& vm, JS::Value value) // https://webidl.spec.whatwg.org/#invoke-a-callback-function // https://whatpr.org/webidl/1437.html#invoke-a-callback-function -JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional this_argument, ExceptionBehavior exception_behavior, GC::MarkedVector args) +JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional this_argument, ExceptionBehavior exception_behavior, GC::RootVector args) { // https://webidl.spec.whatwg.org/#js-invoking-callback-functions // The exceptionBehavior argument must be supplied if, and only if, callable’s return type is not a promise type. If callable’s return type is neither undefined nor any, it must be "rethrow". @@ -359,12 +359,12 @@ JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional this_argument, GC::MarkedVector args) +JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional this_argument, GC::RootVector args) { return invoke_callback(callback, move(this_argument), ExceptionBehavior::NotSpecified, move(args)); } -JS::Completion construct(WebIDL::CallbackType& callback, GC::MarkedVector args) +JS::Completion construct(WebIDL::CallbackType& callback, GC::RootVector args) { // 1. Let completion be an uninitialized variable. JS::Completion completion; diff --git a/Libraries/LibWeb/WebIDL/AbstractOperations.h b/Libraries/LibWeb/WebIDL/AbstractOperations.h index 301055f0714..cb582c592d4 100644 --- a/Libraries/LibWeb/WebIDL/AbstractOperations.h +++ b/Libraries/LibWeb/WebIDL/AbstractOperations.h @@ -21,7 +21,7 @@ bool is_buffer_source_type(JS::Value); GC::Ptr underlying_buffer_source(JS::Object& buffer_source); ErrorOr get_buffer_source_copy(JS::Object const& buffer_source); -JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, String const& operation_name, Optional this_argument, GC::MarkedVector args); +JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, String const& operation_name, Optional this_argument, GC::RootVector args); JS::ThrowCompletionOr to_string(JS::VM&, JS::Value); JS::ThrowCompletionOr to_usv_string(JS::VM&, JS::Value); @@ -33,7 +33,7 @@ JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, String { auto& function_object = callback.callback; - GC::MarkedVector arguments_list { function_object->heap() }; + GC::RootVector arguments_list { function_object->heap() }; (arguments_list.append(forward(args)), ...); return call_user_object_operation(callback, operation_name, move(this_argument), move(arguments_list)); @@ -45,8 +45,8 @@ enum class ExceptionBehavior { Rethrow, }; -JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional this_argument, ExceptionBehavior exception_behavior, GC::MarkedVector args); -JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional this_argument, GC::MarkedVector args); +JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional this_argument, ExceptionBehavior exception_behavior, GC::RootVector args); +JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional this_argument, GC::RootVector args); // https://webidl.spec.whatwg.org/#invoke-a-callback-function template @@ -54,7 +54,7 @@ JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional arguments_list { function_object->heap() }; + GC::RootVector arguments_list { function_object->heap() }; (arguments_list.append(forward(args)), ...); return invoke_callback(callback, move(this_argument), exception_behavior, move(arguments_list)); @@ -66,7 +66,7 @@ JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional(args)...); } -JS::Completion construct(WebIDL::CallbackType& callback, GC::MarkedVector args); +JS::Completion construct(WebIDL::CallbackType& callback, GC::RootVector args); // https://webidl.spec.whatwg.org/#construct-a-callback-function template @@ -74,7 +74,7 @@ JS::Completion construct(WebIDL::CallbackType& callback, Args&&... args) { auto& function_object = callback.callback; - GC::MarkedVector arguments_list { function_object->heap() }; + GC::RootVector arguments_list { function_object->heap() }; (arguments_list.append(forward(args)), ...); return construct(callback, move(arguments_list)); diff --git a/Meta/Lagom/ClangPlugins/LibJSGCPluginAction.cpp b/Meta/Lagom/ClangPlugins/LibJSGCPluginAction.cpp index 8047d4bb3f4..6faf85d24cc 100644 --- a/Meta/Lagom/ClangPlugins/LibJSGCPluginAction.cpp +++ b/Meta/Lagom/ClangPlugins/LibJSGCPluginAction.cpp @@ -56,13 +56,13 @@ static std::vector get_all_qualified_types(clang::QualType cons if (auto const* template_specialization = type->getAs()) { auto specialization_name = template_specialization->getTemplateName().getAsTemplateDecl()->getQualifiedNameAsString(); - // Do not unwrap GCPtr/NonnullGCPtr/MarkedVector + // Do not unwrap GCPtr/NonnullGCPtr/RootVector static std::unordered_set gc_relevant_type_names { "GC::Ptr", "GC::Ref", "GC::RawPtr", "GC::RawRef", - "GC::MarkedVector", + "GC::RootVector", "GC::Root", }; diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index 905a22ebc2b..33fb846b057 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -158,8 +158,8 @@ static StringView sequence_storage_type_to_cpp_storage_type_name(SequenceStorage switch (sequence_storage_type) { case SequenceStorageType::Vector: return "Vector"sv; - case SequenceStorageType::MarkedVector: - return "GC::MarkedVector"sv; + case SequenceStorageType::RootVector: + return "GC::RootVector"sv; default: VERIFY_NOT_REACHED(); } @@ -193,13 +193,13 @@ static ByteString union_type_to_variant(UnionType const& union_type, Interface c CppType idl_type_name_to_cpp_type(Type const& type, Interface const& interface) { if (is_platform_object(type) || type.name() == "WindowProxy"sv) - return { .name = ByteString::formatted("GC::Root<{}>", type.name()), .sequence_storage_type = SequenceStorageType::MarkedVector }; + return { .name = ByteString::formatted("GC::Root<{}>", type.name()), .sequence_storage_type = SequenceStorageType::RootVector }; if (is_javascript_builtin(type)) - return { .name = ByteString::formatted("GC::Root", type.name()), .sequence_storage_type = SequenceStorageType::MarkedVector }; + return { .name = ByteString::formatted("GC::Root", type.name()), .sequence_storage_type = SequenceStorageType::RootVector }; if (interface.callback_functions.contains(type.name())) - return { .name = "GC::Root", .sequence_storage_type = SequenceStorageType::MarkedVector }; + return { .name = "GC::Root", .sequence_storage_type = SequenceStorageType::RootVector }; if (type.is_string()) return { .name = "String", .sequence_storage_type = SequenceStorageType::Vector }; @@ -232,25 +232,25 @@ CppType idl_type_name_to_cpp_type(Type const& type, Interface const& interface) return { .name = "WebIDL::Long", .sequence_storage_type = SequenceStorageType::Vector }; if (type.name() == "any" || type.name() == "undefined") - return { .name = "JS::Value", .sequence_storage_type = SequenceStorageType::MarkedVector }; + return { .name = "JS::Value", .sequence_storage_type = SequenceStorageType::RootVector }; if (type.name() == "object") return { .name = "GC::Root", .sequence_storage_type = SequenceStorageType::Vector }; if (type.name() == "BufferSource") - return { .name = "GC::Root", .sequence_storage_type = SequenceStorageType::MarkedVector }; + return { .name = "GC::Root", .sequence_storage_type = SequenceStorageType::RootVector }; if (type.name() == "ArrayBufferView") - return { .name = "GC::Root", .sequence_storage_type = SequenceStorageType::MarkedVector }; + return { .name = "GC::Root", .sequence_storage_type = SequenceStorageType::RootVector }; if (type.name() == "File") - return { .name = "GC::Root", .sequence_storage_type = SequenceStorageType::MarkedVector }; + return { .name = "GC::Root", .sequence_storage_type = SequenceStorageType::RootVector }; if (type.name() == "Function") - return { .name = "GC::Ref", .sequence_storage_type = SequenceStorageType::MarkedVector }; + return { .name = "GC::Ref", .sequence_storage_type = SequenceStorageType::RootVector }; if (type.name() == "Promise") - return { .name = "GC::Root", .sequence_storage_type = SequenceStorageType::MarkedVector }; + return { .name = "GC::Root", .sequence_storage_type = SequenceStorageType::RootVector }; if (type.name() == "sequence") { auto& parameterized_type = verify_cast(type); @@ -258,7 +258,7 @@ CppType idl_type_name_to_cpp_type(Type const& type, Interface const& interface) auto sequence_cpp_type = idl_type_name_to_cpp_type(sequence_type, interface); auto storage_type_name = sequence_storage_type_to_cpp_storage_type_name(sequence_cpp_type.sequence_storage_type); - if (sequence_cpp_type.sequence_storage_type == SequenceStorageType::MarkedVector) + if (sequence_cpp_type.sequence_storage_type == SequenceStorageType::RootVector) return { .name = storage_type_name, .sequence_storage_type = SequenceStorageType::Vector }; return { .name = ByteString::formatted("{}<{}>", storage_type_name, sequence_cpp_type.name), .sequence_storage_type = SequenceStorageType::Vector }; @@ -785,7 +785,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter } else if (parameter.type->name() == "any") { if (variadic) { scoped_generator.append(R"~~~( - GC::MarkedVector @cpp_name@ { vm.heap() }; + GC::RootVector @cpp_name@ { vm.heap() }; if (vm.argument_count() > @js_suffix@) { @cpp_name@.ensure_capacity(vm.argument_count() - @js_suffix@); @@ -1646,7 +1646,7 @@ static void generate_arguments(SourceGenerator& generator, Vector> from the // C++ implementation, thus allowing us to unwrap the element (a handle) like below. - // This might need to change if we switch to a MarkedVector. + // This might need to change if we switch to a RootVector. if (is_platform_object(sequence_generic_type.parameters().first())) { scoped_generator.append(R"~~~( auto* wrapped_element@recursion_depth@ = &(*element@recursion_depth@); diff --git a/Meta/gn/secondary/Userland/Libraries/LibJS/BUILD.gn b/Meta/gn/secondary/Userland/Libraries/LibJS/BUILD.gn index 1bc5a63c30a..6759c41b6d5 100644 --- a/Meta/gn/secondary/Userland/Libraries/LibJS/BUILD.gn +++ b/Meta/gn/secondary/Userland/Libraries/LibJS/BUILD.gn @@ -40,7 +40,7 @@ shared_library("LibJS") { "Heap/Handle.cpp", "Heap/Heap.cpp", "Heap/HeapBlock.cpp", - "Heap/MarkedVector.cpp", + "Heap/RootVector.cpp", "Lexer.cpp", "MarkupGenerator.cpp", "Module.cpp", diff --git a/Services/WebContent/WebContentConsoleClient.cpp b/Services/WebContent/WebContentConsoleClient.cpp index f830b7a78b4..b23a3737a61 100644 --- a/Services/WebContent/WebContentConsoleClient.cpp +++ b/Services/WebContent/WebContentConsoleClient.cpp @@ -150,7 +150,7 @@ JS::ThrowCompletionOr WebContentConsoleClient::printer(JS::Console::L if (log_level == JS::Console::LogLevel::Table) { auto& vm = m_console->realm().vm(); - auto table_args = arguments.get>(); + auto table_args = arguments.get>(); auto& table = table_args.at(0).as_object(); auto& columns = TRY(table.get(vm.names.columns)).as_array().indexed_properties(); auto& rows = TRY(table.get(vm.names.rows)).as_array().indexed_properties(); @@ -244,7 +244,7 @@ JS::ThrowCompletionOr WebContentConsoleClient::printer(JS::Console::L return JS::js_undefined(); } - auto output = TRY(generically_format_values(arguments.get>())); + auto output = TRY(generically_format_values(arguments.get>())); m_console->output_debug_message(log_level, output); StringBuilder html; diff --git a/Services/WebContent/WebDriverConnection.cpp b/Services/WebContent/WebDriverConnection.cpp index 5ef59f3a3e3..095258c0d58 100644 --- a/Services/WebContent/WebDriverConnection.cpp +++ b/Services/WebContent/WebDriverConnection.cpp @@ -2990,7 +2990,7 @@ ErrorOr WebDriverCo auto const& args = *TRY(Web::WebDriver::get_property(payload, "args"sv)); // 5. Let arguments be the result of calling the JSON deserialize algorithm with arguments args. - GC::MarkedVector arguments { vm.heap() }; + GC::RootVector arguments { vm.heap() }; auto& browsing_context = current_browsing_context(); TRY(args.try_for_each([&](JsonValue const& arg) -> ErrorOr { diff --git a/Services/WebContent/WebDriverConnection.h b/Services/WebContent/WebDriverConnection.h index c1789c222df..e8177bc0119 100644 --- a/Services/WebContent/WebDriverConnection.h +++ b/Services/WebContent/WebDriverConnection.h @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include @@ -145,7 +145,7 @@ private: struct ScriptArguments { ByteString script; - GC::MarkedVector arguments; + GC::RootVector arguments; }; ErrorOr extract_the_script_arguments_from_a_request(JS::VM&, JsonValue const& payload); void handle_script_response(Web::WebDriver::ExecutionResult); diff --git a/Tests/ClangPlugins/LibJSGCTests/wrapping_non_cell_member.cpp b/Tests/ClangPlugins/LibJSGCTests/wrapping_non_cell_member.cpp index b642e89452e..6ac1dcb07de 100644 --- a/Tests/ClangPlugins/LibJSGCTests/wrapping_non_cell_member.cpp +++ b/Tests/ClangPlugins/LibJSGCTests/wrapping_non_cell_member.cpp @@ -6,8 +6,8 @@ // RUN: %clang++ -cc1 -verify %plugin_opts% %s 2>&1 -#include #include +#include struct NotACell { }; diff --git a/Utilities/js.cpp b/Utilities/js.cpp index fca406b13ec..10a1c00ff0e 100644 --- a/Utilities/js.cpp +++ b/Utilities/js.cpp @@ -498,7 +498,7 @@ public: return JS::js_undefined(); } - auto output = TRY(generically_format_values(arguments.get>())); + auto output = TRY(generically_format_values(arguments.get>())); switch (log_level) { case JS::Console::LogLevel::Debug: