mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 03:09:08 +00:00
LibJS: Pass argument value vectors as const Vector<Value>&
Now that Interpreter keeps all arguments in the CallFrame stack, we can just pass a const-reference to the CallFrame's argument vector to each function handler (instead of copying it.)
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
|
||||
namespace JS {
|
||||
|
||||
NativeFunction::NativeFunction(AK::Function<Value(Object*, Vector<Value>)> native_function)
|
||||
NativeFunction::NativeFunction(AK::Function<Value(Object*, const Vector<Value>&)> native_function)
|
||||
: m_native_function(move(native_function))
|
||||
{
|
||||
}
|
||||
@@ -39,11 +39,11 @@ NativeFunction::~NativeFunction()
|
||||
{
|
||||
}
|
||||
|
||||
Value NativeFunction::call(Interpreter& interpreter, Vector<Value> arguments)
|
||||
Value NativeFunction::call(Interpreter& interpreter, const Vector<Value>& arguments)
|
||||
{
|
||||
auto this_value = interpreter.this_value();
|
||||
ASSERT(this_value.is_object());
|
||||
return m_native_function(this_value.as_object(), move(arguments));
|
||||
return m_native_function(this_value.as_object(), arguments);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user