@@ -5948,14 +5948,33 @@ Local<Value> v8::Object::SlowGetInternalField(int index) {
5948
5948
return Utils::ToLocal(value);
5949
5949
}
5950
5950
5951
- void v8::Object::SetInternalField(int index, v8::Local<Value> value) {
5952
- i::Handle<i::JSReceiver> obj = Utils::OpenHandle(this);
5951
+ template<typename T>
5952
+ void SetInternalFieldImpl(v8::Object* receiver, int index, v8::Local<T> value) {
5953
+ i::Handle<i::JSReceiver> obj = Utils::OpenHandle(receiver);
5953
5954
const char* location = "v8::Object::SetInternalField()";
5954
5955
if (!InternalFieldOK(obj, index, location)) return;
5955
5956
i::Handle<i::Object> val = Utils::OpenHandle(*value);
5956
5957
i::Handle<i::JSObject>::cast(obj)->SetEmbedderField(index, *val);
5957
5958
}
5958
5959
5960
+ void v8::Object::SetInternalField(int index, v8::Local<Value> value) {
5961
+ SetInternalFieldImpl(this, index, value);
5962
+ }
5963
+
5964
+ /**
5965
+ * These are Node.js-specific extentions used to avoid breaking changes in
5966
+ * Node.js v20.x.
5967
+ */
5968
+ void v8::Object::SetInternalFieldForNodeCore(int index,
5969
+ v8::Local<Module> value) {
5970
+ SetInternalFieldImpl(this, index, value);
5971
+ }
5972
+
5973
+ void v8::Object::SetInternalFieldForNodeCore(int index,
5974
+ v8::Local<UnboundScript> value) {
5975
+ SetInternalFieldImpl(this, index, value);
5976
+ }
5977
+
5959
5978
void* v8::Object::SlowGetAlignedPointerFromInternalField(int index) {
5960
5979
i::Handle<i::JSReceiver> obj = Utils::OpenHandle(this);
5961
5980
const char* location = "v8::Object::GetAlignedPointerFromInternalField()";
0 commit comments