summaryrefslogtreecommitdiff
path: root/src/node_process_methods.cc
diff options
context:
space:
mode:
authorShelley Vohr <shelley.vohr@gmail.com>2022-06-21 14:08:41 +0200
committerJoyee Cheung <joyeec9h3@gmail.com>2022-08-09 16:47:43 +0800
commit8b0e5b19bd053714b3ff4e1d9e8743a13e463039 (patch)
tree38ca7dfd37ec095b77ab6e4c31bb443c16bffe77 /src/node_process_methods.cc
parent472edc775d683aed2d9ed39ca7cf381f3e7e3ce2 (diff)
downloadnode-new-8b0e5b19bd053714b3ff4e1d9e8743a13e463039.tar.gz
src: fix cppgc incompatibility in v8
This patch updates the layout of the BaseObjects to make sure that the first embedder field of them is a "type" pointer, the first 16 bits of which are the Node.js embedder ID, so that cppgc will always skip over them. In addition we now use this field to determine if the native object should be interpreted as a Node.js embedder object in the serialization and deserialization callbacks for the startup snapshot to improve the reliability. Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com> PR-URL: https://github.com/nodejs/node/pull/43521 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
Diffstat (limited to 'src/node_process_methods.cc')
-rw-r--r--src/node_process_methods.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc
index 9d4a5abb01..ae5f38ebf2 100644
--- a/src/node_process_methods.cc
+++ b/src/node_process_methods.cc
@@ -532,7 +532,7 @@ void BindingData::PrepareForSerialization(Local<Context> context,
}
InternalFieldInfo* BindingData::Serialize(int index) {
- DCHECK_EQ(index, BaseObject::kSlot);
+ DCHECK_EQ(index, BaseObject::kEmbedderType);
InternalFieldInfo* info = InternalFieldInfo::New(type());
return info;
}
@@ -541,7 +541,7 @@ void BindingData::Deserialize(Local<Context> context,
Local<Object> holder,
int index,
InternalFieldInfo* info) {
- DCHECK_EQ(index, BaseObject::kSlot);
+ DCHECK_EQ(index, BaseObject::kEmbedderType);
v8::HandleScope scope(context->GetIsolate());
Environment* env = Environment::GetCurrent(context);
// Recreate the buffer in the constructor.