[disassembler] Increase padding on x64

There are instructions that take 7 bytes, e.g.
4881ec10000000 REX.W subq rsp,0x10

Hence increase the padding from 12 characters to 14 characters to
restore alignment.

Drive-by: Rewrite the padding loop to make it more readable and add a
comment.

R=jkummerow@chromium.org

Change-Id: Iddd6a721574fc47b4a072fe40c2f5e90cb3d1186
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2996200
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75480}
This commit is contained in:
Clemens Backes 2021-06-30 14:34:57 +02:00 committed by V8 LUCI CQ
parent ed6b07a607
commit 16515b162f
2 changed files with 4 additions and 2 deletions

View File

@ -2885,7 +2885,8 @@ int DisassemblerIA32::InstructionDecode(v8::base::Vector<char> out_buffer,
for (byte* bp = instr; bp < data; bp++) {
outp += v8::base::SNPrintF(out_buffer + outp, "%02x", *bp);
}
for (int i = 6 - instr_len; i >= 0; i--) {
// Indent instruction, leaving space for 6 bytes, i.e. 12 characters in hex.
while (outp < 12) {
outp += v8::base::SNPrintF(out_buffer + outp, " ");
}

View File

@ -2801,7 +2801,8 @@ int DisassemblerX64::InstructionDecode(v8::base::Vector<char> out_buffer,
for (byte* bp = instr; bp < data; bp++) {
outp += v8::base::SNPrintF(out_buffer + outp, "%02x", *bp);
}
for (int i = 6 - instr_len; i >= 0; i--) {
// Indent instruction, leaving space for 7 bytes, i.e. 14 characters in hex.
while (outp < 14) {
outp += v8::base::SNPrintF(out_buffer + outp, " ");
}