Commit d60404e3 authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[wasm] Print instruction range if disassembler is disabled

Even if the instructions cannot be dissembled, it still often helps to
know which range of instructions belongs to which function. Thus print
this information on --print-wasm-code if the disassembler is not
available.

R=thibaudm@chromium.org

Change-Id: I9e7a4cb6ae4edf3411740fe4dfee248a5b9439ec
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3563564Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79734}
parent 388fdafc
......@@ -388,7 +388,6 @@ void WasmCode::Disassemble(const char* name, std::ostream& os,
os << "Body (size = " << instructions().size() << " = "
<< unpadded_binary_size_ << " + " << padding << " padding)\n";
#ifdef ENABLE_DISASSEMBLER
int instruction_size = unpadded_binary_size_;
if (constant_pool_offset_ < instruction_size) {
instruction_size = constant_pool_offset_;
......@@ -400,6 +399,8 @@ void WasmCode::Disassemble(const char* name, std::ostream& os,
instruction_size = handler_table_offset_;
}
DCHECK_LT(0, instruction_size);
#ifdef ENABLE_DISASSEMBLER
os << "Instructions (size = " << instruction_size << ")\n";
Disassembler::Decode(nullptr, os, instructions().begin(),
instructions().begin() + instruction_size,
......@@ -446,7 +447,11 @@ void WasmCode::Disassemble(const char* name, std::ostream& os,
it.rinfo()->Print(nullptr, os);
}
os << "\n";
#endif // ENABLE_DISASSEMBLER
#else // !ENABLE_DISASSEMBLER
os << "Instructions (size = " << instruction_size << ", "
<< static_cast<void*>(instructions().begin()) << "-"
<< static_cast<void*>(instructions().begin() + instruction_size) << ")\n";
#endif // !ENABLE_DISASSEMBLER
}
const char* GetWasmCodeKindAsString(WasmCode::Kind kind) {
......
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