Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit425e011

Browse files
joyeecheungrichardlau
authored andcommitted
deps: add v8::Object::SetInternalFieldForNodeCore()
This is a non-ABI breaking solution forv8/v8@b60a03dandv8/v8@0aa622ewhich are necessary for backporting vm-related memory fixes to v18.x.PR-URL:#49874Backport-PR-URL:#51004Reviewed-By: Matteo Collina <matteo.collina@gmail.com>Reviewed-By: Anna Henningsen <anna@addaleax.net>Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
1 parentff334cb commit425e011

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

‎deps/v8/include/v8-object.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class Function;
2020
classFunctionTemplate;
2121
template<typename T>
2222
classPropertyCallbackInfo;
23+
classModule;
24+
classUnboundScript;
2325

2426
/**
2527
* A private symbol
@@ -480,6 +482,21 @@ class V8_EXPORT Object : public Value {
480482
/** Sets the value in an internal field.*/
481483
voidSetInternalField(int index, Local<Value> value);
482484

485+
/**
486+
* Warning: These are Node.js-specific extentions used to avoid breaking
487+
* changes in Node.js v18.x. They do not exist in V8 upstream and will
488+
* not exist in Node.js v21.x. Node.js embedders and addon authors should
489+
* not use them from v18.x.
490+
*/
491+
#ifndef NODE_WANT_INTERNALS
492+
V8_DEPRECATED("This extention should only be used by Node.js core")
493+
#endif
494+
voidSetInternalFieldForNodeCore(int index, Local<Module> value);
495+
#ifndef NODE_WANT_INTERNALS
496+
V8_DEPRECATED("This extention should only be used by Node.js core")
497+
#endif
498+
voidSetInternalFieldForNodeCore(int index, Local<UnboundScript> value);
499+
483500
/**
484501
* Gets a 2-byte-aligned native pointer from an internal field. This field
485502
* must have been set by SetAlignedPointerInInternalField, everything else

‎deps/v8/src/api/api.cc

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5948,14 +5948,33 @@ Local<Value> v8::Object::SlowGetInternalField(int index) {
59485948
returnUtils::ToLocal(value);
59495949
}
59505950

5951-
voidv8::Object::SetInternalField(int index, v8::Local<Value> value) {
5952-
i::Handle<i::JSReceiver> obj =Utils::OpenHandle(this);
5951+
template<typename T>
5952+
voidSetInternalFieldImpl(v8::Object* receiver,int index, v8::Local<T> value) {
5953+
i::Handle<i::JSReceiver> obj =Utils::OpenHandle(receiver);
59535954
constchar* 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+
voidv8::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+
voidv8::Object::SetInternalFieldForNodeCore(int index,
5969+
v8::Local<Module> value) {
5970+
SetInternalFieldImpl(this, index, value);
5971+
}
5972+
5973+
voidv8::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
constchar* location ="v8::Object::GetAlignedPointerFromInternalField()";

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp