LibWasm: Implement parsing/validation for proposal exception-handling

Actual execution traps for now.
This commit is contained in:
Ali Mohammad Pur 2025-09-25 03:35:34 +02:00 committed by Ali Mohammad Pur
parent 8138c2f48b
commit d99f663b1a
Notes: github-actions[bot] 2025-10-14 23:28:59 +00:00
14 changed files with 614 additions and 19 deletions

View file

@ -617,6 +617,8 @@ JS::ThrowCompletionOr<Wasm::Value> to_webassembly_value(JS::VM& vm, JS::Value va
cache.add_extern_value(extern_addr, value);
return Wasm::Value { Wasm::Reference { Wasm::Reference::Extern { extern_addr } } };
}
case Wasm::ValueType::ExceptionReference:
return Wasm::Value(Wasm::ValueType { Wasm::ValueType::Kind::ExceptionReference });
case Wasm::ValueType::V128:
return vm.throw_completion<JS::TypeError>("Cannot convert a vector value to a javascript value"sv);
}
@ -636,6 +638,8 @@ Wasm::Value default_webassembly_value(JS::VM& vm, Wasm::ValueType type)
return Wasm::Value(type);
case Wasm::ValueType::ExternReference:
return MUST(to_webassembly_value(vm, JS::js_undefined(), type));
case Wasm::ValueType::ExceptionReference:
return Wasm::Value(type);
}
VERIFY_NOT_REACHED();
}
@ -680,6 +684,7 @@ JS::Value to_js_value(JS::VM& vm, Wasm::Value& wasm_value, Wasm::ValueType type)
return value.release_value();
}
case Wasm::ValueType::V128:
case Wasm::ValueType::ExceptionReference:
VERIFY_NOT_REACHED();
}
VERIFY_NOT_REACHED();