Skip to content

Commit 9a23bdd

Browse files
rmcilroyCommit Bot
authored andcommitted
[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 <[email protected]> Commit-Queue: Ross McIlroy <[email protected]> Cr-Commit-Position: refs/heads/master@{#54253}
1 parent 45eabd1 commit 9a23bdd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/isolate.cc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,8 +1671,17 @@ void Isolate::PrintCurrentStackTrace(FILE* out) {
16711671

16721672
Handle<Object> receiver(frame->receiver(), this);
16731673
Handle<JSFunction> function(frame->function(), this);
1674-
Handle<AbstractCode> code(AbstractCode::cast(frame->LookupCode()), this);
1675-
const int offset = static_cast<int>(frame->pc() - code->InstructionStart());
1674+
Handle<AbstractCode> code;
1675+
int offset;
1676+
if (frame->is_interpreted()) {
1677+
InterpretedFrame* interpreted_frame = InterpretedFrame::cast(frame);
1678+
code = handle(AbstractCode::cast(interpreted_frame->GetBytecodeArray()),
1679+
this);
1680+
offset = interpreted_frame->GetBytecodeOffset();
1681+
} else {
1682+
code = handle(AbstractCode::cast(frame->LookupCode()), this);
1683+
offset = static_cast<int>(frame->pc() - code->InstructionStart());
1684+
}
16761685

16771686
JSStackFrame site(this, receiver, function, code, offset);
16781687
Handle<String> line = site.ToString().ToHandleChecked();

0 commit comments

Comments
 (0)