Commit 9a23bdd7 authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[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/1126313Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54253}
parent 45eabd16
......@@ -1671,8 +1671,17 @@ void Isolate::PrintCurrentStackTrace(FILE* out) {
Handle<Object> receiver(frame->receiver(), this);
Handle<JSFunction> function(frame->function(), this);
Handle<AbstractCode> code(AbstractCode::cast(frame->LookupCode()), this);
const int offset = static_cast<int>(frame->pc() - code->InstructionStart());
Handle<AbstractCode> code;
int offset;
if (frame->is_interpreted()) {
InterpretedFrame* interpreted_frame = InterpretedFrame::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<int>(frame->pc() - code->InstructionStart());
}
JSStackFrame site(this, receiver, function, code, offset);
Handle<String> line = site.ToString().ToHandleChecked();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment