Commit ea535b90 authored by Juliana Franco's avatar Juliana Franco Committed by Commit Bot

Fix bytecode offset

Change DoComputeInterpretedFrame to print the right bytecode
offset, that is, it does not use header size and object tag.

Bug: 
Change-Id: Ibdd16a9d1178b4c7487164676007c6b9fdb3a33a
Reviewed-on: https://chromium-review.googlesource.com/566859
Commit-Queue: Juliana Patricia Vicente Franco <jupvfranco@google.com>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46558}
parent 2625037d
......@@ -248,6 +248,7 @@ void Deoptimizer::DeoptimizeMarkedCodeForContext(Context* context) {
shared->increment_deopt_count();
code->set_deopt_already_counted(true);
}
function->set_code(shared->code());
if (FLAG_trace_deopt) {
......@@ -287,6 +288,7 @@ void Deoptimizer::DeoptimizeMarkedCodeForContext(Context* context) {
}
SafepointEntry safepoint = code->GetSafepointEntry(it.frame()->pc());
int deopt_index = safepoint.deoptimization_index();
// Turbofan deopt is checked when we are patching addresses on stack.
bool turbofanned =
code->is_turbofanned() && function->shared()->asm_function();
......@@ -988,13 +990,17 @@ void Deoptimizer::DoComputeInterpretedFrame(TranslatedFrame* translated_frame,
// The bytecode offset was mentioned explicitly in the BEGIN_FRAME.
output_offset -= kPointerSize;
int raw_bytecode_offset =
BytecodeArray::kHeaderSize - kHeapObjectTag + bytecode_offset;
Smi* smi_bytecode_offset = Smi::FromInt(raw_bytecode_offset);
WriteValueToOutput(smi_bytecode_offset, 0, frame_index, output_offset,
"bytecode offset ");
output_[frame_index]->SetFrameSlot(
output_offset, reinterpret_cast<intptr_t>(smi_bytecode_offset));
if (trace_scope_ != nullptr) {
DebugPrintOutputSlot(reinterpret_cast<intptr_t>(smi_bytecode_offset),
frame_index, output_offset, "bytecode offset @ ");
PrintF(trace_scope_->file(), "%d\n", bytecode_offset);
PrintF(trace_scope_->file(), " -------------------------\n");
}
......
......@@ -14295,6 +14295,16 @@ void Code::PrintExtraICState(std::ostream& os, // NOLINT
#ifdef ENABLE_DISASSEMBLER
namespace {
void print_pc(std::ostream& os, int pc) {
if (pc == -1) {
os << "NA";
} else {
os << std::hex << pc << std::dec;
}
}
} // anonymous namespace
void DeoptimizationInputData::DeoptimizationInputDataPrint(
std::ostream& os) { // NOLINT
disasm::NameConverter converter;
......@@ -14314,14 +14324,12 @@ void DeoptimizationInputData::DeoptimizationInputDataPrint(
}
for (int i = 0; i < deopt_count; i++) {
os << std::setw(6) << i << " " << std::setw(15)
<< BytecodeOffset(i).ToInt() << " " << std::setw(13) << std::hex
<< TrampolinePc(i)->value() << " " << std::setw(6);
int pc_value = Pc(i)->value();
if (pc_value != -1) {
os << pc_value << std::dec;
} else {
os << "NA";
}
<< BytecodeOffset(i).ToInt() << " " << std::setw(13);
print_pc(os, TrampolinePc(i)->value());
os << std::setw(7);
print_pc(os, Pc(i)->value());
os << std::setw(2);
if (!FLAG_print_code_verbose) {
os << "\n";
......
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