mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:52:45 +00:00 
			
		
		
		
	LibJS: Pass call/construct argument lists as ReadonlySpan<Value>
(Instead of MarkedVector<Value>.) This is a step towards not storing argument lists in MarkedVector<Value> at all. Note that they still end up in MarkedVectors since that's what ExecutionContext has.
This commit is contained in:
		
							parent
							
								
									9fa6628efa
								
							
						
					
					
						commit
						ece961f882
					
				
					 29 changed files with 119 additions and 112 deletions
				
			
		|  | @ -279,7 +279,7 @@ ThrowCompletionOr<void> put_by_property_key(VM& vm, Value base, Value this_value | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<Value> perform_call(Interpreter& interpreter, Value this_value, Op::CallType call_type, Value callee, MarkedVector<Value> argument_values) | ||||
| ThrowCompletionOr<Value> perform_call(Interpreter& interpreter, Value this_value, Op::CallType call_type, Value callee, ReadonlySpan<Value> argument_values) | ||||
| { | ||||
|     auto& vm = interpreter.vm(); | ||||
|     auto& function = callee.as_function(); | ||||
|  | @ -288,11 +288,11 @@ ThrowCompletionOr<Value> perform_call(Interpreter& interpreter, Value this_value | |||
|         if (callee == interpreter.realm().intrinsics().eval_function()) | ||||
|             return_value = TRY(perform_eval(vm, !argument_values.is_empty() ? argument_values[0].value_or(JS::js_undefined()) : js_undefined(), vm.in_strict_mode() ? CallerMode::Strict : CallerMode::NonStrict, EvalMode::Direct)); | ||||
|         else | ||||
|             return_value = TRY(JS::call(vm, function, this_value, move(argument_values))); | ||||
|             return_value = TRY(JS::call(vm, function, this_value, argument_values)); | ||||
|     } else if (call_type == Op::CallType::Call) | ||||
|         return_value = TRY(JS::call(vm, function, this_value, move(argument_values))); | ||||
|         return_value = TRY(JS::call(vm, function, this_value, argument_values)); | ||||
|     else | ||||
|         return_value = TRY(construct(vm, function, move(argument_values))); | ||||
|         return_value = TRY(construct(vm, function, argument_values)); | ||||
| 
 | ||||
|     return return_value; | ||||
| } | ||||
|  | @ -633,7 +633,7 @@ ThrowCompletionOr<NonnullGCPtr<Object>> super_call_with_argument_array(VM& vm, V | |||
|         return vm.throw_completion<TypeError>(ErrorType::NotAConstructor, "Super constructor"); | ||||
| 
 | ||||
|     // 6. Let result be ? Construct(func, argList, newTarget).
 | ||||
|     auto result = TRY(construct(vm, static_cast<FunctionObject&>(*func), move(arg_list), &new_target.as_function())); | ||||
|     auto result = TRY(construct(vm, static_cast<FunctionObject&>(*func), arg_list.span(), &new_target.as_function())); | ||||
| 
 | ||||
|     // 7. Let thisER be GetThisEnvironment().
 | ||||
|     auto& this_environment = verify_cast<FunctionEnvironment>(*get_this_environment(vm)); | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ ThrowCompletionOr<Value> get_by_id(VM&, DeprecatedFlyString const& property, Val | |||
| ThrowCompletionOr<Value> get_by_value(VM&, Value base_value, Value property_key_value); | ||||
| ThrowCompletionOr<Value> get_global(Bytecode::Interpreter&, DeprecatedFlyString const& identifier, GlobalVariableCache&); | ||||
| ThrowCompletionOr<void> put_by_property_key(VM&, Value base, Value this_value, Value value, PropertyKey name, Op::PropertyKind kind, PropertyLookupCache* = nullptr); | ||||
| ThrowCompletionOr<Value> perform_call(Interpreter&, Value this_value, Op::CallType, Value callee, MarkedVector<Value> argument_values); | ||||
| ThrowCompletionOr<Value> perform_call(Interpreter&, Value this_value, Op::CallType, Value callee, ReadonlySpan<Value> argument_values); | ||||
| ThrowCompletionOr<void> throw_if_needed_for_call(Interpreter&, Value callee, Op::CallType, Optional<StringTableIndex> const& expression_string); | ||||
| ThrowCompletionOr<Value> typeof_variable(VM&, DeprecatedFlyString const&); | ||||
| ThrowCompletionOr<void> set_variable(VM&, DeprecatedFlyString const&, Value, Op::EnvironmentMode, Op::SetVariable::InitializationMode, EnvironmentVariableCache&); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling