Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
deps: cherry-pick 588e15c from V8 upstream
Original commit message:
    Fixes a bug in cmpw.

    The opcodes for 'cmpw r/m16, r16' and 'cmpw r16, r/m16' were
    swapped, causing a few issues when less than/greater than
    comparison were performed.

    Adds a regression test.

    BUG=621926

    Committed: https://crrev.com/efa7095e3e360fbadbe909d831ac11b268ca26b0
    Review-Url: https://codereview.chromium.org/2103713003
    Cr-Original-Commit-Position: refs/heads/master@{#37339}
    Cr-Commit-Position: refs/heads/master@{#37345}
  • Loading branch information
epertoso authored and cristiancavalli committed Aug 10, 2016
commit 55d238395f21267b815ed15a0199bc1b51ea8121
4 changes: 2 additions & 2 deletions deps/v8/src/ia32/assembler-ia32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -787,14 +787,14 @@ void Assembler::cmpw(const Operand& op, Immediate imm16) {
void Assembler::cmpw(Register reg, const Operand& op) {
EnsureSpace ensure_space(this);
EMIT(0x66);
EMIT(0x39);
EMIT(0x3B);
emit_operand(reg, op);
}

void Assembler::cmpw(const Operand& op, Register reg) {
EnsureSpace ensure_space(this);
EMIT(0x66);
EMIT(0x3B);
EMIT(0x39);
emit_operand(reg, op);
}

Expand Down
21 changes: 17 additions & 4 deletions deps/v8/src/ia32/disasm-ia32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1602,18 +1602,31 @@ int DisassemblerIA32::InstructionDecode(v8::internal::Vector<char> out_buffer,
while (*data == 0x66) data++;
if (*data == 0xf && data[1] == 0x1f) {
AppendToBuffer("nop"); // 0x66 prefix
} else if (*data == 0x90) {
AppendToBuffer("nop"); // 0x66 prefix
} else if (*data == 0x8B) {
} else if (*data == 0x39) {
data++;
data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data);
data += PrintOperands("cmpw", OPER_REG_OP_ORDER, data);
} else if (*data == 0x3B) {
data++;
data += PrintOperands("cmpw", REG_OPER_OP_ORDER, data);
} else if (*data == 0x81) {
data++;
AppendToBuffer("cmpw ");
data += PrintRightOperand(data);
int imm = *reinterpret_cast<int16_t*>(data);
AppendToBuffer(",0x%x", imm);
data += 2;
} else if (*data == 0x89) {
data++;
int mod, regop, rm;
get_modrm(*data, &mod, &regop, &rm);
AppendToBuffer("mov_w ");
data += PrintRightOperand(data);
AppendToBuffer(",%s", NameOfCPURegister(regop));
} else if (*data == 0x8B) {
data++;
data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data);
} else if (*data == 0x90) {
AppendToBuffer("nop"); // 0x66 prefix
} else if (*data == 0xC7) {
data++;
AppendToBuffer("%s ", "mov_w");
Expand Down