Skip to content

Commit 487c1e0

Browse files
committed
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: v8/v8@8a011b5 PR-URL: nodejs#22531 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 2584052 commit 487c1e0

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
# Reset this number to 0 on major V8 upgrades.
3131
# Increment by one for each non-official patch applied to deps/v8.
32-
'v8_embedder_string': '-node.19',
32+
'v8_embedder_string': '-node.20',
3333

3434
# Enable disassembler for `--print-code` v8 options
3535
'v8_enable_disassembler': 1,

deps/v8/include/v8.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,9 @@ class V8_EXPORT StackTrace {
18281828
/**
18291829
* Returns a StackFrame at a particular index.
18301830
*/
1831-
Local<StackFrame> GetFrame(uint32_t index) const;
1831+
V8_DEPRECATE_SOON("Use Isolate version",
1832+
Local<StackFrame> GetFrame(uint32_t index) const);
1833+
Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;
18321834

18331835
/**
18341836
* Returns the number of StackFrames.

deps/v8/src/api.cc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3023,15 +3023,20 @@ void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) {
30233023

30243024
// --- S t a c k T r a c e ---
30253025

3026-
Local<StackFrame> StackTrace::GetFrame(uint32_t index) const {
3027-
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3026+
Local<StackFrame> StackTrace::GetFrame(Isolate* v8_isolate,
3027+
uint32_t index) const {
3028+
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
30283029
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
3029-
EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
3030+
EscapableHandleScope scope(v8_isolate);
30303031
auto obj = handle(Utils::OpenHandle(this)->get(index), isolate);
30313032
auto info = i::Handle<i::StackFrameInfo>::cast(obj);
30323033
return scope.Escape(Utils::StackFrameToLocal(info));
30333034
}
30343035

3036+
Local<StackFrame> StackTrace::GetFrame(uint32_t index) const {
3037+
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3038+
return GetFrame(reinterpret_cast<Isolate*>(isolate), index);
3039+
}
30353040

30363041
int StackTrace::GetFrameCount() const {
30373042
return Utils::OpenHandle(this)->length();

0 commit comments

Comments
 (0)