Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/wasm/wasm-serialization.h')
-rw-r--r--deps/v8/src/wasm/wasm-serialization.h27
1 files changed, 21 insertions, 6 deletions
diff --git a/deps/v8/src/wasm/wasm-serialization.h b/deps/v8/src/wasm/wasm-serialization.h
index 352195b2b0b..436a369fb6e 100644
--- a/deps/v8/src/wasm/wasm-serialization.h
+++ b/deps/v8/src/wasm/wasm-serialization.h
@@ -11,12 +11,27 @@ namespace v8 {
namespace internal {
namespace wasm {
-size_t GetSerializedNativeModuleSize(Isolate* isolate,
- NativeModule* native_module);
-
-bool SerializeNativeModule(Isolate* isolate, NativeModule* native_module,
- Vector<byte> buffer);
-
+// Support to serialize WebAssembly {NativeModule} objects. This class intends
+// to be thread-safe in that it takes a consistent snapshot of the module state
+// at instantiation, allowing other threads to mutate the module concurrently.
+class WasmSerializer {
+ public:
+ WasmSerializer(Isolate* isolate, NativeModule* native_module);
+
+ // Measure the required buffer size needed for serialization.
+ size_t GetSerializedNativeModuleSize() const;
+
+ // Serialize the {NativeModule} into the provided {buffer}. Returns true on
+ // success and false if the given buffer it too small for serialization.
+ bool SerializeNativeModule(Vector<byte> buffer) const;
+
+ private:
+ Isolate* isolate_;
+ NativeModule* native_module_;
+ std::vector<WasmCode*> code_table_;
+};
+
+// Support to deserialize WebAssembly {NativeModule} objects.
MaybeHandle<WasmModuleObject> DeserializeNativeModule(
Isolate* isolate, Vector<const byte> data, Vector<const byte> wire_bytes);