Commit 73c9a994 authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

Emit prefix bytes when printing wasm code

This is useful when generating mjsunit tests from the fuzzer, since
without the prefix bytes, the opcodes are invalid.

This affects the json output for tracing turbofan, so the source view
in turbolizer will see this prefix as well.

Change-Id: Icd112e0d140c13f96530797da721650201e00660
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2006392Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65845}
parent f5626ee2
......@@ -86,6 +86,17 @@ const char* RawOpcodeName(WasmOpcode opcode) {
}
return "Unknown";
}
const char* PrefixName(WasmOpcode prefix_opcode) {
switch (prefix_opcode) {
#define DECLARE_PREFIX_CASE(name, opcode) \
case k##name##Prefix: \
return "k" #name "Prefix";
FOREACH_PREFIX(DECLARE_PREFIX_CASE)
#undef DECLARE_PREFIX_CASE
default:
return "Unknown prefix";
}
}
} // namespace
bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
......@@ -154,6 +165,7 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
unsigned offset = 1;
WasmOpcode opcode = i.current();
if (WasmOpcodes::IsPrefixOpcode(opcode)) {
os << PrefixName(opcode) << ", ";
opcode = i.prefixed_opcode();
offset = 2;
}
......
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