1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

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
parent fa2ae02564
commit 8b6397446e
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);