mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 18:02:20 +00:00
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:
parent
2d95cc01dc
commit
dc52998341
Notes:
github-actions[bot]
2024-07-28 00:57:26 +00:00
Author: https://github.com/dzfrias
Commit: dc52998341
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/874
Reviewed-by: https://github.com/alimpfard ✅
8 changed files with 36 additions and 111 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue