V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
wasm-serialization.h
1
// Copyright 2017 the V8 project authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#ifndef V8_WASM_WASM_SERIALIZATION_H_
6
#define V8_WASM_WASM_SERIALIZATION_H_
7
8
#include "src/wasm/wasm-objects.h"
9
10
namespace
v8
{
11
namespace
internal {
12
namespace
wasm {
13
14
// Support for serializing WebAssembly {NativeModule} objects. This class takes
15
// a snapshot of the module state at instantiation, and other code that modifies
16
// the module after that won't affect the serialized result.
17
class
WasmSerializer
{
18
public
:
19
WasmSerializer
(
Isolate
* isolate,
NativeModule
* native_module);
20
21
// Measure the required buffer size needed for serialization.
22
size_t
GetSerializedNativeModuleSize()
const
;
23
24
// Serialize the {NativeModule} into the provided {buffer}. Returns true on
25
// success and false if the given buffer it too small for serialization.
26
bool
SerializeNativeModule(
Vector<byte>
buffer)
const
;
27
28
private
:
29
Isolate
* isolate_;
30
NativeModule
* native_module_;
31
std::vector<WasmCode*> code_table_;
32
};
33
34
// Support for deserializing WebAssembly {NativeModule} objects.
35
// Checks the version header of the data against the current version.
36
bool
IsSupportedVersion(
Isolate
* isolate,
Vector<const byte>
data);
37
38
// Deserializes the given data to create a compiled Wasm module.
39
MaybeHandle<WasmModuleObject>
DeserializeNativeModule(
40
Isolate
* isolate,
Vector<const byte>
data,
Vector<const byte>
wire_bytes);
41
42
}
// namespace wasm
43
}
// namespace internal
44
}
// namespace v8
45
46
#endif // V8_WASM_WASM_SERIALIZATION_H_
v8::internal::wasm::NativeModule
Definition:
wasm-code-manager.h:209
v8::internal::Vector< byte >
v8
Definition:
libplatform.h:13
v8::internal::MaybeHandle
Definition:
globals.h:561
v8::internal::Isolate
Definition:
isolate.h:516
v8::internal::wasm::WasmSerializer
Definition:
wasm-serialization.h:17
v8
src
wasm
wasm-serialization.h
Generated on Tue Dec 25 2018 14:40:03 by
1.8.14