Commit b76881dc538 for nodejs

commit b76881dc538f8130084b05583749078df5a19592
Author: Joyee Cheung <joyeec9h3@gmail.com>
Date:   Wed Dec 2 22:22:12 2026 +0100

    src: migrate off deprecated V8 15.8 APIs

    Migrate ArrayBufferView::Buffer() and WasmMemoryObject::Buffer() calls
    to GetBuffer() (returning Local<ArrayBufferBase>), RegExp::Exec() to
    RegExp::ExecV2(), and OwnedBuffer::buffer/size to
    OwnedBuffer::as_span().

    V8 16.0 removes ArrayBufferView::Buffer(), WasmMemoryObject::Buffer(),
    and the public OwnedBuffer fields, and changes RegExp::Exec() to return
    MaybeLocal<Value>.

    Refs: https://crrev.com/c/8714721
    Refs: https://crrev.com/c/8794471
    Co-Authored-By: Clemens Backes <post@clemens-backes.de>
    Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
    Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
    PR-URL: https://github.com/nodejs/node/pull/67913
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>

diff --git a/src/compile_cache.cc b/src/compile_cache.cc
index 90ed63f448a..6a8f8ff2d06 100644
--- a/src/compile_cache.cc
+++ b/src/compile_cache.cc
@@ -1,4 +1,5 @@
 #include "compile_cache.h"
+#include <span>
 #include <string>
 #include "debug_utils-inl.h"
 #include "env-inl.h"
@@ -336,10 +337,13 @@ ScriptCompiler::CachedData* SerializeCodeCache(Local<Module> mod) {
 // with the baseline tier so far.
 ScriptCompiler::CachedData* SerializeCodeCache(Local<WasmModuleObject> mod) {
   v8::OwnedBuffer code = mod->GetCompiledModule().Serialize();
-  if (code.size == 0) return nullptr;
+  if (code.empty()) return nullptr;
+  std::span<const uint8_t> span = code.as_span();
+  uint8_t* buffer = new uint8_t[span.size()];
+  memcpy(buffer, span.data(), span.size());
   return new ScriptCompiler::CachedData(
-      code.buffer.release(),
-      static_cast<int>(code.size),
+      buffer,
+      static_cast<int>(span.size()),
       ScriptCompiler::CachedData::BufferOwned);
 }

diff --git a/src/ffi/fast.cc b/src/ffi/fast.cc
index f7d829a9c2a..c55fe173cd5 100644
--- a/src/ffi/fast.cc
+++ b/src/ffi/fast.cc
@@ -247,7 +247,7 @@ extern "C" uintptr_t node_ffi_fast_buffer_data(v8::Local<v8::Value> value,
   constexpr uintptr_t kInvalidBuffer = std::numeric_limits<uintptr_t>::max();
   // The trampoline always passes the FastApiCallbackOptions declared in the
   // CFunctionInfo. No HandleScope is active during a Fast API call, and both
-  // ArrayBufferView::Buffer() and the error paths below create handles, so
+  // ArrayBufferView::GetBuffer() and the error paths below create handles, so
   // open one for the whole helper. Otherwise every call leaks handles into
   // the caller's scope.
   v8::Isolate* isolate = options->isolate;
diff --git a/src/node_ipc_serdes.cc b/src/node_ipc_serdes.cc
index 7d444814d8c..acdfca29b94 100644
--- a/src/node_ipc_serdes.cc
+++ b/src/node_ipc_serdes.cc
@@ -287,8 +287,9 @@ class IPCDeserializerDelegate : public ValueDeserializer::Delegate {
     // Reuse the backing ArrayBuffer when the data is suitably aligned,
     // otherwise copy into a fresh aligned buffer. Mirrors _readHostObject()
     // in lib/v8.js.
-    if (offset_in_ab % bytes_per_element == 0) {
-      return MakeView(env_, type_index, ab_, offset_in_ab, byte_length);
+    if (ab_->IsArrayBuffer() && offset_in_ab % bytes_per_element == 0) {
+      return MakeView(
+          env_, type_index, ab_.As<ArrayBuffer>(), offset_in_ab, byte_length);
     }
     std::shared_ptr<BackingStore> store =
         ArrayBuffer::NewBackingStore(isolate, byte_length);
diff --git a/src/node_url_pattern.cc b/src/node_url_pattern.cc
index 09bc46ab0f4..1e33ba8a531 100644
--- a/src/node_url_pattern.cc
+++ b/src/node_url_pattern.cc
@@ -117,13 +117,13 @@ bool URLPatternRegexProvider::regex_match(std::string_view input,
            .ToLocal(&local_input)) {
     return false;
   }
-  Local<Object> result_object;
+  Local<Value> result_object;
   if (!pattern.Get(isolate)
-           ->Exec(env->context(), local_input)
+           ->ExecV2(env->context(), local_input)
            .ToLocal(&result_object)) {
     return false;
   }
-  // RegExp::Exec returns null if there is no match.
+  // RegExp::ExecV2 returns null if there is no match.
   return !result_object->IsNull();
 }

@@ -138,9 +138,9 @@ URLPatternRegexProvider::regex_search(std::string_view input,
            .ToLocal(&local_input)) {
     return std::nullopt;
   }
-  Local<Object> exec_result_object;
+  Local<Value> exec_result_object;
   auto pattern = global_pattern.Get(isolate);
-  if (!pattern->Exec(env->context(), local_input)
+  if (!pattern->ExecV2(env->context(), local_input)
            .ToLocal(&exec_result_object) ||
       exec_result_object->IsNull()) {
     return std::nullopt;