From 359d6e7b0b0ef7add9eb2015d0dd664a82cf73d7 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 6 Mar 2023 17:16:25 +0100 Subject: Everywhere: Stop using NonnullOwnPtrVector Same as NonnullRefPtrVector: weird semantics, questionable benefits. --- Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.h | 2 +- Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.h | 2 +- Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp | 8 ++++---- Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'Userland/Libraries/LibWeb/WebAssembly') 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 WebAssemblyObject::initialize(JS::Realm& realm) return {}; } -NonnullOwnPtrVector WebAssemblyObject::s_compiled_modules; -NonnullOwnPtrVector WebAssemblyObject::s_instantiated_modules; +Vector> WebAssemblyObject::s_compiled_modules; +Vector> WebAssemblyObject::s_instantiated_modules; Vector 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(buffer)) { module = &static_cast(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 function_instances; }; - static NonnullOwnPtrVector s_compiled_modules; - static NonnullOwnPtrVector s_instantiated_modules; + static Vector> s_compiled_modules; + static Vector> s_instantiated_modules; static Vector s_module_caches; static GlobalModuleCache s_global_cache; -- cgit v1.2.3