From 9e2077afeee0b135fa6961a96314e00a95350ed0 Mon Sep 17 00:00:00 2001 From: Daniel Beckert Date: Wed, 15 Aug 2018 11:14:19 -0300 Subject: [PATCH] deps: backport 9a23bdd from upstream V8 Original commit message: [Isolate] Fix Isolate::PrintCurrentStackTrace for interpreted frames Previously we were getting the code object from the stack, so printed incorrect position details for interpreted frames. BUG=v8:7916 Change-Id: I2f87584117d88b7db3f3b9bdbfe793c4d3e33fe9 Reviewed-on: https://chromium-review.googlesource.com/1126313 Reviewed-by: Toon Verwaest Commit-Queue: Ross McIlroy Cr-Commit-Position: refs/heads/master@{#54253} Refs: https://github.com/v8/v8/commit/9a23bdd7ea2eba9a7a4439a7844e72fbf42bb3c4 Fixes: https://github.com/nodejs/node/issues/21988 PR-URL: https://github.com/nodejs/node/pull/22418 Refs: https://github.com/nodejs/node/pull/22338 Reviewed-By: Matheus Marchini Reviewed-By: Ujjwal Sharma Reviewed-By: Richard Lau --- deps/v8/include/v8-version.h | 2 +- deps/v8/src/isolate.cc | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 113e02667508ad..890a67c8446d40 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 6 #define V8_MINOR_VERSION 2 #define V8_BUILD_NUMBER 414 -#define V8_PATCH_LEVEL 66 +#define V8_PATCH_LEVEL 67 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/src/isolate.cc b/deps/v8/src/isolate.cc index 5149a2650e2a10..02f7d1df64e288 100644 --- a/deps/v8/src/isolate.cc +++ b/deps/v8/src/isolate.cc @@ -1532,9 +1532,17 @@ void Isolate::PrintCurrentStackTrace(FILE* out) { Handle receiver(frame->receiver(), this); Handle function(frame->function(), this); - Handle code(AbstractCode::cast(frame->LookupCode()), this); - const int offset = - static_cast(frame->pc() - code->instruction_start()); + Handle code; + int offset; + if (frame->is_interpreted()) { + InterpretedFrame* interpreted_frame = reinterpret_cast(frame); + code = handle(AbstractCode::cast(interpreted_frame->GetBytecodeArray()), + this); + offset = interpreted_frame->GetBytecodeOffset(); + } else { + code = handle(AbstractCode::cast(frame->LookupCode()), this); + offset = static_cast(frame->pc() - code->instruction_start()); + } JSStackFrame site(this, receiver, function, code, offset); Handle line = site.ToString().ToHandleChecked();