Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1508)

Unified Diff: src/x87/disasm-x87.cc

Issue 293743005: Introduce x87 port (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x87/deoptimizer-x87.cc ('k') | src/x87/frames-x87.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x87/disasm-x87.cc
diff --git a/src/ia32/disasm-ia32.cc b/src/x87/disasm-x87.cc
similarity index 96%
copy from src/ia32/disasm-ia32.cc
copy to src/x87/disasm-x87.cc
index 721b0bb429e8d8962d638fc5170883f15bc6d0cd..4eb69739304fca01c31bd43be81c8d0fa151c013 100644
--- a/src/ia32/disasm-ia32.cc
+++ b/src/x87/disasm-x87.cc
@@ -8,7 +8,7 @@
#include "v8.h"
-#if V8_TARGET_ARCH_IA32
+#if V8_TARGET_ARCH_X87
#include "disasm.h"
@@ -240,10 +240,10 @@ void InstructionTable::AddJumpConditionalShort() {
}
-// The IA32 disassembler implementation.
-class DisassemblerIA32 {
+// The X87 disassembler implementation.
+class DisassemblerX87 {
public:
- DisassemblerIA32(const NameConverter& converter,
+ DisassemblerX87(const NameConverter& converter,
bool abort_on_unimplemented = true)
: converter_(converter),
instruction_table_(InstructionTable::get_instance()),
@@ -252,7 +252,7 @@ class DisassemblerIA32 {
tmp_buffer_[0] = '\0';
}
- virtual ~DisassemblerIA32() {}
+ virtual ~DisassemblerX87() {}
// Writes one disassembled instruction into 'buffer' (0-terminated).
// Returns the length of the disassembled machine instruction in bytes.
@@ -322,7 +322,7 @@ class DisassemblerIA32 {
*base = data & 7;
}
- typedef const char* (DisassemblerIA32::*RegisterNameMapping)(int reg) const;
+ typedef const char* (DisassemblerX87::*RegisterNameMapping)(int reg) const;
int PrintRightOperandHelper(byte* modrmp, RegisterNameMapping register_name);
int PrintRightOperand(byte* modrmp);
@@ -353,7 +353,7 @@ class DisassemblerIA32 {
};
-void DisassemblerIA32::AppendToBuffer(const char* format, ...) {
+void DisassemblerX87::AppendToBuffer(const char* format, ...) {
v8::internal::Vector<char> buf = tmp_buffer_ + tmp_buffer_pos_;
va_list args;
va_start(args, format);
@@ -362,13 +362,13 @@ void DisassemblerIA32::AppendToBuffer(const char* format, ...) {
tmp_buffer_pos_ += result;
}
-int DisassemblerIA32::PrintRightOperandHelper(
+int DisassemblerX87::PrintRightOperandHelper(
byte* modrmp,
RegisterNameMapping direct_register_name) {
int mod, regop, rm;
get_modrm(*modrmp, &mod, &regop, &rm);
RegisterNameMapping register_name = (mod == 3) ? direct_register_name :
- &DisassemblerIA32::NameOfCPURegister;
+ &DisassemblerX87::NameOfCPURegister;
switch (mod) {
case 0:
if (rm == ebp) {
@@ -450,26 +450,26 @@ int DisassemblerIA32::PrintRightOperandHelper(
}
-int DisassemblerIA32::PrintRightOperand(byte* modrmp) {
- return PrintRightOperandHelper(modrmp, &DisassemblerIA32::NameOfCPURegister);
+int DisassemblerX87::PrintRightOperand(byte* modrmp) {
+ return PrintRightOperandHelper(modrmp, &DisassemblerX87::NameOfCPURegister);
}
-int DisassemblerIA32::PrintRightByteOperand(byte* modrmp) {
+int DisassemblerX87::PrintRightByteOperand(byte* modrmp) {
return PrintRightOperandHelper(modrmp,
- &DisassemblerIA32::NameOfByteCPURegister);
+ &DisassemblerX87::NameOfByteCPURegister);
}
-int DisassemblerIA32::PrintRightXMMOperand(byte* modrmp) {
+int DisassemblerX87::PrintRightXMMOperand(byte* modrmp) {
return PrintRightOperandHelper(modrmp,
- &DisassemblerIA32::NameOfXMMRegister);
+ &DisassemblerX87::NameOfXMMRegister);
}
// Returns number of bytes used including the current *data.
// Writes instruction's mnemonic, left and right operands to 'tmp_buffer_'.
-int DisassemblerIA32::PrintOperands(const char* mnem,
+int DisassemblerX87::PrintOperands(const char* mnem,
OperandOrder op_order,
byte* data) {
byte modrm = *data;
@@ -498,7 +498,7 @@ int DisassemblerIA32::PrintOperands(const char* mnem,
// Returns number of bytes used by machine instruction, including *data byte.
// Writes immediate instructions to 'tmp_buffer_'.
-int DisassemblerIA32::PrintImmediateOp(byte* data) {
+int DisassemblerX87::PrintImmediateOp(byte* data) {
bool sign_extension_bit = (*data & 0x02) != 0;
byte modrm = *(data+1);
int mod, regop, rm;
@@ -527,7 +527,7 @@ int DisassemblerIA32::PrintImmediateOp(byte* data) {
// Returns number of bytes used, including *data.
-int DisassemblerIA32::F7Instruction(byte* data) {
+int DisassemblerX87::F7Instruction(byte* data) {
ASSERT_EQ(0xF7, *data);
byte modrm = *(data+1);
int mod, regop, rm;
@@ -561,7 +561,7 @@ int DisassemblerIA32::F7Instruction(byte* data) {
}
-int DisassemblerIA32::D1D3C1Instruction(byte* data) {
+int DisassemblerX87::D1D3C1Instruction(byte* data) {
byte op = *data;
ASSERT(op == 0xD1 || op == 0xD3 || op == 0xC1);
byte modrm = *(data+1);
@@ -604,7 +604,7 @@ int DisassemblerIA32::D1D3C1Instruction(byte* data) {
// Returns number of bytes used, including *data.
-int DisassemblerIA32::JumpShort(byte* data) {
+int DisassemblerX87::JumpShort(byte* data) {
ASSERT_EQ(0xEB, *data);
byte b = *(data+1);
byte* dest = data + static_cast<int8_t>(b) + 2;
@@ -614,7 +614,7 @@ int DisassemblerIA32::JumpShort(byte* data) {
// Returns number of bytes used, including *data.
-int DisassemblerIA32::JumpConditional(byte* data, const char* comment) {
+int DisassemblerX87::JumpConditional(byte* data, const char* comment) {
ASSERT_EQ(0x0F, *data);
byte cond = *(data+1) & 0x0F;
byte* dest = data + *reinterpret_cast<int32_t*>(data+2) + 6;
@@ -628,7 +628,7 @@ int DisassemblerIA32::JumpConditional(byte* data, const char* comment) {
// Returns number of bytes used, including *data.
-int DisassemblerIA32::JumpConditionalShort(byte* data, const char* comment) {
+int DisassemblerX87::JumpConditionalShort(byte* data, const char* comment) {
byte cond = *data & 0x0F;
byte b = *(data+1);
byte* dest = data + static_cast<int8_t>(b) + 2;
@@ -642,7 +642,7 @@ int DisassemblerIA32::JumpConditionalShort(byte* data, const char* comment) {
// Returns number of bytes used, including *data.
-int DisassemblerIA32::SetCC(byte* data) {
+int DisassemblerX87::SetCC(byte* data) {
ASSERT_EQ(0x0F, *data);
byte cond = *(data+1) & 0x0F;
const char* mnem = set_conditional_mnem[cond];
@@ -653,7 +653,7 @@ int DisassemblerIA32::SetCC(byte* data) {
// Returns number of bytes used, including *data.
-int DisassemblerIA32::CMov(byte* data) {
+int DisassemblerX87::CMov(byte* data) {
ASSERT_EQ(0x0F, *data);
byte cond = *(data + 1) & 0x0F;
const char* mnem = conditional_move_mnem[cond];
@@ -663,7 +663,7 @@ int DisassemblerIA32::CMov(byte* data) {
// Returns number of bytes used, including *data.
-int DisassemblerIA32::FPUInstruction(byte* data) {
+int DisassemblerX87::FPUInstruction(byte* data) {
byte escape_opcode = *data;
ASSERT_EQ(0xD8, escape_opcode & 0xF8);
byte modrm_byte = *(data+1);
@@ -675,7 +675,7 @@ int DisassemblerIA32::FPUInstruction(byte* data) {
}
}
-int DisassemblerIA32::MemoryFPUInstruction(int escape_opcode,
+int DisassemblerX87::MemoryFPUInstruction(int escape_opcode,
int modrm_byte,
byte* modrm_start) {
const char* mnem = "?";
@@ -722,7 +722,7 @@ int DisassemblerIA32::MemoryFPUInstruction(int escape_opcode,
return count + 1;
}
-int DisassemblerIA32::RegisterFPUInstruction(int escape_opcode,
+int DisassemblerX87::RegisterFPUInstruction(int escape_opcode,
byte modrm_byte) {
bool has_register = false; // Is the FPU register encoded in modrm_byte?
const char* mnem = "?";
@@ -873,7 +873,7 @@ static const char* F0Mnem(byte f0byte) {
// Disassembled instruction '*instr' and writes it into 'out_buffer'.
-int DisassemblerIA32::InstructionDecode(v8::internal::Vector<char> out_buffer,
+int DisassemblerX87::InstructionDecode(v8::internal::Vector<char> out_buffer,
byte* instr) {
tmp_buffer_pos_ = 0; // starting to write as position 0
byte* data = instr;
@@ -1709,7 +1709,7 @@ const char* NameConverter::NameOfXMMRegister(int reg) const {
const char* NameConverter::NameInCode(byte* addr) const {
- // IA32 does not embed debug strings at the moment.
+ // X87 does not embed debug strings at the moment.
UNREACHABLE();
return "";
}
@@ -1726,7 +1726,7 @@ Disassembler::~Disassembler() {}
int Disassembler::InstructionDecode(v8::internal::Vector<char> buffer,
byte* instruction) {
- DisassemblerIA32 d(converter_, false /*do not crash if unimplemented*/);
+ DisassemblerX87 d(converter_, false /*do not crash if unimplemented*/);
return d.InstructionDecode(buffer, instruction);
}
@@ -1759,4 +1759,4 @@ int Disassembler::ConstantPoolSizeAt(byte* instruction) { return -1; }
} // namespace disasm
-#endif // V8_TARGET_ARCH_IA32
+#endif // V8_TARGET_ARCH_X87
« no previous file with comments | « src/x87/deoptimizer-x87.cc ('k') | src/x87/frames-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698