Commit 4de2137d authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[ia32] Tentative fix for invalid codegen on ia32

It looks like codegen on ia32 may sometimes miss a byte during
emit_arith. Our working theory is that this happens because `length`
in emit_operand, for whatever reason, is 0 and we thus do not advance
`pc_` correctly. The tentative fix is to use EMIT to increment the pc_
on each single write instead of relying on `length`.

Bug: v8:9774
Change-Id: I522eef96481f44f57628f914c9c170f1644ec47a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1824941
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63978}
parent 6b59680c
...@@ -3182,11 +3182,10 @@ void Assembler::emit_operand(int code, Operand adr) { ...@@ -3182,11 +3182,10 @@ void Assembler::emit_operand(int code, Operand adr) {
DCHECK_GT(length, 0); DCHECK_GT(length, 0);
// Emit updated ModRM byte containing the given register. // Emit updated ModRM byte containing the given register.
pc_[0] = (adr.buf_[0] & ~0x38) | (code << 3); EMIT((adr.buf_[0] & ~0x38) | (code << 3));
// Emit the rest of the encoded operand. // Emit the rest of the encoded operand.
for (unsigned i = 1; i < length; i++) pc_[i] = adr.buf_[i]; for (unsigned i = 1; i < length; i++) EMIT(adr.buf_[i]);
pc_ += length;
// Emit relocation information if necessary. // Emit relocation information if necessary.
if (length >= sizeof(int32_t) && !RelocInfo::IsNone(adr.rmode_)) { if (length >= sizeof(int32_t) && !RelocInfo::IsNone(adr.rmode_)) {
......
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