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, ...@@ -210,10 +210,12 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
} }
} }
os << " // " << WasmOpcodes::OpcodeName(opcode);
switch (opcode) { switch (opcode) {
case kExprElse: case kExprElse:
case kExprCatch: case kExprCatch:
os << " // @" << i.pc_offset(); os << " @" << i.pc_offset();
control_depth++; control_depth++;
break; break;
case kExprLoop: case kExprLoop:
...@@ -222,7 +224,7 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body, ...@@ -222,7 +224,7 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
case kExprTry: { case kExprTry: {
BlockTypeImmediate<Decoder::kNoValidate> imm(WasmFeatures::All(), &i, BlockTypeImmediate<Decoder::kNoValidate> imm(WasmFeatures::All(), &i,
i.pc()); i.pc());
os << " // @" << i.pc_offset(); os << " @" << i.pc_offset();
if (decoder.Complete(imm)) { if (decoder.Complete(imm)) {
for (uint32_t i = 0; i < imm.out_arity(); i++) { for (uint32_t i = 0; i < imm.out_arity(); i++) {
os << " " << ValueTypes::TypeName(imm.out_type(i)); os << " " << ValueTypes::TypeName(imm.out_type(i));
...@@ -232,28 +234,28 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body, ...@@ -232,28 +234,28 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
break; break;
} }
case kExprEnd: case kExprEnd:
os << " // @" << i.pc_offset(); os << " @" << i.pc_offset();
control_depth--; control_depth--;
break; break;
case kExprBr: { case kExprBr: {
BranchDepthImmediate<Decoder::kNoValidate> imm(&i, i.pc()); BranchDepthImmediate<Decoder::kNoValidate> imm(&i, i.pc());
os << " // depth=" << imm.depth; os << " depth=" << imm.depth;
break; break;
} }
case kExprBrIf: { case kExprBrIf: {
BranchDepthImmediate<Decoder::kNoValidate> imm(&i, i.pc()); BranchDepthImmediate<Decoder::kNoValidate> imm(&i, i.pc());
os << " // depth=" << imm.depth; os << " depth=" << imm.depth;
break; break;
} }
case kExprBrTable: { case kExprBrTable: {
BranchTableImmediate<Decoder::kNoValidate> imm(&i, i.pc()); BranchTableImmediate<Decoder::kNoValidate> imm(&i, i.pc());
os << " // entries=" << imm.table_count; os << " entries=" << imm.table_count;
break; break;
} }
case kExprCallIndirect: { case kExprCallIndirect: {
CallIndirectImmediate<Decoder::kNoValidate> imm(WasmFeatures::All(), &i, CallIndirectImmediate<Decoder::kNoValidate> imm(WasmFeatures::All(), &i,
i.pc()); i.pc());
os << " // sig #" << imm.sig_index; os << " sig #" << imm.sig_index;
if (decoder.Complete(i.pc(), imm)) { if (decoder.Complete(i.pc(), imm)) {
os << ": " << *imm.sig; os << ": " << *imm.sig;
} }
...@@ -261,7 +263,7 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body, ...@@ -261,7 +263,7 @@ bool PrintRawWasmCode(AccountingAllocator* allocator, const FunctionBody& body,
} }
case kExprCallFunction: { case kExprCallFunction: {
CallFunctionImmediate<Decoder::kNoValidate> imm(&i, i.pc()); CallFunctionImmediate<Decoder::kNoValidate> imm(&i, i.pc());
os << " // function #" << imm.index; os << " function #" << imm.index;
if (decoder.Complete(i.pc(), imm)) { if (decoder.Complete(i.pc(), imm)) {
os << ": " << *imm.sig; 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