diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-06-01 09:48:36 +0430 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-06-02 16:09:16 +0430 |
commit | 56bf80251c14847e8a1fa7f07378941aa9c60d37 (patch) | |
tree | 7e0bbfeccac28170636040fc11ce48262882ca5e /Tests | |
parent | 7fb458b7c98e7c531e713c243da7c24e9fee182e (diff) | |
download | serenity-56bf80251c14847e8a1fa7f07378941aa9c60d37.zip |
LibWasm: Implement reference instructions (ref.{null,func,is_null})
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/LibWasm/test-wasm.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Tests/LibWasm/test-wasm.cpp b/Tests/LibWasm/test-wasm.cpp index 0ecd294ec6..ecd89f8932 100644 --- a/Tests/LibWasm/test-wasm.cpp +++ b/Tests/LibWasm/test-wasm.cpp @@ -190,6 +190,12 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::wasm_invoke) case Wasm::ValueType::Kind::ExternReference: arguments.append(Wasm::Value(Wasm::ExternAddress { static_cast<u64>(value) })); break; + case Wasm::ValueType::Kind::NullFunctionReference: + arguments.append(Wasm::Value(Wasm::Value::Null { Wasm::ValueType(Wasm::ValueType::Kind::FunctionReference) })); + break; + case Wasm::ValueType::Kind::NullExternReference: + arguments.append(Wasm::Value(Wasm::Value::Null { Wasm::ValueType(Wasm::ValueType::Kind::ExternReference) })); + break; } } @@ -206,6 +212,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::wasm_invoke) result.values().first().value().visit( [&](const auto& value) { return_value = JS::Value(static_cast<double>(value)); }, [&](const Wasm::FunctionAddress& index) { return_value = JS::Value(static_cast<double>(index.value())); }, - [&](const Wasm::ExternAddress& index) { return_value = JS::Value(static_cast<double>(index.value())); }); + [&](const Wasm::ExternAddress& index) { return_value = JS::Value(static_cast<double>(index.value())); }, + [&](const Wasm::Value::Null&) { return_value = JS::js_null(); }); return return_value; } |