diff options
Diffstat (limited to 'deps/v8/src/ia32/disasm-ia32.cc')
-rw-r--r-- | deps/v8/src/ia32/disasm-ia32.cc | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/deps/v8/src/ia32/disasm-ia32.cc b/deps/v8/src/ia32/disasm-ia32.cc index 42f699bf82a..75cd9a258a1 100644 --- a/deps/v8/src/ia32/disasm-ia32.cc +++ b/deps/v8/src/ia32/disasm-ia32.cc @@ -228,15 +228,16 @@ void InstructionTable::AddJumpConditionalShort() { // The IA32 disassembler implementation. class DisassemblerIA32 { public: - DisassemblerIA32(const NameConverter& converter, - bool abort_on_unimplemented = true) + DisassemblerIA32( + const NameConverter& converter, + Disassembler::UnimplementedOpcodeAction unimplemented_opcode_action) : converter_(converter), vex_byte0_(0), vex_byte1_(0), vex_byte2_(0), instruction_table_(InstructionTable::get_instance()), tmp_buffer_pos_(0), - abort_on_unimplemented_(abort_on_unimplemented) { + unimplemented_opcode_action_(unimplemented_opcode_action) { tmp_buffer_[0] = '\0'; } @@ -254,7 +255,7 @@ class DisassemblerIA32 { InstructionTable* instruction_table_; v8::internal::EmbeddedVector<char, 128> tmp_buffer_; unsigned int tmp_buffer_pos_; - bool abort_on_unimplemented_; + Disassembler::UnimplementedOpcodeAction unimplemented_opcode_action_; enum { eax = 0, @@ -392,8 +393,9 @@ class DisassemblerIA32 { PRINTF_FORMAT(2, 3) void AppendToBuffer(const char* format, ...); void UnimplementedInstruction() { - if (abort_on_unimplemented_) { - UNIMPLEMENTED(); + if (unimplemented_opcode_action_ == + Disassembler::kAbortOnUnimplementedOpcode) { + FATAL("Unimplemented instruction in disassembler"); } else { AppendToBuffer("'Unimplemented Instruction'"); } @@ -1500,6 +1502,8 @@ static const char* F0Mnem(byte f0byte) { return "bsf"; case 0xBD: return "bsr"; + case 0xC7: + return "cmpxchg8b"; default: return nullptr; } @@ -1745,6 +1749,11 @@ int DisassemblerIA32::InstructionDecode(v8::internal::Vector<char> out_buffer, NameOfXMMRegister(regop), static_cast<int>(imm8)); data += 2; + } else if (f0byte >= 0xC8 && f0byte <= 0xCF) { + // bswap + data += 2; + int reg = f0byte - 0xC8; + AppendToBuffer("bswap %s", NameOfCPURegister(reg)); } else if ((f0byte & 0xF0) == 0x80) { data += JumpConditional(data, branch_hint); } else if (f0byte == 0xBE || f0byte == 0xBF || f0byte == 0xB6 || @@ -1801,6 +1810,13 @@ int DisassemblerIA32::InstructionDecode(v8::internal::Vector<char> 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; @@ -2490,6 +2506,9 @@ int DisassemblerIA32::InstructionDecode(v8::internal::Vector<char> out_buffer, case 0x5F: mnem = "maxss"; break; + case 0x7E: + mnem = "movq"; + break; } data += 3; int mod, regop, rm; @@ -2619,32 +2638,20 @@ const char* NameConverter::NameInCode(byte* addr) const { //------------------------------------------------------------------------------ -Disassembler::Disassembler(const NameConverter& converter) - : converter_(converter) {} - - -Disassembler::~Disassembler() {} - - int Disassembler::InstructionDecode(v8::internal::Vector<char> buffer, byte* instruction) { - DisassemblerIA32 d(converter_, false /*do not crash if unimplemented*/); - return d.InstructionDecode(buffer, instruction); -} - -int Disassembler::InstructionDecodeForTesting(v8::internal::Vector<char> buffer, - byte* instruction) { - DisassemblerIA32 d(converter_, true /*crash if unimplemented*/); + DisassemblerIA32 d(converter_, unimplemented_opcode_action()); return d.InstructionDecode(buffer, instruction); } // The IA-32 assembler does not currently use constant pools. int Disassembler::ConstantPoolSizeAt(byte* instruction) { return -1; } - -/*static*/ void Disassembler::Disassemble(FILE* f, byte* begin, byte* end) { +// static +void Disassembler::Disassemble(FILE* f, byte* begin, byte* end, + UnimplementedOpcodeAction unimplemented_action) { NameConverter converter; - Disassembler d(converter); + Disassembler d(converter, unimplemented_action); for (byte* pc = begin; pc < end;) { v8::internal::EmbeddedVector<char, 128> buffer; buffer[0] = '\0'; |