libv8-node 16.10.0.0-arm64-darwin → 18.8.0.0-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/libv8-node/paths.rb +1 -1
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/arm64-darwin/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/allocation.h +100 -22
- data/vendor/v8/include/cppgc/cross-thread-persistent.h +114 -33
- data/vendor/v8/include/cppgc/default-platform.h +2 -10
- data/vendor/v8/include/cppgc/explicit-management.h +22 -4
- data/vendor/v8/include/cppgc/garbage-collected.h +15 -26
- data/vendor/v8/include/cppgc/heap-consistency.h +30 -0
- data/vendor/v8/include/cppgc/heap-state.h +12 -0
- data/vendor/v8/include/cppgc/heap.h +7 -2
- data/vendor/v8/include/cppgc/internal/api-constants.h +8 -0
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +25 -14
- data/vendor/v8/include/cppgc/internal/finalizer-trait.h +4 -1
- data/vendor/v8/include/cppgc/internal/gc-info.h +90 -10
- data/vendor/v8/include/cppgc/internal/logging.h +3 -3
- data/vendor/v8/include/cppgc/internal/name-trait.h +11 -0
- data/vendor/v8/include/cppgc/internal/persistent-node.h +73 -29
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +26 -15
- data/vendor/v8/include/cppgc/internal/write-barrier.h +62 -23
- data/vendor/v8/include/cppgc/liveness-broker.h +4 -1
- data/vendor/v8/include/cppgc/member.h +7 -2
- data/vendor/v8/include/cppgc/persistent.h +38 -33
- data/vendor/v8/include/cppgc/platform.h +4 -1
- data/vendor/v8/include/cppgc/prefinalizer.h +35 -12
- data/vendor/v8/include/cppgc/testing.h +9 -2
- data/vendor/v8/include/cppgc/type-traits.h +6 -13
- data/vendor/v8/include/cppgc/visitor.h +9 -7
- data/vendor/v8/include/libplatform/libplatform.h +0 -11
- data/vendor/v8/include/libplatform/v8-tracing.h +0 -1
- data/vendor/v8/include/v8-array-buffer.h +445 -0
- data/vendor/v8/include/v8-callbacks.h +397 -0
- data/vendor/v8/include/v8-container.h +129 -0
- data/vendor/v8/include/v8-context.h +407 -0
- data/vendor/v8/include/v8-cppgc.h +21 -128
- data/vendor/v8/include/v8-data.h +80 -0
- data/vendor/v8/include/v8-date.h +43 -0
- data/vendor/v8/include/v8-debug.h +168 -0
- data/vendor/v8/include/v8-embedder-heap.h +218 -0
- data/vendor/v8/include/v8-embedder-state-scope.h +51 -0
- data/vendor/v8/include/v8-exception.h +217 -0
- data/vendor/v8/include/v8-extension.h +62 -0
- data/vendor/v8/include/v8-external.h +37 -0
- data/vendor/v8/include/v8-fast-api-calls.h +172 -24
- data/vendor/v8/include/v8-forward.h +81 -0
- data/vendor/v8/include/v8-function-callback.h +475 -0
- data/vendor/v8/include/v8-function.h +125 -0
- data/vendor/v8/include/v8-initialization.h +315 -0
- data/vendor/v8/include/v8-inspector.h +56 -28
- data/vendor/v8/include/v8-internal.h +217 -55
- data/vendor/v8/include/v8-isolate.h +1709 -0
- data/vendor/v8/include/v8-json.h +47 -0
- data/vendor/v8/include/v8-local-handle.h +455 -0
- data/vendor/v8/include/v8-locker.h +149 -0
- data/vendor/v8/include/v8-maybe.h +137 -0
- data/vendor/v8/include/v8-memory-span.h +43 -0
- data/vendor/v8/include/v8-message.h +216 -0
- data/vendor/v8/include/v8-metrics.h +69 -16
- data/vendor/v8/include/v8-microtask-queue.h +152 -0
- data/vendor/v8/include/v8-microtask.h +28 -0
- data/vendor/v8/include/v8-object.h +775 -0
- data/vendor/v8/include/v8-persistent-handle.h +590 -0
- data/vendor/v8/include/v8-platform.h +400 -17
- data/vendor/v8/include/v8-primitive-object.h +118 -0
- data/vendor/v8/include/v8-primitive.h +866 -0
- data/vendor/v8/include/v8-profiler.h +88 -13
- data/vendor/v8/include/v8-promise.h +174 -0
- data/vendor/v8/include/v8-proxy.h +50 -0
- data/vendor/v8/include/v8-regexp.h +105 -0
- data/vendor/v8/include/v8-script.h +747 -0
- data/vendor/v8/include/v8-snapshot.h +196 -0
- data/vendor/v8/include/v8-statistics.h +217 -0
- data/vendor/v8/include/v8-template.h +1079 -0
- data/vendor/v8/include/v8-traced-handle.h +420 -0
- data/vendor/v8/include/v8-typed-array.h +282 -0
- data/vendor/v8/include/v8-unwinder-state.h +4 -3
- data/vendor/v8/include/v8-unwinder.h +132 -0
- data/vendor/v8/include/v8-util.h +7 -1
- data/vendor/v8/include/v8-value-serializer-version.h +1 -1
- data/vendor/v8/include/v8-value-serializer.h +279 -0
- data/vendor/v8/include/v8-value.h +526 -0
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8-wasm.h +257 -0
- data/vendor/v8/include/v8-weak-callback-info.h +87 -0
- data/vendor/v8/include/v8.h +41 -12601
- data/vendor/v8/include/v8config.h +102 -12
- metadata +47 -5
- data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +0 -30
@@ -0,0 +1,132 @@
|
|
1
|
+
// Copyright 2021 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 INCLUDE_V8_UNWINDER_H_
|
6
|
+
#define INCLUDE_V8_UNWINDER_H_
|
7
|
+
|
8
|
+
#include <memory>
|
9
|
+
|
10
|
+
#include "v8-embedder-state-scope.h" // NOLINT(build/include_directory)
|
11
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
12
|
+
|
13
|
+
namespace v8 {
|
14
|
+
// Holds the callee saved registers needed for the stack unwinder. It is the
|
15
|
+
// empty struct if no registers are required. Implemented in
|
16
|
+
// include/v8-unwinder-state.h.
|
17
|
+
struct CalleeSavedRegisters;
|
18
|
+
|
19
|
+
// A RegisterState represents the current state of registers used
|
20
|
+
// by the sampling profiler API.
|
21
|
+
struct V8_EXPORT RegisterState {
|
22
|
+
RegisterState();
|
23
|
+
~RegisterState();
|
24
|
+
RegisterState(const RegisterState& other);
|
25
|
+
RegisterState& operator=(const RegisterState& other);
|
26
|
+
|
27
|
+
void* pc; // Instruction pointer.
|
28
|
+
void* sp; // Stack pointer.
|
29
|
+
void* fp; // Frame pointer.
|
30
|
+
void* lr; // Link register (or nullptr on platforms without a link register).
|
31
|
+
// Callee saved registers (or null if no callee saved registers were stored)
|
32
|
+
std::unique_ptr<CalleeSavedRegisters> callee_saved;
|
33
|
+
};
|
34
|
+
|
35
|
+
// A StateTag represents a possible state of the VM.
|
36
|
+
enum StateTag : int {
|
37
|
+
JS,
|
38
|
+
GC,
|
39
|
+
PARSER,
|
40
|
+
BYTECODE_COMPILER,
|
41
|
+
COMPILER,
|
42
|
+
OTHER,
|
43
|
+
EXTERNAL,
|
44
|
+
ATOMICS_WAIT,
|
45
|
+
IDLE
|
46
|
+
};
|
47
|
+
|
48
|
+
// The output structure filled up by GetStackSample API function.
|
49
|
+
struct SampleInfo {
|
50
|
+
size_t frames_count; // Number of frames collected.
|
51
|
+
void* external_callback_entry; // External callback address if VM is
|
52
|
+
// executing an external callback.
|
53
|
+
void* context; // Incumbent native context address.
|
54
|
+
void* embedder_context; // Native context address for embedder state
|
55
|
+
StateTag vm_state; // Current VM state.
|
56
|
+
EmbedderStateTag embedder_state; // Current Embedder state
|
57
|
+
};
|
58
|
+
|
59
|
+
struct MemoryRange {
|
60
|
+
const void* start = nullptr;
|
61
|
+
size_t length_in_bytes = 0;
|
62
|
+
};
|
63
|
+
|
64
|
+
struct JSEntryStub {
|
65
|
+
MemoryRange code;
|
66
|
+
};
|
67
|
+
|
68
|
+
struct JSEntryStubs {
|
69
|
+
JSEntryStub js_entry_stub;
|
70
|
+
JSEntryStub js_construct_entry_stub;
|
71
|
+
JSEntryStub js_run_microtasks_entry_stub;
|
72
|
+
};
|
73
|
+
|
74
|
+
/**
|
75
|
+
* Various helpers for skipping over V8 frames in a given stack.
|
76
|
+
*
|
77
|
+
* The unwinder API is only supported on the x64, ARM64 and ARM32 architectures.
|
78
|
+
*/
|
79
|
+
class V8_EXPORT Unwinder {
|
80
|
+
public:
|
81
|
+
/**
|
82
|
+
* Attempt to unwind the stack to the most recent C++ frame. This function is
|
83
|
+
* signal-safe and does not access any V8 state and thus doesn't require an
|
84
|
+
* Isolate.
|
85
|
+
*
|
86
|
+
* The unwinder needs to know the location of the JS Entry Stub (a piece of
|
87
|
+
* code that is run when C++ code calls into generated JS code). This is used
|
88
|
+
* for edge cases where the current frame is being constructed or torn down
|
89
|
+
* when the stack sample occurs.
|
90
|
+
*
|
91
|
+
* The unwinder also needs the virtual memory range of all possible V8 code
|
92
|
+
* objects. There are two ranges required - the heap code range and the range
|
93
|
+
* for code embedded in the binary.
|
94
|
+
*
|
95
|
+
* Available on x64, ARM64 and ARM32.
|
96
|
+
*
|
97
|
+
* \param code_pages A list of all of the ranges in which V8 has allocated
|
98
|
+
* executable code. The caller should obtain this list by calling
|
99
|
+
* Isolate::CopyCodePages() during the same interrupt/thread suspension that
|
100
|
+
* captures the stack.
|
101
|
+
* \param register_state The current registers. This is an in-out param that
|
102
|
+
* will be overwritten with the register values after unwinding, on success.
|
103
|
+
* \param stack_base The resulting stack pointer and frame pointer values are
|
104
|
+
* bounds-checked against the stack_base and the original stack pointer value
|
105
|
+
* to ensure that they are valid locations in the given stack. If these values
|
106
|
+
* or any intermediate frame pointer values used during unwinding are ever out
|
107
|
+
* of these bounds, unwinding will fail.
|
108
|
+
*
|
109
|
+
* \return True on success.
|
110
|
+
*/
|
111
|
+
static bool TryUnwindV8Frames(const JSEntryStubs& entry_stubs,
|
112
|
+
size_t code_pages_length,
|
113
|
+
const MemoryRange* code_pages,
|
114
|
+
RegisterState* register_state,
|
115
|
+
const void* stack_base);
|
116
|
+
|
117
|
+
/**
|
118
|
+
* Whether the PC is within the V8 code range represented by code_pages.
|
119
|
+
*
|
120
|
+
* If this returns false, then calling UnwindV8Frames() with the same PC
|
121
|
+
* and unwind_state will always fail. If it returns true, then unwinding may
|
122
|
+
* (but not necessarily) be successful.
|
123
|
+
*
|
124
|
+
* Available on x64, ARM64 and ARM32
|
125
|
+
*/
|
126
|
+
static bool PCIsInV8(size_t code_pages_length, const MemoryRange* code_pages,
|
127
|
+
void* pc);
|
128
|
+
};
|
129
|
+
|
130
|
+
} // namespace v8
|
131
|
+
|
132
|
+
#endif // INCLUDE_V8_UNWINDER_H_
|
data/vendor/v8/include/v8-util.h
CHANGED
@@ -5,11 +5,14 @@
|
|
5
5
|
#ifndef V8_UTIL_H_
|
6
6
|
#define V8_UTIL_H_
|
7
7
|
|
8
|
-
#include "v8.h" // NOLINT(build/include_directory)
|
9
8
|
#include <assert.h>
|
9
|
+
|
10
10
|
#include <map>
|
11
11
|
#include <vector>
|
12
12
|
|
13
|
+
#include "v8-function-callback.h" // NOLINT(build/include_directory)
|
14
|
+
#include "v8-persistent-handle.h" // NOLINT(build/include_directory)
|
15
|
+
|
13
16
|
/**
|
14
17
|
* Support for Persistent containers.
|
15
18
|
*
|
@@ -19,6 +22,9 @@
|
|
19
22
|
*/
|
20
23
|
namespace v8 {
|
21
24
|
|
25
|
+
template <typename K, typename V, typename Traits>
|
26
|
+
class GlobalValueMap;
|
27
|
+
|
22
28
|
typedef uintptr_t PersistentContainerValue;
|
23
29
|
static const uintptr_t kPersistentContainerNotFound = 0;
|
24
30
|
enum PersistentContainerCallbackType {
|
@@ -0,0 +1,279 @@
|
|
1
|
+
// Copyright 2021 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 INCLUDE_V8_VALUE_SERIALIZER_H_
|
6
|
+
#define INCLUDE_V8_VALUE_SERIALIZER_H_
|
7
|
+
|
8
|
+
#include <stddef.h>
|
9
|
+
#include <stdint.h>
|
10
|
+
|
11
|
+
#include <utility>
|
12
|
+
|
13
|
+
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
14
|
+
#include "v8-maybe.h" // NOLINT(build/include_directory)
|
15
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
16
|
+
|
17
|
+
namespace v8 {
|
18
|
+
|
19
|
+
class ArrayBuffer;
|
20
|
+
class Isolate;
|
21
|
+
class Object;
|
22
|
+
class SharedArrayBuffer;
|
23
|
+
class String;
|
24
|
+
class WasmModuleObject;
|
25
|
+
class Value;
|
26
|
+
|
27
|
+
namespace internal {
|
28
|
+
struct ScriptStreamingData;
|
29
|
+
} // namespace internal
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Value serialization compatible with the HTML structured clone algorithm.
|
33
|
+
* The format is backward-compatible (i.e. safe to store to disk).
|
34
|
+
*/
|
35
|
+
class V8_EXPORT ValueSerializer {
|
36
|
+
public:
|
37
|
+
class V8_EXPORT Delegate {
|
38
|
+
public:
|
39
|
+
virtual ~Delegate() = default;
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Handles the case where a DataCloneError would be thrown in the structured
|
43
|
+
* clone spec. Other V8 embedders may throw some other appropriate exception
|
44
|
+
* type.
|
45
|
+
*/
|
46
|
+
virtual void ThrowDataCloneError(Local<String> message) = 0;
|
47
|
+
|
48
|
+
/**
|
49
|
+
* The embedder overrides this method to write some kind of host object, if
|
50
|
+
* possible. If not, a suitable exception should be thrown and
|
51
|
+
* Nothing<bool>() returned.
|
52
|
+
*/
|
53
|
+
virtual Maybe<bool> WriteHostObject(Isolate* isolate, Local<Object> object);
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Called when the ValueSerializer is going to serialize a
|
57
|
+
* SharedArrayBuffer object. The embedder must return an ID for the
|
58
|
+
* object, using the same ID if this SharedArrayBuffer has already been
|
59
|
+
* serialized in this buffer. When deserializing, this ID will be passed to
|
60
|
+
* ValueDeserializer::GetSharedArrayBufferFromId as |clone_id|.
|
61
|
+
*
|
62
|
+
* If the object cannot be serialized, an
|
63
|
+
* exception should be thrown and Nothing<uint32_t>() returned.
|
64
|
+
*/
|
65
|
+
virtual Maybe<uint32_t> GetSharedArrayBufferId(
|
66
|
+
Isolate* isolate, Local<SharedArrayBuffer> shared_array_buffer);
|
67
|
+
|
68
|
+
virtual Maybe<uint32_t> GetWasmModuleTransferId(
|
69
|
+
Isolate* isolate, Local<WasmModuleObject> module);
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Returns whether shared values are supported. GetSharedValueId is only
|
73
|
+
* called if SupportsSharedValues() returns true.
|
74
|
+
*/
|
75
|
+
virtual bool SupportsSharedValues() const;
|
76
|
+
|
77
|
+
/**
|
78
|
+
* Called when the ValueSerializer serializes a value that is shared across
|
79
|
+
* Isolates. The embedder must return an ID for the object. This function
|
80
|
+
* must be idempotent for the same object. When deserializing, the ID will
|
81
|
+
* be passed to ValueDeserializer::Delegate::GetSharedValueFromId as
|
82
|
+
* |shared_value_id|.
|
83
|
+
*/
|
84
|
+
virtual Maybe<uint32_t> GetSharedValueId(Isolate* isolate,
|
85
|
+
Local<Value> shared_value);
|
86
|
+
|
87
|
+
/**
|
88
|
+
* Allocates memory for the buffer of at least the size provided. The actual
|
89
|
+
* size (which may be greater or equal) is written to |actual_size|. If no
|
90
|
+
* buffer has been allocated yet, nullptr will be provided.
|
91
|
+
*
|
92
|
+
* If the memory cannot be allocated, nullptr should be returned.
|
93
|
+
* |actual_size| will be ignored. It is assumed that |old_buffer| is still
|
94
|
+
* valid in this case and has not been modified.
|
95
|
+
*
|
96
|
+
* The default implementation uses the stdlib's `realloc()` function.
|
97
|
+
*/
|
98
|
+
virtual void* ReallocateBufferMemory(void* old_buffer, size_t size,
|
99
|
+
size_t* actual_size);
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Frees a buffer allocated with |ReallocateBufferMemory|.
|
103
|
+
*
|
104
|
+
* The default implementation uses the stdlib's `free()` function.
|
105
|
+
*/
|
106
|
+
virtual void FreeBufferMemory(void* buffer);
|
107
|
+
};
|
108
|
+
|
109
|
+
explicit ValueSerializer(Isolate* isolate);
|
110
|
+
ValueSerializer(Isolate* isolate, Delegate* delegate);
|
111
|
+
~ValueSerializer();
|
112
|
+
|
113
|
+
/**
|
114
|
+
* Writes out a header, which includes the format version.
|
115
|
+
*/
|
116
|
+
void WriteHeader();
|
117
|
+
|
118
|
+
/**
|
119
|
+
* Serializes a JavaScript value into the buffer.
|
120
|
+
*/
|
121
|
+
V8_WARN_UNUSED_RESULT Maybe<bool> WriteValue(Local<Context> context,
|
122
|
+
Local<Value> value);
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Returns the stored data (allocated using the delegate's
|
126
|
+
* ReallocateBufferMemory) and its size. This serializer should not be used
|
127
|
+
* once the buffer is released. The contents are undefined if a previous write
|
128
|
+
* has failed. Ownership of the buffer is transferred to the caller.
|
129
|
+
*/
|
130
|
+
V8_WARN_UNUSED_RESULT std::pair<uint8_t*, size_t> Release();
|
131
|
+
|
132
|
+
/**
|
133
|
+
* Marks an ArrayBuffer as havings its contents transferred out of band.
|
134
|
+
* Pass the corresponding ArrayBuffer in the deserializing context to
|
135
|
+
* ValueDeserializer::TransferArrayBuffer.
|
136
|
+
*/
|
137
|
+
void TransferArrayBuffer(uint32_t transfer_id,
|
138
|
+
Local<ArrayBuffer> array_buffer);
|
139
|
+
|
140
|
+
/**
|
141
|
+
* Indicate whether to treat ArrayBufferView objects as host objects,
|
142
|
+
* i.e. pass them to Delegate::WriteHostObject. This should not be
|
143
|
+
* called when no Delegate was passed.
|
144
|
+
*
|
145
|
+
* The default is not to treat ArrayBufferViews as host objects.
|
146
|
+
*/
|
147
|
+
void SetTreatArrayBufferViewsAsHostObjects(bool mode);
|
148
|
+
|
149
|
+
/**
|
150
|
+
* Write raw data in various common formats to the buffer.
|
151
|
+
* Note that integer types are written in base-128 varint format, not with a
|
152
|
+
* binary copy. For use during an override of Delegate::WriteHostObject.
|
153
|
+
*/
|
154
|
+
void WriteUint32(uint32_t value);
|
155
|
+
void WriteUint64(uint64_t value);
|
156
|
+
void WriteDouble(double value);
|
157
|
+
void WriteRawBytes(const void* source, size_t length);
|
158
|
+
|
159
|
+
ValueSerializer(const ValueSerializer&) = delete;
|
160
|
+
void operator=(const ValueSerializer&) = delete;
|
161
|
+
|
162
|
+
private:
|
163
|
+
struct PrivateData;
|
164
|
+
PrivateData* private_;
|
165
|
+
};
|
166
|
+
|
167
|
+
/**
|
168
|
+
* Deserializes values from data written with ValueSerializer, or a compatible
|
169
|
+
* implementation.
|
170
|
+
*/
|
171
|
+
class V8_EXPORT ValueDeserializer {
|
172
|
+
public:
|
173
|
+
class V8_EXPORT Delegate {
|
174
|
+
public:
|
175
|
+
virtual ~Delegate() = default;
|
176
|
+
|
177
|
+
/**
|
178
|
+
* The embedder overrides this method to read some kind of host object, if
|
179
|
+
* possible. If not, a suitable exception should be thrown and
|
180
|
+
* MaybeLocal<Object>() returned.
|
181
|
+
*/
|
182
|
+
virtual MaybeLocal<Object> ReadHostObject(Isolate* isolate);
|
183
|
+
|
184
|
+
/**
|
185
|
+
* Get a WasmModuleObject given a transfer_id previously provided
|
186
|
+
* by ValueSerializer::Delegate::GetWasmModuleTransferId
|
187
|
+
*/
|
188
|
+
virtual MaybeLocal<WasmModuleObject> GetWasmModuleFromId(
|
189
|
+
Isolate* isolate, uint32_t transfer_id);
|
190
|
+
|
191
|
+
/**
|
192
|
+
* Get a SharedArrayBuffer given a clone_id previously provided
|
193
|
+
* by ValueSerializer::Delegate::GetSharedArrayBufferId
|
194
|
+
*/
|
195
|
+
virtual MaybeLocal<SharedArrayBuffer> GetSharedArrayBufferFromId(
|
196
|
+
Isolate* isolate, uint32_t clone_id);
|
197
|
+
|
198
|
+
/**
|
199
|
+
* Returns whether shared values are supported. GetSharedValueFromId is only
|
200
|
+
* called if SupportsSharedValues() returns true.
|
201
|
+
*/
|
202
|
+
virtual bool SupportsSharedValues() const;
|
203
|
+
|
204
|
+
/**
|
205
|
+
* Get a value shared across Isolates given a shared_value_id provided by
|
206
|
+
* ValueSerializer::Delegate::GetSharedValueId.
|
207
|
+
*/
|
208
|
+
virtual MaybeLocal<Value> GetSharedValueFromId(Isolate* isolate,
|
209
|
+
uint32_t shared_value_id);
|
210
|
+
};
|
211
|
+
|
212
|
+
ValueDeserializer(Isolate* isolate, const uint8_t* data, size_t size);
|
213
|
+
ValueDeserializer(Isolate* isolate, const uint8_t* data, size_t size,
|
214
|
+
Delegate* delegate);
|
215
|
+
~ValueDeserializer();
|
216
|
+
|
217
|
+
/**
|
218
|
+
* Reads and validates a header (including the format version).
|
219
|
+
* May, for example, reject an invalid or unsupported wire format.
|
220
|
+
*/
|
221
|
+
V8_WARN_UNUSED_RESULT Maybe<bool> ReadHeader(Local<Context> context);
|
222
|
+
|
223
|
+
/**
|
224
|
+
* Deserializes a JavaScript value from the buffer.
|
225
|
+
*/
|
226
|
+
V8_WARN_UNUSED_RESULT MaybeLocal<Value> ReadValue(Local<Context> context);
|
227
|
+
|
228
|
+
/**
|
229
|
+
* Accepts the array buffer corresponding to the one passed previously to
|
230
|
+
* ValueSerializer::TransferArrayBuffer.
|
231
|
+
*/
|
232
|
+
void TransferArrayBuffer(uint32_t transfer_id,
|
233
|
+
Local<ArrayBuffer> array_buffer);
|
234
|
+
|
235
|
+
/**
|
236
|
+
* Similar to TransferArrayBuffer, but for SharedArrayBuffer.
|
237
|
+
* The id is not necessarily in the same namespace as unshared ArrayBuffer
|
238
|
+
* objects.
|
239
|
+
*/
|
240
|
+
void TransferSharedArrayBuffer(uint32_t id,
|
241
|
+
Local<SharedArrayBuffer> shared_array_buffer);
|
242
|
+
|
243
|
+
/**
|
244
|
+
* Must be called before ReadHeader to enable support for reading the legacy
|
245
|
+
* wire format (i.e., which predates this being shipped).
|
246
|
+
*
|
247
|
+
* Don't use this unless you need to read data written by previous versions of
|
248
|
+
* blink::ScriptValueSerializer.
|
249
|
+
*/
|
250
|
+
void SetSupportsLegacyWireFormat(bool supports_legacy_wire_format);
|
251
|
+
|
252
|
+
/**
|
253
|
+
* Reads the underlying wire format version. Likely mostly to be useful to
|
254
|
+
* legacy code reading old wire format versions. Must be called after
|
255
|
+
* ReadHeader.
|
256
|
+
*/
|
257
|
+
uint32_t GetWireFormatVersion() const;
|
258
|
+
|
259
|
+
/**
|
260
|
+
* Reads raw data in various common formats to the buffer.
|
261
|
+
* Note that integer types are read in base-128 varint format, not with a
|
262
|
+
* binary copy. For use during an override of Delegate::ReadHostObject.
|
263
|
+
*/
|
264
|
+
V8_WARN_UNUSED_RESULT bool ReadUint32(uint32_t* value);
|
265
|
+
V8_WARN_UNUSED_RESULT bool ReadUint64(uint64_t* value);
|
266
|
+
V8_WARN_UNUSED_RESULT bool ReadDouble(double* value);
|
267
|
+
V8_WARN_UNUSED_RESULT bool ReadRawBytes(size_t length, const void** data);
|
268
|
+
|
269
|
+
ValueDeserializer(const ValueDeserializer&) = delete;
|
270
|
+
void operator=(const ValueDeserializer&) = delete;
|
271
|
+
|
272
|
+
private:
|
273
|
+
struct PrivateData;
|
274
|
+
PrivateData* private_;
|
275
|
+
};
|
276
|
+
|
277
|
+
} // namespace v8
|
278
|
+
|
279
|
+
#endif // INCLUDE_V8_VALUE_SERIALIZER_H_
|