From 3dc9cfc4af70cf96ff3955851c15915132a9e4f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sun, 26 Aug 2018 09:29:37 +0200 Subject: [PATCH] deps: backport StackFrame::GetFrame with isolate This overload was added in V8 6.9 and the one without isolate was removed in V8 7.0. Refs: https://github.com/v8/v8/commit/8a011b57d8b26e9cfe1c20a2ef26adb14be6ecc2 PR-URL: https://github.com/nodejs/node/pull/22531 Reviewed-By: Colin Ihrig Reviewed-By: Daniel Bevenius Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- common.gypi | 2 +- deps/v8/include/v8.h | 4 +++- deps/v8/src/api.cc | 11 ++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/common.gypi b/common.gypi index 0316afe7048df0..64c70c83975bee 100644 --- a/common.gypi +++ b/common.gypi @@ -29,7 +29,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.19', + 'v8_embedder_string': '-node.20', # Enable disassembler for `--print-code` v8 options 'v8_enable_disassembler': 1, diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index 5763393fe76a93..91001cf594ca26 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -1735,7 +1735,9 @@ class V8_EXPORT StackTrace { /** * Returns a StackFrame at a particular index. */ - Local GetFrame(uint32_t index) const; + V8_DEPRECATE_SOON("Use Isolate version", + Local GetFrame(uint32_t index) const); + Local GetFrame(Isolate* isolate, uint32_t index) const; /** * Returns the number of StackFrames. diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index 03c9f008465d5e..a2721f180e20a9 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -3015,15 +3015,20 @@ void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) { // --- S t a c k T r a c e --- -Local StackTrace::GetFrame(uint32_t index) const { - i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); +Local StackTrace::GetFrame(Isolate* v8_isolate, + uint32_t index) const { + i::Isolate* isolate = reinterpret_cast(v8_isolate); ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); - EscapableHandleScope scope(reinterpret_cast(isolate)); + EscapableHandleScope scope(v8_isolate); auto obj = handle(Utils::OpenHandle(this)->get(index), isolate); auto info = i::Handle::cast(obj); return scope.Escape(Utils::StackFrameToLocal(info)); } +Local StackTrace::GetFrame(uint32_t index) const { + i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); + return GetFrame(reinterpret_cast(isolate), index); +} int StackTrace::GetFrameCount() const { return Utils::OpenHandle(this)->length();