Skip to content

Commit bdb87f9

Browse files
committed
chore:remove zero-fill sandbox patch component
xref #49452
1 parent 2b6f185 commit bdb87f9

6 files changed

Lines changed: 26 additions & 177 deletions

patches/node/api_remove_deprecated_getisolate.patch

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ Subject: Remove deprecated `GetIsolate`
66
https://chromium-review.googlesource.com/c/v8/v8/+/6905244
77

88
diff --git a/src/api/environment.cc b/src/api/environment.cc
9-
index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7c630fddf 100644
9+
index ceac508418f489a8077c1bc85a2feaf85bf60480..33827edce63c9fe08b52aea59571391a83853443 100644
1010
--- a/src/api/environment.cc
1111
+++ b/src/api/environment.cc
12-
@@ -654,7 +654,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create(
12+
@@ -646,7 +646,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create(
1313

1414
MaybeLocal<Object> GetPerContextExports(Local<Context> context,
1515
IsolateData* isolate_data) {
@@ -18,7 +18,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7
1818
EscapableHandleScope handle_scope(isolate);
1919

2020
Local<Object> global = context->Global();
21-
@@ -700,7 +700,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) {
21+
@@ -692,7 +692,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) {
2222
// This runs at runtime, regardless of whether the context
2323
// is created from a snapshot.
2424
Maybe<void> InitializeContextRuntime(Local<Context> context) {
@@ -27,7 +27,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7
2727
HandleScope handle_scope(isolate);
2828

2929
// When `IsCodeGenerationFromStringsAllowed` is true, V8 takes the fast path
30-
@@ -779,7 +779,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) {
30+
@@ -771,7 +771,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) {
3131
}
3232

3333
Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
@@ -36,7 +36,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7
3636
HandleScope handle_scope(isolate);
3737

3838
// Delete `Intl.v8BreakIterator`
39-
@@ -804,7 +804,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
39+
@@ -796,7 +796,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) {
4040
}
4141

4242
Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
@@ -45,7 +45,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7
4545
HandleScope handle_scope(isolate);
4646

4747
// Initialize the default values.
48-
@@ -822,7 +822,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
48+
@@ -814,7 +814,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
4949
MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
5050
IsolateData* isolate_data) {
5151
CHECK(isolate_data);
@@ -54,7 +54,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7
5454
EscapableHandleScope scope(isolate);
5555
Context::Scope context_scope(context);
5656

57-
@@ -846,7 +846,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
57+
@@ -838,7 +838,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
5858
MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
5959
IsolateData* isolate_data) {
6060
CHECK(isolate_data);
@@ -63,7 +63,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7
6363
EscapableHandleScope scope(isolate);
6464
Context::Scope context_scope(context);
6565

66-
@@ -872,7 +872,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
66+
@@ -864,7 +864,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
6767
Maybe<void> InitializePrimordials(Local<Context> context,
6868
IsolateData* isolate_data) {
6969
// Run per-context JS files.

patches/node/fix_remove_fastapitypedarray_usage.patch

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ index fe669d40c31a29334b047b9cfee3067f64ef0a7b..9e5de7bbe574add017cd12ee091304d0
4848

4949
static CFunction fast_timing_safe_equal(CFunction::Make(FastTimingSafeEqual));
5050
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
51-
index 45c6b4cf19f7b336891dae3cd84d698507227d9e..fc7ccd647585fe3b96648ccd83ef49d93c9c4438 100644
51+
index b9f0c97938203b4652780a7d707c5e83319330b0..8a5b6b57321c2843a965a7e51b2ebed991a1e424 100644
5252
--- a/src/node_buffer.cc
5353
+++ b/src/node_buffer.cc
5454
@@ -44,6 +44,14 @@
@@ -74,7 +74,7 @@ index 45c6b4cf19f7b336891dae3cd84d698507227d9e..fc7ccd647585fe3b96648ccd83ef49d9
7474
using v8::FunctionCallbackInfo;
7575
using v8::Global;
7676
using v8::HandleScope;
77-
@@ -584,19 +591,24 @@ void SlowCopy(const FunctionCallbackInfo<Value>& args) {
77+
@@ -583,19 +590,24 @@ void SlowCopy(const FunctionCallbackInfo<Value>& args) {
7878

7979
// Assume caller has properly validated args.
8080
uint32_t FastCopy(Local<Value> receiver,
@@ -107,7 +107,7 @@ index 45c6b4cf19f7b336891dae3cd84d698507227d9e..fc7ccd647585fe3b96648ccd83ef49d9
107107
return to_copy;
108108
}
109109

110-
@@ -865,19 +877,17 @@ void Compare(const FunctionCallbackInfo<Value> &args) {
110+
@@ -864,19 +876,17 @@ void Compare(const FunctionCallbackInfo<Value> &args) {
111111
}
112112

113113
int32_t FastCompare(v8::Local<v8::Value>,
@@ -135,7 +135,7 @@ index 45c6b4cf19f7b336891dae3cd84d698507227d9e..fc7ccd647585fe3b96648ccd83ef49d9
135135
}
136136

137137
static v8::CFunction fast_compare(v8::CFunction::Make(FastCompare));
138-
@@ -1149,14 +1159,13 @@ void SlowIndexOfNumber(const FunctionCallbackInfo<Value>& args) {
138+
@@ -1148,14 +1158,13 @@ void SlowIndexOfNumber(const FunctionCallbackInfo<Value>& args) {
139139
}
140140

141141
int32_t FastIndexOfNumber(v8::Local<v8::Value>,
@@ -153,7 +153,7 @@ index 45c6b4cf19f7b336891dae3cd84d698507227d9e..fc7ccd647585fe3b96648ccd83ef49d9
153153
}
154154

155155
static v8::CFunction fast_index_of_number(
156-
@@ -1550,21 +1559,31 @@ void SlowWriteString(const FunctionCallbackInfo<Value>& args) {
156+
@@ -1510,21 +1519,31 @@ void SlowWriteString(const FunctionCallbackInfo<Value>& args) {
157157

158158
template <encoding encoding>
159159
uint32_t FastWriteString(Local<Value> receiver,

patches/node/fix_replace_deprecated_setprototype.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ This is already applied in newer versions of Node so we can drop
99
this patch once we upgrade to v23.
1010

1111
diff --git a/src/api/environment.cc b/src/api/environment.cc
12-
index 0a358735c331767e8eb563a80e9aaccfb544c27b..d7d18d5fcbf008ac131db189a141315af4f6410b 100644
12+
index 79327877b0f34cbafb3efcc21617027d4011f806..8a12475857135bd3e904610b7eb887c397c8e73c 100644
1313
--- a/src/api/environment.cc
1414
+++ b/src/api/environment.cc
15-
@@ -835,7 +835,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
15+
@@ -827,7 +827,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
1616

1717
Local<Object> private_symbols_object;
1818
if (!private_symbols->NewInstance(context).ToLocal(&private_symbols_object) ||
@@ -21,7 +21,7 @@ index 0a358735c331767e8eb563a80e9aaccfb544c27b..d7d18d5fcbf008ac131db189a141315a
2121
.IsNothing()) {
2222
return MaybeLocal<Object>();
2323
}
24-
@@ -861,7 +861,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
24+
@@ -853,7 +853,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
2525
Local<Object> per_isolate_symbols_object;
2626
if (!per_isolate_symbols->NewInstance(context).ToLocal(
2727
&per_isolate_symbols_object) ||

patches/node/refactor_attach_cppgc_heap_on_v8_isolate_creation.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ This can be removed when Node.js upgrades to a version of V8 containing CLs
1818
from the above issue.
1919

2020
diff --git a/src/api/environment.cc b/src/api/environment.cc
21-
index cb37fa080fc8e8d524cfa2758c4a8c2c5652324d..8e227ddd1be50c046a8cf2895a31d607eb7d31de 100644
21+
index fd71ceac65ccef1d2832b45b0b5612877cee22c1..ceac508418f489a8077c1bc85a2feaf85bf60480 100644
2222
--- a/src/api/environment.cc
2323
+++ b/src/api/environment.cc
24-
@@ -316,6 +316,10 @@ Isolate* NewIsolate(Isolate::CreateParams* params,
24+
@@ -308,6 +308,10 @@ Isolate* NewIsolate(Isolate::CreateParams* params,
2525
MultiIsolatePlatform* platform,
2626
const SnapshotData* snapshot_data,
2727
const IsolateSettings& settings) {
@@ -32,7 +32,7 @@ index cb37fa080fc8e8d524cfa2758c4a8c2c5652324d..8e227ddd1be50c046a8cf2895a31d607
3232
Isolate* isolate = Isolate::Allocate();
3333
if (isolate == nullptr) return nullptr;
3434

35-
@@ -359,9 +363,12 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator,
35+
@@ -351,9 +355,12 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator,
3636
uv_loop_t* event_loop,
3737
MultiIsolatePlatform* platform,
3838
const EmbedderSnapshotData* snapshot_data,

patches/node/src_switch_from_get_setprototype_to_get_setprototypev2.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ Reviewed-By: Moshe Atlow <[email protected]>
1010
Reviewed-By: James M Snell <[email protected]>
1111

1212
diff --git a/src/api/environment.cc b/src/api/environment.cc
13-
index 82f53bba29613de212f64be440ca20d7c630fddf..0a358735c331767e8eb563a80e9aaccfb544c27b 100644
13+
index 33827edce63c9fe08b52aea59571391a83853443..79327877b0f34cbafb3efcc21617027d4011f806 100644
1414
--- a/src/api/environment.cc
1515
+++ b/src/api/environment.cc
16-
@@ -886,7 +886,7 @@ Maybe<void> InitializePrimordials(Local<Context> context,
16+
@@ -878,7 +878,7 @@ Maybe<void> InitializePrimordials(Local<Context> context,
1717
CHECK(!exports->Has(context, primordials_string).FromJust());
1818

1919
Local<Object> primordials = Object::New(isolate);
@@ -51,10 +51,10 @@ index 7b2efa49468c0bed2f5935552addd3ab37d0a50b..413db3ed9b88d7b7fb2ac6dd1153dade
5151
return GET_RETURN_STATUS(env);
5252
}
5353
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
54-
index fc7ccd647585fe3b96648ccd83ef49d93c9c4438..aeacdcd13422aeb0fa4b1e234851d7b52f5de116 100644
54+
index 8a5b6b57321c2843a965a7e51b2ebed991a1e424..e844fe6cb33acefd075516e675075421ad5c3cff 100644
5555
--- a/src/node_buffer.cc
5656
+++ b/src/node_buffer.cc
57-
@@ -284,8 +284,9 @@ MaybeLocal<Uint8Array> New(Environment* env,
57+
@@ -283,8 +283,9 @@ MaybeLocal<Uint8Array> New(Environment* env,
5858
size_t length) {
5959
CHECK(!env->buffer_prototype_object().IsEmpty());
6060
Local<Uint8Array> ui = Uint8Array::New(ab, byte_offset, length);

patches/node/support_v8_sandboxed_pointers.patch

Lines changed: 3 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -6,63 +6,6 @@ Subject: support V8 sandboxed pointers
66
This refactors several allocators to allocate within the V8 memory cage,
77
allowing them to be compatible with the V8_SANDBOXED_POINTERS feature.
88

9-
diff --git a/src/api/environment.cc b/src/api/environment.cc
10-
index fd71ceac65ccef1d2832b45b0b5612877cee22c1..cb37fa080fc8e8d524cfa2758c4a8c2c5652324d 100644
11-
--- a/src/api/environment.cc
12-
+++ b/src/api/environment.cc
13-
@@ -106,6 +106,14 @@ MaybeLocal<Value> PrepareStackTraceCallback(Local<Context> context,
14-
return result;
15-
}
16-
17-
+NodeArrayBufferAllocator::NodeArrayBufferAllocator() {
18-
+ zero_fill_field_ = static_cast<uint32_t*>(allocator_->Allocate(sizeof(*zero_fill_field_)));
19-
+}
20-
+
21-
+NodeArrayBufferAllocator::~NodeArrayBufferAllocator() {
22-
+ allocator_->Free(zero_fill_field_, sizeof(*zero_fill_field_));
23-
+}
24-
+
25-
void* NodeArrayBufferAllocator::Allocate(size_t size) {
26-
void* ret;
27-
if (zero_fill_field_ || per_process::cli_options->zero_fill_all_buffers)
28-
diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc
29-
index f23cedf4f2449d8edc9a8de1b70332e75d693cdd..976653dd1e9363e046788fc3419a9b649ceb2ea4 100644
30-
--- a/src/crypto/crypto_dh.cc
31-
+++ b/src/crypto/crypto_dh.cc
32-
@@ -55,13 +55,32 @@ void DiffieHellman::MemoryInfo(MemoryTracker* tracker) const {
33-
34-
namespace {
35-
MaybeLocal<Value> DataPointerToBuffer(Environment* env, DataPointer&& data) {
36-
+#if defined(V8_ENABLE_SANDBOX)
37-
+ std::unique_ptr<v8::BackingStore> backing;
38-
+ if (data.size() > 0) {
39-
+ std::unique_ptr<ArrayBuffer::Allocator> allocator(ArrayBuffer::Allocator::NewDefaultAllocator());
40-
+ void* v8_data = allocator->Allocate(data.size());
41-
+ CHECK(v8_data);
42-
+ memcpy(v8_data, data.get(), data.size());
43-
+ backing = ArrayBuffer::NewBackingStore(
44-
+ v8_data,
45-
+ data.size(),
46-
+ [](void* data, size_t length, void*) {
47-
+ std::unique_ptr<ArrayBuffer::Allocator> allocator(ArrayBuffer::Allocator::NewDefaultAllocator());
48-
+ allocator->Free(data, length);
49-
+ }, nullptr);
50-
+ } else {
51-
+ NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data());
52-
+ backing = v8::ArrayBuffer::NewBackingStore(env->isolate(), data.size());
53-
+ }
54-
+#else
55-
auto backing = ArrayBuffer::NewBackingStore(
56-
data.get(),
57-
data.size(),
58-
[](void* data, size_t len, void* ptr) { DataPointer free_me(data, len); },
59-
nullptr);
60-
data.release();
61-
-
62-
+#endif
63-
auto ab = ArrayBuffer::New(env->isolate(), std::move(backing));
64-
return Buffer::New(env, ab, 0, ab->ByteLength()).FromMaybe(Local<Value>());
65-
}
669
diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc
6710
index 4505786745c54a529f904d5e7813a86204e0a78b..eab18ab9888e2f7c0757fefab80505d8c99dc742 100644
6811
--- a/src/crypto/crypto_util.cc
@@ -189,64 +132,10 @@ index f616223cfb0f6e10f7cf57ada9704316bde2797e..eb6dad44a49d997097c8fb5009eeb60a
189132
Local<Value> ret;
190133
if (!Buffer::New(env, ab, 0, ab->ByteLength()).ToLocal(&ret)) return {};
191134
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
192-
index 357dc5f6d1c1c2d3756a94c1326b0502403e1eaf..45c6b4cf19f7b336891dae3cd84d698507227d9e 100644
135+
index 357dc5f6d1c1c2d3756a94c1326b0502403e1eaf..b9f0c97938203b4652780a7d707c5e83319330b0 100644
193136
--- a/src/node_buffer.cc
194137
+++ b/src/node_buffer.cc
195-
@@ -78,6 +78,7 @@ using v8::SharedArrayBuffer;
196-
using v8::String;
197-
using v8::Uint32;
198-
using v8::Uint8Array;
199-
+using v8::Uint32Array;
200-
using v8::Value;
201-
202-
namespace {
203-
@@ -1228,6 +1229,45 @@ void SetBufferPrototype(const FunctionCallbackInfo<Value>& args) {
204-
realm->set_buffer_prototype_object(proto);
205-
}
206-
207-
+void GetZeroFillToggle(const FunctionCallbackInfo<Value>& args) {
208-
+ Environment* env = Environment::GetCurrent(args);
209-
+ NodeArrayBufferAllocator* allocator = env->isolate_data()->node_allocator();
210-
+ Local<ArrayBuffer> ab;
211-
+ // It can be a nullptr when running inside an isolate where we
212-
+ // do not own the ArrayBuffer allocator.
213-
+ if (allocator == nullptr || env->isolate_data()->is_building_snapshot()) {
214-
+ // Create a dummy Uint32Array - the JS land can only toggle the C++ land
215-
+ // setting when the allocator uses our toggle. With this the toggle in JS
216-
+ // land results in no-ops.
217-
+ // When building a snapshot, just use a dummy toggle as well to avoid
218-
+ // introducing the dynamic external reference. We'll re-initialize the
219-
+ // toggle with a real one connected to the C++ allocator after snapshot
220-
+ // deserialization.
221-
+
222-
+ ab = ArrayBuffer::New(env->isolate(), sizeof(uint32_t));
223-
+ } else {
224-
+ // TODO(joyeecheung): save ab->GetBackingStore()->Data() in the Node.js
225-
+ // array buffer allocator and include it into the C++ toggle while the
226-
+ // Environment is still alive.
227-
+ uint32_t* zero_fill_field = allocator->zero_fill_field();
228-
+ std::unique_ptr<BackingStore> backing =
229-
+ ArrayBuffer::NewBackingStore(zero_fill_field,
230-
+ sizeof(*zero_fill_field),
231-
+ [](void*, size_t, void*) {},
232-
+ nullptr);
233-
+ ab = ArrayBuffer::New(env->isolate(), std::move(backing));
234-
+ }
235-
+
236-
+ if (ab->SetPrivate(env->context(),
237-
+ env->untransferable_object_private_symbol(),
238-
+ True(env->isolate()))
239-
+ .IsNothing()) {
240-
+ return;
241-
+ }
242-
+
243-
+ args.GetReturnValue().Set(Uint32Array::New(ab, 0, 1));
244-
+}
245-
+
246-
static void Btoa(const FunctionCallbackInfo<Value>& args) {
247-
CHECK_EQ(args.Length(), 1);
248-
Environment* env = Environment::GetCurrent(args);
249-
@@ -1412,7 +1452,7 @@ inline size_t CheckNumberToSize(Local<Value> number) {
138+
@@ -1412,7 +1412,7 @@ inline size_t CheckNumberToSize(Local<Value> number) {
250139
CHECK(value >= 0 && value < maxSize);
251140
size_t size = static_cast<size_t>(value);
252141
#ifdef V8_ENABLE_SANDBOX
@@ -255,7 +144,7 @@ index 357dc5f6d1c1c2d3756a94c1326b0502403e1eaf..45c6b4cf19f7b336891dae3cd84d6985
255144
#endif
256145
return size;
257146
}
258-
@@ -1437,7 +1477,7 @@ void CreateUnsafeArrayBuffer(const FunctionCallbackInfo<Value>& args) {
147+
@@ -1437,7 +1437,7 @@ void CreateUnsafeArrayBuffer(const FunctionCallbackInfo<Value>& args) {
259148
buf = ArrayBuffer::New(isolate, size);
260149
} else {
261150
std::unique_ptr<BackingStore> store =
@@ -264,22 +153,6 @@ index 357dc5f6d1c1c2d3756a94c1326b0502403e1eaf..45c6b4cf19f7b336891dae3cd84d6985
264153
if (!store) {
265154
return env->ThrowRangeError("Array buffer allocation failed");
266155
}
267-
@@ -1615,6 +1655,7 @@ void Initialize(Local<Object> target,
268-
"utf8WriteStatic",
269-
SlowWriteString<UTF8>,
270-
&fast_write_string_utf8);
271-
+ SetMethod(context, target, "getZeroFillToggle", GetZeroFillToggle);
272-
}
273-
274-
} // anonymous namespace
275-
@@ -1663,6 +1704,7 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
276-
registry->Register(StringWrite<HEX>);
277-
registry->Register(StringWrite<UCS2>);
278-
registry->Register(StringWrite<UTF8>);
279-
+ registry->Register(GetZeroFillToggle);
280-
281-
registry->Register(CopyArrayBuffer);
282-
registry->Register(CreateUnsafeArrayBuffer);
283156
diff --git a/src/node_i18n.cc b/src/node_i18n.cc
284157
index 6be3920632b25db450025ebab6a2636e4811cdbe..b49916d2b5fc5e58cf3fb67329430fd3df8fb813 100644
285158
--- a/src/node_i18n.cc
@@ -320,30 +193,6 @@ index 6be3920632b25db450025ebab6a2636e4811cdbe..b49916d2b5fc5e58cf3fb67329430fd3
320193
}
321194

322195
constexpr const char* EncodingName(const enum encoding encoding) {
323-
diff --git a/src/node_internals.h b/src/node_internals.h
324-
index 12ea72b61b0a5e194207bb369dfed4b8667107cb..64442215714a98f648971e517ddd9c77e38fe3f2 100644
325-
--- a/src/node_internals.h
326-
+++ b/src/node_internals.h
327-
@@ -121,7 +121,9 @@ v8::MaybeLocal<v8::Object> InitializePrivateSymbols(
328-
329-
class NodeArrayBufferAllocator : public ArrayBufferAllocator {
330-
public:
331-
- inline uint32_t* zero_fill_field() { return &zero_fill_field_; }
332-
+ NodeArrayBufferAllocator();
333-
+ ~NodeArrayBufferAllocator() override;
334-
+ inline uint32_t* zero_fill_field() { return zero_fill_field_; }
335-
336-
void* Allocate(size_t size) override; // Defined in src/node.cc
337-
void* AllocateUninitialized(size_t size) override;
338-
@@ -139,7 +141,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator {
339-
}
340-
341-
private:
342-
- uint32_t zero_fill_field_ = 1; // Boolean but exposed as uint32 to JS land.
343-
+ uint32_t* zero_fill_field_ = nullptr; // Boolean but exposed as uint32 to JS land.
344-
std::atomic<size_t> total_mem_usage_ {0};
345-
346-
// Delegate to V8's allocator for compatibility with the V8 memory cage.
347196
diff --git a/src/node_serdes.cc b/src/node_serdes.cc
348197
index c55a2e28066147ae5ca5def10ec76ccc03c634b4..c54183c72944989219b6437c9e571a3f7f3f8dd5 100644
349198
--- a/src/node_serdes.cc

0 commit comments

Comments
 (0)