From f03c118cb8cc2c65b373e4db67b6b89cadd4cc18 Mon Sep 17 00:00:00 2001 From: Amir Valizadeh Date: Mon, 21 Jul 2025 14:21:12 -0700 Subject: [PATCH] added nodejs 22.17.1 patches --- azure-pipelines.yml | 14 +- src/NodeBuilder.js | 2 - src/patch/22.17.1/configure.py.patch | 17 + src/patch/22.17.1/no_rand_on_glibc.patch | 24 + src/patch/22.17.1/node.cc.patch | 17 + src/patch/22.17.1/node.gyp.patch | 13 + src/patch/22.17.1/node_buffer.cc.patch | 173 +++++ .../22.17.1/run_third_party_main.js.patch | 17 + .../22.17.1/v8_backing_store_callers.patch | 721 ++++++++++++++++++ src/patch/22.17.1/v8config.patch | 14 + src/patch/22.17.1/vcbuild.bat.patch | 29 + 11 files changed, 1032 insertions(+), 9 deletions(-) create mode 100644 src/patch/22.17.1/configure.py.patch create mode 100644 src/patch/22.17.1/no_rand_on_glibc.patch create mode 100644 src/patch/22.17.1/node.cc.patch create mode 100644 src/patch/22.17.1/node.gyp.patch create mode 100644 src/patch/22.17.1/node_buffer.cc.patch create mode 100644 src/patch/22.17.1/run_third_party_main.js.patch create mode 100644 src/patch/22.17.1/v8_backing_store_callers.patch create mode 100644 src/patch/22.17.1/v8config.patch create mode 100644 src/patch/22.17.1/vcbuild.bat.patch diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5b07fe0..47f576e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,11 +9,11 @@ jobs: # arch: 'linux/arm64' # node: '20.18.0' - linux_amd64: - imageName: 'ubuntu-20.04' - arch: 'linux/amd64' - node: '22.14.0' - ptrcompress: false + # linux_amd64: + # imageName: 'ubuntu-20.04' + # arch: 'linux/amd64' + # node: '22.14.0' + # ptrcompress: false # Pointer Compression builds are failing on Linux # linux_amd64_ptrc: @@ -34,12 +34,12 @@ jobs: macos_arm64: imageName: 'macOS-15' - node: '22.14.0' + node: '22.17.1' arch: 'arm64' ptrcompress: false macos_x64: imageName: 'macOS-15' - node: '22.14.0' + node: '22.17.1' arch: 'x64' ptrcompress: false diff --git a/src/NodeBuilder.js b/src/NodeBuilder.js index 74cad54..05b4927 100644 --- a/src/NodeBuilder.js +++ b/src/NodeBuilder.js @@ -200,7 +200,6 @@ class NodeJsBuilder { async patchThirdPartyMain() { await patchFile(this.nodeSrcDir, join(this.patchDir, 'run_third_party_main.js.patch')); await patchFile(this.nodeSrcDir, join(this.patchDir, 'node.cc.patch')); - await patchFile(this.nodeSrcDir, join(this.patchDir, 'fs-event.c.patch')); } async patchNodeCompileIssues() { @@ -212,7 +211,6 @@ class NodeJsBuilder { // The following patches fix the memory leak when using pointer compression // They are fixing both Linux and Windows, however, we only apply them to Windows to keep the blast radius small await patchFile(this.nodeSrcDir, join(this.patchDir, 'configure.py.patch')); - await patchFile(this.nodeSrcDir, join(this.patchDir, 'features.gypi.patch')); await patchFile(this.nodeSrcDir, join(this.patchDir, 'node_buffer.cc.patch')); await patchFile(this.nodeSrcDir, join(this.patchDir, 'v8_backing_store_callers.patch')); } diff --git a/src/patch/22.17.1/configure.py.patch b/src/patch/22.17.1/configure.py.patch new file mode 100644 index 0000000..daaa087 --- /dev/null +++ b/src/patch/22.17.1/configure.py.patch @@ -0,0 +1,17 @@ +--- a/configure.py ++++ b/configure.py +@@ -1722,11 +1722,12 @@ def configure_v8(o, configs): + # Until we manage to get rid of all those, v8_enable_sandbox cannot be used. + # Note that enabling pointer compression without enabling sandbox is unsupported by V8, + # so this can be broken at any time. +- o['variables']['v8_enable_sandbox'] = 0 ++ # o['variables']['v8_enable_sandbox'] = 0 ++ o['variables']['v8_enable_sandbox'] = 1 if options.enable_pointer_compression else 0 + o['variables']['v8_enable_pointer_compression_shared_cage'] = 1 if options.enable_pointer_compression else 0 + o['variables']['v8_enable_external_code_space'] = 1 if options.enable_pointer_compression else 0 ++ o['variables']['v8_enable_shared_ro_heap'] = 0 if options.disable_shared_ro_heap else 1 + o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0 +- o['variables']['v8_enable_shared_ro_heap'] = 0 if options.enable_pointer_compression or options.disable_shared_ro_heap else 1 + o['variables']['v8_enable_extensible_ro_snapshot'] = 0 + o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0 + o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform) diff --git a/src/patch/22.17.1/no_rand_on_glibc.patch b/src/patch/22.17.1/no_rand_on_glibc.patch new file mode 100644 index 0000000..38004b5 --- /dev/null +++ b/src/patch/22.17.1/no_rand_on_glibc.patch @@ -0,0 +1,24 @@ +disable usage of + +--- a/deps/cares/config/linux/ares_config.h ++++ b/deps/cares/config/linux/ares_config.h +@@ -116,7 +116,9 @@ + #define HAVE_GETNAMEINFO 1 + + /* Define to 1 if you have `getrandom` */ ++#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 25 + #define HAVE_GETRANDOM 1 ++#endif + + /* Define to 1 if you have `getservbyport_r` */ + #define HAVE_GETSERVBYPORT_R 1 +@@ -329,7 +331,9 @@ + #define HAVE_SYS_PARAM_H 1 + + /* Define to 1 if you have the header file. */ ++#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 25 + #define HAVE_SYS_RANDOM_H 1 ++#endif + + /* Define to 1 if you have the header file. */ + #define HAVE_SYS_SELECT_H 1 diff --git a/src/patch/22.17.1/node.cc.patch b/src/patch/22.17.1/node.cc.patch new file mode 100644 index 0000000..06bca9a --- /dev/null +++ b/src/patch/22.17.1/node.cc.patch @@ -0,0 +1,17 @@ +--- a/src/node.cc ++++ b/src/node.cc +@@ -404,6 +404,14 @@ MaybeLocal StartExecution(Environment* env, StartExecutionCallback cb) { + return env->RunSnapshotDeserializeMain(); + } + ++ // To allow people to extend Node in different ways, this hook allows ++ // one to drop a file lib/_third_party_main.js into the build ++ // directory which will be executed instead of Node's normal loading. ++ if (env->builtin_loader()->Exists("_third_party_main")) { ++ return StartExecution(env, "internal/main/run_third_party_main"); ++ } ++ ++ + if (env->worker_context() != nullptr) { + return StartExecution(env, "internal/main/worker_thread"); + } diff --git a/src/patch/22.17.1/node.gyp.patch b/src/patch/22.17.1/node.gyp.patch new file mode 100644 index 0000000..fc3d79b --- /dev/null +++ b/src/patch/22.17.1/node.gyp.patch @@ -0,0 +1,13 @@ +disable building of cctest as it (a) it fails to build due to align_alloc and (b) it is just a waste of time + +--- a/node.gyp ++++ b/node.gyp +@@ -1170,7 +1170,7 @@ + }, # fuzz_strings + { + 'target_name': 'cctest', +- 'type': 'executable', ++ 'type': 'none', + + 'dependencies': [ + '<(node_lib_target_name)', diff --git a/src/patch/22.17.1/node_buffer.cc.patch b/src/patch/22.17.1/node_buffer.cc.patch new file mode 100644 index 0000000..8db5be5 --- /dev/null +++ b/src/patch/22.17.1/node_buffer.cc.patch @@ -0,0 +1,173 @@ +--- a/src/node_buffer.cc ++++ b/src/node_buffer.cc +@@ -81,6 +81,100 @@ using v8::Uint32Array; + using v8::Uint8Array; + using v8::Value; + ++// Helper function to create a sandbox-aware backing store ++std::unique_ptr CreateBackingStore( ++ Isolate* isolate, ++ void* data, ++ size_t byte_length, ++ BackingStore::DeleterCallback deleter, ++ void* deleter_data) { ++#ifdef V8_ENABLE_SANDBOX ++ // When V8 sandbox is enabled, we need to allocate memory through V8's ++ // ArrayBuffer::Allocator to ensure it's within the sandbox memory region. ++ // This creates a new backing store by first allocating memory through V8, ++ // copying any existing data into it, and setting up proper deallocation. ++ ArrayBuffer::Allocator* allocator = isolate->GetArrayBufferAllocator(); ++ if (!allocator) { ++ fprintf(stderr, "Failed to get array buffer allocator\n"); ++ return nullptr; ++ } ++ ++ // Allocate memory using the isolate's allocator to ensure it's within the sandbox ++ void* allocated_memory = allocator->Allocate(byte_length); ++ if (!allocated_memory) { ++ fprintf(stderr, "Failed to allocate memory\n"); ++ return nullptr; ++ } ++ ++ // If we have data to copy, copy it into the allocated memory ++ if (data != nullptr) { ++ memcpy(allocated_memory, data, byte_length); ++ } ++ ++ // Define a structure to hold all the information needed for proper memory cleanup ++ struct BackingStoreDeleterContext { ++ BackingStore::DeleterCallback original_deleter; // Original callback to free external resources ++ void* original_deleter_data; // Data passed to the original deleter ++ void* original_data; // Original data pointer ++ ArrayBuffer::Allocator* allocator; // Allocator used to free the memory ++ }; ++ ++ std::unique_ptr deletion_context; ++ if (deleter != nullptr) { ++ deletion_context = std::make_unique(BackingStoreDeleterContext{ ++ deleter, deleter_data, data, allocator ++ }); ++ } ++ ++ std::unique_ptr store; ++ if (deleter != nullptr) { ++ store = ArrayBuffer::NewBackingStore( ++ allocated_memory, ++ byte_length, ++ [](void* data, size_t length, void* deletion_context_ptr) { ++ auto* context = static_cast(deletion_context_ptr); ++ // Call the original deleter to clean up any external resources ++ context->original_deleter(context->original_data, length, context->original_deleter_data); ++ // Free the memory using the allocator ++ context->allocator->Free(data, length); ++ }, ++ deletion_context.get() // Pass the deletion context for memory cleanup ++ ); ++ } else { ++ store = ArrayBuffer::NewBackingStore( ++ allocated_memory, ++ byte_length, ++ [](void* data, size_t length, void* allocator_ptr) { ++ auto* allocator = static_cast(allocator_ptr); ++ // Free the memory using the allocator ++ allocator->Free(data, length); ++ }, ++ static_cast(allocator) // Pass the allocator for memory cleanup ++ ); ++ } ++ ++ // Handle the case where backing store creation fails ++ if (!store) { ++ fprintf(stderr, "Failed to create backing store\n"); ++ allocator->Free(allocated_memory, byte_length); ++ return nullptr; ++ } ++ ++ // Transfer ownership of the deletion context to the BackingStore ++ // This ensures the deletion context lives as long as the BackingStore and is properly cleaned up ++ deletion_context.release(); ++ ++ return store; ++#else ++ // When sandbox is not enabled, we can directly create the backing store ++ if (deleter != nullptr) { ++ return ArrayBuffer::NewBackingStore(data, byte_length, deleter, deleter_data); ++ } else { ++ return ArrayBuffer::NewBackingStore(isolate, byte_length); ++ } ++#endif ++} ++ + namespace { + + class CallbackInfo : public Cleanable { +@@ -122,7 +216,7 @@ Local CallbackInfo::CreateTrackedArrayBuffer( + + CallbackInfo* self = new CallbackInfo(env, callback, data, hint); + std::unique_ptr bs = +- ArrayBuffer::NewBackingStore(data, length, [](void*, size_t, void* arg) { ++ CreateBackingStore(env->isolate(), data, length, [](void*, size_t, void* arg) { + static_cast(arg)->OnBackingStoreFree(); + }, self); + Local ab = ArrayBuffer::New(env->isolate(), std::move(bs)); +@@ -309,7 +403,7 @@ MaybeLocal New(Isolate* isolate, + std::unique_ptr store; + + if (length > 0) { +- store = ArrayBuffer::NewBackingStore(isolate, length); ++ store = CreateBackingStore(isolate, nullptr, length, nullptr, nullptr); + + if (!store) [[unlikely]] { + THROW_ERR_MEMORY_ALLOCATION_FAILED(isolate); +@@ -327,7 +421,7 @@ MaybeLocal New(Isolate* isolate, + if (actual > 0) [[likely]] { + if (actual < length) { + std::unique_ptr old_store = std::move(store); +- store = ArrayBuffer::NewBackingStore(isolate, actual); ++ store = CreateBackingStore(isolate, nullptr, actual, nullptr, nullptr); + memcpy(store->Data(), old_store->Data(), actual); + } + Local buf = ArrayBuffer::New(isolate, std::move(store)); +@@ -371,7 +465,7 @@ MaybeLocal New(Environment* env, size_t length) { + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); + std::unique_ptr bs = +- ArrayBuffer::NewBackingStore(isolate, length); ++ CreateBackingStore(isolate, nullptr, length, nullptr, nullptr); + + CHECK(bs); + +@@ -414,7 +508,7 @@ MaybeLocal Copy(Environment* env, const char* data, size_t length) { + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); + std::unique_ptr bs = +- ArrayBuffer::NewBackingStore(isolate, length); ++ CreateBackingStore(isolate, nullptr, length, nullptr, nullptr); + + CHECK(bs); + +@@ -515,7 +609,7 @@ MaybeLocal New(Environment* env, + free(data); + }; + std::unique_ptr bs = +- v8::ArrayBuffer::NewBackingStore(data, length, free_callback, nullptr); ++ CreateBackingStore(env->isolate(), data, length, free_callback, nullptr); + + Local ab = v8::ArrayBuffer::New(env->isolate(), std::move(bs)); + +@@ -1242,10 +1336,11 @@ void GetZeroFillToggle(const FunctionCallbackInfo& args) { + } else { + uint32_t* zero_fill_field = allocator->zero_fill_field(); + std::unique_ptr backing = +- ArrayBuffer::NewBackingStore(zero_fill_field, +- sizeof(*zero_fill_field), +- [](void*, size_t, void*) {}, +- nullptr); ++ CreateBackingStore(env->isolate(), ++ zero_fill_field, ++ sizeof(*zero_fill_field), ++ [](void*, size_t, void*) {}, ++ nullptr); + ab = ArrayBuffer::New(env->isolate(), std::move(backing)); + } + diff --git a/src/patch/22.17.1/run_third_party_main.js.patch b/src/patch/22.17.1/run_third_party_main.js.patch new file mode 100644 index 0000000..7994bee --- /dev/null +++ b/src/patch/22.17.1/run_third_party_main.js.patch @@ -0,0 +1,17 @@ +--- /dev/null ++++ b/lib/internal/main/run_third_party_main.js +@@ -0,0 +1,14 @@ ++'use strict'; ++ ++const { ++ prepareMainThreadExecution, ++ markBootstrapComplete ++} = require('internal/process/pre_execution'); ++ ++prepareMainThreadExecution(); ++markBootstrapComplete(); ++ ++// Legacy _third_party_main.js support ++process.nextTick(() => { ++ require('_third_party_main'); ++}); diff --git a/src/patch/22.17.1/v8_backing_store_callers.patch b/src/patch/22.17.1/v8_backing_store_callers.patch new file mode 100644 index 0000000..030b5ee --- /dev/null +++ b/src/patch/22.17.1/v8_backing_store_callers.patch @@ -0,0 +1,721 @@ +--- a/src/aliased_struct-inl.h ++++ b/src/aliased_struct-inl.h +@@ -6,6 +6,7 @@ + #include "aliased_struct.h" + #include "v8.h" + #include ++#include "node_buffer.h" + + namespace node { + +@@ -15,7 +16,7 @@ AliasedStruct::AliasedStruct(v8::Isolate* isolate, Args&&... args) + : isolate_(isolate) { + const v8::HandleScope handle_scope(isolate); + +- store_ = v8::ArrayBuffer::NewBackingStore(isolate, sizeof(T)); ++ store_ = node::Buffer::CreateBackingStore(isolate, nullptr, sizeof(T), nullptr, nullptr); + ptr_ = new (store_->Data()) T(std::forward(args)...); + DCHECK_NOT_NULL(ptr_); + + +--- a/src/crypto/crypto_cipher.cc ++++ b/src/crypto/crypto_cipher.cc +@@ -776,7 +776,7 @@ CipherBase::UpdateResult CipherBase::Update( + + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env()->isolate_data()); +- *out = ArrayBuffer::NewBackingStore(env()->isolate(), buf_len); ++ *out = node::Buffer::CreateBackingStore(env()->isolate(), nullptr, buf_len, nullptr, nullptr); + } + + buffer = { +@@ -789,10 +789,10 @@ CipherBase::UpdateResult CipherBase::Update( + + CHECK_LE(static_cast(buf_len), (*out)->ByteLength()); + if (buf_len == 0) { +- *out = ArrayBuffer::NewBackingStore(env()->isolate(), 0); ++ *out = node::Buffer::CreateBackingStore(env()->isolate(), nullptr, 0, nullptr, nullptr); + } else if (static_cast(buf_len) != (*out)->ByteLength()) { + std::unique_ptr old_out = std::move(*out); +- *out = ArrayBuffer::NewBackingStore(env()->isolate(), buf_len); ++ *out = node::Buffer::CreateBackingStore(env()->isolate(), nullptr, buf_len, nullptr, nullptr); + memcpy((*out)->Data(), old_out->Data(), buf_len); + } + +@@ -854,8 +854,8 @@ bool CipherBase::Final(std::unique_ptr* out) { + + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env()->isolate_data()); +- *out = ArrayBuffer::NewBackingStore( +- env()->isolate(), static_cast(ctx_.getBlockSize())); ++ *out = node::Buffer::CreateBackingStore( ++ env()->isolate(), nullptr, static_cast(ctx_.getBlockSize()), nullptr, nullptr); + } + + if (kind_ == kDecipher && +@@ -876,7 +876,7 @@ bool CipherBase::Final(std::unique_ptr* out) { + bool ok; + if (kind_ == kDecipher && mode == EVP_CIPH_CCM_MODE) { + ok = !pending_auth_failed_; +- *out = ArrayBuffer::NewBackingStore(env()->isolate(), 0); ++ *out = node::Buffer::CreateBackingStore(env()->isolate(), nullptr, 0, nullptr, nullptr); + } else { + int out_len = (*out)->ByteLength(); + ok = ctx_.update( +@@ -884,10 +884,10 @@ bool CipherBase::Final(std::unique_ptr* out) { + + CHECK_LE(static_cast(out_len), (*out)->ByteLength()); + if (out_len == 0) { +- *out = ArrayBuffer::NewBackingStore(env()->isolate(), 0); ++ *out = node::Buffer::CreateBackingStore(env()->isolate(), nullptr, 0, nullptr, nullptr); + } else if (static_cast(out_len) != (*out)->ByteLength()) { + std::unique_ptr old_out = std::move(*out); +- *out = ArrayBuffer::NewBackingStore(env()->isolate(), out_len); ++ *out = node::Buffer::CreateBackingStore(env()->isolate(), nullptr, out_len, nullptr, nullptr); + memcpy((*out)->Data(), old_out->Data(), out_len); + } + +@@ -974,7 +974,7 @@ bool PublicKeyCipher::Cipher( + + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); +- *out = ArrayBuffer::NewBackingStore(env->isolate(), out_len); ++ *out = node::Buffer::CreateBackingStore(env->isolate(), nullptr, out_len, nullptr, nullptr); + } + + if (EVP_PKEY_cipher( +@@ -988,10 +988,10 @@ bool PublicKeyCipher::Cipher( + + CHECK_LE(out_len, (*out)->ByteLength()); + if (out_len == 0) { +- *out = ArrayBuffer::NewBackingStore(env->isolate(), 0); ++ *out = node::Buffer::CreateBackingStore(env->isolate(), nullptr, 0, nullptr, nullptr); + } else if (out_len != (*out)->ByteLength()) { + std::unique_ptr old_out = std::move(*out); +- *out = ArrayBuffer::NewBackingStore(env->isolate(), out_len); ++ *out = node::Buffer::CreateBackingStore(env->isolate(), nullptr, out_len, nullptr, nullptr); + memcpy((*out)->Data(), old_out->Data(), out_len); + } + + +--- a/src/crypto/crypto_common.cc ++++ b/src/crypto/crypto_common.cc +@@ -310,7 +310,7 @@ MaybeLocal ECPointToBuffer(Environment* env, + std::unique_ptr bs; + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); +- bs = ArrayBuffer::NewBackingStore(env->isolate(), len); ++ bs = node::Buffer::CreateBackingStore(env->isolate(), nullptr, len, nullptr, nullptr); + } + + len = EC_POINT_point2oct(group, + + +--- a/src/crypto/crypto_dh.cc ++++ b/src/crypto/crypto_dh.cc +@@ -11,6 +11,7 @@ + #include "openssl/dh.h" + #include "threadpoolwork-inl.h" + #include "v8.h" ++#include "node_buffer.h" + + namespace node { + +@@ -53,7 +54,8 @@ void DiffieHellman::MemoryInfo(MemoryTracker* tracker) const { + + namespace { + MaybeLocal DataPointerToBuffer(Environment* env, DataPointer&& data) { +- auto backing = ArrayBuffer::NewBackingStore( ++ auto backing = node::Buffer::CreateBackingStore( ++ env->isolate(), + data.get(), + data.size(), + [](void* data, size_t len, void* ptr) { DataPointer free_me(data, len); }, + + +--- a/src/crypto/crypto_ec.cc ++++ b/src/crypto/crypto_ec.cc +@@ -207,7 +207,7 @@ void ECDH::ComputeSecret(const FunctionCallbackInfo& args) { + // NOTE: field_size is in bits + int field_size = EC_GROUP_get_degree(ecdh->group_); + size_t out_len = (field_size + 7) / 8; +- bs = ArrayBuffer::NewBackingStore(env->isolate(), out_len); ++ bs = node::Buffer::CreateBackingStore(env->isolate(), nullptr, out_len, nullptr, nullptr); + } + + if (!ECDH_compute_key( +@@ -260,8 +260,7 @@ void ECDH::GetPrivateKey(const FunctionCallbackInfo& args) { + std::unique_ptr bs; + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); +- bs = ArrayBuffer::NewBackingStore(env->isolate(), +- BignumPointer::GetByteCount(b)); ++ bs = node::Buffer::CreateBackingStore(env->isolate(), nullptr, BignumPointer::GetByteCount(b), nullptr, nullptr); + } + CHECK_EQ(bs->ByteLength(), + BignumPointer::EncodePaddedInto( + + +--- a/src/node_blob.cc ++++ b/src/node_blob.cc +@@ -12,6 +12,7 @@ + #include "permission/permission.h" + #include "util.h" + #include "v8.h" ++#include "node_buffer.h" + + #include + +@@ -83,7 +84,7 @@ void Concat(const FunctionCallbackInfo& args) { + } + + std::shared_ptr store = +- ArrayBuffer::NewBackingStore(env->isolate(), total); ++ node::Buffer::CreateBackingStore(env->isolate(), nullptr, total, nullptr, nullptr); + uint8_t* ptr = static_cast(store->Data()); + for (size_t n = 0; n < views.size(); n++) { + uint8_t* from = +@@ -211,7 +212,7 @@ void Blob::New(const FunctionCallbackInfo& args) { + + // If the ArrayBuffer is not detachable, we will copy from it instead. + std::shared_ptr store = +- ArrayBuffer::NewBackingStore(isolate, byte_length); ++ node::Buffer::CreateBackingStore(isolate, nullptr, byte_length, nullptr, nullptr); + uint8_t* ptr = static_cast(buf->Data()) + byte_offset; + std::copy(ptr, ptr + byte_length, static_cast(store->Data())); + return DataQueue::CreateInMemoryEntryFromBackingStore( +@@ -376,7 +377,7 @@ void Blob::Reader::Pull(const FunctionCallbackInfo& args) { + for (size_t n = 0; n < count; n++) total += vecs[n].len; + + std::shared_ptr store = +- ArrayBuffer::NewBackingStore(env->isolate(), total); ++ node::Buffer::CreateBackingStore(env->isolate(), nullptr, total, nullptr, nullptr); + auto ptr = static_cast(store->Data()); + for (size_t n = 0; n < count; n++) { + std::copy(vecs[n].base, vecs[n].base + vecs[n].len, ptr); + + +--- a/src/node_buffer.h ++++ b/src/node_buffer.h +@@ -86,6 +86,13 @@ static inline bool IsWithinBounds(size_t off, size_t len, size_t max) { + return true; + } + ++std::unique_ptr CreateBackingStore( ++ v8::Isolate* isolate, ++ void* data, ++ size_t byte_length, ++ v8::BackingStore::DeleterCallback deleter, ++ void* deleter_data); ++ + } // namespace Buffer + } // namespace node + + +--- a/src/node_http2.cc ++++ b/src/node_http2.cc +@@ -301,7 +301,7 @@ Local Http2Settings::Pack( + std::unique_ptr bs; + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); +- bs = ArrayBuffer::NewBackingStore(env->isolate(), count * 6); ++ bs = node::Buffer::CreateBackingStore(env->isolate(), nullptr, count * 6, nullptr, nullptr); + } + if (nghttp2_pack_settings_payload(static_cast(bs->Data()), + bs->ByteLength(), +@@ -470,10 +470,10 @@ Origins::Origins( + + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); +- bs_ = ArrayBuffer::NewBackingStore(env->isolate(), ++ bs_ = node::Buffer::CreateBackingStore(env->isolate(), nullptr, + alignof(nghttp2_origin_entry) - 1 + + count_ * sizeof(nghttp2_origin_entry) + +- origin_string_len); ++ origin_string_len, nullptr, nullptr); + } + + // Make sure the start address is aligned appropriately for an nghttp2_nv*. +@@ -2112,7 +2112,7 @@ void Http2Session::OnStreamRead(ssize_t nread, const uv_buf_t& buf_) { + [[likely]] { + // Shrink to the actual amount of used data. + std::unique_ptr old_bs = std::move(bs); +- bs = ArrayBuffer::NewBackingStore(env()->isolate(), nread); ++ bs = node::Buffer::CreateBackingStore(env()->isolate(), nullptr, nread, nullptr, nullptr); + memcpy(bs->Data(), old_bs->Data(), nread); + } else { + // This is a very unlikely case, and should only happen if the ReadStart() +@@ -2123,8 +2123,7 @@ void Http2Session::OnStreamRead(ssize_t nread, const uv_buf_t& buf_) { + std::unique_ptr new_bs; + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env()->isolate_data()); +- new_bs = ArrayBuffer::NewBackingStore(env()->isolate(), +- pending_len + nread); ++ new_bs = node::Buffer::CreateBackingStore(env()->isolate(), nullptr, pending_len + nread, nullptr, nullptr); + } + memcpy(static_cast(new_bs->Data()), + stream_buf_.base + stream_buf_offset_, + + +--- a/src/node_sea.cc ++++ b/src/node_sea.cc +@@ -12,6 +12,7 @@ + #include "node_union_bytes.h" + #include "node_v8_platform-inl.h" + #include "util-inl.h" ++#include "node_buffer.h" + + // The POSTJECT_SENTINEL_FUSE macro is a string of random characters selected by + // the Node.js project that is present only once in the entire binary. It is +@@ -592,7 +593,8 @@ void GetAsset(const FunctionCallbackInfo& args) { + } + // We cast away the constness here, the JS land should ensure that + // the data is not mutated. +- std::unique_ptr store = ArrayBuffer::NewBackingStore( ++ std::unique_ptr store = node::Buffer::CreateBackingStore( ++ args.GetIsolate(), + const_cast(it->second.data()), + it->second.size(), + [](void*, size_t, void*) {}, + + +--- a/src/node_sqlite.cc ++++ b/src/node_sqlite.cc +@@ -11,6 +11,7 @@ + #include "sqlite3.h" + #include "threadpoolwork-inl.h" + #include "util-inl.h" ++#include "node_buffer.h" + + #include + +@@ -103,7 +104,7 @@ using v8::Value; + static_cast(sqlite3_##from##_bytes(__VA_ARGS__)); \ + auto data = reinterpret_cast( \ + sqlite3_##from##_blob(__VA_ARGS__)); \ +- auto store = ArrayBuffer::NewBackingStore((isolate), size); \ ++ auto store = node::Buffer::CreateBackingStore(isolate, nullptr, size, nullptr, nullptr); \ + memcpy(store->Data(), data, size); \ + auto ab = ArrayBuffer::New((isolate), std::move(store)); \ + (result) = Uint8Array::New(ab, 0, size); \ + + +--- a/src/node_trace_events.cc ++++ b/src/node_trace_events.cc +@@ -4,6 +4,7 @@ + #include "node.h" + #include "node_external_reference.h" + #include "node_internals.h" ++#include "node_buffer.h" + #include "node_v8_platform-inl.h" + #include "tracing/agent.h" + #include "util-inl.h" +@@ -133,7 +134,8 @@ static void GetCategoryEnabledBuffer(const FunctionCallbackInfo& args) { + TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_name.out()); + uint8_t* enabled_pointer_cast = const_cast(enabled_pointer); + +- std::unique_ptr bs = ArrayBuffer::NewBackingStore( ++ std::unique_ptr bs = node::Buffer::CreateBackingStore( ++ isolate, + enabled_pointer_cast, + sizeof(*enabled_pointer_cast), + [](void*, size_t, void*) {}, + + +--- a/src/quic/session.cc ++++ b/src/quic/session.cc +@@ -31,6 +31,7 @@ + #include "streams.h" + #include "tlscontext.h" + #include "transportparams.h" ++#include "node_buffer.h" + + namespace node { + +@@ -1401,7 +1402,7 @@ void Session::DatagramReceived(const uint8_t* data, + // we just drop it on the floor. + if (state_->datagram == 0 || datalen == 0) return; + +- auto backing = ArrayBuffer::NewBackingStore(env()->isolate(), datalen); ++ auto backing = node::Buffer::CreateBackingStore(env()->isolate(), nullptr, datalen, nullptr, nullptr); + Debug(this, "Session is receiving datagram of size %zu", datalen); + memcpy(backing->Data(), data, datalen); + STAT_INCREMENT(Stats, datagrams_received); + + +--- a/src/quic/streams.cc ++++ b/src/quic/streams.cc +@@ -12,6 +12,7 @@ + #include "bindingdata.h" + #include "defs.h" + #include "session.h" ++#include "node_buffer.h" + + namespace node { + +@@ -959,7 +960,7 @@ void Stream::ReceiveData(const uint8_t* data, + } + + STAT_INCREMENT_N(Stats, bytes_received, len); +- auto backing = ArrayBuffer::NewBackingStore(env()->isolate(), len); ++ auto backing = node::Buffer::CreateBackingStore(env()->isolate(), nullptr, len, nullptr, nullptr); + memcpy(backing->Data(), data, len); + inbound_->append(DataQueue::CreateInMemoryEntryFromBackingStore( + std::move(backing), 0, len)); + + +--- a/src/quic/tlscontext.cc ++++ b/src/quic/tlscontext.cc +@@ -17,6 +17,7 @@ + #include "defs.h" + #include "session.h" + #include "transportparams.h" ++#include "node_buffer.h" + + namespace node { + +@@ -218,7 +219,7 @@ int TLSContext::OnNewSession(SSL* ssl, SSL_SESSION* sess) { + // and continue without emitting the sessionticket event. + if (size > 0 && size <= crypto::SecureContext::kMaxSessionSize) { + auto ticket = +- ArrayBuffer::NewBackingStore(session.env()->isolate(), size); ++ node::Buffer::CreateBackingStore(session.env()->isolate(), nullptr, size, nullptr, nullptr); + auto data = reinterpret_cast(ticket->Data()); + if (i2d_SSL_SESSION(sess, &data) > 0) { + session.EmitSessionTicket(Store(std::move(ticket), size)); + + +--- a/src/quic/transportparams.cc ++++ b/src/quic/transportparams.cc +@@ -11,6 +11,7 @@ + #include "endpoint.h" + #include "session.h" + #include "tokens.h" ++#include "node_buffer.h" + + namespace node { + +@@ -191,7 +192,7 @@ Store TransportParams::Encode(Environment* env, int version) { + + DCHECK_GT(size, 0); + +- auto result = ArrayBuffer::NewBackingStore(env->isolate(), size); ++ auto result = node::Buffer::CreateBackingStore(env->isolate(), nullptr, size, nullptr, nullptr); + + auto ret = ngtcp2_transport_params_encode_versioned( + static_cast(result->Data()), size, version, ¶ms_); + + +--- a/src/udp_wrap.cc ++++ b/src/udp_wrap.cc +@@ -755,11 +755,11 @@ void UDPWrap::OnRecv(ssize_t nread, + MakeCallback(env->onmessage_string(), arraysize(argv), argv); + return; + } else if (nread == 0) { +- bs = ArrayBuffer::NewBackingStore(isolate, 0); ++ bs = node::Buffer::CreateBackingStore(isolate, nullptr, 0, nullptr, nullptr); + } else if (static_cast(nread) != bs->ByteLength()) { + CHECK_LE(static_cast(nread), bs->ByteLength()); + std::unique_ptr old_bs = std::move(bs); +- bs = ArrayBuffer::NewBackingStore(isolate, nread); ++ bs = node::Buffer::CreateBackingStore(isolate, nullptr, nread, nullptr, nullptr); + memcpy(bs->Data(), old_bs->Data(), nread); + } + + +--- a/src/crypto/crypto_random.cc ++++ b/src/crypto/crypto_random.cc +@@ -6,6 +6,7 @@ + #include "ncrypto.h" + #include "threadpoolwork-inl.h" + #include "v8.h" ++#include "node_buffer.h" + + #include + +@@ -79,7 +80,7 @@ MaybeLocal RandomPrimeTraits::EncodeOutput( + Environment* env, const RandomPrimeConfig& params, ByteSource* unused) { + size_t size = params.prime.byteLength(); + std::shared_ptr store = +- ArrayBuffer::NewBackingStore(env->isolate(), size); ++ node::Buffer::CreateBackingStore(env->isolate(), nullptr, size, nullptr, nullptr); + CHECK_EQ(size, + BignumPointer::EncodePaddedInto( + params.prime.get(), + + +--- a/src/crypto/crypto_rsa.cc ++++ b/src/crypto/crypto_rsa.cc +@@ -8,6 +8,7 @@ + #include "memory_tracker-inl.h" + #include "threadpoolwork-inl.h" + #include "v8.h" ++#include "node_buffer.h" + + #include + #include +@@ -538,8 +539,8 @@ Maybe GetRsaKeyDetail(Environment* env, + std::unique_ptr public_exponent; + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); +- public_exponent = ArrayBuffer::NewBackingStore( +- env->isolate(), BignumPointer::GetByteCount(e)); ++ public_exponent = node::Buffer::CreateBackingStore( ++ env->isolate(), nullptr, BignumPointer::GetByteCount(e), nullptr, nullptr); + } + CHECK_EQ(BignumPointer::EncodePaddedInto( + e, + + +--- a/src/crypto/crypto_sig.cc ++++ b/src/crypto/crypto_sig.cc +@@ -9,7 +9,7 @@ + #include "openssl/ec.h" + #include "threadpoolwork-inl.h" + #include "v8.h" +- ++#include "node_buffer.h" + namespace node { + + using ncrypto::BignumPointer; +@@ -95,7 +95,7 @@ std::unique_ptr Node_SignFinal(Environment* env, + std::unique_ptr sig; + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); +- sig = ArrayBuffer::NewBackingStore(env->isolate(), sig_len); ++ sig = node::Buffer::CreateBackingStore(env->isolate(), nullptr, sig_len, nullptr, nullptr); + } + EVPKeyCtxPointer pkctx = pkey.newCtx(); + if (pkctx && EVP_PKEY_sign_init(pkctx.get()) > 0 && +@@ -109,10 +109,10 @@ std::unique_ptr Node_SignFinal(Environment* env, + m_len) > 0) { + CHECK_LE(sig_len, sig->ByteLength()); + if (sig_len == 0) { +- sig = ArrayBuffer::NewBackingStore(env->isolate(), 0); ++ sig = node::Buffer::CreateBackingStore(env->isolate(), nullptr, 0, nullptr, nullptr); + } else if (sig_len != sig->ByteLength()) { + std::unique_ptr old_sig = std::move(sig); +- sig = ArrayBuffer::NewBackingStore(env->isolate(), sig_len); ++ sig = node::Buffer::CreateBackingStore(env->isolate(), nullptr, sig_len, nullptr, nullptr); + memcpy(sig->Data(), old_sig->Data(), sig_len); + } + return sig; +@@ -171,7 +171,7 @@ std::unique_ptr ConvertSignatureToP1363( + std::unique_ptr buf; + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); +- buf = ArrayBuffer::NewBackingStore(env->isolate(), 2 * n); ++ buf = node::Buffer::CreateBackingStore(env->isolate(), nullptr, 2 * n, nullptr, nullptr); + } + if (!ExtractP1363(static_cast(signature->Data()), + static_cast(buf->Data()), + + +--- a/src/crypto/crypto_tls.cc ++++ b/src/crypto/crypto_tls.cc +@@ -1089,7 +1089,7 @@ int TLSWrap::DoWrite(WriteWrap* w, + if (nonempty_count != 1) { + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env()->isolate_data()); +- bs = ArrayBuffer::NewBackingStore(env()->isolate(), length); ++ bs = node::Buffer::CreateBackingStore(env()->isolate(), nullptr, length, nullptr, nullptr); + } + size_t offset = 0; + for (i = 0; i < count; i++) { +@@ -1108,7 +1108,7 @@ int TLSWrap::DoWrite(WriteWrap* w, + + if (written == -1) { + NoArrayBufferZeroFillScope no_zero_fill_scope(env()->isolate_data()); +- bs = ArrayBuffer::NewBackingStore(env()->isolate(), length); ++ bs = node::Buffer::CreateBackingStore(env()->isolate(), nullptr, length, nullptr, nullptr); + memcpy(bs->Data(), buf->base, buf->len); + } + } +@@ -1753,7 +1753,7 @@ void TLSWrap::GetFinished(const FunctionCallbackInfo& args) { + std::unique_ptr bs; + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); +- bs = ArrayBuffer::NewBackingStore(env->isolate(), len); ++ bs = node::Buffer::CreateBackingStore(env->isolate(), nullptr, len, nullptr, nullptr); + } + + CHECK_EQ(bs->ByteLength(), +@@ -1784,7 +1784,7 @@ void TLSWrap::GetPeerFinished(const FunctionCallbackInfo& args) { + std::unique_ptr bs; + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); +- bs = ArrayBuffer::NewBackingStore(env->isolate(), len); ++ bs = node::Buffer::CreateBackingStore(env->isolate(), nullptr, len, nullptr, nullptr); + } + + CHECK_EQ(bs->ByteLength(), +@@ -1813,7 +1813,7 @@ void TLSWrap::GetSession(const FunctionCallbackInfo& args) { + std::unique_ptr bs; + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); +- bs = ArrayBuffer::NewBackingStore(env->isolate(), slen); ++ bs = node::Buffer::CreateBackingStore(env->isolate(), nullptr, slen, nullptr, nullptr); + } + + unsigned char* p = static_cast(bs->Data()); +@@ -2000,7 +2000,7 @@ void TLSWrap::ExportKeyingMaterial(const FunctionCallbackInfo& args) { + std::unique_ptr bs; + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); +- bs = ArrayBuffer::NewBackingStore(env->isolate(), olen); ++ bs = node::Buffer::CreateBackingStore(env->isolate(), nullptr, olen, nullptr, nullptr); + } + + ByteSource context; + + +--- a/src/crypto/crypto_util.cc ++++ b/src/crypto/crypto_util.cc +@@ -333,11 +333,12 @@ ByteSource& ByteSource::operator=(ByteSource&& other) noexcept { + return *this; + } + +-std::unique_ptr ByteSource::ReleaseToBackingStore() { ++std::unique_ptr ByteSource::ReleaseToBackingStore(Environment* env) { + // It's ok for allocated_data_ to be nullptr but + // only if size_ is zero. + CHECK_IMPLIES(size_ > 0, allocated_data_ != nullptr); +- std::unique_ptr ptr = ArrayBuffer::NewBackingStore( ++ std::unique_ptr ptr = node::Buffer::CreateBackingStore( ++ env->isolate(), + allocated_data_, + size(), + [](void* data, size_t length, void* deleter_data) { +@@ -351,7 +352,7 @@ std::unique_ptr ByteSource::ReleaseToBackingStore() { + } + + Local ByteSource::ToArrayBuffer(Environment* env) { +- std::unique_ptr store = ReleaseToBackingStore(); ++ std::unique_ptr store = ReleaseToBackingStore(env); + return ArrayBuffer::New(env->isolate(), std::move(store)); + } + +@@ -668,7 +669,8 @@ void SecureBuffer(const FunctionCallbackInfo& args) { + return; + } + std::shared_ptr store = +- ArrayBuffer::NewBackingStore( ++ node::Buffer::CreateBackingStore( ++ env->isolate(), + data, + len, + [](void* data, size_t len, void* deleter_data) { + + +--- a/src/crypto/crypto_util.h ++++ b/src/crypto/crypto_util.h +@@ -241,7 +241,7 @@ class ByteSource { + // Creates a v8::BackingStore that takes over responsibility for + // any allocated data. The ByteSource will be reset with size = 0 + // after being called. +- std::unique_ptr ReleaseToBackingStore(); ++ std::unique_ptr ReleaseToBackingStore(Environment* env); + + v8::Local ToArrayBuffer(Environment* env); + + +--- a/src/crypto/crypto_x509.cc ++++ b/src/crypto/crypto_x509.cc +@@ -9,6 +9,7 @@ + #include "node_errors.h" + #include "util-inl.h" + #include "v8.h" ++#include "node_buffer.h" + + #include + #include +@@ -167,7 +168,8 @@ MaybeLocal ToV8Value(Local context, const BIOPointer& bio) { + MaybeLocal ToBuffer(Environment* env, BIOPointer* bio) { + if (bio == nullptr || !*bio) return {}; + BUF_MEM* mem = *bio; +- auto backing = ArrayBuffer::NewBackingStore( ++ auto backing = node::Buffer::CreateBackingStore( ++ env->isolate(), + mem->data, + mem->length, + [](void*, size_t, void* data) { +@@ -671,7 +673,7 @@ MaybeLocal GetPubKey(Environment* env, OSSL3_CONST RSA* rsa) { + std::unique_ptr bs; + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); +- bs = ArrayBuffer::NewBackingStore(env->isolate(), size); ++ bs = node::Buffer::CreateBackingStore(env->isolate(), nullptr, size, nullptr, nullptr); + } + + unsigned char* serialized = reinterpret_cast(bs->Data()); + + +--- a/src/encoding_binding.cc ++++ b/src/encoding_binding.cc +@@ -4,6 +4,7 @@ + #include "node_buffer.h" + #include "node_errors.h" + #include "node_external_reference.h" ++#include "node_buffer.h" + #include "simdutf.h" + #include "string_bytes.h" + #include "v8.h" +@@ -126,7 +127,7 @@ void BindingData::EncodeUtf8String(const FunctionCallbackInfo& args) { + { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); + std::unique_ptr bs = +- ArrayBuffer::NewBackingStore(isolate, length); ++ node::Buffer::CreateBackingStore(isolate, nullptr, length, nullptr, nullptr); + + CHECK(bs); + + +--- a/src/env.cc ++++ b/src/env.cc +@@ -750,7 +750,7 @@ void Environment::add_refs(int64_t diff) { + uv_buf_t Environment::allocate_managed_buffer(const size_t suggested_size) { + NoArrayBufferZeroFillScope no_zero_fill_scope(isolate_data()); + std::unique_ptr bs = +- v8::ArrayBuffer::NewBackingStore(isolate(), suggested_size); ++ node::Buffer::CreateBackingStore(isolate(), nullptr, suggested_size, nullptr, nullptr); + uv_buf_t buf = uv_buf_init(static_cast(bs->Data()), bs->ByteLength()); + released_allocated_buffers_.emplace(buf.base, std::move(bs)); + return buf; + + +--- a/src/stream_base.cc ++++ b/src/stream_base.cc +@@ -244,7 +244,7 @@ int StreamBase::Writev(const FunctionCallbackInfo& args) { + std::unique_ptr bs; + if (storage_size > 0) { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); +- bs = ArrayBuffer::NewBackingStore(isolate, storage_size); ++ bs = node::Buffer::CreateBackingStore(isolate, nullptr, storage_size, nullptr, nullptr); + } + + offset = 0; +@@ -399,13 +399,13 @@ int StreamBase::WriteString(const FunctionCallbackInfo& args) { + if (try_write) { + // Copy partial data + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); +- bs = ArrayBuffer::NewBackingStore(isolate, buf.len); ++ bs = node::Buffer::CreateBackingStore(isolate, nullptr, buf.len, nullptr, nullptr); + memcpy(bs->Data(), buf.base, buf.len); + data_size = buf.len; + } else { + // Write it + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); +- bs = ArrayBuffer::NewBackingStore(isolate, storage_size); ++ bs = node::Buffer::CreateBackingStore(isolate, nullptr, storage_size, nullptr, nullptr); + data_size = StringBytes::Write(isolate, + static_cast(bs->Data()), + storage_size, +@@ -707,7 +707,7 @@ void EmitToJSStreamListener::OnStreamRead(ssize_t nread, const uv_buf_t& buf_) { + CHECK_LE(static_cast(nread), bs->ByteLength()); + if (static_cast(nread) != bs->ByteLength()) { + std::unique_ptr old_bs = std::move(bs); +- bs = ArrayBuffer::NewBackingStore(isolate, nread); ++ bs = node::Buffer::CreateBackingStore(isolate, nullptr, nread, nullptr, nullptr); + memcpy(bs->Data(), old_bs->Data(), nread); + } + diff --git a/src/patch/22.17.1/v8config.patch b/src/patch/22.17.1/v8config.patch new file mode 100644 index 0000000..8721ee7 --- /dev/null +++ b/src/patch/22.17.1/v8config.patch @@ -0,0 +1,14 @@ +--- a/deps/v8/include/v8config.h ++++ b/deps/v8/include/v8config.h +@@ -491,8 +491,9 @@ + # define V8_ASSUME USE + #endif + +-// Prefer c++20 std::assume_aligned +-#if __cplusplus >= 202002L && defined(__cpp_lib_assume_aligned) ++// Prefer c++20 std::assume_aligned. Don't use it on MSVC though, because it's ++// not happy with our large 4GB alignment values. ++#if __cplusplus >= 202002L && defined(__cpp_lib_assume_aligned) && !V8_CC_MSVC + # define V8_ASSUME_ALIGNED(ptr, alignment) \ + std::assume_aligned<(alignment)>(ptr) + #elif V8_HAS_BUILTIN_ASSUME_ALIGNED diff --git a/src/patch/22.17.1/vcbuild.bat.patch b/src/patch/22.17.1/vcbuild.bat.patch new file mode 100644 index 0000000..34c786f --- /dev/null +++ b/src/patch/22.17.1/vcbuild.bat.patch @@ -0,0 +1,29 @@ +expose option for configuring pointer compression + + +--- a/vcbuild.bat ++++ b/vcbuild.bat +@@ -73,6 +73,7 @@ set doc= + set extra_msbuild_args= + set compile_commands= + set cfg= ++set v8_ptr_compress= + set exit_code=0 + + :next-arg +@@ -149,6 +150,7 @@ if /i "%1"=="cctest" set cctest=1&goto arg-ok + if /i "%1"=="openssl-no-asm" set openssl_no_asm=1&goto arg-ok + if /i "%1"=="no-shared-roheap" set no_shared_roheap=1&goto arg-ok + if /i "%1"=="doc" set doc=1&goto arg-ok ++if /i "%1"=="v8_ptr_compress" set v8_ptr_compress=1&goto arg-ok + if /i "%1"=="binlog" set extra_msbuild_args=/binaryLogger:out\%config%\node.binlog&goto arg-ok + if /i "%1"=="compile-commands" set compile_commands=1&goto arg-ok + if /i "%1"=="cfg" set cfg=1&goto arg-ok +@@ -210,6 +212,7 @@ if defined debug_nghttp2 set configure_flags=%configure_flags% --debug-nghttp + if defined openssl_no_asm set configure_flags=%configure_flags% --openssl-no-asm + if defined no_shared_roheap set configure_flags=%configure_flags% --disable-shared-readonly-heap + if defined DEBUG_HELPER set configure_flags=%configure_flags% --verbose ++if defined v8_ptr_compress set configure_flags=%configure_flags% --experimental-enable-pointer-compression + if defined ccache_path set configure_flags=%configure_flags% --use-ccache-win + if defined compile_commands set configure_flags=%configure_flags% -C + if defined cfg set configure_flags=%configure_flags% --control-flow-guard