MCPcopy Create free account
hub / github.com/WebAssembly/wasm-c-api / deserialize

Method deserialize

src/wasm-v8.cc:1477–1490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1475}
1476
1477auto Module::deserialize(Store* store_abs, const vec<byte_t>& serialized) -> own<Module> {
1478 auto store = impl(store_abs);
1479 auto isolate = store->isolate();
1480 v8::HandleScope handle_scope(isolate);
1481 auto ptr = serialized.get();
1482 auto binary_size = wasm::bin::u64(ptr);
1483 auto size_size = ptr - serialized.get();
1484 auto serial_size = serialized.size() - size_size - binary_size;
1485 auto ptr2 = reinterpret_cast<const uint8_t*>(ptr);
1486 auto maybe_obj = wasm_v8::module_deserialize(
1487 isolate, ptr2, binary_size, ptr2 + binary_size, serial_size);
1488 if (maybe_obj.IsEmpty()) return nullptr;
1489 return RefImpl<Module>::make(store, maybe_obj.ToLocalChecked());
1490}
1491
1492
1493// TODO(v8): do better when V8 can do better.

Callers

nothing calls this directly

Calls 6

implFunction · 0.85
u64Function · 0.85
module_deserializeFunction · 0.85
isolateMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected