summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-05-11 04:44:59 +0430
committerLinus Groh <mail@linusgroh.de>2021-05-21 00:15:23 +0100
commit3283c8a495b9837879704805a20fc451d9201da5 (patch)
treebbdd65fdb88ee93477936ecc0f7ea90f7d7a232f /Tests
parentefb106069bb434e96aac3391fd2d81ca68007000 (diff)
downloadserenity-3283c8a495b9837879704805a20fc451d9201da5.zip
LibWasm: Make the instantiation process produce an OwnPtr
Managing the instantiated modules becomes a pain if they're on the stack, since an instantiated module will eventually reference itself. To make using this simpler, just avoid copying the instance.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/LibWasm/test-wasm.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/Tests/LibWasm/test-wasm.cpp b/Tests/LibWasm/test-wasm.cpp
index 14fff623f2..0ecd294ec6 100644
--- a/Tests/LibWasm/test-wasm.cpp
+++ b/Tests/LibWasm/test-wasm.cpp
@@ -60,7 +60,7 @@ private:
static Wasm::AbstractMachine m_machine;
Optional<Wasm::Module> m_module;
- Optional<Wasm::ModuleInstance> m_module_instance;
+ OwnPtr<Wasm::ModuleInstance> m_module_instance;
};
Wasm::AbstractMachine WebAssemblyModule::m_machine;
@@ -149,15 +149,6 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::wasm_invoke)
auto address = static_cast<unsigned long>(vm.argument(0).to_double(global_object));
if (vm.exception())
return {};
- auto this_value = vm.this_value(global_object);
- auto object = this_value.to_object(global_object);
- if (vm.exception())
- return {};
- if (!object || !is<WebAssemblyModule>(object)) {
- vm.throw_exception<JS::TypeError>(global_object, "Not a WebAssemblyModule");
- return {};
- }
- auto instance = static_cast<WebAssemblyModule*>(object);
Wasm::FunctionAddress function_address { address };
auto function_instance = WebAssemblyModule::machine().store().get(function_address);
if (!function_instance) {