LibWasm: Move some Values and Vector<Value>s instead of copying them

This commit is contained in:
Ali Mohammad Pur 2021-08-12 00:59:00 +04:30 committed by Andreas Kling
commit 8b6397446e
Notes: sideshowbarker 2024-07-18 07:03:47 +09:00
2 changed files with 5 additions and 7 deletions

View file

@ -42,10 +42,8 @@ Result Configuration::call(Interpreter& interpreter, FunctionAddress address, Ve
if (!function)
return Trap {};
if (auto* wasm_function = function->get_pointer<WasmFunction>()) {
Vector<Value> locals;
locals.ensure_capacity(arguments.size() + wasm_function->code().locals().size());
for (auto& value : arguments)
locals.append(Value { value });
Vector<Value> locals = move(arguments);
locals.ensure_capacity(locals.size() + wasm_function->code().locals().size());
for (auto& type : wasm_function->code().locals())
locals.empend(type, 0ull);