From bc183dbbcb61b1e03196b82f8bad23a167f481a9 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Wed, 9 Feb 2022 10:06:40 +0000 Subject: [PATCH] LibJS: Replace uses of MarkedValueList with MarkedVector This is effectively a drop-in replacement. --- .../LibWeb/WrapperGenerator.cpp | 6 ++--- Userland/Libraries/LibJS/AST.cpp | 12 ++++----- Userland/Libraries/LibJS/Bytecode/Op.cpp | 2 +- Userland/Libraries/LibJS/Heap/Heap.h | 1 + Userland/Libraries/LibJS/Interpreter.h | 2 +- Userland/Libraries/LibJS/Parser.h | 2 +- .../LibJS/Runtime/AbstractOperations.cpp | 16 +++++------ .../LibJS/Runtime/AbstractOperations.h | 27 ++++++++++--------- Userland/Libraries/LibJS/Runtime/Array.cpp | 2 +- Userland/Libraries/LibJS/Runtime/Array.h | 4 +-- .../LibJS/Runtime/ArrayPrototype.cpp | 14 +++++----- .../Libraries/LibJS/Runtime/BoundFunction.cpp | 8 +++--- .../Libraries/LibJS/Runtime/BoundFunction.h | 4 +-- .../Runtime/ECMAScriptFunctionObject.cpp | 4 +-- .../LibJS/Runtime/ECMAScriptFunctionObject.h | 4 +-- .../LibJS/Runtime/ExecutionContext.h | 6 ++--- .../LibJS/Runtime/FinalizationRegistry.cpp | 2 +- .../LibJS/Runtime/FunctionConstructor.cpp | 2 +- .../LibJS/Runtime/FunctionConstructor.h | 2 +- .../Libraries/LibJS/Runtime/FunctionObject.h | 4 +-- .../LibJS/Runtime/FunctionPrototype.cpp | 4 +-- .../Libraries/LibJS/Runtime/GlobalObject.h | 4 +-- .../Libraries/LibJS/Runtime/Intl/Intl.cpp | 2 +- .../Runtime/Intl/PluralRulesPrototype.cpp | 4 +-- .../LibJS/Runtime/IteratorOperations.cpp | 4 +-- .../LibJS/Runtime/IteratorOperations.h | 2 +- .../Libraries/LibJS/Runtime/JobCallback.h | 2 +- .../LibJS/Runtime/MarkedValueList.cpp | 2 +- .../LibJS/Runtime/ModuleNamespaceObject.cpp | 2 +- .../LibJS/Runtime/ModuleNamespaceObject.h | 2 +- .../LibJS/Runtime/NativeFunction.cpp | 4 +-- .../Libraries/LibJS/Runtime/NativeFunction.h | 4 +-- Userland/Libraries/LibJS/Runtime/Object.cpp | 8 +++--- Userland/Libraries/LibJS/Runtime/Object.h | 6 ++--- .../LibJS/Runtime/ObjectConstructor.cpp | 2 +- .../Libraries/LibJS/Runtime/PromiseJobs.cpp | 4 +-- .../Libraries/LibJS/Runtime/ProxyObject.cpp | 12 ++++----- .../Libraries/LibJS/Runtime/ProxyObject.h | 6 ++--- .../LibJS/Runtime/RegExpPrototype.cpp | 6 ++--- .../Libraries/LibJS/Runtime/StringObject.cpp | 4 +-- .../Libraries/LibJS/Runtime/StringObject.h | 2 +- .../Runtime/Temporal/AbstractOperations.cpp | 4 +-- .../Runtime/Temporal/AbstractOperations.h | 2 +- .../LibJS/Runtime/Temporal/Calendar.cpp | 2 +- .../Runtime/Temporal/CalendarPrototype.cpp | 2 +- .../LibJS/Runtime/Temporal/TimeZone.h | 1 - .../Runtime/Temporal/TimeZonePrototype.cpp | 2 +- .../Libraries/LibJS/Runtime/TypedArray.cpp | 4 +-- Userland/Libraries/LibJS/Runtime/TypedArray.h | 6 ++--- .../LibJS/Runtime/TypedArrayConstructor.cpp | 6 ++--- .../LibJS/Runtime/TypedArrayPrototype.cpp | 20 +++++++------- Userland/Libraries/LibJS/Runtime/VM.cpp | 2 +- Userland/Libraries/LibJS/Runtime/VM.h | 6 ++--- Userland/Libraries/LibJS/Runtime/Value.cpp | 2 +- Userland/Libraries/LibJS/Runtime/Value.h | 2 +- .../LibJS/Runtime/WrappedFunction.cpp | 4 +-- .../Libraries/LibJS/Runtime/WrappedFunction.h | 2 +- .../LibWeb/Bindings/MainThreadVM.cpp | 2 +- .../LibWeb/WebAssembly/WebAssemblyObject.cpp | 2 +- .../WebContent/ConsoleGlobalObject.cpp | 2 +- .../Services/WebContent/ConsoleGlobalObject.h | 2 +- 61 files changed, 143 insertions(+), 142 deletions(-) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp index b76e6b06b9..6005e2d0b4 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp @@ -2218,7 +2218,7 @@ public: virtual JS::ThrowCompletionOr internal_define_own_property(JS::PropertyKey const&, JS::PropertyDescriptor const&) 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; )~~~"); } @@ -3053,12 +3053,12 @@ JS::ThrowCompletionOr @class_name@::internal_prevent_extensions() // 3.9.6. [[OwnPropertyKeys]], https://webidl.spec.whatwg.org/#legacy-platform-object-ownpropertykeys scoped_generator.append(R"~~~( -JS::ThrowCompletionOr @class_name@::internal_own_property_keys() const +JS::ThrowCompletionOr> @class_name@::internal_own_property_keys() const { auto& vm = this->vm(); // 1. Let keys be a new empty list of ECMAScript String and Symbol values. - JS::MarkedValueList keys { heap() }; + JS::MarkedVector keys { heap() }; )~~~"); diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp index da4899613f..eca2383e6f 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/Userland/Libraries/LibJS/AST.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -25,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -351,7 +351,7 @@ ThrowCompletionOr CallExpression::compute_this_an } // 13.3.8.1 Runtime Semantics: ArgumentListEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-argumentlistevaluation -static ThrowCompletionOr argument_list_evaluation(Interpreter& interpreter, GlobalObject& global_object, Vector const& arguments, MarkedValueList& list) +static ThrowCompletionOr argument_list_evaluation(Interpreter& interpreter, GlobalObject& global_object, Vector const& arguments, MarkedVector& list) { list.ensure_capacity(arguments.size()); @@ -383,7 +383,7 @@ Completion NewExpression::execute(Interpreter& interpreter, GlobalObject& global // 3. If arguments is empty, let argList be a new empty List. // 4. Else, // a. Let argList be ? ArgumentListEvaluation of arguments. - MarkedValueList arg_list(vm.heap()); + MarkedVector arg_list(vm.heap()); TRY(argument_list_evaluation(interpreter, global_object, m_arguments, arg_list)); // 5. If IsConstructor(constructor) is false, throw a TypeError exception. @@ -421,7 +421,7 @@ Completion CallExpression::execute(Interpreter& interpreter, GlobalObject& globa VERIFY(!callee.is_empty()); - MarkedValueList arg_list(vm.heap()); + MarkedVector arg_list(vm.heap()); TRY(argument_list_evaluation(interpreter, global_object, m_arguments, arg_list)); if (!callee.is_function()) @@ -458,7 +458,7 @@ Completion SuperCall::execute(Interpreter& interpreter, GlobalObject& global_obj auto* func = get_super_constructor(interpreter.vm()); // 4. Let argList be ? ArgumentListEvaluation of Arguments. - MarkedValueList arg_list(vm.heap()); + MarkedVector arg_list(vm.heap()); TRY(argument_list_evaluation(interpreter, global_object, m_arguments, arg_list)); // 5. If IsConstructor(func) is false, throw a TypeError exception. @@ -3549,7 +3549,7 @@ Completion TaggedTemplateLiteral::execute(Interpreter& interpreter, GlobalObject auto tag = TRY(m_tag->execute(interpreter, global_object)).release_value(); auto& expressions = m_template_literal->expressions(); auto* strings = MUST(Array::create(global_object, 0)); - MarkedValueList arguments(vm.heap()); + MarkedVector arguments(vm.heap()); arguments.append(strings); for (size_t i = 0; i < expressions.size(); ++i) { auto value = TRY(expressions[i].execute(interpreter, global_object)).release_value(); diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index 9ec0c533a2..1b079d801d 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -356,7 +356,7 @@ ThrowCompletionOr Call::execute_impl(Bytecode::Interpreter& interpreter) c if (!return_value_or_error.is_error()) return_value = return_value_or_error.release_value(); } else { - MarkedValueList argument_values { interpreter.vm().heap() }; + MarkedVector argument_values { interpreter.vm().heap() }; for (size_t i = 0; i < m_argument_count; ++i) argument_values.append(interpreter.reg(m_arguments[i])); diff --git a/Userland/Libraries/LibJS/Heap/Heap.h b/Userland/Libraries/LibJS/Heap/Heap.h index ddb189581e..5edf1d341c 100644 --- a/Userland/Libraries/LibJS/Heap/Heap.h +++ b/Userland/Libraries/LibJS/Heap/Heap.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include diff --git a/Userland/Libraries/LibJS/Interpreter.h b/Userland/Libraries/LibJS/Interpreter.h index c96ddbc65c..5de562431d 100644 --- a/Userland/Libraries/LibJS/Interpreter.h +++ b/Userland/Libraries/LibJS/Interpreter.h @@ -15,12 +15,12 @@ #include #include #include +#include #include #include #include #include #include -#include #include #include #include diff --git a/Userland/Libraries/LibJS/Parser.h b/Userland/Libraries/LibJS/Parser.h index db690c4879..daed380a7b 100644 --- a/Userland/Libraries/LibJS/Parser.h +++ b/Userland/Libraries/LibJS/Parser.h @@ -175,7 +175,7 @@ public: }; // Needs to mess with m_state, and we're not going to expose a non-const getter for that :^) - friend ThrowCompletionOr FunctionConstructor::create_dynamic_function(GlobalObject&, FunctionObject&, FunctionObject*, FunctionKind, MarkedValueList const&); + friend ThrowCompletionOr FunctionConstructor::create_dynamic_function(GlobalObject&, FunctionObject&, FunctionObject*, FunctionKind, MarkedVector const&); private: friend class ScopePusher; diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp index a1f31d33cf..037027776c 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp @@ -44,13 +44,13 @@ ThrowCompletionOr require_object_coercible(GlobalObject& global_object, V } // 7.3.14 Call ( F, V [ , argumentsList ] ), https://tc39.es/ecma262/#sec-call -ThrowCompletionOr call_impl(GlobalObject& global_object, Value function, Value this_value, Optional arguments_list) +ThrowCompletionOr call_impl(GlobalObject& global_object, Value function, Value this_value, Optional> arguments_list) { auto& vm = global_object.vm(); // 1. If argumentsList is not present, set argumentsList to a new empty List. if (!arguments_list.has_value()) - arguments_list = MarkedValueList { global_object.heap() }; + arguments_list = MarkedVector { global_object.heap() }; // 2. If IsCallable(F) is false, throw a TypeError exception. if (!function.is_function()) @@ -60,11 +60,11 @@ ThrowCompletionOr call_impl(GlobalObject& global_object, Value function, return function.as_function().internal_call(this_value, move(*arguments_list)); } -ThrowCompletionOr call_impl(GlobalObject& global_object, FunctionObject& function, Value this_value, Optional arguments_list) +ThrowCompletionOr call_impl(GlobalObject& global_object, FunctionObject& function, Value this_value, Optional> arguments_list) { // 1. If argumentsList is not present, set argumentsList to a new empty List. if (!arguments_list.has_value()) - arguments_list = MarkedValueList { global_object.heap() }; + arguments_list = MarkedVector { global_object.heap() }; // 2. If IsCallable(F) is false, throw a TypeError exception. // Note: Called with a FunctionObject ref @@ -74,7 +74,7 @@ ThrowCompletionOr call_impl(GlobalObject& global_object, FunctionObject& } // 7.3.15 Construct ( F [ , argumentsList [ , newTarget ] ] ), https://tc39.es/ecma262/#sec-construct -ThrowCompletionOr construct_impl(GlobalObject& global_object, FunctionObject& function, Optional arguments_list, FunctionObject* new_target) +ThrowCompletionOr construct_impl(GlobalObject& global_object, FunctionObject& function, Optional> arguments_list, FunctionObject* new_target) { // 1. If newTarget is not present, set newTarget to F. if (!new_target) @@ -82,7 +82,7 @@ ThrowCompletionOr construct_impl(GlobalObject& global_object, FunctionO // 2. If argumentsList is not present, set argumentsList to a new empty List. if (!arguments_list.has_value()) - arguments_list = MarkedValueList { global_object.heap() }; + arguments_list = MarkedVector { global_object.heap() }; // 3. Return ? F.[[Construct]](argumentsList, newTarget). return function.internal_construct(move(*arguments_list), *new_target); @@ -97,7 +97,7 @@ ThrowCompletionOr length_of_array_like(GlobalObject& global_object, Obje } // 7.3.20 CreateListFromArrayLike ( obj [ , elementTypes ] ), https://tc39.es/ecma262/#sec-createlistfromarraylike -ThrowCompletionOr create_list_from_array_like(GlobalObject& global_object, Value value, Function(Value)> check_value) +ThrowCompletionOr> create_list_from_array_like(GlobalObject& global_object, Value value, Function(Value)> check_value) { auto& vm = global_object.vm(); auto& heap = global_object.heap(); @@ -114,7 +114,7 @@ ThrowCompletionOr create_list_from_array_like(GlobalObject& glo auto length = TRY(length_of_array_like(global_object, array_like)); // 4. Let list be a new empty List. - auto list = MarkedValueList { heap }; + auto list = MarkedVector { heap }; // 5. Let index be 0. // 6. Repeat, while index < len, diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/AbstractOperations.h index 46ce41edb0..9e0035baac 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.h +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -25,11 +26,11 @@ Environment& get_this_environment(VM&); Object* get_super_constructor(VM&); ThrowCompletionOr make_super_property_reference(GlobalObject&, Value actual_this, PropertyKey const&, bool strict); ThrowCompletionOr require_object_coercible(GlobalObject&, Value); -ThrowCompletionOr call_impl(GlobalObject&, Value function, Value this_value, Optional = {}); -ThrowCompletionOr call_impl(GlobalObject&, FunctionObject& function, Value this_value, Optional = {}); -ThrowCompletionOr construct_impl(GlobalObject&, FunctionObject&, Optional = {}, FunctionObject* new_target = nullptr); +ThrowCompletionOr call_impl(GlobalObject&, Value function, Value this_value, Optional> = {}); +ThrowCompletionOr call_impl(GlobalObject&, FunctionObject& function, Value this_value, Optional> = {}); +ThrowCompletionOr construct_impl(GlobalObject&, FunctionObject&, Optional> = {}, FunctionObject* new_target = nullptr); ThrowCompletionOr length_of_array_like(GlobalObject&, Object const&); -ThrowCompletionOr create_list_from_array_like(GlobalObject&, Value, Function(Value)> = {}); +ThrowCompletionOr> create_list_from_array_like(GlobalObject&, Value, Function(Value)> = {}); ThrowCompletionOr species_constructor(GlobalObject&, Object const&, FunctionObject& default_constructor); ThrowCompletionOr get_function_realm(GlobalObject&, FunctionObject const&); ThrowCompletionOr initialize_bound_name(GlobalObject&, FlyString const&, Value, Environment*); @@ -54,12 +55,12 @@ ThrowCompletionOr perform_eval(Value, GlobalObject&, CallerMode, EvalMode ThrowCompletionOr eval_declaration_instantiation(VM& vm, GlobalObject& global_object, Program const& program, Environment* variable_environment, Environment* lexical_environment, PrivateEnvironment* private_environment, bool strict); // 7.3.14 Call ( F, V [ , argumentsList ] ), https://tc39.es/ecma262/#sec-call -ALWAYS_INLINE ThrowCompletionOr call(GlobalObject& global_object, Value function, Value this_value, MarkedValueList arguments_list) +ALWAYS_INLINE ThrowCompletionOr call(GlobalObject& global_object, Value function, Value this_value, MarkedVector arguments_list) { return call_impl(global_object, function, this_value, move(arguments_list)); } -ALWAYS_INLINE ThrowCompletionOr call(GlobalObject& global_object, Value function, Value this_value, Optional arguments_list) +ALWAYS_INLINE ThrowCompletionOr call(GlobalObject& global_object, Value function, Value this_value, Optional> arguments_list) { return call_impl(global_object, function, this_value, move(arguments_list)); } @@ -68,7 +69,7 @@ template ALWAYS_INLINE ThrowCompletionOr call(GlobalObject& global_object, Value function, Value this_value, Args&&... args) { if constexpr (sizeof...(Args) > 0) { - MarkedValueList arguments_list { global_object.heap() }; + MarkedVector arguments_list { global_object.heap() }; (..., arguments_list.append(forward(args))); return call_impl(global_object, function, this_value, move(arguments_list)); } @@ -76,12 +77,12 @@ ALWAYS_INLINE ThrowCompletionOr call(GlobalObject& global_object, Value f return call_impl(global_object, function, this_value); } -ALWAYS_INLINE ThrowCompletionOr call(GlobalObject& global_object, FunctionObject& function, Value this_value, MarkedValueList arguments_list) +ALWAYS_INLINE ThrowCompletionOr call(GlobalObject& global_object, FunctionObject& function, Value this_value, MarkedVector arguments_list) { return call_impl(global_object, function, this_value, move(arguments_list)); } -ALWAYS_INLINE ThrowCompletionOr call(GlobalObject& global_object, FunctionObject& function, Value this_value, Optional arguments_list) +ALWAYS_INLINE ThrowCompletionOr call(GlobalObject& global_object, FunctionObject& function, Value this_value, Optional> arguments_list) { return call_impl(global_object, function, this_value, move(arguments_list)); } @@ -90,7 +91,7 @@ template ALWAYS_INLINE ThrowCompletionOr call(GlobalObject& global_object, FunctionObject& function, Value this_value, Args&&... args) { if constexpr (sizeof...(Args) > 0) { - MarkedValueList arguments_list { global_object.heap() }; + MarkedVector arguments_list { global_object.heap() }; (..., arguments_list.append(forward(args))); return call_impl(global_object, function, this_value, move(arguments_list)); } @@ -103,7 +104,7 @@ template ALWAYS_INLINE ThrowCompletionOr construct(GlobalObject& global_object, FunctionObject& function, Args&&... args) { if constexpr (sizeof...(Args) > 0) { - MarkedValueList arguments_list { global_object.heap() }; + MarkedVector arguments_list { global_object.heap() }; (..., arguments_list.append(forward(args))); return construct_impl(global_object, function, move(arguments_list)); } @@ -111,12 +112,12 @@ ALWAYS_INLINE ThrowCompletionOr construct(GlobalObject& global_object, return construct_impl(global_object, function); } -ALWAYS_INLINE ThrowCompletionOr construct(GlobalObject& global_object, FunctionObject& function, MarkedValueList arguments_list, FunctionObject* new_target = nullptr) +ALWAYS_INLINE ThrowCompletionOr construct(GlobalObject& global_object, FunctionObject& function, MarkedVector arguments_list, FunctionObject* new_target = nullptr) { return construct_impl(global_object, function, move(arguments_list), new_target); } -ALWAYS_INLINE ThrowCompletionOr construct(GlobalObject& global_object, FunctionObject& function, Optional arguments_list, FunctionObject* new_target = nullptr) +ALWAYS_INLINE ThrowCompletionOr construct(GlobalObject& global_object, FunctionObject& function, Optional> arguments_list, FunctionObject* new_target = nullptr) { return construct_impl(global_object, function, move(arguments_list), new_target); } diff --git a/Userland/Libraries/LibJS/Runtime/Array.cpp b/Userland/Libraries/LibJS/Runtime/Array.cpp index 73dda85dd7..d5dde14d17 100644 --- a/Userland/Libraries/LibJS/Runtime/Array.cpp +++ b/Userland/Libraries/LibJS/Runtime/Array.cpp @@ -217,7 +217,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/Userland/Libraries/LibJS/Runtime/Array.h b/Userland/Libraries/LibJS/Runtime/Array.h index 35cbf07561..7e1cb1f2d3 100644 --- a/Userland/Libraries/LibJS/Runtime/Array.h +++ b/Userland/Libraries/LibJS/Runtime/Array.h @@ -26,7 +26,7 @@ public: template static Array* create_from(GlobalObject& global_object, Span elements, Function map_fn) { - auto values = MarkedValueList { global_object.heap() }; + auto values = MarkedVector { global_object.heap() }; values.ensure_capacity(elements.size()); for (auto const& element : elements) values.append(map_fn(element)); @@ -40,7 +40,7 @@ public: virtual ThrowCompletionOr> internal_get_own_property(PropertyKey const&) const override; virtual ThrowCompletionOr internal_define_own_property(PropertyKey const&, PropertyDescriptor const&) override; virtual ThrowCompletionOr internal_delete(PropertyKey const&) override; - virtual ThrowCompletionOr internal_own_property_keys() const override; + virtual ThrowCompletionOr> internal_own_property_keys() const override; [[nodiscard]] bool length_is_writable() const { return m_length_writable; }; diff --git a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp index a6c0090d7f..ca0a305705 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp @@ -864,15 +864,15 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reverse) return this_object; } -static ThrowCompletionOr array_merge_sort(VM& vm, GlobalObject& global_object, FunctionObject* compare_func, MarkedValueList& arr_to_sort) +static ThrowCompletionOr array_merge_sort(VM& vm, GlobalObject& global_object, FunctionObject* compare_func, MarkedVector& 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 {}; - MarkedValueList left(vm.heap()); - MarkedValueList right(vm.heap()); + MarkedVector left(vm.heap()); + MarkedVector right(vm.heap()); left.ensure_capacity(arr_to_sort.size() / 2); right.ensure_capacity(arr_to_sort.size() / 2 + (arr_to_sort.size() & 1)); @@ -972,7 +972,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::sort) auto length = TRY(length_of_array_like(global_object, *object)); - MarkedValueList items(vm.heap()); + MarkedVector items(vm.heap()); for (size_t k = 0; k < length; ++k) { auto k_present = TRY(object->has_property(k)); @@ -1689,7 +1689,7 @@ static void add_value_to_keyed_group(GlobalObject& global_object, GroupsType& gr } // 2. Let group be the Record { [[Key]]: key, [[Elements]]: « value » }. - MarkedValueList new_elements { global_object.heap() }; + MarkedVector new_elements { global_object.heap() }; new_elements.append(value); // 3. Append group as the last element of groups. @@ -1714,7 +1714,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::group_by) return vm.throw_completion(global_object, ErrorType::NotAFunction, callback_function.to_string_without_side_effects()); // 5. Let groups be a new empty List. - OrderedHashMap groups; + OrderedHashMap> groups; // 4. Let k be 0. // 6. Repeat, while k < len @@ -1781,7 +1781,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::group_by_to_map) }; // 5. Let groups be a new empty List. - OrderedHashMap, MarkedValueList, KeyedGroupTraits> groups; + OrderedHashMap, MarkedVector, KeyedGroupTraits> groups; // 4. Let k be 0. // 6. Repeat, while k < len diff --git a/Userland/Libraries/LibJS/Runtime/BoundFunction.cpp b/Userland/Libraries/LibJS/Runtime/BoundFunction.cpp index 11e27b71ae..9321f28729 100644 --- a/Userland/Libraries/LibJS/Runtime/BoundFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/BoundFunction.cpp @@ -34,7 +34,7 @@ BoundFunction::~BoundFunction() } // 10.4.1.1 [[Call]] ( thisArgument, argumentsList ), https://tc39.es/ecma262/#sec-bound-function-exotic-objects-call-thisargument-argumentslist -ThrowCompletionOr BoundFunction::internal_call([[maybe_unused]] Value this_argument, MarkedValueList arguments_list) +ThrowCompletionOr BoundFunction::internal_call([[maybe_unused]] Value this_argument, MarkedVector arguments_list) { // 1. Let target be F.[[BoundTargetFunction]]. auto& target = *m_bound_target_function; @@ -46,7 +46,7 @@ ThrowCompletionOr BoundFunction::internal_call([[maybe_unused]] Value thi auto& bound_args = m_bound_arguments; // 4. Let args be the list-concatenation of boundArgs and argumentsList. - auto args = MarkedValueList { heap() }; + auto args = MarkedVector { heap() }; args.extend(bound_args); args.extend(move(arguments_list)); @@ -55,7 +55,7 @@ ThrowCompletionOr BoundFunction::internal_call([[maybe_unused]] Value thi } // 10.4.1.2 [[Construct]] ( argumentsList, newTarget ), https://tc39.es/ecma262/#sec-bound-function-exotic-objects-construct-argumentslist-newtarget -ThrowCompletionOr BoundFunction::internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) +ThrowCompletionOr BoundFunction::internal_construct(MarkedVector arguments_list, FunctionObject& new_target) { // 1. Let target be F.[[BoundTargetFunction]]. auto& target = *m_bound_target_function; @@ -67,7 +67,7 @@ ThrowCompletionOr BoundFunction::internal_construct(MarkedValueList arg auto& bound_args = m_bound_arguments; // 4. Let args be the list-concatenation of boundArgs and argumentsList. - auto args = MarkedValueList { heap() }; + auto args = MarkedVector { heap() }; args.extend(bound_args); args.extend(move(arguments_list)); diff --git a/Userland/Libraries/LibJS/Runtime/BoundFunction.h b/Userland/Libraries/LibJS/Runtime/BoundFunction.h index 46795d4a33..0069befe4e 100644 --- a/Userland/Libraries/LibJS/Runtime/BoundFunction.h +++ b/Userland/Libraries/LibJS/Runtime/BoundFunction.h @@ -18,8 +18,8 @@ public: virtual void initialize(GlobalObject&) override; virtual ~BoundFunction(); - virtual ThrowCompletionOr internal_call(Value this_argument, MarkedValueList arguments_list) override; - virtual ThrowCompletionOr internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) override; + virtual ThrowCompletionOr internal_call(Value this_argument, MarkedVector arguments_list) override; + virtual ThrowCompletionOr internal_construct(MarkedVector arguments_list, FunctionObject& new_target) override; virtual const FlyString& name() const override { return m_name; } virtual bool is_strict_mode() const override { return m_bound_target_function->is_strict_mode(); } diff --git a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp index 524059518a..ab60930f2a 100644 --- a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp @@ -136,7 +136,7 @@ ECMAScriptFunctionObject::~ECMAScriptFunctionObject() } // 10.2.1 [[Call]] ( thisArgument, argumentsList ), https://tc39.es/ecma262/#sec-ecmascript-function-objects-call-thisargument-argumentslist -ThrowCompletionOr ECMAScriptFunctionObject::internal_call(Value this_argument, MarkedValueList arguments_list) +ThrowCompletionOr ECMAScriptFunctionObject::internal_call(Value this_argument, MarkedVector arguments_list) { auto& vm = this->vm(); @@ -194,7 +194,7 @@ ThrowCompletionOr ECMAScriptFunctionObject::internal_call(Value this_argu } // 10.2.2 [[Construct]] ( argumentsList, newTarget ), https://tc39.es/ecma262/#sec-ecmascript-function-objects-construct-argumentslist-newtarget -ThrowCompletionOr ECMAScriptFunctionObject::internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) +ThrowCompletionOr ECMAScriptFunctionObject::internal_construct(MarkedVector arguments_list, FunctionObject& new_target) { auto& vm = this->vm(); auto& global_object = this->global_object(); diff --git a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h index ebd17ebec5..e220d5cdca 100644 --- a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h +++ b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h @@ -39,8 +39,8 @@ public: virtual void initialize(GlobalObject&) override; virtual ~ECMAScriptFunctionObject(); - virtual ThrowCompletionOr internal_call(Value this_argument, MarkedValueList arguments_list) override; - virtual ThrowCompletionOr internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) override; + virtual ThrowCompletionOr internal_call(Value this_argument, MarkedVector arguments_list) override; + virtual ThrowCompletionOr internal_construct(MarkedVector arguments_list, FunctionObject& new_target) override; void make_method(Object& home_object); diff --git a/Userland/Libraries/LibJS/Runtime/ExecutionContext.h b/Userland/Libraries/LibJS/Runtime/ExecutionContext.h index 753b6690ab..baedc56368 100644 --- a/Userland/Libraries/LibJS/Runtime/ExecutionContext.h +++ b/Userland/Libraries/LibJS/Runtime/ExecutionContext.h @@ -10,8 +10,8 @@ #include #include #include +#include #include -#include #include #include @@ -45,7 +45,7 @@ struct ExecutionContext { } private: - explicit ExecutionContext(MarkedValueList existing_arguments) + explicit ExecutionContext(MarkedVector existing_arguments) : arguments(move(existing_arguments)) { } @@ -61,7 +61,7 @@ public: ASTNode const* current_node { nullptr }; FlyString function_name; Value this_value; - MarkedValueList arguments; + MarkedVector arguments; bool is_strict_mode { false }; // https://html.spec.whatwg.org/multipage/webappapis.html#skip-when-determining-incumbent-counter diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.cpp b/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.cpp index 40bdbcb214..336cb17613 100644 --- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.cpp +++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.cpp @@ -72,7 +72,7 @@ ThrowCompletionOr FinalizationRegistry::cleanup(Optional call continue; // b. Remove cell from finalizationRegistry.[[Cells]]. - MarkedValueList arguments(vm.heap()); + MarkedVector arguments(vm.heap()); arguments.append(it->held_value); it.remove(m_records); diff --git a/Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp b/Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp index 2a75c27fca..695cb2c00a 100644 --- a/Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp @@ -40,7 +40,7 @@ FunctionConstructor::~FunctionConstructor() } // 20.2.1.1.1 CreateDynamicFunction ( constructor, newTarget, kind, args ), https://tc39.es/ecma262/#sec-createdynamicfunction -ThrowCompletionOr FunctionConstructor::create_dynamic_function(GlobalObject& global_object, FunctionObject& constructor, FunctionObject* new_target, FunctionKind kind, MarkedValueList const& args) +ThrowCompletionOr FunctionConstructor::create_dynamic_function(GlobalObject& global_object, FunctionObject& constructor, FunctionObject* new_target, FunctionKind kind, MarkedVector const& args) { auto& vm = global_object.vm(); diff --git a/Userland/Libraries/LibJS/Runtime/FunctionConstructor.h b/Userland/Libraries/LibJS/Runtime/FunctionConstructor.h index e4a90634bf..68cf3944b1 100644 --- a/Userland/Libraries/LibJS/Runtime/FunctionConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/FunctionConstructor.h @@ -15,7 +15,7 @@ class FunctionConstructor final : public NativeFunction { JS_OBJECT(FunctionConstructor, NativeFunction); public: - static ThrowCompletionOr create_dynamic_function(GlobalObject& global_object, FunctionObject& constructor, FunctionObject* new_target, FunctionKind kind, MarkedValueList const& args); + static ThrowCompletionOr create_dynamic_function(GlobalObject& global_object, FunctionObject& constructor, FunctionObject* new_target, FunctionKind kind, MarkedVector const& args); explicit FunctionConstructor(GlobalObject&); virtual void initialize(GlobalObject&) override; diff --git a/Userland/Libraries/LibJS/Runtime/FunctionObject.h b/Userland/Libraries/LibJS/Runtime/FunctionObject.h index 0f6a510463..7bc7a0ac80 100644 --- a/Userland/Libraries/LibJS/Runtime/FunctionObject.h +++ b/Userland/Libraries/LibJS/Runtime/FunctionObject.h @@ -24,8 +24,8 @@ public: // Table 7: Additional Essential Internal Methods of Function Objects, https://tc39.es/ecma262/#table-additional-essential-internal-methods-of-function-objects - virtual ThrowCompletionOr internal_call(Value this_argument, MarkedValueList arguments_list) = 0; - virtual ThrowCompletionOr internal_construct([[maybe_unused]] MarkedValueList arguments_list, [[maybe_unused]] FunctionObject& new_target) { VERIFY_NOT_REACHED(); } + virtual ThrowCompletionOr internal_call(Value this_argument, MarkedVector arguments_list) = 0; + virtual ThrowCompletionOr internal_construct([[maybe_unused]] MarkedVector arguments_list, [[maybe_unused]] FunctionObject& new_target) { VERIFY_NOT_REACHED(); } virtual const FlyString& name() const = 0; diff --git a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp index a03b2bbda2..2189f324aa 100644 --- a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -14,7 +15,6 @@ #include #include #include -#include #include namespace JS { @@ -83,7 +83,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::call) return vm.throw_completion(global_object, ErrorType::NotAnObjectOfType, "Function"); auto& function = static_cast(*this_object); auto this_arg = vm.argument(0); - MarkedValueList arguments(vm.heap()); + MarkedVector arguments(vm.heap()); if (vm.argument_count() > 1) { for (size_t i = 1; i < vm.argument_count(); ++i) arguments.append(vm.argument(i)); diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.h b/Userland/Libraries/LibJS/Runtime/GlobalObject.h index 7da5eec6fe..d70e7ae76b 100644 --- a/Userland/Libraries/LibJS/Runtime/GlobalObject.h +++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.h @@ -173,12 +173,12 @@ template [[nodiscard]] ALWAYS_INLINE ThrowCompletionOr Value::invoke(GlobalObject& global_object, PropertyKey const& property_key, Args... args) { if constexpr (sizeof...(Args) > 0) { - MarkedValueList arglist { global_object.vm().heap() }; + MarkedVector arglist { global_object.vm().heap() }; (..., arglist.append(move(args))); return invoke_internal(global_object, property_key, move(arglist)); } - return invoke_internal(global_object, property_key, Optional {}); + return invoke_internal(global_object, property_key, Optional> {}); } } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/Intl.cpp b/Userland/Libraries/LibJS/Runtime/Intl/Intl.cpp index 8bdfcb4153..022d1f2785 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/Intl.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/Intl.cpp @@ -64,7 +64,7 @@ JS_DEFINE_NATIVE_FUNCTION(Intl::get_canonical_locales) // 1. Let ll be ? CanonicalizeLocaleList(locales). auto locale_list = TRY(canonicalize_locale_list(global_object, locales)); - MarkedValueList marked_locale_list { vm.heap() }; + MarkedVector marked_locale_list { vm.heap() }; marked_locale_list.ensure_capacity(locale_list.size()); for (auto& locale : locale_list) marked_locale_list.append(js_string(vm, move(locale))); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp index 6670e0aee1..83aa2fe315 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp @@ -4,10 +4,10 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include #include -#include namespace JS::Intl { @@ -59,7 +59,7 @@ JS_DEFINE_NATIVE_FUNCTION(PluralRulesPrototype::resolved_options) // 5. Let pluralCategories be a List of Strings containing all possible results of PluralRuleSelect for the selected locale pr.[[Locale]]. // FIXME: Implement this when the data is available in LibUnicode. - MarkedValueList plural_categories { vm.heap() }; + MarkedVector plural_categories { vm.heap() }; // 6. Perform ! CreateDataProperty(options, "pluralCategories", CreateArrayFromList(pluralCategories)). MUST(options->create_data_property_or_throw(vm.names.pluralCategories, Array::create_from(global_object, plural_categories))); diff --git a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp index a36b14c284..b8a575004a 100644 --- a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp @@ -212,10 +212,10 @@ Object* create_iterator_result_object(GlobalObject& global_object, Value value, } // 7.4.11 IterableToList ( items [ , method ] ), https://tc39.es/ecma262/#sec-iterabletolist -ThrowCompletionOr iterable_to_list(GlobalObject& global_object, Value iterable, Optional method) +ThrowCompletionOr> iterable_to_list(GlobalObject& global_object, Value iterable, Optional method) { auto& vm = global_object.vm(); - MarkedValueList values(vm.heap()); + MarkedVector values(vm.heap()); (void)TRY(get_iterator_values( global_object, iterable, [&](auto value) -> Optional { diff --git a/Userland/Libraries/LibJS/Runtime/IteratorOperations.h b/Userland/Libraries/LibJS/Runtime/IteratorOperations.h index 7786b26f6e..6262916a30 100644 --- a/Userland/Libraries/LibJS/Runtime/IteratorOperations.h +++ b/Userland/Libraries/LibJS/Runtime/IteratorOperations.h @@ -30,7 +30,7 @@ ThrowCompletionOr iterator_value(GlobalObject&, Object& iterator_result); Completion iterator_close(GlobalObject&, Iterator const&, Completion); Completion async_iterator_close(GlobalObject&, Iterator const&, Completion); Object* create_iterator_result_object(GlobalObject&, Value, bool done); -ThrowCompletionOr iterable_to_list(GlobalObject&, Value iterable, Optional method = {}); +ThrowCompletionOr> iterable_to_list(GlobalObject&, Value iterable, Optional method = {}); using IteratorValueCallback = Function(Value)>; Completion get_iterator_values(GlobalObject&, Value iterable, IteratorValueCallback callback, Optional method = {}); diff --git a/Userland/Libraries/LibJS/Runtime/JobCallback.h b/Userland/Libraries/LibJS/Runtime/JobCallback.h index 90c84b7a7e..8679ac26aa 100644 --- a/Userland/Libraries/LibJS/Runtime/JobCallback.h +++ b/Userland/Libraries/LibJS/Runtime/JobCallback.h @@ -30,7 +30,7 @@ inline JobCallback make_job_callback(FunctionObject& callback) } // 9.5.3 HostCallJobCallback ( jobCallback, V, argumentsList ), https://tc39.es/ecma262/#sec-hostcalljobcallback -inline ThrowCompletionOr call_job_callback(GlobalObject& global_object, JobCallback& job_callback, Value this_value, MarkedValueList arguments_list) +inline ThrowCompletionOr call_job_callback(GlobalObject& global_object, JobCallback& job_callback, Value this_value, MarkedVector arguments_list) { // 1. Assert: IsCallable(jobCallback.[[Callback]]) is true. VERIFY(!job_callback.callback.is_null()); diff --git a/Userland/Libraries/LibJS/Runtime/MarkedValueList.cpp b/Userland/Libraries/LibJS/Runtime/MarkedValueList.cpp index 1e770d831d..47ee03a4ce 100644 --- a/Userland/Libraries/LibJS/Runtime/MarkedValueList.cpp +++ b/Userland/Libraries/LibJS/Runtime/MarkedValueList.cpp @@ -5,7 +5,7 @@ */ #include -#include +#include namespace JS { diff --git a/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.cpp b/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.cpp index 27e04943b3..91ec15c17d 100644 --- a/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.cpp @@ -205,7 +205,7 @@ 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]]. diff --git a/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.h b/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.h index 573d8a936f..8c8e03d646 100644 --- a/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.h +++ b/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.h @@ -30,7 +30,7 @@ public: virtual ThrowCompletionOr internal_get(PropertyKey const&, Value receiver) const override; virtual ThrowCompletionOr internal_set(PropertyKey const&, Value value, Value receiver) 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(GlobalObject& object) override; private: diff --git a/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp b/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp index 910fadadfd..72bc55acc2 100644 --- a/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp @@ -52,7 +52,7 @@ NativeFunction::~NativeFunction() // these good candidates for a bit of code duplication :^) // 10.3.1 [[Call]] ( thisArgument, argumentsList ), https://tc39.es/ecma262/#sec-built-in-function-objects-call-thisargument-argumentslist -ThrowCompletionOr NativeFunction::internal_call(Value this_argument, MarkedValueList arguments_list) +ThrowCompletionOr NativeFunction::internal_call(Value this_argument, MarkedVector arguments_list) { auto& vm = this->vm(); auto& global_object = this->global_object(); @@ -117,7 +117,7 @@ ThrowCompletionOr NativeFunction::internal_call(Value this_argument, Mark } // 10.3.2 [[Construct]] ( argumentsList, newTarget ), https://tc39.es/ecma262/#sec-built-in-function-objects-construct-argumentslist-newtarget -ThrowCompletionOr NativeFunction::internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) +ThrowCompletionOr NativeFunction::internal_construct(MarkedVector arguments_list, FunctionObject& new_target) { auto& vm = this->vm(); auto& global_object = this->global_object(); diff --git a/Userland/Libraries/LibJS/Runtime/NativeFunction.h b/Userland/Libraries/LibJS/Runtime/NativeFunction.h index d028b629f9..e1e4b09509 100644 --- a/Userland/Libraries/LibJS/Runtime/NativeFunction.h +++ b/Userland/Libraries/LibJS/Runtime/NativeFunction.h @@ -22,8 +22,8 @@ public: virtual void initialize(GlobalObject&) override { } virtual ~NativeFunction() override; - virtual ThrowCompletionOr internal_call(Value this_argument, MarkedValueList arguments_list) override; - virtual ThrowCompletionOr internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) override; + virtual ThrowCompletionOr internal_call(Value this_argument, MarkedVector arguments_list) override; + virtual ThrowCompletionOr internal_construct(MarkedVector arguments_list, FunctionObject& new_target) override; // Used for [[Call]] / [[Construct]]'s "...result of evaluating F in a manner that conforms to the specification of F". // Needs to be overridden by all NativeFunctions without an m_native_function. diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index 49cce3dee8..f78bd56b87 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.cpp +++ b/Userland/Libraries/LibJS/Runtime/Object.cpp @@ -384,7 +384,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. @@ -397,7 +397,7 @@ ThrowCompletionOr Object::enumerable_own_property_names(Propert auto own_keys = TRY(internal_own_property_keys()); // 3. Let properties be a new empty List. - auto properties = MarkedValueList { heap() }; + auto properties = MarkedVector { heap() }; // 4. For each element key of ownKeys, do for (auto& key : own_keys) { @@ -894,12 +894,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. - MarkedValueList keys { heap() }; + MarkedVector 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/Userland/Libraries/LibJS/Runtime/Object.h b/Userland/Libraries/LibJS/Runtime/Object.h index dc47616525..75662d7236 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.h +++ b/Userland/Libraries/LibJS/Runtime/Object.h @@ -12,9 +12,9 @@ #include #include #include +#include #include #include -#include #include #include #include @@ -100,7 +100,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(Value source, HashTable const& seen_names, GlobalObject& global_object); PrivateElement* private_element_find(PrivateName const& name); @@ -122,7 +122,7 @@ public: virtual ThrowCompletionOr internal_get(PropertyKey const&, Value receiver) const; virtual ThrowCompletionOr internal_set(PropertyKey const&, Value value, Value receiver); virtual ThrowCompletionOr internal_delete(PropertyKey const&); - virtual ThrowCompletionOr internal_own_property_keys() const; + virtual ThrowCompletionOr> internal_own_property_keys() const; ThrowCompletionOr ordinary_set_with_own_descriptor(PropertyKey const&, Value, Value, Optional); diff --git a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp index 8f2f15ee1f..9f2c9fc7f9 100644 --- a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp @@ -98,7 +98,7 @@ static ThrowCompletionOr get_own_property_keys(GlobalObject& global_obje auto keys = TRY(object->internal_own_property_keys()); // 3. Let nameList be a new empty List. - auto name_list = MarkedValueList { vm.heap() }; + auto name_list = MarkedVector { vm.heap() }; // 4. For each element nextKey of keys, do for (auto& next_key : keys) { diff --git a/Userland/Libraries/LibJS/Runtime/PromiseJobs.cpp b/Userland/Libraries/LibJS/Runtime/PromiseJobs.cpp index 1812b7a3dc..163fe1c158 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseJobs.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseJobs.cpp @@ -53,7 +53,7 @@ static ThrowCompletionOr run_reaction_job(GlobalObject& global_object, Pr // e. Else, let handlerResult be HostCallJobCallback(handler, undefined, « argument »). else { dbgln_if(PROMISE_DEBUG, "run_reaction_job: Calling handler callback {} @ {} with argument {}", handler.value().callback.cell()->class_name(), handler.value().callback.cell(), argument); - MarkedValueList arguments(vm.heap()); + MarkedVector arguments(vm.heap()); arguments.append(argument); handler_result = vm.host_call_job_callback(global_object, handler.value(), js_undefined(), move(arguments)); } @@ -133,7 +133,7 @@ static ThrowCompletionOr run_resolve_thenable_job(GlobalObject& global_ob // b. Let thenCallResult be HostCallJobCallback(then, thenable, « resolvingFunctions.[[Resolve]], resolvingFunctions.[[Reject]] »). dbgln_if(PROMISE_DEBUG, "run_resolve_thenable_job: Calling then job callback for thenable {}", &thenable); - MarkedValueList arguments(vm.heap()); + MarkedVector arguments(vm.heap()); arguments.append(Value(&resolve_function)); arguments.append(Value(&reject_function)); auto then_call_result = vm.host_call_job_callback(global_object, then, thenable, move(arguments)); diff --git a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp index d6b6691ed4..5acd610323 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp @@ -641,7 +641,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 { auto& vm = this->vm(); auto& global_object = this->global_object(); @@ -692,10 +692,10 @@ ThrowCompletionOr ProxyObject::internal_own_property_keys() con // 13. Assert: targetKeys contains no duplicate entries. // 14. Let targetConfigurableKeys be a new empty List. - auto target_configurable_keys = MarkedValueList { heap() }; + auto target_configurable_keys = MarkedVector { heap() }; // 15. Let targetNonconfigurableKeys be a new empty List. - auto target_nonconfigurable_keys = MarkedValueList { heap() }; + auto target_nonconfigurable_keys = MarkedVector { heap() }; // 16. For each element key of targetKeys, do for (auto& key : target_keys) { @@ -723,7 +723,7 @@ ThrowCompletionOr ProxyObject::internal_own_property_keys() con } // 18. Let uncheckedResultKeys be a List whose elements are the elements of trapResult. - auto unchecked_result_keys = MarkedValueList { heap() }; + auto unchecked_result_keys = MarkedVector { heap() }; unchecked_result_keys.extend(trap_result); // 19. For each element key of targetNonconfigurableKeys, do @@ -763,7 +763,7 @@ ThrowCompletionOr ProxyObject::internal_own_property_keys() con } // 10.5.12 [[Call]] ( thisArgument, argumentsList ), https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist -ThrowCompletionOr ProxyObject::internal_call(Value this_argument, MarkedValueList arguments_list) +ThrowCompletionOr ProxyObject::internal_call(Value this_argument, MarkedVector arguments_list) { auto& vm = this->vm(); auto& global_object = this->global_object(); @@ -811,7 +811,7 @@ bool ProxyObject::has_constructor() const } // 10.5.13 [[Construct]] ( argumentsList, newTarget ), https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-construct-argumentslist-newtarget -ThrowCompletionOr ProxyObject::internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) +ThrowCompletionOr ProxyObject::internal_construct(MarkedVector arguments_list, FunctionObject& new_target) { auto& vm = this->vm(); auto& global_object = this->global_object(); diff --git a/Userland/Libraries/LibJS/Runtime/ProxyObject.h b/Userland/Libraries/LibJS/Runtime/ProxyObject.h index e727b57952..07948c4999 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyObject.h +++ b/Userland/Libraries/LibJS/Runtime/ProxyObject.h @@ -42,9 +42,9 @@ public: virtual ThrowCompletionOr internal_get(PropertyKey const&, Value receiver) const override; virtual ThrowCompletionOr internal_set(PropertyKey const&, Value value, Value receiver) override; virtual ThrowCompletionOr internal_delete(PropertyKey const&) override; - virtual ThrowCompletionOr internal_own_property_keys() const override; - virtual ThrowCompletionOr internal_call(Value this_argument, MarkedValueList arguments_list) override; - virtual ThrowCompletionOr internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) override; + virtual ThrowCompletionOr> internal_own_property_keys() const override; + virtual ThrowCompletionOr internal_call(Value this_argument, MarkedVector arguments_list) override; + virtual ThrowCompletionOr internal_construct(MarkedVector arguments_list, FunctionObject& new_target) override; private: virtual void visit_edges(Visitor&) override; diff --git a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp index 5a58afbd02..8a1899926a 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp @@ -640,7 +640,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace) } // 9. Let results be a new empty List. - MarkedValueList results(vm.heap()); + MarkedVector results(vm.heap()); // 10. Let done be false. // 11. Repeat, while done is false, @@ -705,7 +705,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace) // g. Let n be 1. // h. Let captures be a new empty List. - MarkedValueList captures(vm.heap()); + MarkedVector captures(vm.heap()); // i. Repeat, while n ≤ nCaptures, for (size_t n = 1; n <= n_captures; ++n) { @@ -733,7 +733,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace) // k. If functionalReplace is true, then if (replace_value.is_function()) { // i. Let replacerArgs be « matched ». - MarkedValueList replacer_args(vm.heap()); + MarkedVector replacer_args(vm.heap()); replacer_args.append(js_string(vm, move(matched))); // ii. Append in List order the elements of captures to the end of the List replacerArgs. diff --git a/Userland/Libraries/LibJS/Runtime/StringObject.cpp b/Userland/Libraries/LibJS/Runtime/StringObject.cpp index 9a66161633..f92a65eb43 100644 --- a/Userland/Libraries/LibJS/Runtime/StringObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringObject.cpp @@ -130,12 +130,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 = MarkedValueList { heap() }; + auto keys = MarkedVector { heap() }; // 2. Let str be O.[[StringData]]. auto str = m_string.utf16_string_view(); diff --git a/Userland/Libraries/LibJS/Runtime/StringObject.h b/Userland/Libraries/LibJS/Runtime/StringObject.h index e21203128c..10149e822e 100644 --- a/Userland/Libraries/LibJS/Runtime/StringObject.h +++ b/Userland/Libraries/LibJS/Runtime/StringObject.h @@ -26,7 +26,7 @@ public: private: virtual ThrowCompletionOr> internal_get_own_property(PropertyKey const&) const override; virtual ThrowCompletionOr internal_define_own_property(PropertyKey const&, PropertyDescriptor const&) 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/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index fbb8bcc496..6bf140914c 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp @@ -38,7 +38,7 @@ static Optional to_option_type(Value value) } // 13.1 IterableToListOfType ( items, elementTypes ), https://tc39.es/proposal-temporal/#sec-iterabletolistoftype -ThrowCompletionOr iterable_to_list_of_type(GlobalObject& global_object, Value items, Vector const& element_types) +ThrowCompletionOr> iterable_to_list_of_type(GlobalObject& global_object, Value items, Vector const& element_types) { auto& vm = global_object.vm(); auto& heap = global_object.heap(); @@ -47,7 +47,7 @@ ThrowCompletionOr iterable_to_list_of_type(GlobalObject& global auto iterator_record = TRY(get_iterator(global_object, items, IteratorHint::Sync)); // 2. Let values be a new empty List. - MarkedValueList values(heap); + MarkedVector values(heap); // 3. Let next be true. auto next = true; diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h index 978c36f1e8..0933539446 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h @@ -97,7 +97,7 @@ struct SecondsStringPrecision { u32 increment; }; -ThrowCompletionOr iterable_to_list_of_type(GlobalObject&, Value items, Vector const& element_types); +ThrowCompletionOr> iterable_to_list_of_type(GlobalObject&, Value items, Vector const& element_types); ThrowCompletionOr get_options_object(GlobalObject&, Value options); ThrowCompletionOr get_option(GlobalObject&, Object const& options, PropertyKey const& property, Vector const& types, Vector const& values, Value fallback); template diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp index c9b7955f94..67fe9e53c0 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp @@ -89,7 +89,7 @@ ThrowCompletionOr> calendar_fields(GlobalObject& global_object, O auto fields = TRY(Value(&calendar).get_method(global_object, vm.names.fields)); // 2. Let fieldsArray be ! CreateArrayFromList(fieldNames). - auto field_names_values = MarkedValueList { vm.heap() }; + auto field_names_values = MarkedVector { vm.heap() }; for (auto& field_name : field_names) field_names_values.append(js_string(vm, field_name)); Value fields_array = Array::create_from(global_object, field_names_values); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp index fcc4b3385a..3b3bbf8f96 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp @@ -489,7 +489,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::fields) auto iterator_record = TRY(get_iterator(global_object, fields, IteratorHint::Sync)); // 5. Let fieldNames be a new empty List. - auto field_names = MarkedValueList { vm.heap() }; + auto field_names = MarkedVector { vm.heap() }; // 6. Let next be true. // 7. Repeat, while next is not false, diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h index 500a11b7c9..77432aeb39 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h @@ -8,7 +8,6 @@ #include #include -#include #include #include diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp index 9666281e82..feabeeb0f0 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp @@ -151,7 +151,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_possible_instants_for) auto possible_epoch_nanoseconds = get_iana_time_zone_epoch_value(global_object, time_zone->identifier(), date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), date_time->iso_hour(), date_time->iso_minute(), date_time->iso_second(), date_time->iso_millisecond(), date_time->iso_microsecond(), date_time->iso_nanosecond()); // 6. Let possibleInstants be a new empty List. - auto possible_instants = MarkedValueList { vm.heap() }; + auto possible_instants = MarkedVector { vm.heap() }; // 7. For each value epochNanoseconds in possibleEpochNanoseconds, do for (auto& epoch_nanoseconds : possible_epoch_nanoseconds) { diff --git a/Userland/Libraries/LibJS/Runtime/TypedArray.cpp b/Userland/Libraries/LibJS/Runtime/TypedArray.cpp index 27e4ba3e7a..bf6eb8a426 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArray.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArray.cpp @@ -291,7 +291,7 @@ static ThrowCompletionOr initialize_typed_array_from_array_like(GlobalObje // 23.2.5.1.4 InitializeTypedArrayFromList, https://tc39.es/ecma262/#sec-initializetypedarrayfromlist template -static ThrowCompletionOr initialize_typed_array_from_list(GlobalObject& global_object, TypedArray& typed_array, const MarkedValueList& list) +static ThrowCompletionOr initialize_typed_array_from_list(GlobalObject& global_object, TypedArray& typed_array, const MarkedVector& list) { auto& vm = global_object.vm(); @@ -332,7 +332,7 @@ static ThrowCompletionOr initialize_typed_array_from_list(GlobalObject& gl } // 23.2.4.2 TypedArrayCreate ( constructor, argumentList ), https://tc39.es/ecma262/#typedarray-create -ThrowCompletionOr typed_array_create(GlobalObject& global_object, FunctionObject& constructor, MarkedValueList arguments) +ThrowCompletionOr typed_array_create(GlobalObject& global_object, FunctionObject& constructor, MarkedVector arguments) { auto& vm = global_object.vm(); diff --git a/Userland/Libraries/LibJS/Runtime/TypedArray.h b/Userland/Libraries/LibJS/Runtime/TypedArray.h index b765c57caa..640e516457 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArray.h +++ b/Userland/Libraries/LibJS/Runtime/TypedArray.h @@ -388,12 +388,12 @@ public: } // 10.4.5.7 [[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(); // 1. Let keys be a new empty List. - auto keys = MarkedValueList { heap() }; + auto keys = MarkedVector { heap() }; // 2. Assert: O is an Integer-Indexed exotic object. @@ -469,7 +469,7 @@ private: virtual bool is_typed_array() const final { return true; } }; -ThrowCompletionOr typed_array_create(GlobalObject& global_object, FunctionObject& constructor, MarkedValueList arguments); +ThrowCompletionOr typed_array_create(GlobalObject& global_object, FunctionObject& constructor, MarkedVector arguments); #define JS_DECLARE_TYPED_ARRAY(ClassName, snake_name, PrototypeName, ConstructorName, Type) \ class ClassName : public TypedArray { \ diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp index b94d8b5a82..c2b4fd2cac 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp @@ -76,7 +76,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::from) if (using_iterator) { auto values = TRY(iterable_to_list(global_object, source, using_iterator)); - MarkedValueList arguments(vm.heap()); + MarkedVector arguments(vm.heap()); arguments.empend(values.size()); auto target_object = TRY(typed_array_create(global_object, constructor.as_function(), move(arguments))); @@ -96,7 +96,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::from) auto array_like = MUST(source.to_object(global_object)); auto length = TRY(length_of_array_like(global_object, *array_like)); - MarkedValueList arguments(vm.heap()); + MarkedVector arguments(vm.heap()); arguments.empend(length); auto target_object = TRY(typed_array_create(global_object, constructor.as_function(), move(arguments))); @@ -120,7 +120,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::of) auto constructor = vm.this_value(global_object); if (!constructor.is_constructor()) return vm.throw_completion(global_object, ErrorType::NotAConstructor, constructor.to_string_without_side_effects()); - MarkedValueList arguments(vm.heap()); + MarkedVector arguments(vm.heap()); arguments.append(Value(length)); auto new_object = TRY(typed_array_create(global_object, constructor.as_function(), move(arguments))); for (size_t k = 0; k < length; ++k) { diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp index 61d799fad7..5b9b873648 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp @@ -142,7 +142,7 @@ static ThrowCompletionOr for_each_item_from_last(VM& vm, GlobalObject& glo } // 23.2.4.1 TypedArraySpeciesCreate ( exemplar, argumentList ), https://tc39.es/ecma262/#typedarray-species-create -static ThrowCompletionOr typed_array_species_create(GlobalObject& global_object, TypedArrayBase const& exemplar, MarkedValueList arguments) +static ThrowCompletionOr typed_array_species_create(GlobalObject& global_object, TypedArrayBase const& exemplar, MarkedVector arguments) { auto& vm = global_object.vm(); @@ -871,7 +871,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::slice) auto count = max(final - k, 0); - MarkedValueList arguments(vm.heap()); + MarkedVector arguments(vm.heap()); arguments.empend(count); auto* new_array = TRY(typed_array_species_create(global_object, *typed_array, move(arguments))); @@ -917,14 +917,14 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::slice) return new_array; } -static ThrowCompletionOr typed_array_merge_sort(GlobalObject& global_object, FunctionObject* compare_function, ArrayBuffer& buffer, MarkedValueList& arr_to_sort) +static ThrowCompletionOr typed_array_merge_sort(GlobalObject& global_object, FunctionObject* compare_function, ArrayBuffer& buffer, MarkedVector& arr_to_sort) { auto& vm = global_object.vm(); if (arr_to_sort.size() <= 1) return {}; - MarkedValueList left(vm.heap()); - MarkedValueList right(vm.heap()); + MarkedVector left(vm.heap()); + MarkedVector right(vm.heap()); left.ensure_capacity(arr_to_sort.size() / 2); right.ensure_capacity(arr_to_sort.size() / 2 + (arr_to_sort.size() & 1)); @@ -1014,7 +1014,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::sort) auto length = typed_array->array_length(); - MarkedValueList items(vm.heap()); + MarkedVector items(vm.heap()); for (u32 k = 0; k < length; ++k) { auto k_present = TRY(typed_array->has_property(k)); @@ -1077,7 +1077,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::subarray) return typed_array; } - MarkedValueList arguments(vm.heap()); + MarkedVector arguments(vm.heap()); arguments.empend(typed_array->viewed_array_buffer()); arguments.empend(begin_byte_offset.value()); arguments.empend(new_length); @@ -1306,7 +1306,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::filter) auto* callback_function = TRY(callback_from_args(global_object, "filter")); // 5. Let kept be a new empty List. - MarkedValueList kept(vm.heap()); + MarkedVector kept(vm.heap()); // 7. Let captured be 0. size_t captured = 0; @@ -1336,7 +1336,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::filter) } // 9. Let A be ? TypedArraySpeciesCreate(O, « 𝔽(captured) »). - MarkedValueList arguments(vm.heap()); + MarkedVector arguments(vm.heap()); arguments.empend(captured); auto* filter_array = TRY(typed_array_species_create(global_object, *typed_array, move(arguments))); @@ -1370,7 +1370,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::map) auto* callback_function = TRY(callback_from_args(global_object, "map")); // 5. Let A be ? TypedArraySpeciesCreate(O, « 𝔽(len) »). - MarkedValueList arguments(vm.heap()); + MarkedVector arguments(vm.heap()); arguments.empend(initial_length); auto* return_array = TRY(typed_array_species_create(global_object, *typed_array, move(arguments))); diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index e42caa49b4..43e2625f94 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -51,7 +51,7 @@ VM::VM(OwnPtr custom_data) promise_rejection_tracker(promise, operation); }; - host_call_job_callback = [](GlobalObject& global_object, JobCallback& job_callback, Value this_value, MarkedValueList arguments) { + host_call_job_callback = [](GlobalObject& global_object, JobCallback& job_callback, Value this_value, MarkedVector arguments) { return call_job_callback(global_object, job_callback, this_value, move(arguments)); }; diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h index 5b9ee5bbcc..5650a791b6 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.h +++ b/Userland/Libraries/LibJS/Runtime/VM.h @@ -15,13 +15,13 @@ #include #include #include +#include #include #include #include #include #include #include -#include #include #include @@ -167,7 +167,7 @@ public: return throw_completion(global_object, String::formatted(type.message(), forward(args)...)); } - Value construct(FunctionObject&, FunctionObject& new_target, Optional arguments); + Value construct(FunctionObject&, FunctionObject& new_target, Optional> arguments); String join_arguments(size_t start_index = 0) const; @@ -217,7 +217,7 @@ public: void enable_default_host_import_module_dynamically_hook(); Function host_promise_rejection_tracker; - Function(GlobalObject&, JobCallback&, Value, MarkedValueList)> host_call_job_callback; + Function(GlobalObject&, JobCallback&, Value, MarkedVector)> host_call_job_callback; Function host_enqueue_finalization_registry_cleanup_job; Function()>, Realm*)> host_enqueue_promise_job; Function host_make_job_callback; diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index 65fb415552..01f14e2be3 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -1569,7 +1569,7 @@ ThrowCompletionOr is_less_than(GlobalObject& global_object, bool left_ } // 7.3.21 Invoke ( V, P [ , argumentsList ] ), https://tc39.es/ecma262/#sec-invoke -ThrowCompletionOr Value::invoke_internal(GlobalObject& global_object, JS::PropertyKey const& property_key, Optional arguments) +ThrowCompletionOr Value::invoke_internal(GlobalObject& global_object, JS::PropertyKey const& property_key, Optional> arguments) { auto& vm = global_object.vm(); auto property = TRY(get(global_object, property_key)); diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h index 0f4ae1af1f..7b96309cf9 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.h +++ b/Userland/Libraries/LibJS/Runtime/Value.h @@ -352,7 +352,7 @@ public: private: Type m_type { Type::Empty }; - [[nodiscard]] ThrowCompletionOr invoke_internal(GlobalObject& global_object, PropertyKey const&, Optional arguments); + [[nodiscard]] ThrowCompletionOr invoke_internal(GlobalObject& global_object, PropertyKey const&, Optional> arguments); ThrowCompletionOr to_i32_slow_case(GlobalObject&) const; diff --git a/Userland/Libraries/LibJS/Runtime/WrappedFunction.cpp b/Userland/Libraries/LibJS/Runtime/WrappedFunction.cpp index 422e0e7f14..a7edbeee0a 100644 --- a/Userland/Libraries/LibJS/Runtime/WrappedFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/WrappedFunction.cpp @@ -44,7 +44,7 @@ WrappedFunction::WrappedFunction(Realm& realm, FunctionObject& wrapped_target_fu } // 2.1 [[Call]] ( thisArgument, argumentsList ), https://tc39.es/proposal-shadowrealm/#sec-wrapped-function-exotic-objects-call-thisargument-argumentslist -ThrowCompletionOr WrappedFunction::internal_call(Value this_argument, MarkedValueList arguments_list) +ThrowCompletionOr WrappedFunction::internal_call(Value this_argument, MarkedVector arguments_list) { auto& vm = this->vm(); auto& global_object = this->global_object(); @@ -64,7 +64,7 @@ ThrowCompletionOr WrappedFunction::internal_call(Value this_argument, Mar // 5. NOTE: Any exception objects produced after this point are associated with callerRealm. // 6. Let wrappedArgs be a new empty List. - auto wrapped_args = MarkedValueList { vm.heap() }; + auto wrapped_args = MarkedVector { vm.heap() }; wrapped_args.ensure_capacity(arguments_list.size()); // 7. For each element arg of argumentsList, do diff --git a/Userland/Libraries/LibJS/Runtime/WrappedFunction.h b/Userland/Libraries/LibJS/Runtime/WrappedFunction.h index 00eb2fd7ec..fc1e212449 100644 --- a/Userland/Libraries/LibJS/Runtime/WrappedFunction.h +++ b/Userland/Libraries/LibJS/Runtime/WrappedFunction.h @@ -20,7 +20,7 @@ public: WrappedFunction(Realm&, FunctionObject&, Object& prototype); virtual ~WrappedFunction() = default; - virtual ThrowCompletionOr internal_call(Value this_argument, MarkedValueList arguments_list) override; + virtual ThrowCompletionOr internal_call(Value this_argument, MarkedVector arguments_list) override; // FIXME: Remove this (and stop inventing random internal slots that shouldn't exist, jeez) virtual FlyString const& name() const override { return m_wrapped_target_function.name(); } diff --git a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp index 0a20d0eecd..0586bbf471 100644 --- a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp +++ b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp @@ -127,7 +127,7 @@ JS::VM& main_thread_vm() }; // 8.1.5.3.1 HostCallJobCallback(callback, V, argumentsList), https://html.spec.whatwg.org/multipage/webappapis.html#hostcalljobcallback - vm->host_call_job_callback = [](JS::GlobalObject& global_object, JS::JobCallback& callback, JS::Value this_value, JS::MarkedValueList arguments_list) { + vm->host_call_job_callback = [](JS::GlobalObject& global_object, JS::JobCallback& callback, JS::Value this_value, JS::MarkedVector arguments_list) { auto& callback_host_defined = verify_cast(*callback.custom_data); // 1. Let incumbent settings be callback.[[HostDefined]].[[IncumbentSettings]]. (NOTE: Not necessary) diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp index b875626d43..de27ae907c 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp @@ -210,7 +210,7 @@ JS::ThrowCompletionOr WebAssemblyObject::instantiate_module(Wasm::Module // just extract its address and resolve to that. Wasm::HostFunction host_function { [&](auto&, auto& arguments) -> Wasm::Result { - JS::MarkedValueList argument_values { vm.heap() }; + JS::MarkedVector argument_values { vm.heap() }; for (auto& entry : arguments) argument_values.append(to_js_value(global_object, entry)); diff --git a/Userland/Services/WebContent/ConsoleGlobalObject.cpp b/Userland/Services/WebContent/ConsoleGlobalObject.cpp index f424223b4c..89bab1984e 100644 --- a/Userland/Services/WebContent/ConsoleGlobalObject.cpp +++ b/Userland/Services/WebContent/ConsoleGlobalObject.cpp @@ -93,7 +93,7 @@ JS::ThrowCompletionOr ConsoleGlobalObject::internal_delete(JS::PropertyKey return m_window_object->internal_delete(property_name); } -JS::ThrowCompletionOr ConsoleGlobalObject::internal_own_property_keys() const +JS::ThrowCompletionOr> ConsoleGlobalObject::internal_own_property_keys() const { return m_window_object->internal_own_property_keys(); } diff --git a/Userland/Services/WebContent/ConsoleGlobalObject.h b/Userland/Services/WebContent/ConsoleGlobalObject.h index 32a19cdd4f..57dd008c43 100644 --- a/Userland/Services/WebContent/ConsoleGlobalObject.h +++ b/Userland/Services/WebContent/ConsoleGlobalObject.h @@ -33,7 +33,7 @@ public: virtual JS::ThrowCompletionOr internal_get(JS::PropertyKey const&, JS::Value) const override; virtual JS::ThrowCompletionOr internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver) override; virtual JS::ThrowCompletionOr internal_delete(JS::PropertyKey const& name) override; - virtual JS::ThrowCompletionOr internal_own_property_keys() const override; + virtual JS::ThrowCompletionOr> internal_own_property_keys() const override; virtual void initialize_global_object() override;