summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/WebAssembly
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2023-03-06 17:16:25 +0100
committerAndreas Kling <kling@serenityos.org>2023-03-06 23:46:35 +0100
commit359d6e7b0b0ef7add9eb2015d0dd664a82cf73d7 (patch)
treebe51963e0f0dc7e1eeeb670188c8fe1fa5eea37f /Userland/Libraries/LibWeb/WebAssembly
parent689ca370d4eca80eb5c3856a69c3eed4ed848a29 (diff)
downloadserenity-359d6e7b0b0ef7add9eb2015d0dd664a82cf73d7.zip
Everywhere: Stop using NonnullOwnPtrVector
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
Diffstat (limited to 'Userland/Libraries/LibWeb/WebAssembly')
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.h2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.h2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp8
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h4
4 files changed, 8 insertions, 8 deletions
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.h
index f6a05660e6..e14ba08b84 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.h
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.h
@@ -24,7 +24,7 @@ public:
virtual ~WebAssemblyInstanceObject() override = default;
size_t index() const { return m_index; }
- Wasm::ModuleInstance& instance() const { return WebAssemblyObject::s_instantiated_modules.at(m_index); }
+ Wasm::ModuleInstance& instance() const { return *WebAssemblyObject::s_instantiated_modules[m_index]; }
auto& cache() { return WebAssemblyObject::s_module_caches.at(m_index); }
void visit_edges(Visitor&) override;
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.h
index 77ed857184..5ed6c3c130 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.h
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.h
@@ -22,7 +22,7 @@ public:
virtual ~WebAssemblyModuleObject() override = default;
size_t index() const { return m_index; }
- Wasm::Module const& module() const { return WebAssemblyObject::s_compiled_modules.at(m_index).module; }
+ Wasm::Module const& module() const { return WebAssemblyObject::s_compiled_modules.at(m_index)->module; }
private:
size_t m_index { 0 };
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
index 7a28c17d15..e2800c8624 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
@@ -58,8 +58,8 @@ JS::ThrowCompletionOr<void> WebAssemblyObject::initialize(JS::Realm& realm)
return {};
}
-NonnullOwnPtrVector<WebAssemblyObject::CompiledWebAssemblyModule> WebAssemblyObject::s_compiled_modules;
-NonnullOwnPtrVector<Wasm::ModuleInstance> WebAssemblyObject::s_instantiated_modules;
+Vector<NonnullOwnPtr<WebAssemblyObject::CompiledWebAssemblyModule>> WebAssemblyObject::s_compiled_modules;
+Vector<NonnullOwnPtr<Wasm::ModuleInstance>> WebAssemblyObject::s_instantiated_modules;
Vector<WebAssemblyObject::ModuleCache> WebAssemblyObject::s_module_caches;
WebAssemblyObject::GlobalModuleCache WebAssemblyObject::s_global_cache;
Wasm::AbstractMachine WebAssemblyObject::s_abstract_machine;
@@ -101,7 +101,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyObject::validate)
};
// 3 continued - our "compile" step is lazy with validation, explicitly do the validation.
- if (s_abstract_machine.validate(s_compiled_modules[maybe_module.value()].module).is_error())
+ if (s_abstract_machine.validate(s_compiled_modules[maybe_module.value()]->module).is_error())
return JS::Value(false);
// 4. Return true.
@@ -331,7 +331,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyObject::instantiate)
promise->reject(*result.release_error().value());
return promise;
}
- module = &WebAssemblyObject::s_compiled_modules.at(result.release_value()).module;
+ module = &WebAssemblyObject::s_compiled_modules.at(result.release_value())->module;
should_return_module = true;
} else if (is<WebAssemblyModuleObject>(buffer)) {
module = &static_cast<WebAssemblyModuleObject*>(buffer)->module();
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h
index c3c2f23a32..9171ff46ac 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h
@@ -54,8 +54,8 @@ public:
HashMap<Wasm::FunctionAddress, JS::NativeFunction*> function_instances;
};
- static NonnullOwnPtrVector<CompiledWebAssemblyModule> s_compiled_modules;
- static NonnullOwnPtrVector<Wasm::ModuleInstance> s_instantiated_modules;
+ static Vector<NonnullOwnPtr<CompiledWebAssemblyModule>> s_compiled_modules;
+ static Vector<NonnullOwnPtr<Wasm::ModuleInstance>> s_instantiated_modules;
static Vector<ModuleCache> s_module_caches;
static GlobalModuleCache s_global_cache;