mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:38:11 +00:00
LibWeb: Port WebAssembly.Memory to IDL
This commit is contained in:
parent
de32c44762
commit
ca96f8e364
15 changed files with 148 additions and 216 deletions
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Web::Bindings {
|
||||
|
||||
class WebAssemblyMemoryObject;
|
||||
class WebAssemblyTableObject;
|
||||
JS::ThrowCompletionOr<size_t> parse_module(JS::VM&, JS::Object* buffer);
|
||||
JS::NativeFunction* create_native_function(JS::VM&, Wasm::FunctionAddress address, DeprecatedString const& name);
|
||||
|
@ -46,7 +45,7 @@ public:
|
|||
// WebAssemblyModuleObject's and WebAssemblyInstantiatedModuleObject's.
|
||||
struct ModuleCache {
|
||||
HashMap<Wasm::FunctionAddress, JS::GCPtr<JS::FunctionObject>> function_instances;
|
||||
HashMap<Wasm::MemoryAddress, JS::GCPtr<WebAssemblyMemoryObject>> memory_instances;
|
||||
HashMap<Wasm::MemoryAddress, JS::GCPtr<WebAssembly::Memory>> memory_instances;
|
||||
HashMap<Wasm::TableAddress, JS::GCPtr<WebAssemblyTableObject>> table_instances;
|
||||
};
|
||||
struct GlobalModuleCache {
|
||||
|
@ -66,17 +65,4 @@ private:
|
|||
JS_DECLARE_NATIVE_FUNCTION(instantiate);
|
||||
};
|
||||
|
||||
class WebAssemblyMemoryObject final : public JS::Object {
|
||||
JS_OBJECT(WebAssemblyMemoryObject, JS::Object);
|
||||
|
||||
public:
|
||||
WebAssemblyMemoryObject(JS::Realm&, Wasm::MemoryAddress);
|
||||
virtual ~WebAssemblyMemoryObject() override = default;
|
||||
|
||||
auto address() const { return m_address; }
|
||||
|
||||
private:
|
||||
Wasm::MemoryAddress m_address;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue