Commit 8aa6f871 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[interpreter] Print bytecode offsets when dumping bytecode.

R=rmcilroy@chromium.org

Review URL: https://codereview.chromium.org/1803373002

Cr-Commit-Position: refs/heads/master@{#35363}
parent 3ad450bc
......@@ -14570,7 +14570,6 @@ int BytecodeArray::SourceStatementPosition(int offset) {
void BytecodeArray::Disassemble(std::ostream& os) {
os << "Parameter count " << parameter_count() << "\n";
os << "Frame size " << frame_size() << "\n";
Vector<char> buf = Vector<char>::New(50);
const uint8_t* base_address = GetFirstBytecodeAddress();
interpreter::SourcePositionTableIterator source_positions(
......@@ -14587,12 +14586,13 @@ void BytecodeArray::Disassemble(std::ostream& os) {
os << " ";
}
const uint8_t* current_address = base_address + iterator.current_offset();
SNPrintF(buf, "%p", current_address);
os << buf.start() << " : ";
os << reinterpret_cast<const void*>(current_address) << " @ "
<< std::setw(4) << iterator.current_offset() << " : ";
interpreter::Bytecodes::Decode(os, current_address, parameter_count());
if (interpreter::Bytecodes::IsJump(iterator.current_bytecode())) {
SNPrintF(buf, " (%p)", base_address + iterator.GetJumpTargetOffset());
os << buf.start();
const void* jump_target = base_address + iterator.GetJumpTargetOffset();
os << " (" << jump_target << " @ " << iterator.GetJumpTargetOffset()
<< ")";
}
os << std::endl;
iterator.Advance();
......
......@@ -117,10 +117,10 @@ RUNTIME_FUNCTION(Runtime_InterpreterTraceBytecodeEntry) {
AdvanceToOffsetForTracing(bytecode_iterator, offset);
if (offset == bytecode_iterator.current_offset()) {
// Print bytecode.
const uint8_t* bytecode_address =
reinterpret_cast<const uint8_t*>(*bytecode_array) + bytecode_offset;
os << " -> " << static_cast<const void*>(bytecode_address)
<< " (" << bytecode_offset << ") : ";
const uint8_t* base_address = bytecode_array->GetFirstBytecodeAddress();
const uint8_t* bytecode_address = base_address + offset;
os << " -> " << static_cast<const void*>(bytecode_address) << " @ "
<< std::setw(4) << offset << " : ";
interpreter::Bytecodes::Decode(os, bytecode_address,
bytecode_array->parameter_count());
os << std::endl;
......
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