LibWasm: Remove Module::functions

`Module::functions` created clones of all of the functions in the
module. It provided a _slightly_ better API, but ended up costing around
40ms when instantiating spidermonkey.
This commit is contained in:
Diego Frias 2024-07-27 16:44:36 -07:00 committed by Ali Mohammad Pur
parent 2d95cc01dc
commit dc52998341
Notes: github-actions[bot] 2024-07-28 00:57:26 +00:00
8 changed files with 36 additions and 111 deletions

View file

@ -44,14 +44,16 @@ Result Configuration::call(Interpreter& interpreter, FunctionAddress address, Ve
return Trap {};
if (auto* wasm_function = function->get_pointer<WasmFunction>()) {
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);
locals.ensure_capacity(locals.size() + wasm_function->code().func().locals().size());
for (auto& local : wasm_function->code().func().locals()) {
for (size_t i = 0; i < local.n(); ++i)
locals.empend(local.type(), 0ull);
}
set_frame(Frame {
wasm_function->module(),
move(locals),
wasm_function->code().body(),
wasm_function->code().func().body(),
wasm_function->type().results().size(),
});
m_ip = 0;