1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:37:34 +00:00

LibWasm+LibWeb: Parse and validate all Wasm SIMD instructions

This commit is contained in:
Ali Mohammad Pur 2023-06-12 13:04:22 +03:30 committed by Ali Mohammad Pur
parent b005691497
commit 2462064fcd
13 changed files with 2474 additions and 78 deletions

View file

@ -12,6 +12,7 @@
#include <AK/OwnPtr.h>
#include <AK/Result.h>
#include <AK/StackInfo.h>
#include <AK/UFixedBigInt.h>
#include <LibWasm/Types.h>
// NOTE: Special case for Wasm::Result.
@ -74,7 +75,7 @@ public:
{
}
using AnyValueType = Variant<i32, i64, float, double, Reference>;
using AnyValueType = Variant<i32, i64, float, double, u128, Reference>;
explicit Value(AnyValueType value)
: m_value(move(value))
{
@ -111,11 +112,20 @@ public:
VERIFY(raw_value == 0);
m_value = Reference { Reference::Null { ValueType(ValueType::Kind::ExternReference) } };
break;
case ValueType::Kind::V128:
m_value = u128(0ull, bit_cast<u64>(raw_value));
break;
default:
VERIFY_NOT_REACHED();
}
}
template<SameAs<u128> T>
explicit Value(T raw_value)
: m_value(raw_value)
{
}
ALWAYS_INLINE Value(Value const& value) = default;
ALWAYS_INLINE Value(Value&& value) = default;
ALWAYS_INLINE Value& operator=(Value&& value) = default;
@ -158,6 +168,7 @@ public:
[](i64) { return ValueType::Kind::I64; },
[](float) { return ValueType::Kind::F32; },
[](double) { return ValueType::Kind::F64; },
[](u128) { return ValueType::Kind::V128; },
[&](Reference const& type) {
return type.ref().visit(
[](Reference::Func const&) { return ValueType::Kind::FunctionReference; },