Commit a0cbfe75 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Add comment after each line of generated wasm test code

This makes the output of --wasm-fuzzer-gen-test more useful by adding a
comment at the end of each line. This prevents clang-format from
breaking up individual lines.

R=ahaas@chromium.org

Bug: v8:10177
Change-Id: I222f7e30c84712357159e837e8b2e36737696669
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2036076Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66099}
parent 8bb8d187
......@@ -210,10 +210,12 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
}
}
os << " // " << WasmOpcodes::OpcodeName(opcode);
switch (opcode) {
case kExprElse:
case kExprCatch:
os << " // @" << i.pc_offset();
os << " @" << i.pc_offset();
control_depth++;
break;
case kExprLoop:
......@@ -222,7 +224,7 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
case kExprTry: {
BlockTypeImmediate<Decoder::kNoValidate> imm(WasmFeatures::All(), &i,
i.pc());
os << " // @" << i.pc_offset();
os << " @" << i.pc_offset();
if (decoder.Complete(imm)) {
for (uint32_t i = 0; i < imm.out_arity(); i++) {
os << " " << ValueTypes::TypeName(imm.out_type(i));
......@@ -232,28 +234,28 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
break;
}
case kExprEnd:
os << " // @" << i.pc_offset();
os << " @" << i.pc_offset();
control_depth--;
break;
case kExprBr: {
BranchDepthImmediate<Decoder::kNoValidate> imm(&i, i.pc());
os << " // depth=" << imm.depth;
os << " depth=" << imm.depth;
break;
}
case kExprBrIf: {
BranchDepthImmediate<Decoder::kNoValidate> imm(&i, i.pc());
os << " // depth=" << imm.depth;
os << " depth=" << imm.depth;
break;
}
case kExprBrTable: {
BranchTableImmediate<Decoder::kNoValidate> imm(&i, i.pc());
os << " // entries=" << imm.table_count;
os << " entries=" << imm.table_count;
break;
}
case kExprCallIndirect: {
CallIndirectImmediate<Decoder::kNoValidate> imm(WasmFeatures::All(), &i,
i.pc());
os << " // sig #" << imm.sig_index;
os << " sig #" << imm.sig_index;
if (decoder.Complete(i.pc(), imm)) {
os << ": " << *imm.sig;
}
......@@ -261,7 +263,7 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
}
case kExprCallFunction: {
CallFunctionImmediate<Decoder::kNoValidate> imm(&i, i.pc());
os << " // function #" << imm.index;
os << " function #" << imm.index;
if (decoder.Complete(i.pc(), imm)) {
os << ": " << *imm.sig;
}
......
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