LibWeb: Support wasm module instantiation using a global address

Fixes 1 WPT subtest in `wasm/core/simd`.
This commit is contained in:
Jelle Raaijmakers 2025-07-25 15:08:31 +02:00 committed by Ali Mohammad Pur
commit 76ee1ce04c
Notes: github-actions[bot] 2025-07-25 13:36:40 +00:00
4 changed files with 42 additions and 2 deletions

View file

@ -342,8 +342,11 @@ JS::ThrowCompletionOr<NonnullOwnPtr<Wasm::ModuleInstance>> instantiate_module(JS
// 3.5.1.7. Set the surrounding agent's associated store to store.
address = cache.abstract_machine().store().allocate({ type.type(), false }, cast_value);
}
// FIXME: 3.5.2. Otherwise, if v implements Global,
// FIXME: 3.5.2.1. Let globaladdr be v.[[Global]].
// 3.5.2. Otherwise, if v implements Global,
else if (import_.is_object() && is<Global>(import_.as_object())) {
// 3.5.2.1. Let globaladdr be v.[[Global]].
address = as<Global>(import_.as_object()).address();
}
// 3.5.3. Otherwise,
else {
// 3.5.3.1. Throw a LinkError exception.