◐ Shell
clean mode source ↗

deps: add v8::Object::SetInternalFieldForNodeCore() · nodejs/node@425e011

Original file line numberDiff line numberDiff line change

@@ -5948,14 +5948,33 @@ Local<Value> v8::Object::SlowGetInternalField(int index) {

59485948

return Utils::ToLocal(value);

59495949

}

59505950
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);

59535954

const char* location = "v8::Object::SetInternalField()";

59545955

if (!InternalFieldOK(obj, index, location)) return;

59555956

i::Handle<i::Object> val = Utils::OpenHandle(*value);

59565957

i::Handle<i::JSObject>::cast(obj)->SetEmbedderField(index, *val);

59575958

}

59585959
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+
59595978

void* v8::Object::SlowGetAlignedPointerFromInternalField(int index) {

59605979

i::Handle<i::JSReceiver> obj = Utils::OpenHandle(this);

59615980

const char* location = "v8::Object::GetAlignedPointerFromInternalField()";