Skip to content

Commit 5f0a257

Browse files
committed
deps: make V8 14.2 ABI-compatible with 14.1
- Reintroduce `GetIsolate` Refs: v8/v8@98282b9
1 parent 54aaeee commit 5f0a257

File tree

5 files changed

+53
-0
lines changed

5 files changed

+53
-0
lines changed

deps/v8/include/v8-context.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ class V8_EXPORT Context : public Data {
255255
*/
256256
Maybe<void> DeepFreeze(DeepFreezeDelegate* delegate = nullptr);
257257

258+
/** Returns the isolate associated with a current context. */
259+
V8_DEPRECATED(
260+
"Use Isolate::GetCurrent() instead, which is guaranteed to return the "
261+
"same isolate since https://crrev.com/c/6458560.")
262+
Isolate* GetIsolate();
263+
258264
/** Returns the microtask queue associated with a current context. */
259265
MicrotaskQueue* GetMicrotaskQueue();
260266

deps/v8/include/v8-internal.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,18 @@ class Internals {
13231323
#endif
13241324
}
13251325

1326+
V8_DEPRECATED(
1327+
"Use GetCurrentIsolateForSandbox() instead, which is guaranteed to "
1328+
"return the same isolate since https://crrev.com/c/6458560.")
1329+
V8_INLINE static v8::Isolate* GetIsolateForSandbox(Address obj) {
1330+
#ifdef V8_ENABLE_SANDBOX
1331+
return GetCurrentIsolate();
1332+
#else
1333+
// Not used in non-sandbox mode.
1334+
return nullptr;
1335+
#endif
1336+
}
1337+
13261338
// Returns v8::Isolate::Current(), but without needing to include the
13271339
// v8-isolate.h header.
13281340
V8_EXPORT static v8::Isolate* GetCurrentIsolate();

deps/v8/include/v8-message.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ class V8_EXPORT Message {
108108
public:
109109
Local<String> Get() const;
110110

111+
/**
112+
* Return the isolate to which the Message belongs.
113+
*/
114+
V8_DEPRECATED(
115+
"Use Isolate::GetCurrent() instead, which is guaranteed to return the "
116+
"same isolate since https://crrev.com/c/6458560.")
117+
Isolate* GetIsolate() const;
118+
111119
V8_WARN_UNUSED_RESULT MaybeLocal<String> GetSource(
112120
Local<Context> context) const;
113121
V8_WARN_UNUSED_RESULT MaybeLocal<String> GetSourceLine(

deps/v8/include/v8-object.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,21 @@ class V8_EXPORT Object : public Value {
899899
V8_WARN_UNUSED_RESULT MaybeLocal<Value> CallAsConstructor(
900900
Local<Context> context, int argc, Local<Value> argv[]);
901901

902+
/**
903+
* Return the isolate to which the Object belongs to.
904+
*/
905+
V8_DEPRECATED(
906+
"Use Isolate::GetCurrent() instead, which is guaranteed to return the "
907+
"same isolate since https://crrev.com/c/6458560.")
908+
Isolate* GetIsolate();
909+
910+
V8_DEPRECATED(
911+
"Use Isolate::GetCurrent() instead, which is guaranteed to return the "
912+
"same isolate since https://crrev.com/c/6458560.")
913+
V8_INLINE static Isolate* GetIsolate(const TracedReference<Object>& handle) {
914+
return handle.template value<Object>()->GetIsolate();
915+
}
916+
902917
/**
903918
* If this object is a Set, Map, WeakSet or WeakMap, this returns a
904919
* representation of the elements of this object as an array.

deps/v8/src/api/api.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2913,6 +2913,11 @@ Local<String> Message::Get() const {
29132913
return scope.Escape(result);
29142914
}
29152915

2916+
v8::Isolate* Message::GetIsolate() const {
2917+
i::Isolate* i_isolate = i::Isolate::Current();
2918+
return reinterpret_cast<Isolate*>(i_isolate);
2919+
}
2920+
29162921
ScriptOrigin Message::GetScriptOrigin() const {
29172922
auto self = Utils::OpenDirectHandle(this);
29182923
i::Isolate* i_isolate = i::Isolate::Current();
@@ -7205,6 +7210,8 @@ Maybe<void> Context::DeepFreeze(DeepFreezeDelegate* delegate) {
72057210
return JustVoid();
72067211
}
72077212

7213+
v8::Isolate* Context::GetIsolate() { return Isolate::GetCurrent(); }
7214+
72087215
v8::MicrotaskQueue* Context::GetMicrotaskQueue() {
72097216
auto env = Utils::OpenDirectHandle(this);
72107217
Utils::ApiCheck(i::IsNativeContext(*env), "v8::Context::GetMicrotaskQueue",
@@ -7796,6 +7803,11 @@ bool v8::String::StringEquals(Local<String> that) const {
77967803
return self->Equals(*other);
77977804
}
77987805

7806+
Isolate* v8::Object::GetIsolate() {
7807+
i::Isolate* i_isolate = i::Isolate::Current();
7808+
return reinterpret_cast<Isolate*>(i_isolate);
7809+
}
7810+
77997811
Local<v8::Object> v8::Object::New(Isolate* v8_isolate) {
78007812
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
78017813
ApiRuntimeCallStatsScope rcs_scope(i_isolate, RCCId::kAPI_Object_New);

0 commit comments

Comments
 (0)