From 99395bb4886d89d7f95268a779035a9c8e85308a Mon Sep 17 00:00:00 2001 From: Shawn Salekin Date: Mon, 16 Mar 2026 09:26:16 -0400 Subject: [PATCH 1/3] added data type tags to SetAlignedPointerInInternalField and GetAlignedPointerFromInternalField for v8 >= 14 --- nan.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nan.h b/nan.h index a0f90aa9..79bbefc6 100644 --- a/nan.h +++ b/nan.h @@ -819,14 +819,26 @@ inline uv_loop_t* GetCurrentEventLoop() { inline void* GetInternalFieldPointer( v8::Local object , int index) { +# if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION >= 14) + return object->GetAlignedPointerFromInternalField( + index, v8::kEmbedderDataTypeTagDefault + ); +# else return object->GetAlignedPointerFromInternalField(index); +# endif } inline void SetInternalFieldPointer( v8::Local object , int index , void* value) { +# if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION >= 14) + object->SetAlignedPointerInInternalField( + index, value, v8::kEmbedderDataTypeTagDefault + ); +# else object->SetAlignedPointerInInternalField(index, value); +# endif } # define NAN_GC_CALLBACK(name) \ From 28afdf0e4be050d04dabaca7402e7b4f70b31d78 Mon Sep 17 00:00:00 2001 From: Shawn Salekin Date: Tue, 17 Mar 2026 09:58:03 -0400 Subject: [PATCH 2/3] Added more specific v8 version check (14.2.194) --- nan.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/nan.h b/nan.h index 79bbefc6..02aa4e81 100644 --- a/nan.h +++ b/nan.h @@ -819,7 +819,10 @@ inline uv_loop_t* GetCurrentEventLoop() { inline void* GetInternalFieldPointer( v8::Local object , int index) { -# if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION >= 14) +#if (V8_MAJOR_VERSION > 14) || \ + (V8_MAJOR_VERSION == 14 && V8_MINOR_VERSION > 2) || \ + (V8_MAJOR_VERSION == 14 && V8_MINOR_VERSION == 2 && \ + V8_BUILD_NUMBER >= 194) return object->GetAlignedPointerFromInternalField( index, v8::kEmbedderDataTypeTagDefault ); @@ -832,7 +835,11 @@ inline uv_loop_t* GetCurrentEventLoop() { v8::Local object , int index , void* value) { -# if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION >= 14) +#if (V8_MAJOR_VERSION > 14) || \ + (V8_MAJOR_VERSION == 14 && V8_MINOR_VERSION > 2) || \ + (V8_MAJOR_VERSION == 14 && V8_MINOR_VERSION == 2 && \ + V8_BUILD_NUMBER >= 194) + return object->GetAlignedPointerFromInternalField( object->SetAlignedPointerInInternalField( index, value, v8::kEmbedderDataTypeTagDefault ); From 45b8187e06c83d4e21cd14db79ae803a1203ca8c Mon Sep 17 00:00:00 2001 From: Shawn Salekin Date: Tue, 17 Mar 2026 10:04:19 -0400 Subject: [PATCH 3/3] improved readability --- nan.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/nan.h b/nan.h index 02aa4e81..852092f5 100644 --- a/nan.h +++ b/nan.h @@ -821,8 +821,7 @@ inline uv_loop_t* GetCurrentEventLoop() { , int index) { #if (V8_MAJOR_VERSION > 14) || \ (V8_MAJOR_VERSION == 14 && V8_MINOR_VERSION > 2) || \ - (V8_MAJOR_VERSION == 14 && V8_MINOR_VERSION == 2 && \ - V8_BUILD_NUMBER >= 194) + (V8_MAJOR_VERSION == 14 && V8_MINOR_VERSION == 2 && V8_BUILD_NUMBER >= 194) return object->GetAlignedPointerFromInternalField( index, v8::kEmbedderDataTypeTagDefault ); @@ -837,8 +836,7 @@ inline uv_loop_t* GetCurrentEventLoop() { , void* value) { #if (V8_MAJOR_VERSION > 14) || \ (V8_MAJOR_VERSION == 14 && V8_MINOR_VERSION > 2) || \ - (V8_MAJOR_VERSION == 14 && V8_MINOR_VERSION == 2 && \ - V8_BUILD_NUMBER >= 194) + (V8_MAJOR_VERSION == 14 && V8_MINOR_VERSION == 2 && V8_BUILD_NUMBER >= 194) return object->GetAlignedPointerFromInternalField( object->SetAlignedPointerInInternalField( index, value, v8::kEmbedderDataTypeTagDefault