#include <cassert>
#include <cinttypes>
#include <cstdarg>
#include <cstdio>
#if V8_TARGET_ARCH_X64
#include "src/base/compiler-specific.h"
#include "src/base/lazy-instance.h"
#include "src/base/memory.h"
#include "src/base/strings.h"
#include "src/codegen/x64/fma-instr.h"
#include "src/codegen/x64/register-x64.h"
#include "src/codegen/x64/sse-instr.h"
#include "src/common/globals.h"
#include "src/diagnostics/disasm.h"
namespace disasm {
enum OperandType { … };
struct ByteMnemonic { … };
static const ByteMnemonic two_operands_instr[] = …;
static const ByteMnemonic zero_operands_instr[] = …;
static const ByteMnemonic call_jump_instr[] = …;
static const ByteMnemonic short_immediate_instr[] = …;
static const char* const conditional_code_suffix[] = …;
enum InstructionType { … };
enum Prefixes { … };
struct InstructionDesc { … };
class InstructionTable { … };
InstructionTable::InstructionTable() { … }
void InstructionTable::Clear() { … }
void InstructionTable::Init() { … }
void InstructionTable::CopyTable(const ByteMnemonic bm[],
InstructionType type) { … }
void InstructionTable::SetTableRange(InstructionType type, uint8_t start,
uint8_t end, bool byte_size,
const char* mnem) { … }
void InstructionTable::AddJumpConditionalShort() { … }
namespace {
DEFINE_LAZY_LEAKY_OBJECT_GETTER(…)
}
static const InstructionDesc cmov_instructions[16] = …;
static const char* const cmp_pseudo_op[16] = …;
namespace {
int8_t Imm8(const uint8_t* data) { … }
uint8_t Imm8_U(const uint8_t* data) { … }
int16_t Imm16(const uint8_t* data) { … }
uint16_t Imm16_U(const uint8_t* data) { … }
int32_t Imm32(const uint8_t* data) { … }
uint32_t Imm32_U(const uint8_t* data) { … }
int64_t Imm64(const uint8_t* data) { … }
}
const char* NameOfYMMRegister(int reg);
class DisassemblerX64 { … };
void DisassemblerX64::AppendToBuffer(const char* format, ...) { … }
void DisassemblerX64::TryAppendRootRelativeName(int offset) { … }
int DisassemblerX64::PrintRightOperandHelper(
uint8_t* modrmp, RegisterNameMapping direct_register_name) { … }
int DisassemblerX64::PrintImmediate(uint8_t* data, OperandSize size) { … }
int DisassemblerX64::PrintRightOperand(uint8_t* modrmp) { … }
int DisassemblerX64::PrintRightByteOperand(uint8_t* modrmp) { … }
int DisassemblerX64::PrintRightXMMOperand(uint8_t* modrmp) { … }
int DisassemblerX64::PrintRightAVXOperand(uint8_t* modrmp) { … }
int DisassemblerX64::PrintOperands(const char* mnem, OperandType op_order,
uint8_t* data) { … }
int DisassemblerX64::PrintImmediateOp(uint8_t* data) { … }
int DisassemblerX64::F6F7Instruction(uint8_t* data) { … }
int DisassemblerX64::ShiftInstruction(uint8_t* data) { … }
int DisassemblerX64::JumpShort(uint8_t* data) { … }
int DisassemblerX64::JumpConditional(uint8_t* data) { … }
int DisassemblerX64::JumpConditionalShort(uint8_t* data) { … }
int DisassemblerX64::SetCC(uint8_t* data) { … }
const char* sf_str[4] = …;
int DisassemblerX64::AVXInstruction(uint8_t* data) { … }
int DisassemblerX64::FPUInstruction(uint8_t* data) { … }
int DisassemblerX64::MemoryFPUInstruction(int escape_opcode, int modrm_byte,
uint8_t* modrm_start) { … }
int DisassemblerX64::RegisterFPUInstruction(int escape_opcode,
uint8_t modrm_byte) { … }
int DisassemblerX64::TwoByteOpcodeInstruction(uint8_t* data) { … }
int DisassemblerX64::ThreeByteOpcodeInstruction(uint8_t* data) { … }
const char* DisassemblerX64::TwoByteMnemonic(uint8_t opcode) { … }
int DisassemblerX64::InstructionDecode(v8::base::Vector<char> out_buffer,
uint8_t* instr) { … }
static const char* const cpu_regs[16] = …;
static const char* const byte_cpu_regs[16] = …;
static const char* const xmm_regs[16] = …;
static const char* const ymm_regs[16] = …;
const char* NameConverter::NameOfAddress(uint8_t* addr) const { … }
const char* NameConverter::NameOfConstant(uint8_t* addr) const { … }
const char* NameConverter::NameOfCPURegister(int reg) const { … }
const char* NameConverter::NameOfByteCPURegister(int reg) const { … }
const char* NameConverter::NameOfXMMRegister(int reg) const { … }
const char* NameOfYMMRegister(int reg) { … }
const char* NameConverter::NameInCode(uint8_t* addr) const { … }
int Disassembler::InstructionDecode(v8::base::Vector<char> buffer,
uint8_t* instruction) { … }
int Disassembler::ConstantPoolSizeAt(uint8_t* instruction) { … }
void Disassembler::Disassemble(FILE* f, uint8_t* begin, uint8_t* end,
UnimplementedOpcodeAction unimplemented_action) { … }
}
#endif