MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / get_diff_value

Function get_diff_value

crates/fuzzing/src/oracles/diff_v8.rs:294–321  ·  view source on GitHub ↗
(
    val: &v8::Local<'_, v8::Value>,
    ty: DiffValueType,
    scope: &mut v8::HandleScope<'_>,
)

Source from the content-addressed store, hash-verified

292}
293
294fn get_diff_value(
295 val: &v8::Local<'_, v8::Value>,
296 ty: DiffValueType,
297 scope: &mut v8::HandleScope<'_>,
298) -> DiffValue {
299 match ty {
300 DiffValueType::I32 => DiffValue::I32(val.to_int32(scope).unwrap().value()),
301 DiffValueType::I64 => {
302 let (val, todo) = val.to_big_int(scope).unwrap().i64_value();
303 assert!(todo);
304 DiffValue::I64(val)
305 }
306 DiffValueType::F32 => {
307 DiffValue::F32((val.to_number(scope).unwrap().value() as f32).to_bits())
308 }
309 DiffValueType::F64 => DiffValue::F64(val.to_number(scope).unwrap().value().to_bits()),
310 DiffValueType::FuncRef => DiffValue::FuncRef {
311 null: val.is_null(),
312 },
313 DiffValueType::ExternRef => DiffValue::ExternRef {
314 null: val.is_null(),
315 },
316 DiffValueType::AnyRef => unimplemented!(),
317 DiffValueType::ExnRef => unimplemented!(),
318 DiffValueType::V128 => unreachable!(),
319 DiffValueType::ContRef => unimplemented!(),
320 }
321}
322
323#[test]
324fn smoke() {

Callers 2

evaluateMethod · 0.85
get_globalMethod · 0.85

Calls 4

is_nullMethod · 0.80
valueMethod · 0.45
unwrapMethod · 0.45
to_bitsMethod · 0.45

Tested by

no test coverage detected