@@ -11,7 +11,7 @@ This is a non-ABI breaking solution added by Node.js in v20.x for:
11
11
which are necessary for backporting the vm-related memory fixes in https://github.com/nodejs/node/pull/48510.
12
12
13
13
diff --git a/include/v8-object.h b/include/v8-object.h
14
- index4ab2e52e0c5dcb344e687e808f39a5cd9f4c736a..c6523c5cc818524160bf5b75af1b54656f1cc7c9 100644
14
+ index6cdf53b19c7d058bb66b9fcbe745874cc48daa99..8d112008c2667db97ed5b5af3f87c40d0ef8466a 100644
15
15
--- a/include/v8-object.h
16
16
+++ b/include/v8-object.h
17
17
@@ -20,6 +20,8 @@ class Function;
@@ -23,9 +23,9 @@ index 4ab2e52e0c5dcb344e687e808f39a5cd9f4c736a..c6523c5cc818524160bf5b75af1b5465
23
23
24
24
/**
25
25
* A private symbol
26
- @@ -500 ,6 +502 ,21 @@ class V8_EXPORT Object : public Value {
27
- */
28
- V8_INLINE void* GetAlignedPointerFromInternalField(int index);
26
+ @@ -509 ,6 +511 ,21 @@ class V8_EXPORT Object : public Value {
27
+ index);
28
+ }
29
29
30
30
+ /**
31
31
+ * Warning: These are Node.js-specific extentions used to avoid breaking
@@ -42,29 +42,18 @@ index 4ab2e52e0c5dcb344e687e808f39a5cd9f4c736a..c6523c5cc818524160bf5b75af1b5465
42
42
+ #endif
43
43
+ void SetInternalFieldForNodeCore(int index, Local<UnboundScript> value);
44
44
+
45
- /** Same as above, but works forPersistentBase . */
45
+ /** Same as above, but works forTracedReference . */
46
46
V8_INLINE static void* GetAlignedPointerFromInternalField(
47
- constPersistentBase <Object>& object, int index) {
47
+ constBasicTracedReference <Object>& object, int index) {
48
48
diff --git a/src/api/api.cc b/src/api/api.cc
49
- index3979ae69e897ba4f757b8a5fc3e8f21c21f88137..65997c6c4c0aa256231200092de9fdd2e8b62e6a 100644
49
+ index694aec891a48337fa0387d60bcc34e05752ff2f0..5b4ca8498fdadefab29e6258a1f12d7a61f064e6 100644
50
50
--- a/src/api/api.cc
51
51
+++ b/src/api/api.cc
52
- @@ -6302,14 +6302,33 @@ Local<Data> v8::Object::SlowGetInternalField(int index) {
53
- isolate);
52
+ @@ -6319,7 +6319,26 @@ Local<Data> v8::Object::SlowGetInternalField(int index) {
54
53
}
55
54
56
- - void v8::Object::SetInternalField(int index, v8::Local<Data> value) {
55
+ void v8::Object::SetInternalField(int index, v8::Local<Data> value) {
57
56
- auto obj = Utils::OpenDirectHandle(this);
58
- + template<typename T>
59
- + void SetInternalFieldImpl(v8::Object* receiver, int index, v8::Local<T> value) {
60
- + auto obj = Utils::OpenDirectHandle(receiver);
61
- const char* location = "v8::Object::SetInternalField()";
62
- if (!InternalFieldOK(obj, index, location)) return;
63
- auto val = Utils::OpenDirectHandle(*value);
64
- i::DirectHandle<i::JSObject>::cast(obj)->SetEmbedderField(index, *val);
65
- }
66
-
67
- + void v8::Object::SetInternalField(int index, v8::Local<Data> value) {
68
57
+ SetInternalFieldImpl(this, index, value);
69
58
+ }
70
59
+
@@ -82,6 +71,9 @@ index 3979ae69e897ba4f757b8a5fc3e8f21c21f88137..65997c6c4c0aa256231200092de9fdd2
82
71
+ SetInternalFieldImpl(this, index, value);
83
72
+ }
84
73
+
85
- void* v8::Object::SlowGetAlignedPointerFromInternalField(int index) {
86
- auto obj = Utils::OpenDirectHandle(this);
87
- const char* location = "v8::Object::GetAlignedPointerFromInternalField()";
74
+ + template<typename T>
75
+ + void SetInternalFieldImpl(v8::Object* receiver, int index, v8::Local<T> value) {
76
+ + auto obj = Utils::OpenDirectHandle(receiver);
77
+ const char* location = "v8::Object::SetInternalField()";
78
+ if (!InternalFieldOK(obj, index, location)) return;
79
+ auto val = Utils::OpenDirectHandle(*value);