mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 06:32:44 +00:00 
			
		
		
		
	LibJS: Replace uses of MarkedValueList with MarkedVector<Value>
This is effectively a drop-in replacement.
This commit is contained in:
		
							parent
							
								
									1d32ac7b8b
								
							
						
					
					
						commit
						bc183dbbcb
					
				
					 61 changed files with 143 additions and 142 deletions
				
			
		|  | @ -2218,7 +2218,7 @@ public: | |||
|     virtual JS::ThrowCompletionOr<bool> internal_define_own_property(JS::PropertyKey const&, JS::PropertyDescriptor const&) override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const&) override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_prevent_extensions() override; | ||||
|     virtual JS::ThrowCompletionOr<JS::MarkedValueList> internal_own_property_keys() const override; | ||||
|     virtual JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> internal_own_property_keys() const override; | ||||
| )~~~"); | ||||
|     } | ||||
| 
 | ||||
|  | @ -3053,12 +3053,12 @@ JS::ThrowCompletionOr<bool> @class_name@::internal_prevent_extensions() | |||
| 
 | ||||
|         // 3.9.6. [[OwnPropertyKeys]], https://webidl.spec.whatwg.org/#legacy-platform-object-ownpropertykeys
 | ||||
|         scoped_generator.append(R"~~~( | ||||
| JS::ThrowCompletionOr<JS::MarkedValueList> @class_name@::internal_own_property_keys() const | ||||
| JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> @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<JS::Value> keys { heap() }; | ||||
| 
 | ||||
| )~~~"); | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,6 +15,7 @@ | |||
| #include <AK/TemporaryChange.h> | ||||
| #include <LibCrypto/BigInt/SignedBigInteger.h> | ||||
| #include <LibJS/AST.h> | ||||
| #include <LibJS/Heap/MarkedVector.h> | ||||
| #include <LibJS/Interpreter.h> | ||||
| #include <LibJS/Runtime/AbstractOperations.h> | ||||
| #include <LibJS/Runtime/Accessor.h> | ||||
|  | @ -25,7 +26,6 @@ | |||
| #include <LibJS/Runtime/FunctionEnvironment.h> | ||||
| #include <LibJS/Runtime/GlobalObject.h> | ||||
| #include <LibJS/Runtime/IteratorOperations.h> | ||||
| #include <LibJS/Runtime/MarkedValueList.h> | ||||
| #include <LibJS/Runtime/NativeFunction.h> | ||||
| #include <LibJS/Runtime/ObjectEnvironment.h> | ||||
| #include <LibJS/Runtime/PrimitiveString.h> | ||||
|  | @ -351,7 +351,7 @@ ThrowCompletionOr<CallExpression::ThisAndCallee> CallExpression::compute_this_an | |||
| } | ||||
| 
 | ||||
| // 13.3.8.1 Runtime Semantics: ArgumentListEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-argumentlistevaluation
 | ||||
| static ThrowCompletionOr<void> argument_list_evaluation(Interpreter& interpreter, GlobalObject& global_object, Vector<CallExpression::Argument> const& arguments, MarkedValueList& list) | ||||
| static ThrowCompletionOr<void> argument_list_evaluation(Interpreter& interpreter, GlobalObject& global_object, Vector<CallExpression::Argument> const& arguments, MarkedVector<Value>& 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<Value> 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<Value> 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<Value> 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<Value> 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(); | ||||
|  |  | |||
|  | @ -356,7 +356,7 @@ ThrowCompletionOr<void> 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<Value> argument_values { interpreter.vm().heap() }; | ||||
|         for (size_t i = 0; i < m_argument_count; ++i) | ||||
|             argument_values.append(interpreter.reg(m_arguments[i])); | ||||
| 
 | ||||
|  |  | |||
|  | @ -20,6 +20,7 @@ | |||
| #include <LibJS/Heap/CellAllocator.h> | ||||
| #include <LibJS/Heap/Handle.h> | ||||
| #include <LibJS/Heap/MarkedVector.h> | ||||
| #include <LibJS/Runtime/MarkedValueList.h> | ||||
| #include <LibJS/Runtime/Object.h> | ||||
| #include <LibJS/Runtime/WeakContainer.h> | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,12 +15,12 @@ | |||
| #include <LibJS/Forward.h> | ||||
| #include <LibJS/Heap/DeferGC.h> | ||||
| #include <LibJS/Heap/Heap.h> | ||||
| #include <LibJS/Heap/MarkedVector.h> | ||||
| #include <LibJS/Runtime/Completion.h> | ||||
| #include <LibJS/Runtime/DeclarativeEnvironment.h> | ||||
| #include <LibJS/Runtime/ErrorTypes.h> | ||||
| #include <LibJS/Runtime/GlobalEnvironment.h> | ||||
| #include <LibJS/Runtime/GlobalObject.h> | ||||
| #include <LibJS/Runtime/MarkedValueList.h> | ||||
| #include <LibJS/Runtime/Realm.h> | ||||
| #include <LibJS/Runtime/VM.h> | ||||
| #include <LibJS/Runtime/Value.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<ECMAScriptFunctionObject*> FunctionConstructor::create_dynamic_function(GlobalObject&, FunctionObject&, FunctionObject*, FunctionKind, MarkedValueList const&); | ||||
|     friend ThrowCompletionOr<ECMAScriptFunctionObject*> FunctionConstructor::create_dynamic_function(GlobalObject&, FunctionObject&, FunctionObject*, FunctionKind, MarkedVector<Value> const&); | ||||
| 
 | ||||
| private: | ||||
|     friend class ScopePusher; | ||||
|  |  | |||
|  | @ -44,13 +44,13 @@ ThrowCompletionOr<Value> require_object_coercible(GlobalObject& global_object, V | |||
| } | ||||
| 
 | ||||
| // 7.3.14 Call ( F, V [ , argumentsList ] ), https://tc39.es/ecma262/#sec-call
 | ||||
| ThrowCompletionOr<Value> call_impl(GlobalObject& global_object, Value function, Value this_value, Optional<MarkedValueList> arguments_list) | ||||
| ThrowCompletionOr<Value> call_impl(GlobalObject& global_object, Value function, Value this_value, Optional<MarkedVector<Value>> 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<Value> { global_object.heap() }; | ||||
| 
 | ||||
|     // 2. If IsCallable(F) is false, throw a TypeError exception.
 | ||||
|     if (!function.is_function()) | ||||
|  | @ -60,11 +60,11 @@ ThrowCompletionOr<Value> call_impl(GlobalObject& global_object, Value function, | |||
|     return function.as_function().internal_call(this_value, move(*arguments_list)); | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<Value> call_impl(GlobalObject& global_object, FunctionObject& function, Value this_value, Optional<MarkedValueList> arguments_list) | ||||
| ThrowCompletionOr<Value> call_impl(GlobalObject& global_object, FunctionObject& function, Value this_value, Optional<MarkedVector<Value>> 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<Value> { global_object.heap() }; | ||||
| 
 | ||||
|     // 2. If IsCallable(F) is false, throw a TypeError exception.
 | ||||
|     // Note: Called with a FunctionObject ref
 | ||||
|  | @ -74,7 +74,7 @@ ThrowCompletionOr<Value> call_impl(GlobalObject& global_object, FunctionObject& | |||
| } | ||||
| 
 | ||||
| // 7.3.15 Construct ( F [ , argumentsList [ , newTarget ] ] ), https://tc39.es/ecma262/#sec-construct
 | ||||
| ThrowCompletionOr<Object*> construct_impl(GlobalObject& global_object, FunctionObject& function, Optional<MarkedValueList> arguments_list, FunctionObject* new_target) | ||||
| ThrowCompletionOr<Object*> construct_impl(GlobalObject& global_object, FunctionObject& function, Optional<MarkedVector<Value>> arguments_list, FunctionObject* new_target) | ||||
| { | ||||
|     // 1. If newTarget is not present, set newTarget to F.
 | ||||
|     if (!new_target) | ||||
|  | @ -82,7 +82,7 @@ ThrowCompletionOr<Object*> 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<Value> { global_object.heap() }; | ||||
| 
 | ||||
|     // 3. Return ? F.[[Construct]](argumentsList, newTarget).
 | ||||
|     return function.internal_construct(move(*arguments_list), *new_target); | ||||
|  | @ -97,7 +97,7 @@ ThrowCompletionOr<size_t> length_of_array_like(GlobalObject& global_object, Obje | |||
| } | ||||
| 
 | ||||
| // 7.3.20 CreateListFromArrayLike ( obj [ , elementTypes ] ), https://tc39.es/ecma262/#sec-createlistfromarraylike
 | ||||
| ThrowCompletionOr<MarkedValueList> create_list_from_array_like(GlobalObject& global_object, Value value, Function<ThrowCompletionOr<void>(Value)> check_value) | ||||
| ThrowCompletionOr<MarkedVector<Value>> create_list_from_array_like(GlobalObject& global_object, Value value, Function<ThrowCompletionOr<void>(Value)> check_value) | ||||
| { | ||||
|     auto& vm = global_object.vm(); | ||||
|     auto& heap = global_object.heap(); | ||||
|  | @ -114,7 +114,7 @@ ThrowCompletionOr<MarkedValueList> 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<Value> { heap }; | ||||
| 
 | ||||
|     // 5. Let index be 0.
 | ||||
|     // 6. Repeat, while index < len,
 | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ | |||
| #include <LibCrypto/Forward.h> | ||||
| #include <LibJS/AST.h> | ||||
| #include <LibJS/Forward.h> | ||||
| #include <LibJS/Heap/MarkedVector.h> | ||||
| #include <LibJS/Runtime/FunctionObject.h> | ||||
| #include <LibJS/Runtime/GlobalObject.h> | ||||
| #include <LibJS/Runtime/PrivateEnvironment.h> | ||||
|  | @ -25,11 +26,11 @@ Environment& get_this_environment(VM&); | |||
| Object* get_super_constructor(VM&); | ||||
| ThrowCompletionOr<Reference> make_super_property_reference(GlobalObject&, Value actual_this, PropertyKey const&, bool strict); | ||||
| ThrowCompletionOr<Value> require_object_coercible(GlobalObject&, Value); | ||||
| ThrowCompletionOr<Value> call_impl(GlobalObject&, Value function, Value this_value, Optional<MarkedValueList> = {}); | ||||
| ThrowCompletionOr<Value> call_impl(GlobalObject&, FunctionObject& function, Value this_value, Optional<MarkedValueList> = {}); | ||||
| ThrowCompletionOr<Object*> construct_impl(GlobalObject&, FunctionObject&, Optional<MarkedValueList> = {}, FunctionObject* new_target = nullptr); | ||||
| ThrowCompletionOr<Value> call_impl(GlobalObject&, Value function, Value this_value, Optional<MarkedVector<Value>> = {}); | ||||
| ThrowCompletionOr<Value> call_impl(GlobalObject&, FunctionObject& function, Value this_value, Optional<MarkedVector<Value>> = {}); | ||||
| ThrowCompletionOr<Object*> construct_impl(GlobalObject&, FunctionObject&, Optional<MarkedVector<Value>> = {}, FunctionObject* new_target = nullptr); | ||||
| ThrowCompletionOr<size_t> length_of_array_like(GlobalObject&, Object const&); | ||||
| ThrowCompletionOr<MarkedValueList> create_list_from_array_like(GlobalObject&, Value, Function<ThrowCompletionOr<void>(Value)> = {}); | ||||
| ThrowCompletionOr<MarkedVector<Value>> create_list_from_array_like(GlobalObject&, Value, Function<ThrowCompletionOr<void>(Value)> = {}); | ||||
| ThrowCompletionOr<FunctionObject*> species_constructor(GlobalObject&, Object const&, FunctionObject& default_constructor); | ||||
| ThrowCompletionOr<Realm*> get_function_realm(GlobalObject&, FunctionObject const&); | ||||
| ThrowCompletionOr<void> initialize_bound_name(GlobalObject&, FlyString const&, Value, Environment*); | ||||
|  | @ -54,12 +55,12 @@ ThrowCompletionOr<Value> perform_eval(Value, GlobalObject&, CallerMode, EvalMode | |||
| ThrowCompletionOr<void> 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<Value> call(GlobalObject& global_object, Value function, Value this_value, MarkedValueList arguments_list) | ||||
| ALWAYS_INLINE ThrowCompletionOr<Value> call(GlobalObject& global_object, Value function, Value this_value, MarkedVector<Value> arguments_list) | ||||
| { | ||||
|     return call_impl(global_object, function, this_value, move(arguments_list)); | ||||
| } | ||||
| 
 | ||||
| ALWAYS_INLINE ThrowCompletionOr<Value> call(GlobalObject& global_object, Value function, Value this_value, Optional<MarkedValueList> arguments_list) | ||||
| ALWAYS_INLINE ThrowCompletionOr<Value> call(GlobalObject& global_object, Value function, Value this_value, Optional<MarkedVector<Value>> arguments_list) | ||||
| { | ||||
|     return call_impl(global_object, function, this_value, move(arguments_list)); | ||||
| } | ||||
|  | @ -68,7 +69,7 @@ template<typename... Args> | |||
| ALWAYS_INLINE ThrowCompletionOr<Value> call(GlobalObject& global_object, Value function, Value this_value, Args&&... args) | ||||
| { | ||||
|     if constexpr (sizeof...(Args) > 0) { | ||||
|         MarkedValueList arguments_list { global_object.heap() }; | ||||
|         MarkedVector<Value> arguments_list { global_object.heap() }; | ||||
|         (..., arguments_list.append(forward<Args>(args))); | ||||
|         return call_impl(global_object, function, this_value, move(arguments_list)); | ||||
|     } | ||||
|  | @ -76,12 +77,12 @@ ALWAYS_INLINE ThrowCompletionOr<Value> call(GlobalObject& global_object, Value f | |||
|     return call_impl(global_object, function, this_value); | ||||
| } | ||||
| 
 | ||||
| ALWAYS_INLINE ThrowCompletionOr<Value> call(GlobalObject& global_object, FunctionObject& function, Value this_value, MarkedValueList arguments_list) | ||||
| ALWAYS_INLINE ThrowCompletionOr<Value> call(GlobalObject& global_object, FunctionObject& function, Value this_value, MarkedVector<Value> arguments_list) | ||||
| { | ||||
|     return call_impl(global_object, function, this_value, move(arguments_list)); | ||||
| } | ||||
| 
 | ||||
| ALWAYS_INLINE ThrowCompletionOr<Value> call(GlobalObject& global_object, FunctionObject& function, Value this_value, Optional<MarkedValueList> arguments_list) | ||||
| ALWAYS_INLINE ThrowCompletionOr<Value> call(GlobalObject& global_object, FunctionObject& function, Value this_value, Optional<MarkedVector<Value>> arguments_list) | ||||
| { | ||||
|     return call_impl(global_object, function, this_value, move(arguments_list)); | ||||
| } | ||||
|  | @ -90,7 +91,7 @@ template<typename... Args> | |||
| ALWAYS_INLINE ThrowCompletionOr<Value> call(GlobalObject& global_object, FunctionObject& function, Value this_value, Args&&... args) | ||||
| { | ||||
|     if constexpr (sizeof...(Args) > 0) { | ||||
|         MarkedValueList arguments_list { global_object.heap() }; | ||||
|         MarkedVector<Value> arguments_list { global_object.heap() }; | ||||
|         (..., arguments_list.append(forward<Args>(args))); | ||||
|         return call_impl(global_object, function, this_value, move(arguments_list)); | ||||
|     } | ||||
|  | @ -103,7 +104,7 @@ template<typename... Args> | |||
| ALWAYS_INLINE ThrowCompletionOr<Object*> construct(GlobalObject& global_object, FunctionObject& function, Args&&... args) | ||||
| { | ||||
|     if constexpr (sizeof...(Args) > 0) { | ||||
|         MarkedValueList arguments_list { global_object.heap() }; | ||||
|         MarkedVector<Value> arguments_list { global_object.heap() }; | ||||
|         (..., arguments_list.append(forward<Args>(args))); | ||||
|         return construct_impl(global_object, function, move(arguments_list)); | ||||
|     } | ||||
|  | @ -111,12 +112,12 @@ ALWAYS_INLINE ThrowCompletionOr<Object*> construct(GlobalObject& global_object, | |||
|     return construct_impl(global_object, function); | ||||
| } | ||||
| 
 | ||||
| ALWAYS_INLINE ThrowCompletionOr<Object*> construct(GlobalObject& global_object, FunctionObject& function, MarkedValueList arguments_list, FunctionObject* new_target = nullptr) | ||||
| ALWAYS_INLINE ThrowCompletionOr<Object*> construct(GlobalObject& global_object, FunctionObject& function, MarkedVector<Value> arguments_list, FunctionObject* new_target = nullptr) | ||||
| { | ||||
|     return construct_impl(global_object, function, move(arguments_list), new_target); | ||||
| } | ||||
| 
 | ||||
| ALWAYS_INLINE ThrowCompletionOr<Object*> construct(GlobalObject& global_object, FunctionObject& function, Optional<MarkedValueList> arguments_list, FunctionObject* new_target = nullptr) | ||||
| ALWAYS_INLINE ThrowCompletionOr<Object*> construct(GlobalObject& global_object, FunctionObject& function, Optional<MarkedVector<Value>> arguments_list, FunctionObject* new_target = nullptr) | ||||
| { | ||||
|     return construct_impl(global_object, function, move(arguments_list), new_target); | ||||
| } | ||||
|  |  | |||
|  | @ -217,7 +217,7 @@ ThrowCompletionOr<bool> Array::internal_delete(PropertyKey const& property_key) | |||
| } | ||||
| 
 | ||||
| // NON-STANDARD: Used to inject the ephemeral length property's key
 | ||||
| ThrowCompletionOr<MarkedValueList> Array::internal_own_property_keys() const | ||||
| ThrowCompletionOr<MarkedVector<Value>> Array::internal_own_property_keys() const | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     auto keys = TRY(Object::internal_own_property_keys()); | ||||
|  |  | |||
|  | @ -26,7 +26,7 @@ public: | |||
|     template<typename T> | ||||
|     static Array* create_from(GlobalObject& global_object, Span<T const> elements, Function<Value(T const&)> map_fn) | ||||
|     { | ||||
|         auto values = MarkedValueList { global_object.heap() }; | ||||
|         auto values = MarkedVector<Value> { 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<Optional<PropertyDescriptor>> internal_get_own_property(PropertyKey const&) const override; | ||||
|     virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyKey const&, PropertyDescriptor const&) override; | ||||
|     virtual ThrowCompletionOr<bool> internal_delete(PropertyKey const&) override; | ||||
|     virtual ThrowCompletionOr<MarkedValueList> internal_own_property_keys() const override; | ||||
|     virtual ThrowCompletionOr<MarkedVector<Value>> internal_own_property_keys() const override; | ||||
| 
 | ||||
|     [[nodiscard]] bool length_is_writable() const { return m_length_writable; }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -864,15 +864,15 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reverse) | |||
|     return this_object; | ||||
| } | ||||
| 
 | ||||
| static ThrowCompletionOr<void> array_merge_sort(VM& vm, GlobalObject& global_object, FunctionObject* compare_func, MarkedValueList& arr_to_sort) | ||||
| static ThrowCompletionOr<void> array_merge_sort(VM& vm, GlobalObject& global_object, FunctionObject* compare_func, MarkedVector<Value>& arr_to_sort) | ||||
| { | ||||
|     // FIXME: it would probably be better to switch to insertion sort for small arrays for
 | ||||
|     // better performance
 | ||||
|     if (arr_to_sort.size() <= 1) | ||||
|         return {}; | ||||
| 
 | ||||
|     MarkedValueList left(vm.heap()); | ||||
|     MarkedValueList right(vm.heap()); | ||||
|     MarkedVector<Value> left(vm.heap()); | ||||
|     MarkedVector<Value> right(vm.heap()); | ||||
| 
 | ||||
|     left.ensure_capacity(arr_to_sort.size() / 2); | ||||
|     right.ensure_capacity(arr_to_sort.size() / 2 + (arr_to_sort.size() & 1)); | ||||
|  | @ -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<Value> 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<Value> 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<TypeError>(global_object, ErrorType::NotAFunction, callback_function.to_string_without_side_effects()); | ||||
| 
 | ||||
|     // 5. Let groups be a new empty List.
 | ||||
|     OrderedHashMap<PropertyKey, MarkedValueList> groups; | ||||
|     OrderedHashMap<PropertyKey, MarkedVector<Value>> 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<Handle<Value>, MarkedValueList, KeyedGroupTraits> groups; | ||||
|     OrderedHashMap<Handle<Value>, MarkedVector<Value>, KeyedGroupTraits> groups; | ||||
| 
 | ||||
|     // 4. Let k be 0.
 | ||||
|     // 6. Repeat, while k < len
 | ||||
|  |  | |||
|  | @ -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<Value> BoundFunction::internal_call([[maybe_unused]] Value this_argument, MarkedValueList arguments_list) | ||||
| ThrowCompletionOr<Value> BoundFunction::internal_call([[maybe_unused]] Value this_argument, MarkedVector<Value> arguments_list) | ||||
| { | ||||
|     // 1. Let target be F.[[BoundTargetFunction]].
 | ||||
|     auto& target = *m_bound_target_function; | ||||
|  | @ -46,7 +46,7 @@ ThrowCompletionOr<Value> 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<Value> { heap() }; | ||||
|     args.extend(bound_args); | ||||
|     args.extend(move(arguments_list)); | ||||
| 
 | ||||
|  | @ -55,7 +55,7 @@ ThrowCompletionOr<Value> 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<Object*> BoundFunction::internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) | ||||
| ThrowCompletionOr<Object*> BoundFunction::internal_construct(MarkedVector<Value> arguments_list, FunctionObject& new_target) | ||||
| { | ||||
|     // 1. Let target be F.[[BoundTargetFunction]].
 | ||||
|     auto& target = *m_bound_target_function; | ||||
|  | @ -67,7 +67,7 @@ ThrowCompletionOr<Object*> 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<Value> { heap() }; | ||||
|     args.extend(bound_args); | ||||
|     args.extend(move(arguments_list)); | ||||
| 
 | ||||
|  |  | |||
|  | @ -18,8 +18,8 @@ public: | |||
|     virtual void initialize(GlobalObject&) override; | ||||
|     virtual ~BoundFunction(); | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedValueList arguments_list) override; | ||||
|     virtual ThrowCompletionOr<Object*> internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) override; | ||||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override; | ||||
|     virtual ThrowCompletionOr<Object*> internal_construct(MarkedVector<Value> 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(); } | ||||
|  |  | |||
|  | @ -136,7 +136,7 @@ ECMAScriptFunctionObject::~ECMAScriptFunctionObject() | |||
| } | ||||
| 
 | ||||
| // 10.2.1 [[Call]] ( thisArgument, argumentsList ), https://tc39.es/ecma262/#sec-ecmascript-function-objects-call-thisargument-argumentslist
 | ||||
| ThrowCompletionOr<Value> ECMAScriptFunctionObject::internal_call(Value this_argument, MarkedValueList arguments_list) | ||||
| ThrowCompletionOr<Value> ECMAScriptFunctionObject::internal_call(Value this_argument, MarkedVector<Value> arguments_list) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
| 
 | ||||
|  | @ -194,7 +194,7 @@ ThrowCompletionOr<Value> ECMAScriptFunctionObject::internal_call(Value this_argu | |||
| } | ||||
| 
 | ||||
| // 10.2.2 [[Construct]] ( argumentsList, newTarget ), https://tc39.es/ecma262/#sec-ecmascript-function-objects-construct-argumentslist-newtarget
 | ||||
| ThrowCompletionOr<Object*> ECMAScriptFunctionObject::internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) | ||||
| ThrowCompletionOr<Object*> ECMAScriptFunctionObject::internal_construct(MarkedVector<Value> arguments_list, FunctionObject& new_target) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     auto& global_object = this->global_object(); | ||||
|  |  | |||
|  | @ -39,8 +39,8 @@ public: | |||
|     virtual void initialize(GlobalObject&) override; | ||||
|     virtual ~ECMAScriptFunctionObject(); | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedValueList arguments_list) override; | ||||
|     virtual ThrowCompletionOr<Object*> internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) override; | ||||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override; | ||||
|     virtual ThrowCompletionOr<Object*> internal_construct(MarkedVector<Value> arguments_list, FunctionObject& new_target) override; | ||||
| 
 | ||||
|     void make_method(Object& home_object); | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,8 +10,8 @@ | |||
| #include <AK/FlyString.h> | ||||
| #include <AK/WeakPtr.h> | ||||
| #include <LibJS/Forward.h> | ||||
| #include <LibJS/Heap/MarkedVector.h> | ||||
| #include <LibJS/Module.h> | ||||
| #include <LibJS/Runtime/MarkedValueList.h> | ||||
| #include <LibJS/Runtime/PrivateEnvironment.h> | ||||
| #include <LibJS/Runtime/Value.h> | ||||
| 
 | ||||
|  | @ -45,7 +45,7 @@ struct ExecutionContext { | |||
|     } | ||||
| 
 | ||||
| private: | ||||
|     explicit ExecutionContext(MarkedValueList existing_arguments) | ||||
|     explicit ExecutionContext(MarkedVector<Value> 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<Value> arguments; | ||||
|     bool is_strict_mode { false }; | ||||
| 
 | ||||
|     // https://html.spec.whatwg.org/multipage/webappapis.html#skip-when-determining-incumbent-counter
 | ||||
|  |  | |||
|  | @ -72,7 +72,7 @@ ThrowCompletionOr<void> FinalizationRegistry::cleanup(Optional<JobCallback> call | |||
|             continue; | ||||
| 
 | ||||
|         // b. Remove cell from finalizationRegistry.[[Cells]].
 | ||||
|         MarkedValueList arguments(vm.heap()); | ||||
|         MarkedVector<Value> arguments(vm.heap()); | ||||
|         arguments.append(it->held_value); | ||||
|         it.remove(m_records); | ||||
| 
 | ||||
|  |  | |||
|  | @ -40,7 +40,7 @@ FunctionConstructor::~FunctionConstructor() | |||
| } | ||||
| 
 | ||||
| // 20.2.1.1.1 CreateDynamicFunction ( constructor, newTarget, kind, args ), https://tc39.es/ecma262/#sec-createdynamicfunction
 | ||||
| ThrowCompletionOr<ECMAScriptFunctionObject*> FunctionConstructor::create_dynamic_function(GlobalObject& global_object, FunctionObject& constructor, FunctionObject* new_target, FunctionKind kind, MarkedValueList const& args) | ||||
| ThrowCompletionOr<ECMAScriptFunctionObject*> FunctionConstructor::create_dynamic_function(GlobalObject& global_object, FunctionObject& constructor, FunctionObject* new_target, FunctionKind kind, MarkedVector<Value> const& args) | ||||
| { | ||||
|     auto& vm = global_object.vm(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ class FunctionConstructor final : public NativeFunction { | |||
|     JS_OBJECT(FunctionConstructor, NativeFunction); | ||||
| 
 | ||||
| public: | ||||
|     static ThrowCompletionOr<ECMAScriptFunctionObject*> create_dynamic_function(GlobalObject& global_object, FunctionObject& constructor, FunctionObject* new_target, FunctionKind kind, MarkedValueList const& args); | ||||
|     static ThrowCompletionOr<ECMAScriptFunctionObject*> create_dynamic_function(GlobalObject& global_object, FunctionObject& constructor, FunctionObject* new_target, FunctionKind kind, MarkedVector<Value> const& args); | ||||
| 
 | ||||
|     explicit FunctionConstructor(GlobalObject&); | ||||
|     virtual void initialize(GlobalObject&) override; | ||||
|  |  | |||
|  | @ -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<Value> internal_call(Value this_argument, MarkedValueList arguments_list) = 0; | ||||
|     virtual ThrowCompletionOr<Object*> internal_construct([[maybe_unused]] MarkedValueList arguments_list, [[maybe_unused]] FunctionObject& new_target) { VERIFY_NOT_REACHED(); } | ||||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) = 0; | ||||
|     virtual ThrowCompletionOr<Object*> internal_construct([[maybe_unused]] MarkedVector<Value> arguments_list, [[maybe_unused]] FunctionObject& new_target) { VERIFY_NOT_REACHED(); } | ||||
| 
 | ||||
|     virtual const FlyString& name() const = 0; | ||||
| 
 | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| 
 | ||||
| #include <AK/Function.h> | ||||
| #include <AK/StringBuilder.h> | ||||
| #include <LibJS/Heap/MarkedVector.h> | ||||
| #include <LibJS/Interpreter.h> | ||||
| #include <LibJS/Runtime/AbstractOperations.h> | ||||
| #include <LibJS/Runtime/BoundFunction.h> | ||||
|  | @ -14,7 +15,6 @@ | |||
| #include <LibJS/Runtime/FunctionObject.h> | ||||
| #include <LibJS/Runtime/FunctionPrototype.h> | ||||
| #include <LibJS/Runtime/GlobalObject.h> | ||||
| #include <LibJS/Runtime/MarkedValueList.h> | ||||
| #include <LibJS/Runtime/NativeFunction.h> | ||||
| 
 | ||||
| namespace JS { | ||||
|  | @ -83,7 +83,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::call) | |||
|         return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Function"); | ||||
|     auto& function = static_cast<FunctionObject&>(*this_object); | ||||
|     auto this_arg = vm.argument(0); | ||||
|     MarkedValueList arguments(vm.heap()); | ||||
|     MarkedVector<Value> arguments(vm.heap()); | ||||
|     if (vm.argument_count() > 1) { | ||||
|         for (size_t i = 1; i < vm.argument_count(); ++i) | ||||
|             arguments.append(vm.argument(i)); | ||||
|  |  | |||
|  | @ -173,12 +173,12 @@ template<typename... Args> | |||
| [[nodiscard]] ALWAYS_INLINE ThrowCompletionOr<Value> Value::invoke(GlobalObject& global_object, PropertyKey const& property_key, Args... args) | ||||
| { | ||||
|     if constexpr (sizeof...(Args) > 0) { | ||||
|         MarkedValueList arglist { global_object.vm().heap() }; | ||||
|         MarkedVector<Value> 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<MarkedValueList> {}); | ||||
|     return invoke_internal(global_object, property_key, Optional<MarkedVector<Value>> {}); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -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<Value> 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))); | ||||
|  |  | |||
|  | @ -4,10 +4,10 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include <LibJS/Heap/MarkedVector.h> | ||||
| #include <LibJS/Runtime/Array.h> | ||||
| #include <LibJS/Runtime/GlobalObject.h> | ||||
| #include <LibJS/Runtime/Intl/PluralRulesPrototype.h> | ||||
| #include <LibJS/Runtime/MarkedValueList.h> | ||||
| 
 | ||||
| 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<Value> 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))); | ||||
|  |  | |||
|  | @ -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<MarkedValueList> iterable_to_list(GlobalObject& global_object, Value iterable, Optional<Value> method) | ||||
| ThrowCompletionOr<MarkedVector<Value>> iterable_to_list(GlobalObject& global_object, Value iterable, Optional<Value> method) | ||||
| { | ||||
|     auto& vm = global_object.vm(); | ||||
|     MarkedValueList values(vm.heap()); | ||||
|     MarkedVector<Value> values(vm.heap()); | ||||
| 
 | ||||
|     (void)TRY(get_iterator_values( | ||||
|         global_object, iterable, [&](auto value) -> Optional<Completion> { | ||||
|  |  | |||
|  | @ -30,7 +30,7 @@ ThrowCompletionOr<Value> 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<MarkedValueList> iterable_to_list(GlobalObject&, Value iterable, Optional<Value> method = {}); | ||||
| ThrowCompletionOr<MarkedVector<Value>> iterable_to_list(GlobalObject&, Value iterable, Optional<Value> method = {}); | ||||
| 
 | ||||
| using IteratorValueCallback = Function<Optional<Completion>(Value)>; | ||||
| Completion get_iterator_values(GlobalObject&, Value iterable, IteratorValueCallback callback, Optional<Value> method = {}); | ||||
|  |  | |||
|  | @ -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<Value> call_job_callback(GlobalObject& global_object, JobCallback& job_callback, Value this_value, MarkedValueList arguments_list) | ||||
| inline ThrowCompletionOr<Value> call_job_callback(GlobalObject& global_object, JobCallback& job_callback, Value this_value, MarkedVector<Value> arguments_list) | ||||
| { | ||||
|     // 1. Assert: IsCallable(jobCallback.[[Callback]]) is true.
 | ||||
|     VERIFY(!job_callback.callback.is_null()); | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ | |||
|  */ | ||||
| 
 | ||||
| #include <LibJS/Heap/Heap.h> | ||||
| #include <LibJS/Runtime/MarkedValueList.h> | ||||
| #include <LibJS/Heap/MarkedVector.h> | ||||
| 
 | ||||
| namespace JS { | ||||
| 
 | ||||
|  |  | |||
|  | @ -205,7 +205,7 @@ ThrowCompletionOr<bool> ModuleNamespaceObject::internal_delete(PropertyKey const | |||
| } | ||||
| 
 | ||||
| // 10.4.6.11 [[OwnPropertyKeys]] ( ), https://tc39.es/ecma262/#sec-module-namespace-exotic-objects-ownpropertykeys
 | ||||
| ThrowCompletionOr<MarkedValueList> ModuleNamespaceObject::internal_own_property_keys() const | ||||
| ThrowCompletionOr<MarkedVector<Value>> ModuleNamespaceObject::internal_own_property_keys() const | ||||
| { | ||||
|     // 1. Let exports be O.[[Exports]].
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -30,7 +30,7 @@ public: | |||
|     virtual ThrowCompletionOr<Value> internal_get(PropertyKey const&, Value receiver) const override; | ||||
|     virtual ThrowCompletionOr<bool> internal_set(PropertyKey const&, Value value, Value receiver) override; | ||||
|     virtual ThrowCompletionOr<bool> internal_delete(PropertyKey const&) override; | ||||
|     virtual ThrowCompletionOr<MarkedValueList> internal_own_property_keys() const override; | ||||
|     virtual ThrowCompletionOr<MarkedVector<Value>> internal_own_property_keys() const override; | ||||
|     virtual void initialize(GlobalObject& object) override; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -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<Value> NativeFunction::internal_call(Value this_argument, MarkedValueList arguments_list) | ||||
| ThrowCompletionOr<Value> NativeFunction::internal_call(Value this_argument, MarkedVector<Value> arguments_list) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     auto& global_object = this->global_object(); | ||||
|  | @ -117,7 +117,7 @@ ThrowCompletionOr<Value> 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<Object*> NativeFunction::internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) | ||||
| ThrowCompletionOr<Object*> NativeFunction::internal_construct(MarkedVector<Value> arguments_list, FunctionObject& new_target) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     auto& global_object = this->global_object(); | ||||
|  |  | |||
|  | @ -22,8 +22,8 @@ public: | |||
|     virtual void initialize(GlobalObject&) override { } | ||||
|     virtual ~NativeFunction() override; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedValueList arguments_list) override; | ||||
|     virtual ThrowCompletionOr<Object*> internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) override; | ||||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override; | ||||
|     virtual ThrowCompletionOr<Object*> internal_construct(MarkedVector<Value> 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.
 | ||||
|  |  | |||
|  | @ -384,7 +384,7 @@ ThrowCompletionOr<bool> Object::test_integrity_level(IntegrityLevel level) const | |||
| } | ||||
| 
 | ||||
| // 7.3.24 EnumerableOwnPropertyNames ( O, kind ), https://tc39.es/ecma262/#sec-enumerableownpropertynames
 | ||||
| ThrowCompletionOr<MarkedValueList> Object::enumerable_own_property_names(PropertyKind kind) const | ||||
| ThrowCompletionOr<MarkedVector<Value>> Object::enumerable_own_property_names(PropertyKind kind) const | ||||
| { | ||||
|     // NOTE: This has been flattened for readability, so some `else` branches in the
 | ||||
|     //       spec text have been replaced with `continue`s in the loop below.
 | ||||
|  | @ -397,7 +397,7 @@ ThrowCompletionOr<MarkedValueList> 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<Value> { heap() }; | ||||
| 
 | ||||
|     // 4. For each element key of ownKeys, do
 | ||||
|     for (auto& key : own_keys) { | ||||
|  | @ -894,12 +894,12 @@ ThrowCompletionOr<bool> Object::internal_delete(PropertyKey const& property_key) | |||
| } | ||||
| 
 | ||||
| // 10.1.11 [[OwnPropertyKeys]] ( ), https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys
 | ||||
| ThrowCompletionOr<MarkedValueList> Object::internal_own_property_keys() const | ||||
| ThrowCompletionOr<MarkedVector<Value>> Object::internal_own_property_keys() const | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
| 
 | ||||
|     // 1. Let keys be a new empty List.
 | ||||
|     MarkedValueList keys { heap() }; | ||||
|     MarkedVector<Value> keys { heap() }; | ||||
| 
 | ||||
|     // 2. For each own property key P of O such that P is an array index, in ascending numeric index order, do
 | ||||
|     for (auto& entry : m_indexed_properties) { | ||||
|  |  | |||
|  | @ -12,9 +12,9 @@ | |||
| #include <AK/String.h> | ||||
| #include <LibJS/Forward.h> | ||||
| #include <LibJS/Heap/Cell.h> | ||||
| #include <LibJS/Heap/MarkedVector.h> | ||||
| #include <LibJS/Runtime/Completion.h> | ||||
| #include <LibJS/Runtime/IndexedProperties.h> | ||||
| #include <LibJS/Runtime/MarkedValueList.h> | ||||
| #include <LibJS/Runtime/PrimitiveString.h> | ||||
| #include <LibJS/Runtime/PrivateEnvironment.h> | ||||
| #include <LibJS/Runtime/PropertyDescriptor.h> | ||||
|  | @ -100,7 +100,7 @@ public: | |||
|     ThrowCompletionOr<bool> has_own_property(PropertyKey const&) const; | ||||
|     ThrowCompletionOr<bool> set_integrity_level(IntegrityLevel); | ||||
|     ThrowCompletionOr<bool> test_integrity_level(IntegrityLevel) const; | ||||
|     ThrowCompletionOr<MarkedValueList> enumerable_own_property_names(PropertyKind kind) const; | ||||
|     ThrowCompletionOr<MarkedVector<Value>> enumerable_own_property_names(PropertyKind kind) const; | ||||
|     ThrowCompletionOr<Object*> copy_data_properties(Value source, HashTable<PropertyKey> const& seen_names, GlobalObject& global_object); | ||||
| 
 | ||||
|     PrivateElement* private_element_find(PrivateName const& name); | ||||
|  | @ -122,7 +122,7 @@ public: | |||
|     virtual ThrowCompletionOr<Value> internal_get(PropertyKey const&, Value receiver) const; | ||||
|     virtual ThrowCompletionOr<bool> internal_set(PropertyKey const&, Value value, Value receiver); | ||||
|     virtual ThrowCompletionOr<bool> internal_delete(PropertyKey const&); | ||||
|     virtual ThrowCompletionOr<MarkedValueList> internal_own_property_keys() const; | ||||
|     virtual ThrowCompletionOr<MarkedVector<Value>> internal_own_property_keys() const; | ||||
| 
 | ||||
|     ThrowCompletionOr<bool> ordinary_set_with_own_descriptor(PropertyKey const&, Value, Value, Optional<PropertyDescriptor>); | ||||
| 
 | ||||
|  |  | |||
|  | @ -98,7 +98,7 @@ static ThrowCompletionOr<Array*> 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<Value> { vm.heap() }; | ||||
| 
 | ||||
|     // 4. For each element nextKey of keys, do
 | ||||
|     for (auto& next_key : keys) { | ||||
|  |  | |||
|  | @ -53,7 +53,7 @@ static ThrowCompletionOr<Value> 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<Value> 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<Value> 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<Value> 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)); | ||||
|  |  | |||
|  | @ -641,7 +641,7 @@ ThrowCompletionOr<bool> ProxyObject::internal_delete(PropertyKey const& property | |||
| } | ||||
| 
 | ||||
| // 10.5.11 [[OwnPropertyKeys]] ( ), https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
 | ||||
| ThrowCompletionOr<MarkedValueList> ProxyObject::internal_own_property_keys() const | ||||
| ThrowCompletionOr<MarkedVector<Value>> ProxyObject::internal_own_property_keys() const | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     auto& global_object = this->global_object(); | ||||
|  | @ -692,10 +692,10 @@ ThrowCompletionOr<MarkedValueList> 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<Value> { heap() }; | ||||
| 
 | ||||
|     // 15. Let targetNonconfigurableKeys be a new empty List.
 | ||||
|     auto target_nonconfigurable_keys = MarkedValueList { heap() }; | ||||
|     auto target_nonconfigurable_keys = MarkedVector<Value> { heap() }; | ||||
| 
 | ||||
|     // 16. For each element key of targetKeys, do
 | ||||
|     for (auto& key : target_keys) { | ||||
|  | @ -723,7 +723,7 @@ ThrowCompletionOr<MarkedValueList> 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<Value> { heap() }; | ||||
|     unchecked_result_keys.extend(trap_result); | ||||
| 
 | ||||
|     // 19. For each element key of targetNonconfigurableKeys, do
 | ||||
|  | @ -763,7 +763,7 @@ ThrowCompletionOr<MarkedValueList> 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<Value> ProxyObject::internal_call(Value this_argument, MarkedValueList arguments_list) | ||||
| ThrowCompletionOr<Value> ProxyObject::internal_call(Value this_argument, MarkedVector<Value> 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<Object*> ProxyObject::internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) | ||||
| ThrowCompletionOr<Object*> ProxyObject::internal_construct(MarkedVector<Value> arguments_list, FunctionObject& new_target) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     auto& global_object = this->global_object(); | ||||
|  |  | |||
|  | @ -42,9 +42,9 @@ public: | |||
|     virtual ThrowCompletionOr<Value> internal_get(PropertyKey const&, Value receiver) const override; | ||||
|     virtual ThrowCompletionOr<bool> internal_set(PropertyKey const&, Value value, Value receiver) override; | ||||
|     virtual ThrowCompletionOr<bool> internal_delete(PropertyKey const&) override; | ||||
|     virtual ThrowCompletionOr<MarkedValueList> internal_own_property_keys() const override; | ||||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedValueList arguments_list) override; | ||||
|     virtual ThrowCompletionOr<Object*> internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) override; | ||||
|     virtual ThrowCompletionOr<MarkedVector<Value>> internal_own_property_keys() const override; | ||||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override; | ||||
|     virtual ThrowCompletionOr<Object*> internal_construct(MarkedVector<Value> arguments_list, FunctionObject& new_target) override; | ||||
| 
 | ||||
| private: | ||||
|     virtual void visit_edges(Visitor&) override; | ||||
|  |  | |||
|  | @ -640,7 +640,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace) | |||
|     } | ||||
| 
 | ||||
|     // 9. Let results be a new empty List.
 | ||||
|     MarkedValueList results(vm.heap()); | ||||
|     MarkedVector<Value> 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<Value> 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<Value> 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.
 | ||||
|  |  | |||
|  | @ -130,12 +130,12 @@ ThrowCompletionOr<bool> StringObject::internal_define_own_property(PropertyKey c | |||
| } | ||||
| 
 | ||||
| // 10.4.3.3 [[OwnPropertyKeys]] ( ), https://tc39.es/ecma262/#sec-string-exotic-objects-ownpropertykeys
 | ||||
| ThrowCompletionOr<MarkedValueList> StringObject::internal_own_property_keys() const | ||||
| ThrowCompletionOr<MarkedVector<Value>> 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<Value> { heap() }; | ||||
| 
 | ||||
|     // 2. Let str be O.[[StringData]].
 | ||||
|     auto str = m_string.utf16_string_view(); | ||||
|  |  | |||
|  | @ -26,7 +26,7 @@ public: | |||
| private: | ||||
|     virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyKey const&) const override; | ||||
|     virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyKey const&, PropertyDescriptor const&) override; | ||||
|     virtual ThrowCompletionOr<MarkedValueList> internal_own_property_keys() const override; | ||||
|     virtual ThrowCompletionOr<MarkedVector<Value>> internal_own_property_keys() const override; | ||||
| 
 | ||||
|     virtual bool is_string_object() const final { return true; } | ||||
|     virtual void visit_edges(Visitor&) override; | ||||
|  |  | |||
|  | @ -38,7 +38,7 @@ static Optional<OptionType> to_option_type(Value value) | |||
| } | ||||
| 
 | ||||
| // 13.1 IterableToListOfType ( items, elementTypes ), https://tc39.es/proposal-temporal/#sec-iterabletolistoftype
 | ||||
| ThrowCompletionOr<MarkedValueList> iterable_to_list_of_type(GlobalObject& global_object, Value items, Vector<OptionType> const& element_types) | ||||
| ThrowCompletionOr<MarkedVector<Value>> iterable_to_list_of_type(GlobalObject& global_object, Value items, Vector<OptionType> const& element_types) | ||||
| { | ||||
|     auto& vm = global_object.vm(); | ||||
|     auto& heap = global_object.heap(); | ||||
|  | @ -47,7 +47,7 @@ ThrowCompletionOr<MarkedValueList> 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<Value> values(heap); | ||||
| 
 | ||||
|     // 3. Let next be true.
 | ||||
|     auto next = true; | ||||
|  |  | |||
|  | @ -97,7 +97,7 @@ struct SecondsStringPrecision { | |||
|     u32 increment; | ||||
| }; | ||||
| 
 | ||||
| ThrowCompletionOr<MarkedValueList> iterable_to_list_of_type(GlobalObject&, Value items, Vector<OptionType> const& element_types); | ||||
| ThrowCompletionOr<MarkedVector<Value>> iterable_to_list_of_type(GlobalObject&, Value items, Vector<OptionType> const& element_types); | ||||
| ThrowCompletionOr<Object*> get_options_object(GlobalObject&, Value options); | ||||
| ThrowCompletionOr<Value> get_option(GlobalObject&, Object const& options, PropertyKey const& property, Vector<OptionType> const& types, Vector<StringView> const& values, Value fallback); | ||||
| template<typename NumberType> | ||||
|  |  | |||
|  | @ -89,7 +89,7 @@ ThrowCompletionOr<Vector<String>> 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<Value> { 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); | ||||
|  |  | |||
|  | @ -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<Value> { vm.heap() }; | ||||
| 
 | ||||
|     // 6. Let next be true.
 | ||||
|     // 7. Repeat, while next is not false,
 | ||||
|  |  | |||
|  | @ -8,7 +8,6 @@ | |||
| 
 | ||||
| #include <AK/Optional.h> | ||||
| #include <LibJS/Heap/MarkedVector.h> | ||||
| #include <LibJS/Runtime/MarkedValueList.h> | ||||
| #include <LibJS/Runtime/Object.h> | ||||
| #include <LibJS/Runtime/Temporal/AbstractOperations.h> | ||||
| 
 | ||||
|  |  | |||
|  | @ -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<Value> { vm.heap() }; | ||||
| 
 | ||||
|     // 7. For each value epochNanoseconds in possibleEpochNanoseconds, do
 | ||||
|     for (auto& epoch_nanoseconds : possible_epoch_nanoseconds) { | ||||
|  |  | |||
|  | @ -291,7 +291,7 @@ static ThrowCompletionOr<void> initialize_typed_array_from_array_like(GlobalObje | |||
| 
 | ||||
| // 23.2.5.1.4 InitializeTypedArrayFromList, https://tc39.es/ecma262/#sec-initializetypedarrayfromlist
 | ||||
| template<typename T> | ||||
| static ThrowCompletionOr<void> initialize_typed_array_from_list(GlobalObject& global_object, TypedArray<T>& typed_array, const MarkedValueList& list) | ||||
| static ThrowCompletionOr<void> initialize_typed_array_from_list(GlobalObject& global_object, TypedArray<T>& typed_array, const MarkedVector<Value>& list) | ||||
| { | ||||
|     auto& vm = global_object.vm(); | ||||
| 
 | ||||
|  | @ -332,7 +332,7 @@ static ThrowCompletionOr<void> initialize_typed_array_from_list(GlobalObject& gl | |||
| } | ||||
| 
 | ||||
| // 23.2.4.2 TypedArrayCreate ( constructor, argumentList ), https://tc39.es/ecma262/#typedarray-create
 | ||||
| ThrowCompletionOr<TypedArrayBase*> typed_array_create(GlobalObject& global_object, FunctionObject& constructor, MarkedValueList arguments) | ||||
| ThrowCompletionOr<TypedArrayBase*> typed_array_create(GlobalObject& global_object, FunctionObject& constructor, MarkedVector<Value> arguments) | ||||
| { | ||||
|     auto& vm = global_object.vm(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -388,12 +388,12 @@ public: | |||
|     } | ||||
| 
 | ||||
|     // 10.4.5.7 [[OwnPropertyKeys]] ( ), https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects-ownpropertykeys
 | ||||
|     virtual ThrowCompletionOr<MarkedValueList> internal_own_property_keys() const override | ||||
|     virtual ThrowCompletionOr<MarkedVector<Value>> 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<Value> { 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<TypedArrayBase*> typed_array_create(GlobalObject& global_object, FunctionObject& constructor, MarkedValueList arguments); | ||||
| ThrowCompletionOr<TypedArrayBase*> typed_array_create(GlobalObject& global_object, FunctionObject& constructor, MarkedVector<Value> arguments); | ||||
| 
 | ||||
| #define JS_DECLARE_TYPED_ARRAY(ClassName, snake_name, PrototypeName, ConstructorName, Type) \ | ||||
|     class ClassName : public TypedArray<Type> {                                             \ | ||||
|  |  | |||
|  | @ -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<Value> 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<Value> 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<TypeError>(global_object, ErrorType::NotAConstructor, constructor.to_string_without_side_effects()); | ||||
|     MarkedValueList arguments(vm.heap()); | ||||
|     MarkedVector<Value> 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) { | ||||
|  |  | |||
|  | @ -142,7 +142,7 @@ static ThrowCompletionOr<void> 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<TypedArrayBase*> typed_array_species_create(GlobalObject& global_object, TypedArrayBase const& exemplar, MarkedValueList arguments) | ||||
| static ThrowCompletionOr<TypedArrayBase*> typed_array_species_create(GlobalObject& global_object, TypedArrayBase const& exemplar, MarkedVector<Value> 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<Value> 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<void> typed_array_merge_sort(GlobalObject& global_object, FunctionObject* compare_function, ArrayBuffer& buffer, MarkedValueList& arr_to_sort) | ||||
| static ThrowCompletionOr<void> typed_array_merge_sort(GlobalObject& global_object, FunctionObject* compare_function, ArrayBuffer& buffer, MarkedVector<Value>& arr_to_sort) | ||||
| { | ||||
|     auto& vm = global_object.vm(); | ||||
|     if (arr_to_sort.size() <= 1) | ||||
|         return {}; | ||||
| 
 | ||||
|     MarkedValueList left(vm.heap()); | ||||
|     MarkedValueList right(vm.heap()); | ||||
|     MarkedVector<Value> left(vm.heap()); | ||||
|     MarkedVector<Value> right(vm.heap()); | ||||
| 
 | ||||
|     left.ensure_capacity(arr_to_sort.size() / 2); | ||||
|     right.ensure_capacity(arr_to_sort.size() / 2 + (arr_to_sort.size() & 1)); | ||||
|  | @ -1014,7 +1014,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::sort) | |||
| 
 | ||||
|     auto length = typed_array->array_length(); | ||||
| 
 | ||||
|     MarkedValueList items(vm.heap()); | ||||
|     MarkedVector<Value> 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<Value> 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<Value> 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<Value> 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<Value> arguments(vm.heap()); | ||||
|     arguments.empend(initial_length); | ||||
|     auto* return_array = TRY(typed_array_species_create(global_object, *typed_array, move(arguments))); | ||||
| 
 | ||||
|  |  | |||
|  | @ -51,7 +51,7 @@ VM::VM(OwnPtr<CustomData> 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<Value> arguments) { | ||||
|         return call_job_callback(global_object, job_callback, this_value, move(arguments)); | ||||
|     }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,13 +15,13 @@ | |||
| #include <AK/StackInfo.h> | ||||
| #include <AK/Variant.h> | ||||
| #include <LibJS/Heap/Heap.h> | ||||
| #include <LibJS/Heap/MarkedVector.h> | ||||
| #include <LibJS/Runtime/CommonPropertyNames.h> | ||||
| #include <LibJS/Runtime/Completion.h> | ||||
| #include <LibJS/Runtime/Error.h> | ||||
| #include <LibJS/Runtime/ErrorTypes.h> | ||||
| #include <LibJS/Runtime/ExecutionContext.h> | ||||
| #include <LibJS/Runtime/Iterator.h> | ||||
| #include <LibJS/Runtime/MarkedValueList.h> | ||||
| #include <LibJS/Runtime/Promise.h> | ||||
| #include <LibJS/Runtime/Value.h> | ||||
| 
 | ||||
|  | @ -167,7 +167,7 @@ public: | |||
|         return throw_completion<T>(global_object, String::formatted(type.message(), forward<Args>(args)...)); | ||||
|     } | ||||
| 
 | ||||
|     Value construct(FunctionObject&, FunctionObject& new_target, Optional<MarkedValueList> arguments); | ||||
|     Value construct(FunctionObject&, FunctionObject& new_target, Optional<MarkedVector<Value>> arguments); | ||||
| 
 | ||||
|     String join_arguments(size_t start_index = 0) const; | ||||
| 
 | ||||
|  | @ -217,7 +217,7 @@ public: | |||
|     void enable_default_host_import_module_dynamically_hook(); | ||||
| 
 | ||||
|     Function<void(Promise&, Promise::RejectionOperation)> host_promise_rejection_tracker; | ||||
|     Function<ThrowCompletionOr<Value>(GlobalObject&, JobCallback&, Value, MarkedValueList)> host_call_job_callback; | ||||
|     Function<ThrowCompletionOr<Value>(GlobalObject&, JobCallback&, Value, MarkedVector<Value>)> host_call_job_callback; | ||||
|     Function<void(FinalizationRegistry&)> host_enqueue_finalization_registry_cleanup_job; | ||||
|     Function<void(Function<ThrowCompletionOr<Value>()>, Realm*)> host_enqueue_promise_job; | ||||
|     Function<JobCallback(FunctionObject&)> host_make_job_callback; | ||||
|  |  | |||
|  | @ -1569,7 +1569,7 @@ ThrowCompletionOr<TriState> is_less_than(GlobalObject& global_object, bool left_ | |||
| } | ||||
| 
 | ||||
| // 7.3.21 Invoke ( V, P [ , argumentsList ] ), https://tc39.es/ecma262/#sec-invoke
 | ||||
| ThrowCompletionOr<Value> Value::invoke_internal(GlobalObject& global_object, JS::PropertyKey const& property_key, Optional<MarkedValueList> arguments) | ||||
| ThrowCompletionOr<Value> Value::invoke_internal(GlobalObject& global_object, JS::PropertyKey const& property_key, Optional<MarkedVector<Value>> arguments) | ||||
| { | ||||
|     auto& vm = global_object.vm(); | ||||
|     auto property = TRY(get(global_object, property_key)); | ||||
|  |  | |||
|  | @ -352,7 +352,7 @@ public: | |||
| private: | ||||
|     Type m_type { Type::Empty }; | ||||
| 
 | ||||
|     [[nodiscard]] ThrowCompletionOr<Value> invoke_internal(GlobalObject& global_object, PropertyKey const&, Optional<MarkedValueList> arguments); | ||||
|     [[nodiscard]] ThrowCompletionOr<Value> invoke_internal(GlobalObject& global_object, PropertyKey const&, Optional<MarkedVector<Value>> arguments); | ||||
| 
 | ||||
|     ThrowCompletionOr<i32> to_i32_slow_case(GlobalObject&) const; | ||||
| 
 | ||||
|  |  | |||
|  | @ -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<Value> WrappedFunction::internal_call(Value this_argument, MarkedValueList arguments_list) | ||||
| ThrowCompletionOr<Value> WrappedFunction::internal_call(Value this_argument, MarkedVector<Value> arguments_list) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     auto& global_object = this->global_object(); | ||||
|  | @ -64,7 +64,7 @@ ThrowCompletionOr<Value> 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<Value> { vm.heap() }; | ||||
|     wrapped_args.ensure_capacity(arguments_list.size()); | ||||
| 
 | ||||
|     // 7. For each element arg of argumentsList, do
 | ||||
|  |  | |||
|  | @ -20,7 +20,7 @@ public: | |||
|     WrappedFunction(Realm&, FunctionObject&, Object& prototype); | ||||
|     virtual ~WrappedFunction() = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedValueList arguments_list) override; | ||||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> 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(); } | ||||
|  |  | |||
|  | @ -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<JS::Value> arguments_list) { | ||||
|             auto& callback_host_defined = verify_cast<WebEngineCustomJobCallbackData>(*callback.custom_data); | ||||
| 
 | ||||
|             // 1. Let incumbent settings be callback.[[HostDefined]].[[IncumbentSettings]]. (NOTE: Not necessary)
 | ||||
|  |  | |||
|  | @ -210,7 +210,7 @@ JS::ThrowCompletionOr<size_t> 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<JS::Value> argument_values { vm.heap() }; | ||||
|                             for (auto& entry : arguments) | ||||
|                                 argument_values.append(to_js_value(global_object, entry)); | ||||
| 
 | ||||
|  |  | |||
|  | @ -93,7 +93,7 @@ JS::ThrowCompletionOr<bool> ConsoleGlobalObject::internal_delete(JS::PropertyKey | |||
|     return m_window_object->internal_delete(property_name); | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<JS::MarkedValueList> ConsoleGlobalObject::internal_own_property_keys() const | ||||
| JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> ConsoleGlobalObject::internal_own_property_keys() const | ||||
| { | ||||
|     return m_window_object->internal_own_property_keys(); | ||||
| } | ||||
|  |  | |||
|  | @ -33,7 +33,7 @@ public: | |||
|     virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value) const override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver) override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const& name) override; | ||||
|     virtual JS::ThrowCompletionOr<JS::MarkedValueList> internal_own_property_keys() const override; | ||||
|     virtual JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> internal_own_property_keys() const override; | ||||
| 
 | ||||
|     virtual void initialize_global_object() override; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Linus Groh
						Linus Groh