diff --git a/src/ia32/assembler-ia32.cc b/src/ia32/assembler-ia32.cc index 35e7996e29..6c70cc980c 100644 --- a/src/ia32/assembler-ia32.cc +++ b/src/ia32/assembler-ia32.cc @@ -785,6 +785,13 @@ void Assembler::cmpxchg_w(Operand dst, Register src) { emit_operand(src, dst); } +void Assembler::cmpxchg8b(Operand dst) { + EnsureSpace enure_space(this); + EMIT(0x0F); + EMIT(0xC7); + emit_operand(ecx, dst); +} + void Assembler::lfence() { EnsureSpace ensure_space(this); EMIT(0x0F); diff --git a/src/ia32/assembler-ia32.h b/src/ia32/assembler-ia32.h index 7da22192c6..560930ed28 100644 --- a/src/ia32/assembler-ia32.h +++ b/src/ia32/assembler-ia32.h @@ -667,6 +667,7 @@ class Assembler : public AssemblerBase { void cmpxchg(Operand dst, Register src); void cmpxchg_b(Operand dst, Register src); void cmpxchg_w(Operand dst, Register src); + void cmpxchg8b(Operand dst); // Memory Fence void lfence(); diff --git a/src/ia32/disasm-ia32.cc b/src/ia32/disasm-ia32.cc index 42f699bf82..eed6211834 100644 --- a/src/ia32/disasm-ia32.cc +++ b/src/ia32/disasm-ia32.cc @@ -1500,6 +1500,8 @@ static const char* F0Mnem(byte f0byte) { return "bsf"; case 0xBD: return "bsr"; + case 0xC7: + return "cmpxchg8b"; default: return nullptr; } @@ -1801,6 +1803,13 @@ int DisassemblerIA32::InstructionDecode(v8::internal::Vector out_buffer, get_modrm(*data, &mod, ®op, &rm); AppendToBuffer("%s %s,", f0mnem, NameOfCPURegister(regop)); data += PrintRightOperand(data); + } else if (f0byte == 0xC7) { + // cmpxchg8b + data += 2; + AppendToBuffer("%s ", f0mnem); + int mod, regop, rm; + get_modrm(*data, &mod, ®op, &rm); + data += PrintRightOperand(data); } else if (f0byte == 0xAE && (data[2] & 0xF8) == 0xE8) { AppendToBuffer("lfence"); data += 3; diff --git a/test/cctest/test-disasm-ia32.cc b/test/cctest/test-disasm-ia32.cc index 84764621c9..02e55538b7 100644 --- a/test/cctest/test-disasm-ia32.cc +++ b/test/cctest/test-disasm-ia32.cc @@ -871,6 +871,8 @@ TEST(DisasmIa320) { __ cmpxchg_b(Operand(esp, 12), eax); __ cmpxchg_w(Operand(ebx, ecx, times_4, 10000), eax); __ cmpxchg(Operand(ebx, ecx, times_4, 10000), eax); + __ cmpxchg(Operand(ebx, ecx, times_4, 10000), eax); + __ cmpxchg8b(Operand(ebx, ecx, times_8, 10000)); } // lock prefix.