From ba267c12ed59bbe38186eb30e1aeba1abd2b9a25 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 07:40:14 +0000 Subject: [PATCH] chore: remove deps_add_v8_object_setinternalfieldfornodecore.patch This was a Node 20-specific workaround that's no longer needed in Node 22. Xref: https://github.com/nodejs/node/pull/49874. Co-authored-by: Charles Kerr --- patches/v8/.patches | 1 - ...8_object_setinternalfieldfornodecore.patch | 87 ------------------- 2 files changed, 88 deletions(-) delete mode 100644 patches/v8/deps_add_v8_object_setinternalfieldfornodecore.patch diff --git a/patches/v8/.patches b/patches/v8/.patches index 280a34b936037..dc98544242e85 100644 --- a/patches/v8/.patches +++ b/patches/v8/.patches @@ -1,2 +1 @@ chore_allow_customizing_microtask_policy_per_context.patch -deps_add_v8_object_setinternalfieldfornodecore.patch diff --git a/patches/v8/deps_add_v8_object_setinternalfieldfornodecore.patch b/patches/v8/deps_add_v8_object_setinternalfieldfornodecore.patch deleted file mode 100644 index b682b49f0e1ea..0000000000000 --- a/patches/v8/deps_add_v8_object_setinternalfieldfornodecore.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Tue, 14 Nov 2023 17:48:11 +0100 -Subject: deps: add v8::Object::SetInternalFieldForNodeCore() - -This is a non-ABI breaking solution added by Node.js in v20.x for: - -* https://chromium-review.googlesource.com/c/v8/v8/+/4827307 -* https://chromium-review.googlesource.com/c/v8/v8/+/4707972 - -which are necessary for backporting the vm-related memory fixes in https://github.com/nodejs/node/pull/48510. - -diff --git a/include/v8-object.h b/include/v8-object.h -index 3e57ae8efe33f326ef0e5d609c311d4be5b8afd6..dc521d39c2280dfc3217e97c1e413b2be9b4f7ff 100644 ---- a/include/v8-object.h -+++ b/include/v8-object.h -@@ -22,6 +22,8 @@ class Function; - class FunctionTemplate; - template - class PropertyCallbackInfo; -+class Module; -+class UnboundScript; - - /** - * A private symbol -@@ -532,6 +534,21 @@ class V8_EXPORT Object : public Value { - index); - } - -+ /** -+ * Warning: These are Node.js-specific extentions used to avoid breaking -+ * changes in Node.js v20.x. They do not exist in V8 upstream and will -+ * not exist in Node.js v21.x. Node.js embedders and addon authors should -+ * not use them from v20.x. -+ */ -+#ifndef NODE_WANT_INTERNALS -+ V8_DEPRECATED("This extention should only be used by Node.js core") -+#endif -+ void SetInternalFieldForNodeCore(int index, Local value); -+#ifndef NODE_WANT_INTERNALS -+ V8_DEPRECATED("This extention should only be used by Node.js core") -+#endif -+ void SetInternalFieldForNodeCore(int index, Local value); -+ - /** Same as above, but works for TracedReference. */ - V8_INLINE static void* GetAlignedPointerFromInternalField( - const BasicTracedReference& object, int index) { -diff --git a/src/api/api.cc b/src/api/api.cc -index 62a71b9cb7594e5fcc86f32d7af160c32b8e8944..0b2d5bfa9480ea90eb0adb89132505b8cabafc08 100644 ---- a/src/api/api.cc -+++ b/src/api/api.cc -@@ -6313,14 +6313,33 @@ Local v8::Object::SlowGetInternalField(int index) { - i::Cast(*obj)->GetEmbedderField(index), isolate)); - } - --void v8::Object::SetInternalField(int index, v8::Local value) { -- auto obj = Utils::OpenDirectHandle(this); -+template -+void SetInternalFieldImpl(v8::Object* receiver, int index, v8::Local value) { -+ auto obj = Utils::OpenDirectHandle(receiver); - const char* location = "v8::Object::SetInternalField()"; - if (!InternalFieldOK(obj, index, location)) return; - auto val = Utils::OpenDirectHandle(*value); - i::Cast(obj)->SetEmbedderField(index, *val); - } - -+void v8::Object::SetInternalField(int index, v8::Local value) { -+ SetInternalFieldImpl(this, index, value); -+} -+ -+/** -+ * These are Node.js-specific extentions used to avoid breaking changes in -+ * Node.js v20.x. -+ */ -+void v8::Object::SetInternalFieldForNodeCore(int index, -+ v8::Local value) { -+ SetInternalFieldImpl(this, index, value); -+} -+ -+void v8::Object::SetInternalFieldForNodeCore(int index, -+ v8::Local value) { -+ SetInternalFieldImpl(this, index, value); -+} -+ - void* v8::Object::SlowGetAlignedPointerFromInternalField(v8::Isolate* isolate, - int index) { - auto obj = Utils::OpenDirectHandle(this);