Commit 0b87c570 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Print handler tables together with WasmCode.

R=ahaas@chromium.org
BUG=v8:8091

Change-Id: I648e5a957e02d32e51c94175a6596801ca5ebd9e
Reviewed-on: https://chromium-review.googlesource.com/1188310
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55398}
parent 9d341c4c
......@@ -206,12 +206,12 @@ void HandlerTable::HandlerTableRangePrint(std::ostream& os) {
}
void HandlerTable::HandlerTableReturnPrint(std::ostream& os) {
os << " off hdlr\n";
os << " offset handler\n";
for (int i = 0; i < NumberOfReturnEntries(); ++i) {
int pc_offset = GetReturnOffset(i);
int handler_offset = GetReturnHandler(i);
os << " " << std::setw(4) << pc_offset << " -> " << std::setw(4)
<< handler_offset << "\n";
os << std::hex << " " << std::setw(4) << pc_offset << " -> "
<< std::setw(4) << handler_offset << std::dec << "\n";
}
}
......
......@@ -235,6 +235,9 @@ void WasmCode::Disassemble(const char* name, std::ostream& os,
if (safepoint_table_offset_ && safepoint_table_offset_ < instruction_size) {
instruction_size = safepoint_table_offset_;
}
if (handler_table_offset_ && handler_table_offset_ < instruction_size) {
instruction_size = handler_table_offset_;
}
DCHECK_LT(0, instruction_size);
os << "Instructions (size = " << instruction_size << ")\n";
Disassembler::Decode(nullptr, &os, instructions().start(),
......@@ -242,6 +245,14 @@ void WasmCode::Disassemble(const char* name, std::ostream& os,
CodeReference(this), current_pc);
os << "\n";
if (handler_table_offset_ > 0) {
HandlerTable table(instruction_start(), handler_table_offset_);
os << "Exception Handler Table (size = " << table.NumberOfReturnEntries()
<< "):\n";
table.HandlerTableReturnPrint(os);
os << "\n";
}
if (!protected_instructions_.is_empty()) {
os << "Protected instructions:\n pc offset land pad\n";
for (auto& data : protected_instructions()) {
......
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