mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 22:49:47 +00:00
LibWeb: Implement the WebAssembly "Memory object cache" + other changes
This cache is referenced by a few parts of the JS API spec, including the threads spec (such as in toFixedLengthBuffer), as well as the "refresh the Memory buffer" algorithm, which was implemented as a method of Memory before this change. Now, this algorithm can be implemented in a spec-like fashion (though it mostly seems to add extra complexity). This change also fixes a bug where memories that were re-exported from an imported WebAssembly.Memory were given a distinct WebAssembly.Memory object, since the caching that existed in Instance.cpp was instance-local, not global to the realm. We also make Memory::m_buffer non-lazy, since we have to implement "initialize a memory object" correctly anyway.
This commit is contained in:
parent
a2dc6c4bbb
commit
f2a170bcfb
Notes:
github-actions[bot]
2025-08-23 06:27:54 +00:00
Author: https://github.com/CountBleck
Commit: f2a170bcfb
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5889
Reviewed-by: https://github.com/alimpfard ✅
6 changed files with 55 additions and 33 deletions
|
@ -63,6 +63,7 @@ void visit_edges(JS::Object& object, JS::Cell::Visitor& visitor)
|
|||
visitor.visit(cache.imported_objects());
|
||||
visitor.visit(cache.extern_values());
|
||||
visitor.visit(cache.global_instances());
|
||||
visitor.visit(cache.memory_instances());
|
||||
cache.abstract_machine().visit_external_resources({ .visit_trap = [&visitor](Wasm::ExternallyManagedTrap const& trap) {
|
||||
auto& completion = trap.unsafe_external_object_as<JS::Completion>();
|
||||
visitor.visit(completion.value());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue