OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 ASSERT_EQ(0xF7, *data); | 546 ASSERT_EQ(0xF7, *data); |
547 byte modrm = *(data+1); | 547 byte modrm = *(data+1); |
548 int mod, regop, rm; | 548 int mod, regop, rm; |
549 get_modrm(modrm, &mod, ®op, &rm); | 549 get_modrm(modrm, &mod, ®op, &rm); |
550 if (mod == 3 && regop != 0) { | 550 if (mod == 3 && regop != 0) { |
551 const char* mnem = NULL; | 551 const char* mnem = NULL; |
552 switch (regop) { | 552 switch (regop) { |
553 case 2: mnem = "not"; break; | 553 case 2: mnem = "not"; break; |
554 case 3: mnem = "neg"; break; | 554 case 3: mnem = "neg"; break; |
555 case 4: mnem = "mul"; break; | 555 case 4: mnem = "mul"; break; |
| 556 case 5: mnem = "imul"; break; |
556 case 7: mnem = "idiv"; break; | 557 case 7: mnem = "idiv"; break; |
557 default: UnimplementedInstruction(); | 558 default: UnimplementedInstruction(); |
558 } | 559 } |
559 AppendToBuffer("%s %s", mnem, NameOfCPURegister(rm)); | 560 AppendToBuffer("%s %s", mnem, NameOfCPURegister(rm)); |
560 return 2; | 561 return 2; |
561 } else if (mod == 3 && regop == eax) { | 562 } else if (mod == 3 && regop == eax) { |
562 int32_t imm = *reinterpret_cast<int32_t*>(data+2); | 563 int32_t imm = *reinterpret_cast<int32_t*>(data+2); |
563 AppendToBuffer("test %s,0x%x", NameOfCPURegister(rm), imm); | 564 AppendToBuffer("test %s,0x%x", NameOfCPURegister(rm), imm); |
564 return 6; | 565 return 6; |
565 } else if (regop == eax) { | 566 } else if (regop == eax) { |
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1656 | 1657 |
1657 Disassembler::Disassembler(const NameConverter& converter) | 1658 Disassembler::Disassembler(const NameConverter& converter) |
1658 : converter_(converter) {} | 1659 : converter_(converter) {} |
1659 | 1660 |
1660 | 1661 |
1661 Disassembler::~Disassembler() {} | 1662 Disassembler::~Disassembler() {} |
1662 | 1663 |
1663 | 1664 |
1664 int Disassembler::InstructionDecode(v8::internal::Vector<char> buffer, | 1665 int Disassembler::InstructionDecode(v8::internal::Vector<char> buffer, |
1665 byte* instruction) { | 1666 byte* instruction) { |
1666 DisassemblerIA32 d(converter_, false /*do not crash if unimplemented*/); | 1667 /// DisassemblerIA32 d(converter_, false /*do not crash if unimplemented*/); |
| 1668 DisassemblerIA32 d(converter_, true /*do not crash if unimplemented*/); |
1667 return d.InstructionDecode(buffer, instruction); | 1669 return d.InstructionDecode(buffer, instruction); |
1668 } | 1670 } |
1669 | 1671 |
1670 | 1672 |
1671 // The IA-32 assembler does not currently use constant pools. | 1673 // The IA-32 assembler does not currently use constant pools. |
1672 int Disassembler::ConstantPoolSizeAt(byte* instruction) { return -1; } | 1674 int Disassembler::ConstantPoolSizeAt(byte* instruction) { return -1; } |
1673 | 1675 |
1674 | 1676 |
1675 /*static*/ void Disassembler::Disassemble(FILE* f, byte* begin, byte* end) { | 1677 /*static*/ void Disassembler::Disassemble(FILE* f, byte* begin, byte* end) { |
1676 NameConverter converter; | 1678 NameConverter converter; |
(...skipping 13 matching lines...) Expand all Loading... |
1690 fprintf(f, " "); | 1692 fprintf(f, " "); |
1691 } | 1693 } |
1692 fprintf(f, " %s\n", buffer.start()); | 1694 fprintf(f, " %s\n", buffer.start()); |
1693 } | 1695 } |
1694 } | 1696 } |
1695 | 1697 |
1696 | 1698 |
1697 } // namespace disasm | 1699 } // namespace disasm |
1698 | 1700 |
1699 #endif // V8_TARGET_ARCH_IA32 | 1701 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |