Commit 6bc61c59 authored by jiepan's avatar jiepan Committed by Commit Bot

[wasm] Fix printing of wasm prefixed opcode

Problem description:
For prefixed WASM opcode, opcode prefix is printed as Unknown, not the opcode itself.

Take v128.load as an example:
before fix                  ->  after fix
Unknown, 0x00, 0x04, 0x00,  ->  kExprS128LoadMem, 0x04, 0x00,

Change-Id: Id0cc5c723d19f60ad4f4f6c6ca338b5658c98c7e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1694613
Commit-Queue: Jie Pan <jie.pan@intel.com>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62697}
parent 76ad2c6e
......@@ -151,7 +151,12 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
unsigned length =
WasmDecoder<Decoder::kNoValidate>::OpcodeLength(&decoder, i.pc());
unsigned offset = 1;
WasmOpcode opcode = i.current();
if (WasmOpcodes::IsPrefixOpcode(opcode)) {
opcode = i.prefixed_opcode();
offset = 2;
}
if (line_numbers) line_numbers->push_back(i.position());
if (opcode == kExprElse || opcode == kExprCatch) {
control_depth--;
......@@ -188,7 +193,7 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
}
#undef CASE_LOCAL_TYPE
} else {
for (unsigned j = 1; j < length; ++j) {
for (unsigned j = offset; j < length; ++j) {
os << " 0x" << AsHex(i.pc()[j], 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