Commit c941c4d9 authored by Dan Elphick's avatar Dan Elphick Committed by V8 LUCI CQ

Fix mips build after adding base/strings.h

Bug: v8:11879
Change-Id: I8f307490ca253e6d458db14cc5bf771d6fe1db57
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2979593
Auto-Submit: Dan Elphick <delphick@chromium.org>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Reviewed-by: 's avatarZhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#75315}
parent 3c25c398
...@@ -242,25 +242,26 @@ void Decoder::PrintFd(Instruction* instr) { ...@@ -242,25 +242,26 @@ void Decoder::PrintFd(Instruction* instr) {
// Print the integer value of the sa field. // Print the integer value of the sa field.
void Decoder::PrintSa(Instruction* instr) { void Decoder::PrintSa(Instruction* instr) {
int sa = instr->SaValue(); int sa = instr->SaValue();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", sa); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", sa);
} }
// Print the integer value of the sa field of a lsa instruction. // Print the integer value of the sa field of a lsa instruction.
void Decoder::PrintLsaSa(Instruction* instr) { void Decoder::PrintLsaSa(Instruction* instr) {
int sa = instr->LsaSaValue() + 1; int sa = instr->LsaSaValue() + 1;
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", sa); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", sa);
} }
// Print the integer value of the rd field, when it is not used as reg. // Print the integer value of the rd field, when it is not used as reg.
void Decoder::PrintSd(Instruction* instr) { void Decoder::PrintSd(Instruction* instr) {
int sd = instr->RdValue(); int sd = instr->RdValue();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", sd); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", sd);
} }
// Print the integer value of the rd field, when used as 'ext' size. // Print the integer value of the rd field, when used as 'ext' size.
void Decoder::PrintSs1(Instruction* instr) { void Decoder::PrintSs1(Instruction* instr) {
int ss = instr->RdValue(); int ss = instr->RdValue();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", ss + 1); out_buffer_pos_ +=
base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", ss + 1);
} }
// Print the integer value of the rd field, when used as 'ins' size. // Print the integer value of the rd field, when used as 'ins' size.
...@@ -268,54 +269,55 @@ void Decoder::PrintSs2(Instruction* instr) { ...@@ -268,54 +269,55 @@ void Decoder::PrintSs2(Instruction* instr) {
int ss = instr->RdValue(); int ss = instr->RdValue();
int pos = instr->SaValue(); int pos = instr->SaValue();
out_buffer_pos_ += out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "%d", ss - pos + 1); base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", ss - pos + 1);
} }
// Print the integer value of the cc field for the bc1t/f instructions. // Print the integer value of the cc field for the bc1t/f instructions.
void Decoder::PrintBc(Instruction* instr) { void Decoder::PrintBc(Instruction* instr) {
int cc = instr->FBccValue(); int cc = instr->FBccValue();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", cc); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", cc);
} }
// Print the integer value of the cc field for the FP compare instructions. // Print the integer value of the cc field for the FP compare instructions.
void Decoder::PrintCc(Instruction* instr) { void Decoder::PrintCc(Instruction* instr) {
int cc = instr->FCccValue(); int cc = instr->FCccValue();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "cc(%d)", cc); out_buffer_pos_ +=
base::SNPrintF(out_buffer_ + out_buffer_pos_, "cc(%d)", cc);
} }
void Decoder::PrintBp2(Instruction* instr) { void Decoder::PrintBp2(Instruction* instr) {
int bp2 = instr->Bp2Value(); int bp2 = instr->Bp2Value();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", bp2); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", bp2);
} }
// Print 9-bit unsigned immediate value. // Print 9-bit unsigned immediate value.
void Decoder::PrintUImm9(Instruction* instr) { void Decoder::PrintUImm9(Instruction* instr) {
int32_t imm = instr->Imm9Value(); int32_t imm = instr->Imm9Value();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%u", imm); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%u", imm);
} }
// Print 9-bit signed immediate value. // Print 9-bit signed immediate value.
void Decoder::PrintSImm9(Instruction* instr) { void Decoder::PrintSImm9(Instruction* instr) {
int32_t imm = ((instr->Imm9Value()) << 23) >> 23; int32_t imm = ((instr->Imm9Value()) << 23) >> 23;
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm);
} }
// Print 16-bit unsigned immediate value. // Print 16-bit unsigned immediate value.
void Decoder::PrintUImm16(Instruction* instr) { void Decoder::PrintUImm16(Instruction* instr) {
int32_t imm = instr->Imm16Value(); int32_t imm = instr->Imm16Value();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%u", imm); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%u", imm);
} }
// Print 16-bit signed immediate value. // Print 16-bit signed immediate value.
void Decoder::PrintSImm16(Instruction* instr) { void Decoder::PrintSImm16(Instruction* instr) {
int32_t imm = ((instr->Imm16Value()) << 16) >> 16; int32_t imm = ((instr->Imm16Value()) << 16) >> 16;
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm);
} }
// Print 16-bit hexa immediate value. // Print 16-bit hexa immediate value.
void Decoder::PrintXImm16(Instruction* instr) { void Decoder::PrintXImm16(Instruction* instr) {
int32_t imm = instr->Imm16Value(); int32_t imm = instr->Imm16Value();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm);
} }
// Print absoulte address for 16-bit offset or immediate value. // Print absoulte address for 16-bit offset or immediate value.
...@@ -324,28 +326,28 @@ void Decoder::PrintXImm16(Instruction* instr) { ...@@ -324,28 +326,28 @@ void Decoder::PrintXImm16(Instruction* instr) {
void Decoder::PrintPCImm16(Instruction* instr, int delta_pc, int n_bits) { void Decoder::PrintPCImm16(Instruction* instr, int delta_pc, int n_bits) {
int16_t offset = instr->Imm16Value(); int16_t offset = instr->Imm16Value();
out_buffer_pos_ += out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "%s", base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) + converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (offset << n_bits))); delta_pc + (offset << n_bits)));
} }
// Print 18-bit signed immediate value. // Print 18-bit signed immediate value.
void Decoder::PrintSImm18(Instruction* instr) { void Decoder::PrintSImm18(Instruction* instr) {
int32_t imm = int32_t imm =
((instr->Imm18Value()) << (32 - kImm18Bits)) >> (32 - kImm18Bits); ((instr->Imm18Value()) << (32 - kImm18Bits)) >> (32 - kImm18Bits);
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm);
} }
// Print 18-bit hexa immediate value. // Print 18-bit hexa immediate value.
void Decoder::PrintXImm18(Instruction* instr) { void Decoder::PrintXImm18(Instruction* instr) {
int32_t imm = instr->Imm18Value(); int32_t imm = instr->Imm18Value();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm);
} }
// Print 19-bit hexa immediate value. // Print 19-bit hexa immediate value.
void Decoder::PrintXImm19(Instruction* instr) { void Decoder::PrintXImm19(Instruction* instr) {
int32_t imm = instr->Imm19Value(); int32_t imm = instr->Imm19Value();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm);
} }
// Print 19-bit signed immediate value. // Print 19-bit signed immediate value.
...@@ -354,13 +356,13 @@ void Decoder::PrintSImm19(Instruction* instr) { ...@@ -354,13 +356,13 @@ void Decoder::PrintSImm19(Instruction* instr) {
// set sign // set sign
imm19 <<= (32 - kImm19Bits); imm19 <<= (32 - kImm19Bits);
imm19 >>= (32 - kImm19Bits); imm19 >>= (32 - kImm19Bits);
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm19); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm19);
} }
// Print 21-bit immediate value. // Print 21-bit immediate value.
void Decoder::PrintXImm21(Instruction* instr) { void Decoder::PrintXImm21(Instruction* instr) {
uint32_t imm = instr->Imm21Value(); uint32_t imm = instr->Imm21Value();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm);
} }
// Print 21-bit signed immediate value. // Print 21-bit signed immediate value.
...@@ -369,7 +371,7 @@ void Decoder::PrintSImm21(Instruction* instr) { ...@@ -369,7 +371,7 @@ void Decoder::PrintSImm21(Instruction* instr) {
// set sign // set sign
imm21 <<= (32 - kImm21Bits); imm21 <<= (32 - kImm21Bits);
imm21 >>= (32 - kImm21Bits); imm21 >>= (32 - kImm21Bits);
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm21); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm21);
} }
// Print absoulte address for 21-bit offset or immediate value. // Print absoulte address for 21-bit offset or immediate value.
...@@ -381,9 +383,9 @@ void Decoder::PrintPCImm21(Instruction* instr, int delta_pc, int n_bits) { ...@@ -381,9 +383,9 @@ void Decoder::PrintPCImm21(Instruction* instr, int delta_pc, int n_bits) {
imm21 <<= (32 - kImm21Bits); imm21 <<= (32 - kImm21Bits);
imm21 >>= (32 - kImm21Bits); imm21 >>= (32 - kImm21Bits);
out_buffer_pos_ += out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "%s", base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) + converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (imm21 << n_bits))); delta_pc + (imm21 << n_bits)));
} }
// Print 26-bit hex immediate value. // Print 26-bit hex immediate value.
...@@ -391,7 +393,8 @@ void Decoder::PrintXImm26(Instruction* instr) { ...@@ -391,7 +393,8 @@ void Decoder::PrintXImm26(Instruction* instr) {
uint32_t target = static_cast<uint32_t>(instr->Imm26Value()) uint32_t target = static_cast<uint32_t>(instr->Imm26Value())
<< kImmFieldShift; << kImmFieldShift;
target = (reinterpret_cast<uint32_t>(instr) & ~0xFFFFFFF) | target; target = (reinterpret_cast<uint32_t>(instr) & ~0xFFFFFFF) | target;
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", target); out_buffer_pos_ +=
base::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", target);
} }
// Print 26-bit signed immediate value. // Print 26-bit signed immediate value.
...@@ -400,7 +403,7 @@ void Decoder::PrintSImm26(Instruction* instr) { ...@@ -400,7 +403,7 @@ void Decoder::PrintSImm26(Instruction* instr) {
// set sign // set sign
imm26 <<= (32 - kImm26Bits); imm26 <<= (32 - kImm26Bits);
imm26 >>= (32 - kImm26Bits); imm26 >>= (32 - kImm26Bits);
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm26); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm26);
} }
// Print absoulte address for 26-bit offset or immediate value. // Print absoulte address for 26-bit offset or immediate value.
...@@ -412,9 +415,9 @@ void Decoder::PrintPCImm26(Instruction* instr, int delta_pc, int n_bits) { ...@@ -412,9 +415,9 @@ void Decoder::PrintPCImm26(Instruction* instr, int delta_pc, int n_bits) {
imm26 <<= (32 - kImm26Bits); imm26 <<= (32 - kImm26Bits);
imm26 >>= (32 - kImm26Bits); imm26 >>= (32 - kImm26Bits);
out_buffer_pos_ += out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "%s", base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) + converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (imm26 << n_bits))); delta_pc + (imm26 << n_bits)));
} }
// Print absoulte address for 26-bit offset or immediate value. // Print absoulte address for 26-bit offset or immediate value.
...@@ -425,8 +428,8 @@ void Decoder::PrintPCImm26(Instruction* instr) { ...@@ -425,8 +428,8 @@ void Decoder::PrintPCImm26(Instruction* instr) {
uint32_t pc_mask = ~0xFFFFFFF; uint32_t pc_mask = ~0xFFFFFFF;
uint32_t pc = ((uint32_t)(instr + 1) & pc_mask) | (imm26 << 2); uint32_t pc = ((uint32_t)(instr + 1) & pc_mask) | (imm26 << 2);
out_buffer_pos_ += out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "%s", base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress((reinterpret_cast<byte*>(pc)))); converter_.NameOfAddress((reinterpret_cast<byte*>(pc))));
} }
// Print 26-bit immediate value. // Print 26-bit immediate value.
...@@ -436,8 +439,8 @@ void Decoder::PrintCode(Instruction* instr) { ...@@ -436,8 +439,8 @@ void Decoder::PrintCode(Instruction* instr) {
switch (instr->FunctionFieldRaw()) { switch (instr->FunctionFieldRaw()) {
case BREAK: { case BREAK: {
int32_t code = instr->Bits(25, 6); int32_t code = instr->Bits(25, 6);
out_buffer_pos_ += out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_,
SNPrintF(out_buffer_ + out_buffer_pos_, "0x%05x (%d)", code, code); "0x%05x (%d)", code, code);
break; break;
} }
case TGE: case TGE:
...@@ -448,7 +451,7 @@ void Decoder::PrintCode(Instruction* instr) { ...@@ -448,7 +451,7 @@ void Decoder::PrintCode(Instruction* instr) {
case TNE: { case TNE: {
int32_t code = instr->Bits(15, 6); int32_t code = instr->Bits(15, 6);
out_buffer_pos_ += out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "0x%03x", code); base::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%03x", code);
break; break;
} }
default: // Not a break or trap instruction. default: // Not a break or trap instruction.
...@@ -458,50 +461,50 @@ void Decoder::PrintCode(Instruction* instr) { ...@@ -458,50 +461,50 @@ void Decoder::PrintCode(Instruction* instr) {
void Decoder::PrintMsaXImm8(Instruction* instr) { void Decoder::PrintMsaXImm8(Instruction* instr) {
int32_t imm = instr->MsaImm8Value(); int32_t imm = instr->MsaImm8Value();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm);
} }
void Decoder::PrintMsaImm8(Instruction* instr) { void Decoder::PrintMsaImm8(Instruction* instr) {
int32_t imm = instr->MsaImm8Value(); int32_t imm = instr->MsaImm8Value();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%u", imm); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%u", imm);
} }
void Decoder::PrintMsaImm5(Instruction* instr) { void Decoder::PrintMsaImm5(Instruction* instr) {
int32_t imm = instr->MsaImm5Value(); int32_t imm = instr->MsaImm5Value();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%u", imm); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%u", imm);
} }
void Decoder::PrintMsaSImm5(Instruction* instr) { void Decoder::PrintMsaSImm5(Instruction* instr) {
int32_t imm = instr->MsaImm5Value(); int32_t imm = instr->MsaImm5Value();
imm <<= (32 - kMsaImm5Bits); imm <<= (32 - kMsaImm5Bits);
imm >>= (32 - kMsaImm5Bits); imm >>= (32 - kMsaImm5Bits);
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm);
} }
void Decoder::PrintMsaSImm10(Instruction* instr, bool is_mi10) { void Decoder::PrintMsaSImm10(Instruction* instr, bool is_mi10) {
int32_t imm = is_mi10 ? instr->MsaImmMI10Value() : instr->MsaImm10Value(); int32_t imm = is_mi10 ? instr->MsaImmMI10Value() : instr->MsaImm10Value();
imm <<= (32 - kMsaImm10Bits); imm <<= (32 - kMsaImm10Bits);
imm >>= (32 - kMsaImm10Bits); imm >>= (32 - kMsaImm10Bits);
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm);
} }
void Decoder::PrintMsaImmBit(Instruction* instr) { void Decoder::PrintMsaImmBit(Instruction* instr) {
int32_t m = instr->MsaBitMValue(); int32_t m = instr->MsaBitMValue();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%u", m); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%u", m);
} }
void Decoder::PrintMsaImmElm(Instruction* instr) { void Decoder::PrintMsaImmElm(Instruction* instr) {
int32_t n = instr->MsaElmNValue(); int32_t n = instr->MsaElmNValue();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%u", n); out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%u", n);
} }
void Decoder::PrintMsaCopy(Instruction* instr) { void Decoder::PrintMsaCopy(Instruction* instr) {
int32_t rd = instr->WdValue(); int32_t rd = instr->WdValue();
int32_t ws = instr->WsValue(); int32_t ws = instr->WsValue();
int32_t n = instr->MsaElmNValue(); int32_t n = instr->MsaElmNValue();
out_buffer_pos_ += out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s, %s[%u]",
SNPrintF(out_buffer_ + out_buffer_pos_, "%s, %s[%u]", converter_.NameOfCPURegister(rd),
converter_.NameOfCPURegister(rd), MSARegisters::Name(ws), n); MSARegisters::Name(ws), n);
} }
void Decoder::PrintFormat(Instruction* instr) { void Decoder::PrintFormat(Instruction* instr) {
...@@ -2651,8 +2654,8 @@ void Decoder::DecodeTypeMsa2RF(Instruction* instr) { ...@@ -2651,8 +2654,8 @@ void Decoder::DecodeTypeMsa2RF(Instruction* instr) {
int Decoder::InstructionDecode(byte* instr_ptr) { int Decoder::InstructionDecode(byte* instr_ptr) {
Instruction* instr = Instruction::At(instr_ptr); Instruction* instr = Instruction::At(instr_ptr);
// Print raw instruction bytes. // Print raw instruction bytes.
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%08x ", out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_,
instr->InstructionBits()); "%08x ", instr->InstructionBits());
switch (instr->InstructionType()) { switch (instr->InstructionType()) {
case Instruction::kRegisterType: { case Instruction::kRegisterType: {
DecodeTypeRegister(instr); DecodeTypeRegister(instr);
...@@ -2682,7 +2685,7 @@ int Decoder::InstructionDecode(byte* instr_ptr) { ...@@ -2682,7 +2685,7 @@ int Decoder::InstructionDecode(byte* instr_ptr) {
namespace disasm { namespace disasm {
const char* NameConverter::NameOfAddress(byte* addr) const { const char* NameConverter::NameOfAddress(byte* addr) const {
v8::internal::SNPrintF(tmp_buffer_, "%p", static_cast<void*>(addr)); v8::base::SNPrintF(tmp_buffer_, "%p", static_cast<void*>(addr));
return tmp_buffer_.begin(); return tmp_buffer_.begin();
} }
......
...@@ -295,10 +295,9 @@ void Decoder::PrintSs3(Instruction* instr) { ...@@ -295,10 +295,9 @@ void Decoder::PrintSs3(Instruction* instr) {
// Print the integer value of dinsm size from the msbminus32 and lsb fields. // Print the integer value of dinsm size from the msbminus32 and lsb fields.
void Decoder::PrintSs4(Instruction* instr) { void Decoder::PrintSs4(Instruction* instr) {
int msbminus32 = instr->RdValue(); int msbminus32 = instr->RdValue();
int lsb = instr->S_buffer_pos_ += int lsb = instr->SaValue();
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d",
base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", msbminus32 + 32 - lsb + 1);
msbminus32 + 32 - lsb + 1);
} }
// Print the integer value of dextu/dinsu pos from the lsbminus32 field. // Print the integer value of dextu/dinsu pos from the lsbminus32 field.
...@@ -316,7 +315,7 @@ void Decoder::PrintBc(Instruction* instr) { ...@@ -316,7 +315,7 @@ void Decoder::PrintBc(Instruction* instr) {
// Print the integer value of the cc field for the FP compare instructions. // Print the integer value of the cc field for the FP compare instructions.
void Decoder::PrintCc(Instruction* instr) { void Decoder::PrintCc(Instruction* instr) {
int cc = instr->FC ccValue(); int cc = instr->FCccValue();
out_buffer_pos_ += out_buffer_pos_ +=
base::SNPrintF(out_buffer_ + out_buffer_pos_, "cc(%d)", cc); base::SNPrintF(out_buffer_ + out_buffer_pos_, "cc(%d)", cc);
} }
...@@ -358,9 +357,9 @@ void Decoder::PrintXImm16(Instruction* instr) { ...@@ -358,9 +357,9 @@ void Decoder::PrintXImm16(Instruction* instr) {
void Decoder::PrintPCImm16(Instruction* instr, int delta_pc, int n_bits) { void Decoder::PrintPCImm16(Instruction* instr, int delta_pc, int n_bits) {
int16_t offset = instr->Imm16Value(); int16_t offset = instr->Imm16Value();
out_buffer_pos_ += out_buffer_pos_ +=
base::SNP rintF(out_buffer_ + out_buffer_pos_, "%s", base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) + converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (offset << n_bits))); delta_pc + (offset << n_bits)));
} }
// Print 18-bit signed immediate value. // Print 18-bit signed immediate value.
...@@ -415,9 +414,9 @@ void Decoder::PrintPCImm21(Instruction* instr, int delta_pc, int n_bits) { ...@@ -415,9 +414,9 @@ void Decoder::PrintPCImm21(Instruction* instr, int delta_pc, int n_bits) {
imm21 <<= (32 - kImm21Bits); imm21 <<= (32 - kImm21Bits);
imm21 >>= (32 - kImm21Bits); imm21 >>= (32 - kImm21Bits);
out_buffer_pos_ += out_buffer_pos_ +=
base::SNP rintF(out_buffer_ + out_buffer_pos_, "%s", base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) + converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (imm21 << n_bits))); delta_pc + (imm21 << n_bits)));
} }
// Print 26-bit hex immediate value. // Print 26-bit hex immediate value.
...@@ -447,9 +446,9 @@ void Decoder::PrintPCImm26(Instruction* instr, int delta_pc, int n_bits) { ...@@ -447,9 +446,9 @@ void Decoder::PrintPCImm26(Instruction* instr, int delta_pc, int n_bits) {
imm26 <<= (32 - kImm26Bits); imm26 <<= (32 - kImm26Bits);
imm26 >>= (32 - kImm26Bits); imm26 >>= (32 - kImm26Bits);
out_buffer_pos_ += out_buffer_pos_ +=
base::SNP rintF(out_buffer_ + out_buffer_pos_, "%s", base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) + converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (imm26 << n_bits))); delta_pc + (imm26 << n_bits)));
} }
// Print absoulte address for 26-bit offset or immediate value. // Print absoulte address for 26-bit offset or immediate value.
...@@ -460,8 +459,8 @@ void Decoder::PrintPCImm26(Instruction* instr) { ...@@ -460,8 +459,8 @@ void Decoder::PrintPCImm26(Instruction* instr) {
uint64_t pc_mask = ~0xFFFFFFF; uint64_t pc_mask = ~0xFFFFFFF;
uint64_t pc = ((uint64_t)(instr + 1) & pc_mask) | (imm26 << 2); uint64_t pc = ((uint64_t)(instr + 1) & pc_mask) | (imm26 << 2);
out_buffer_pos_ += out_buffer_pos_ +=
base::SNP rintF(out_buffer_ + out_buffer_pos_, "%s", base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress((reinterpret_cast<byte*>(pc)))); converter_.NameOfAddress((reinterpret_cast<byte*>(pc))));
} }
void Decoder::PrintBp2(Instruction* instr) { void Decoder::PrintBp2(Instruction* instr) {
...@@ -480,10 +479,9 @@ void Decoder::PrintCode(Instruction* instr) { ...@@ -480,10 +479,9 @@ void Decoder::PrintCode(Instruction* instr) {
return; // Not a break or trap instruction. return; // Not a break or trap instruction.
switch (instr->FunctionFieldRaw()) { switch (instr->FunctionFieldRaw()) {
case BREAK: { case BREAK: {
int32_t code = ins_buffer_pos_ += int32_t code = instr->Bits(25, 6);
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_,
base::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%05x (%d)", code, "0x%05x (%d)", code, code);
code);
break; break;
} }
case TGE: case TGE:
...@@ -544,9 +542,10 @@ void Decoder::PrintMsaImmElm(Instruction* instr) { ...@@ -544,9 +542,10 @@ void Decoder::PrintMsaImmElm(Instruction* instr) {
void Decoder::PrintMsaCopy(Instruction* instr) { void Decoder::PrintMsaCopy(Instruction* instr) {
int32_t rd = instr->WdValue(); int32_t rd = instr->WdValue();
int32_t ws = instr->WsValue(); int32_t ws = instr->WsValue();
int32_t n = instr - buffer_pos_ += int32_t n = instr->MsaElmNValue();
rintF(out_buffer_ + out_buffer_po _, "%s, %s[%u]", out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s, %s[%u]",
converter_.NameOfCPURegister(rd), MSARegisters::Name(ws), n); converter_.NameOfCPURegister(rd),
MSARegisters::Name(ws), n);
} }
void Decoder::PrintFormat(Instruction* instr) { void Decoder::PrintFormat(Instruction* instr) {
...@@ -2976,7 +2975,7 @@ int Decoder::InstructionDecode(byte* instr_ptr) { ...@@ -2976,7 +2975,7 @@ int Decoder::InstructionDecode(byte* instr_ptr) {
namespace disasm { namespace disasm {
const char* NameConverter::NameOfAddress(byte* addr) const { const char* NameConverter::NameOfAddress(byte* addr) const {
v8::internal::base::SNPrintF(tmp_buffer_, "%p", static_cast<void*>(addr)); v8::base::SNPrintF(tmp_buffer_, "%p", static_cast<void*>(addr));
return tmp_buffer_.begin(); return tmp_buffer_.begin();
} }
......
...@@ -36,6 +36,7 @@ T Nabs(T a) { ...@@ -36,6 +36,7 @@ T Nabs(T a) {
// Running with a simulator. // Running with a simulator.
#include "src/base/hashmap.h" #include "src/base/hashmap.h"
#include "src/base/strings.h"
#include "src/codegen/assembler.h" #include "src/codegen/assembler.h"
#include "src/codegen/mips/constants-mips.h" #include "src/codegen/mips/constants-mips.h"
#include "src/execution/simulator-base.h" #include "src/execution/simulator-base.h"
...@@ -548,7 +549,7 @@ class Simulator : public SimulatorBase { ...@@ -548,7 +549,7 @@ class Simulator : public SimulatorBase {
instr->OpcodeValue()); instr->OpcodeValue());
} }
InstructionDecode(instr); InstructionDecode(instr);
SNPrintF(trace_buf_, " "); base::SNPrintF(trace_buf_, " ");
} }
// ICache. // ICache.
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "src/base/bits.h" #include "src/base/bits.h"
#include "src/base/platform/platform.h" #include "src/base/platform/platform.h"
#include "src/base/platform/wrappers.h" #include "src/base/platform/wrappers.h"
#include "src/base/strings.h"
#include "src/base/vector.h" #include "src/base/vector.h"
#include "src/codegen/assembler-inl.h" #include "src/codegen/assembler-inl.h"
#include "src/codegen/macro-assembler.h" #include "src/codegen/macro-assembler.h"
...@@ -62,8 +63,8 @@ static int64_t MultiplyHighSigned(int64_t u, int64_t v) { ...@@ -62,8 +63,8 @@ static int64_t MultiplyHighSigned(int64_t u, int64_t v) {
// This macro provides a platform independent use of sscanf. The reason for // This macro provides a platform independent use of sscanf. The reason for
// SScanF not being implemented in a platform independent was through // SScanF not being implemented in a platform independent was through
// ::v8::internal::OS in the same way as SNPrintF is that the Windows C Run-Time // ::v8::internal::OS in the same way as base::SNPrintF is that the Windows C
// Library does not provide vsscanf. // Run-Time Library does not provide vsscanf.
#define SScanF sscanf #define SScanF sscanf
// The MipsDebugger class is used by the simulator while debugging simulated // The MipsDebugger class is used by the simulator while debugging simulated
...@@ -1578,35 +1579,36 @@ void Simulator::TraceRegWr(int64_t value, TraceType t) { ...@@ -1578,35 +1579,36 @@ void Simulator::TraceRegWr(int64_t value, TraceType t) {
switch (t) { switch (t) {
case WORD: case WORD:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"%016" PRIx64 " (%" PRId64 ") int32:%" PRId32 "%016" PRIx64 " (%" PRId64 ") int32:%" PRId32
" uint32:%" PRIu32, " uint32:%" PRIu32,
v.fmt_int64, icount_, v.fmt_int32[0], v.fmt_int32[0]); v.fmt_int64, icount_, v.fmt_int32[0], v.fmt_int32[0]);
break; break;
case DWORD: case DWORD:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"%016" PRIx64 " (%" PRId64 ") int64:%" PRId64 "%016" PRIx64 " (%" PRId64 ") int64:%" PRId64
" uint64:%" PRIu64, " uint64:%" PRIu64,
value, icount_, value, value); value, icount_, value, value);
break; break;
case FLOAT: case FLOAT:
SNPrintF(trace_buf_, "%016" PRIx64 " (%" PRId64 ") flt:%e", base::SNPrintF(trace_buf_, "%016" PRIx64 " (%" PRId64 ") flt:%e",
v.fmt_int64, icount_, v.fmt_float[0]); v.fmt_int64, icount_, v.fmt_float[0]);
break; break;
case DOUBLE: case DOUBLE:
SNPrintF(trace_buf_, "%016" PRIx64 " (%" PRId64 ") dbl:%e", base::SNPrintF(trace_buf_, "%016" PRIx64 " (%" PRId64 ") dbl:%e",
v.fmt_int64, icount_, v.fmt_double); v.fmt_int64, icount_, v.fmt_double);
break; break;
case FLOAT_DOUBLE: case FLOAT_DOUBLE:
SNPrintF(trace_buf_, "%016" PRIx64 " (%" PRId64 ") flt:%e dbl:%e", base::SNPrintF(trace_buf_,
v.fmt_int64, icount_, v.fmt_float[0], v.fmt_double); "%016" PRIx64 " (%" PRId64 ") flt:%e dbl:%e",
v.fmt_int64, icount_, v.fmt_float[0], v.fmt_double);
break; break;
case WORD_DWORD: case WORD_DWORD:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"%016" PRIx64 " (%" PRId64 ") int32:%" PRId32 "%016" PRIx64 " (%" PRId64 ") int32:%" PRId32
" uint32:%" PRIu32 " int64:%" PRId64 " uint64:%" PRIu64, " uint32:%" PRIu32 " int64:%" PRId64 " uint64:%" PRIu64,
v.fmt_int64, icount_, v.fmt_int32[0], v.fmt_int32[0], v.fmt_int64, icount_, v.fmt_int32[0], v.fmt_int32[0],
v.fmt_int64, v.fmt_int64); v.fmt_int64, v.fmt_int64);
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -1628,38 +1630,41 @@ void Simulator::TraceMSARegWr(T* value, TraceType t) { ...@@ -1628,38 +1630,41 @@ void Simulator::TraceMSARegWr(T* value, TraceType t) {
memcpy(v.b, value, kSimd128Size); memcpy(v.b, value, kSimd128Size);
switch (t) { switch (t) {
case BYTE: case BYTE:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 ")", "LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
v.d[0], v.d[1], icount_); ")",
v.d[0], v.d[1], icount_);
break; break;
case HALF: case HALF:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 ")", "LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
v.d[0], v.d[1], icount_); ")",
v.d[0], v.d[1], icount_);
break; break;
case WORD: case WORD:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 "LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") int32[0..3]:%" PRId32 " %" PRId32 " %" PRId32 ") int32[0..3]:%" PRId32 " %" PRId32 " %" PRId32
" %" PRId32, " %" PRId32,
v.d[0], v.d[1], icount_, v.w[0], v.w[1], v.w[2], v.w[3]); v.d[0], v.d[1], icount_, v.w[0], v.w[1], v.w[2], v.w[3]);
break; break;
case DWORD: case DWORD:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 ")", "LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
v.d[0], v.d[1], icount_); ")",
v.d[0], v.d[1], icount_);
break; break;
case FLOAT: case FLOAT:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 "LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") flt[0..3]:%e %e %e %e", ") flt[0..3]:%e %e %e %e",
v.d[0], v.d[1], icount_, v.f[0], v.f[1], v.f[2], v.f[3]); v.d[0], v.d[1], icount_, v.f[0], v.f[1], v.f[2], v.f[3]);
break; break;
case DOUBLE: case DOUBLE:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 "LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") dbl[0..1]:%e %e", ") dbl[0..1]:%e %e",
v.d[0], v.d[1], icount_, v.df[0], v.df[1]); v.d[0], v.d[1], icount_, v.df[0], v.df[1]);
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -1681,25 +1686,25 @@ void Simulator::TraceMSARegWr(T* value) { ...@@ -1681,25 +1686,25 @@ void Simulator::TraceMSARegWr(T* value) {
memcpy(v.b, value, kMSALanesByte); memcpy(v.b, value, kMSALanesByte);
if (std::is_same<T, int32_t>::value) { if (std::is_same<T, int32_t>::value) {
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 "LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") int32[0..3]:%" PRId32 " %" PRId32 " %" PRId32 ") int32[0..3]:%" PRId32 " %" PRId32 " %" PRId32
" %" PRId32, " %" PRId32,
v.d[0], v.d[1], icount_, v.w[0], v.w[1], v.w[2], v.w[3]); v.d[0], v.d[1], icount_, v.w[0], v.w[1], v.w[2], v.w[3]);
} else if (std::is_same<T, float>::value) { } else if (std::is_same<T, float>::value) {
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 "LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") flt[0..3]:%e %e %e %e", ") flt[0..3]:%e %e %e %e",
v.d[0], v.d[1], icount_, v.f[0], v.f[1], v.f[2], v.f[3]); v.d[0], v.d[1], icount_, v.f[0], v.f[1], v.f[2], v.f[3]);
} else if (std::is_same<T, double>::value) { } else if (std::is_same<T, double>::value) {
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 "LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") dbl[0..1]:%e %e", ") dbl[0..1]:%e %e",
v.d[0], v.d[1], icount_, v.df[0], v.df[1]); v.d[0], v.d[1], icount_, v.df[0], v.df[1]);
} else { } else {
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 ")", "LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 ")",
v.d[0], v.d[1], icount_); v.d[0], v.d[1], icount_);
} }
} }
} }
...@@ -1717,34 +1722,36 @@ void Simulator::TraceMemRd(int64_t addr, int64_t value, TraceType t) { ...@@ -1717,34 +1722,36 @@ void Simulator::TraceMemRd(int64_t addr, int64_t value, TraceType t) {
switch (t) { switch (t) {
case WORD: case WORD:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64 "%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") int32:%" PRId32 " uint32:%" PRIu32, ") int32:%" PRId32 " uint32:%" PRIu32,
v.fmt_int64, addr, icount_, v.fmt_int32[0], v.fmt_int32[0]); v.fmt_int64, addr, icount_, v.fmt_int32[0],
v.fmt_int32[0]);
break; break;
case DWORD: case DWORD:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64 "%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") int64:%" PRId64 " uint64:%" PRIu64, ") int64:%" PRId64 " uint64:%" PRIu64,
value, addr, icount_, value, value); value, addr, icount_, value, value);
break; break;
case FLOAT: case FLOAT:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64 "%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") flt:%e", ") flt:%e",
v.fmt_int64, addr, icount_, v.fmt_float[0]); v.fmt_int64, addr, icount_, v.fmt_float[0]);
break; break;
case DOUBLE: case DOUBLE:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64 "%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") dbl:%e", ") dbl:%e",
v.fmt_int64, addr, icount_, v.fmt_double); v.fmt_int64, addr, icount_, v.fmt_double);
break; break;
case FLOAT_DOUBLE: case FLOAT_DOUBLE:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64 "%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") flt:%e dbl:%e", ") flt:%e dbl:%e",
v.fmt_int64, addr, icount_, v.fmt_float[0], v.fmt_double); v.fmt_int64, addr, icount_, v.fmt_float[0],
v.fmt_double);
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -1756,26 +1763,27 @@ void Simulator::TraceMemWr(int64_t addr, int64_t value, TraceType t) { ...@@ -1756,26 +1763,27 @@ void Simulator::TraceMemWr(int64_t addr, int64_t value, TraceType t) {
if (::v8::internal::FLAG_trace_sim) { if (::v8::internal::FLAG_trace_sim) {
switch (t) { switch (t) {
case BYTE: case BYTE:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
" %02" PRIx8 " --> [%016" PRIx64 "] (%" PRId64 " %02" PRIx8 " --> [%016" PRIx64
")", "] (%" PRId64 ")",
static_cast<uint8_t>(value), addr, icount_); static_cast<uint8_t>(value), addr, icount_);
break; break;
case HALF: case HALF:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
" %04" PRIx16 " --> [%016" PRIx64 "] (%" PRId64 " %04" PRIx16 " --> [%016" PRIx64
")", "] (%" PRId64 ")",
static_cast<uint16_t>(value), addr, icount_); static_cast<uint16_t>(value), addr, icount_);
break; break;
case WORD: case WORD:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
" %08" PRIx32 " --> [%016" PRIx64 "] (%" PRId64 ")", " %08" PRIx32 " --> [%016" PRIx64 "] (%" PRId64
static_cast<uint32_t>(value), addr, icount_); ")",
static_cast<uint32_t>(value), addr, icount_);
break; break;
case DWORD: case DWORD:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"%016" PRIx64 " --> [%016" PRIx64 "] (%" PRId64 " )", "%016" PRIx64 " --> [%016" PRIx64 "] (%" PRId64 " )",
value, addr, icount_); value, addr, icount_);
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -1788,32 +1796,35 @@ void Simulator::TraceMemRd(int64_t addr, T value) { ...@@ -1788,32 +1796,35 @@ void Simulator::TraceMemRd(int64_t addr, T value) {
if (::v8::internal::FLAG_trace_sim) { if (::v8::internal::FLAG_trace_sim) {
switch (sizeof(T)) { switch (sizeof(T)) {
case 1: case 1:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"%08" PRIx8 " <-- [%08" PRIx64 "] (%" PRIu64 "%08" PRIx8 " <-- [%08" PRIx64 "] (%" PRIu64
") int8:%" PRId8 " uint8:%" PRIu8, ") int8:%" PRId8 " uint8:%" PRIu8,
static_cast<uint8_t>(value), addr, icount_, static_cast<uint8_t>(value), addr, icount_,
static_cast<int8_t>(value), static_cast<uint8_t>(value)); static_cast<int8_t>(value), static_cast<uint8_t>(value));
break; break;
case 2: case 2:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"%08" PRIx16 " <-- [%08" PRIx64 "] (%" PRIu64 "%08" PRIx16 " <-- [%08" PRIx64 "] (%" PRIu64
") int16:%" PRId16 " uint16:%" PRIu16, ") int16:%" PRId16 " uint16:%" PRIu16,
static_cast<uint16_t>(value), addr, icount_, static_cast<uint16_t>(value), addr, icount_,
static_cast<int16_t>(value), static_cast<uint16_t>(value)); static_cast<int16_t>(value),
static_cast<uint16_t>(value));
break; break;
case 4: case 4:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"%08" PRIx32 " <-- [%08" PRIx64 "] (%" PRIu64 "%08" PRIx32 " <-- [%08" PRIx64 "] (%" PRIu64
") int32:%" PRId32 " uint32:%" PRIu32, ") int32:%" PRId32 " uint32:%" PRIu32,
static_cast<uint32_t>(value), addr, icount_, static_cast<uint32_t>(value), addr, icount_,
static_cast<int32_t>(value), static_cast<uint32_t>(value)); static_cast<int32_t>(value),
static_cast<uint32_t>(value));
break; break;
case 8: case 8:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"%08" PRIx64 " <-- [%08" PRIx64 "] (%" PRIu64 "%08" PRIx64 " <-- [%08" PRIx64 "] (%" PRIu64
") int64:%" PRId64 " uint64:%" PRIu64, ") int64:%" PRId64 " uint64:%" PRIu64,
static_cast<uint64_t>(value), addr, icount_, static_cast<uint64_t>(value), addr, icount_,
static_cast<int64_t>(value), static_cast<uint64_t>(value)); static_cast<int64_t>(value),
static_cast<uint64_t>(value));
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -1826,24 +1837,25 @@ void Simulator::TraceMemWr(int64_t addr, T value) { ...@@ -1826,24 +1837,25 @@ void Simulator::TraceMemWr(int64_t addr, T value) {
if (::v8::internal::FLAG_trace_sim) { if (::v8::internal::FLAG_trace_sim) {
switch (sizeof(T)) { switch (sizeof(T)) {
case 1: case 1:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
" %02" PRIx8 " --> [%08" PRIx64 "] (%" PRIu64 ")", " %02" PRIx8 " --> [%08" PRIx64 "] (%" PRIu64
static_cast<uint8_t>(value), addr, icount_); ")",
static_cast<uint8_t>(value), addr, icount_);
break; break;
case 2: case 2:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
" %04" PRIx16 " --> [%08" PRIx64 "] (%" PRIu64 ")", " %04" PRIx16 " --> [%08" PRIx64 "] (%" PRIu64 ")",
static_cast<uint16_t>(value), addr, icount_); static_cast<uint16_t>(value), addr, icount_);
break; break;
case 4: case 4:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"%08" PRIx32 " --> [%08" PRIx64 "] (%" PRIu64 ")", "%08" PRIx32 " --> [%08" PRIx64 "] (%" PRIu64 ")",
static_cast<uint32_t>(value), addr, icount_); static_cast<uint32_t>(value), addr, icount_);
break; break;
case 8: case 8:
SNPrintF(trace_buf_, base::SNPrintF(trace_buf_,
"%16" PRIx64 " --> [%08" PRIx64 "] (%" PRIu64 ")", "%16" PRIx64 " --> [%08" PRIx64 "] (%" PRIu64 ")",
static_cast<uint64_t>(value), addr, icount_); static_cast<uint64_t>(value), addr, icount_);
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -7319,7 +7331,7 @@ void Simulator::InstructionDecode(Instruction* instr) { ...@@ -7319,7 +7331,7 @@ void Simulator::InstructionDecode(Instruction* instr) {
v8::base::EmbeddedVector<char, 256> buffer; v8::base::EmbeddedVector<char, 256> buffer;
if (::v8::internal::FLAG_trace_sim) { if (::v8::internal::FLAG_trace_sim) {
SNPrintF(trace_buf_, " "); base::SNPrintF(trace_buf_, " ");
disasm::NameConverter converter; disasm::NameConverter converter;
disasm::Disassembler dasm(converter); disasm::Disassembler dasm(converter);
// Use a reasonably large buffer. // Use a reasonably large buffer.
......
...@@ -36,6 +36,7 @@ T Nabs(T a) { ...@@ -36,6 +36,7 @@ T Nabs(T a) {
// Running with a simulator. // Running with a simulator.
#include "src/base/hashmap.h" #include "src/base/hashmap.h"
#include "src/base/strings.h"
#include "src/codegen/assembler.h" #include "src/codegen/assembler.h"
#include "src/codegen/mips64/constants-mips64.h" #include "src/codegen/mips64/constants-mips64.h"
#include "src/execution/simulator-base.h" #include "src/execution/simulator-base.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment