libv8-node 15.14.0.1-aarch64-linux-musl → 18.8.0.0-aarch64-linux-musl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libv8-node/location.rb +1 -1
  3. data/ext/libv8-node/paths.rb +5 -1
  4. data/lib/libv8/node/version.rb +3 -3
  5. data/vendor/v8/{out.gn → aarch64-linux-musl}/libv8/obj/libv8_monolith.a +0 -0
  6. data/vendor/v8/include/cppgc/allocation.h +184 -47
  7. data/vendor/v8/include/cppgc/common.h +9 -6
  8. data/vendor/v8/include/cppgc/cross-thread-persistent.h +465 -0
  9. data/vendor/v8/include/cppgc/custom-space.h +37 -2
  10. data/vendor/v8/include/cppgc/default-platform.h +40 -49
  11. data/vendor/v8/include/cppgc/ephemeron-pair.h +30 -0
  12. data/vendor/v8/include/cppgc/explicit-management.h +100 -0
  13. data/vendor/v8/include/cppgc/garbage-collected.h +19 -29
  14. data/vendor/v8/include/cppgc/heap-consistency.h +266 -0
  15. data/vendor/v8/include/cppgc/heap-state.h +82 -0
  16. data/vendor/v8/include/cppgc/heap-statistics.h +120 -0
  17. data/vendor/v8/include/cppgc/heap.h +73 -6
  18. data/vendor/v8/include/cppgc/internal/api-constants.h +11 -3
  19. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +27 -15
  20. data/vendor/v8/include/cppgc/internal/compiler-specific.h +2 -2
  21. data/vendor/v8/include/cppgc/internal/finalizer-trait.h +4 -1
  22. data/vendor/v8/include/cppgc/internal/gc-info.h +124 -13
  23. data/vendor/v8/include/cppgc/internal/logging.h +3 -3
  24. data/vendor/v8/include/cppgc/internal/name-trait.h +122 -0
  25. data/vendor/v8/include/cppgc/internal/persistent-node.h +116 -16
  26. data/vendor/v8/include/cppgc/internal/pointer-policies.h +84 -32
  27. data/vendor/v8/include/cppgc/internal/write-barrier.h +392 -35
  28. data/vendor/v8/include/cppgc/liveness-broker.h +11 -2
  29. data/vendor/v8/include/cppgc/macros.h +2 -0
  30. data/vendor/v8/include/cppgc/member.h +91 -26
  31. data/vendor/v8/include/cppgc/name-provider.h +65 -0
  32. data/vendor/v8/include/cppgc/object-size-trait.h +58 -0
  33. data/vendor/v8/include/cppgc/persistent.h +70 -41
  34. data/vendor/v8/include/cppgc/platform.h +52 -26
  35. data/vendor/v8/include/cppgc/prefinalizer.h +36 -13
  36. data/vendor/v8/include/cppgc/process-heap-statistics.h +36 -0
  37. data/vendor/v8/include/cppgc/sentinel-pointer.h +32 -0
  38. data/vendor/v8/include/cppgc/source-location.h +2 -1
  39. data/vendor/v8/include/cppgc/testing.h +106 -0
  40. data/vendor/v8/include/cppgc/trace-trait.h +8 -3
  41. data/vendor/v8/include/cppgc/type-traits.h +163 -32
  42. data/vendor/v8/include/cppgc/visitor.h +194 -28
  43. data/vendor/v8/include/libplatform/libplatform.h +11 -11
  44. data/vendor/v8/include/libplatform/v8-tracing.h +2 -1
  45. data/vendor/v8/include/v8-array-buffer.h +445 -0
  46. data/vendor/v8/include/v8-callbacks.h +397 -0
  47. data/vendor/v8/include/v8-container.h +129 -0
  48. data/vendor/v8/include/v8-context.h +407 -0
  49. data/vendor/v8/include/v8-cppgc.h +151 -159
  50. data/vendor/v8/include/v8-data.h +80 -0
  51. data/vendor/v8/include/v8-date.h +43 -0
  52. data/vendor/v8/include/v8-debug.h +168 -0
  53. data/vendor/v8/include/v8-embedder-heap.h +218 -0
  54. data/vendor/v8/include/v8-embedder-state-scope.h +51 -0
  55. data/vendor/v8/include/v8-exception.h +217 -0
  56. data/vendor/v8/include/v8-extension.h +62 -0
  57. data/vendor/v8/include/v8-external.h +37 -0
  58. data/vendor/v8/include/v8-fast-api-calls.h +703 -152
  59. data/vendor/v8/include/v8-forward.h +81 -0
  60. data/vendor/v8/include/v8-function-callback.h +475 -0
  61. data/vendor/v8/include/v8-function.h +125 -0
  62. data/vendor/v8/include/v8-initialization.h +315 -0
  63. data/vendor/v8/include/v8-inspector.h +76 -27
  64. data/vendor/v8/include/v8-internal.h +285 -51
  65. data/vendor/v8/include/v8-isolate.h +1709 -0
  66. data/vendor/v8/include/v8-json.h +47 -0
  67. data/vendor/v8/include/v8-local-handle.h +455 -0
  68. data/vendor/v8/include/v8-locker.h +149 -0
  69. data/vendor/v8/include/v8-maybe.h +137 -0
  70. data/vendor/v8/include/v8-memory-span.h +43 -0
  71. data/vendor/v8/include/v8-message.h +216 -0
  72. data/vendor/v8/include/v8-metrics.h +131 -9
  73. data/vendor/v8/include/v8-microtask-queue.h +152 -0
  74. data/vendor/v8/include/v8-microtask.h +28 -0
  75. data/vendor/v8/include/v8-object.h +775 -0
  76. data/vendor/v8/include/v8-persistent-handle.h +590 -0
  77. data/vendor/v8/include/v8-platform.h +433 -25
  78. data/vendor/v8/include/v8-primitive-object.h +118 -0
  79. data/vendor/v8/include/v8-primitive.h +866 -0
  80. data/vendor/v8/include/v8-profiler.h +149 -10
  81. data/vendor/v8/include/v8-promise.h +174 -0
  82. data/vendor/v8/include/v8-proxy.h +50 -0
  83. data/vendor/v8/include/v8-regexp.h +105 -0
  84. data/vendor/v8/include/v8-script.h +747 -0
  85. data/vendor/v8/include/v8-snapshot.h +196 -0
  86. data/vendor/v8/include/v8-statistics.h +217 -0
  87. data/vendor/v8/include/v8-template.h +1079 -0
  88. data/vendor/v8/include/v8-traced-handle.h +420 -0
  89. data/vendor/v8/include/v8-typed-array.h +282 -0
  90. data/vendor/v8/include/v8-unwinder-state.h +31 -0
  91. data/vendor/v8/include/v8-unwinder.h +132 -0
  92. data/vendor/v8/include/v8-util.h +8 -2
  93. data/vendor/v8/include/v8-value-serializer-version.h +1 -1
  94. data/vendor/v8/include/v8-value-serializer.h +279 -0
  95. data/vendor/v8/include/v8-value.h +526 -0
  96. data/vendor/v8/include/v8-version.h +4 -4
  97. data/vendor/v8/include/v8-wasm.h +257 -0
  98. data/vendor/v8/include/v8-weak-callback-info.h +87 -0
  99. data/vendor/v8/include/v8.h +41 -12051
  100. data/vendor/v8/include/v8config.h +142 -21
  101. metadata +64 -10
  102. data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +0 -30
  103. data/vendor/v8/include/cppgc/internal/process-heap.h +0 -34
@@ -0,0 +1,31 @@
1
+ // Copyright 2020 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_STATE_H_
6
+ #define INCLUDE_V8_UNWINDER_STATE_H_
7
+
8
+ namespace v8 {
9
+
10
+ #ifdef V8_TARGET_ARCH_ARM
11
+ struct CalleeSavedRegisters {
12
+ void* arm_r4;
13
+ void* arm_r5;
14
+ void* arm_r6;
15
+ void* arm_r7;
16
+ void* arm_r8;
17
+ void* arm_r9;
18
+ void* arm_r10;
19
+ };
20
+ #elif V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM64 || \
21
+ V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_PPC || \
22
+ V8_TARGET_ARCH_PPC64 || V8_TARGET_ARCH_RISCV64 || V8_TARGET_ARCH_S390 || \
23
+ V8_TARGET_ARCH_LOONG64
24
+ struct CalleeSavedRegisters {};
25
+ #else
26
+ #error Target architecture was not detected as supported by v8
27
+ #endif
28
+
29
+ } // namespace v8
30
+
31
+ #endif // INCLUDE_V8_UNWINDER _STATE_H_
@@ -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_
@@ -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 {
@@ -43,7 +49,7 @@ class StdMapTraits {
43
49
 
44
50
  static bool Empty(Impl* impl) { return impl->empty(); }
45
51
  static size_t Size(Impl* impl) { return impl->size(); }
46
- static void Swap(Impl& a, Impl& b) { std::swap(a, b); } // NOLINT
52
+ static void Swap(Impl& a, Impl& b) { std::swap(a, b); }
47
53
  static Iterator Begin(Impl* impl) { return impl->begin(); }
48
54
  static Iterator End(Impl* impl) { return impl->end(); }
49
55
  static K Key(Iterator it) { return it->first; }
@@ -17,7 +17,7 @@
17
17
 
18
18
  namespace v8 {
19
19
 
20
- constexpr uint32_t CurrentValueSerializerFormatVersion() { return 13; }
20
+ constexpr uint32_t CurrentValueSerializerFormatVersion() { return 15; }
21
21
 
22
22
  } // namespace v8
23
23
 
@@ -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_