From 487c1e0816040a398fc4bfb26d0efd435e51f0c8 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: 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 --- deps/v8/include/v8.h | 4 +++- deps/v8/src/api.cc | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'deps') diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index 362bece11f..0f1f74e6a1 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -1828,7 +1828,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 5f8f375200..3fec027b01 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -3023,15 +3023,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(); -- cgit v1.2.1