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) {
// Print the integer value of the sa field.
void Decoder::PrintSa(Instruction* instr) {
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.
void Decoder::PrintLsaSa(Instruction* instr) {
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.
void Decoder::PrintSd(Instruction* instr) {
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.
void Decoder::PrintSs1(Instruction* instr) {
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.
......@@ -268,54 +269,55 @@ void Decoder::PrintSs2(Instruction* instr) {
int ss = instr->RdValue();
int pos = instr->SaValue();
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.
void Decoder::PrintBc(Instruction* instr) {
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.
void Decoder::PrintCc(Instruction* instr) {
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) {
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.
void Decoder::PrintUImm9(Instruction* instr) {
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.
void Decoder::PrintSImm9(Instruction* instr) {
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.
void Decoder::PrintUImm16(Instruction* instr) {
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.
void Decoder::PrintSImm16(Instruction* instr) {
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.
void Decoder::PrintXImm16(Instruction* instr) {
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.
......@@ -324,28 +326,28 @@ void Decoder::PrintXImm16(Instruction* instr) {
void Decoder::PrintPCImm16(Instruction* instr, int delta_pc, int n_bits) {
int16_t offset = instr->Imm16Value();
out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (offset << n_bits)));
base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (offset << n_bits)));
}
// Print 18-bit signed immediate value.
void Decoder::PrintSImm18(Instruction* instr) {
int32_t imm =
((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.
void Decoder::PrintXImm18(Instruction* instr) {
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.
void Decoder::PrintXImm19(Instruction* instr) {
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.
......@@ -354,13 +356,13 @@ void Decoder::PrintSImm19(Instruction* instr) {
// set sign
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.
void Decoder::PrintXImm21(Instruction* instr) {
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.
......@@ -369,7 +371,7 @@ void Decoder::PrintSImm21(Instruction* instr) {
// set sign
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.
......@@ -381,9 +383,9 @@ void Decoder::PrintPCImm21(Instruction* instr, int delta_pc, int n_bits) {
imm21 <<= (32 - kImm21Bits);
imm21 >>= (32 - kImm21Bits);
out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (imm21 << n_bits)));
base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (imm21 << n_bits)));
}
// Print 26-bit hex immediate value.
......@@ -391,7 +393,8 @@ void Decoder::PrintXImm26(Instruction* instr) {
uint32_t target = static_cast<uint32_t>(instr->Imm26Value())
<< kImmFieldShift;
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.
......@@ -400,7 +403,7 @@ void Decoder::PrintSImm26(Instruction* instr) {
// set sign
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.
......@@ -412,9 +415,9 @@ void Decoder::PrintPCImm26(Instruction* instr, int delta_pc, int n_bits) {
imm26 <<= (32 - kImm26Bits);
imm26 >>= (32 - kImm26Bits);
out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (imm26 << n_bits)));
base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (imm26 << n_bits)));
}
// Print absoulte address for 26-bit offset or immediate value.
......@@ -425,8 +428,8 @@ void Decoder::PrintPCImm26(Instruction* instr) {
uint32_t pc_mask = ~0xFFFFFFF;
uint32_t pc = ((uint32_t)(instr + 1) & pc_mask) | (imm26 << 2);
out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress((reinterpret_cast<byte*>(pc))));
base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress((reinterpret_cast<byte*>(pc))));
}
// Print 26-bit immediate value.
......@@ -436,8 +439,8 @@ void Decoder::PrintCode(Instruction* instr) {
switch (instr->FunctionFieldRaw()) {
case BREAK: {
int32_t code = instr->Bits(25, 6);
out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "0x%05x (%d)", code, code);
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_,
"0x%05x (%d)", code, code);
break;
}
case TGE:
......@@ -448,7 +451,7 @@ void Decoder::PrintCode(Instruction* instr) {
case TNE: {
int32_t code = instr->Bits(15, 6);
out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "0x%03x", code);
base::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%03x", code);
break;
}
default: // Not a break or trap instruction.
......@@ -458,50 +461,50 @@ void Decoder::PrintCode(Instruction* instr) {
void Decoder::PrintMsaXImm8(Instruction* instr) {
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) {
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) {
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) {
int32_t imm = instr->MsaImm5Value();
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) {
int32_t imm = is_mi10 ? instr->MsaImmMI10Value() : instr->MsaImm10Value();
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) {
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) {
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) {
int32_t rd = instr->WdValue();
int32_t ws = instr->WsValue();
int32_t n = instr->MsaElmNValue();
out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "%s, %s[%u]",
converter_.NameOfCPURegister(rd), MSARegisters::Name(ws), n);
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s, %s[%u]",
converter_.NameOfCPURegister(rd),
MSARegisters::Name(ws), n);
}
void Decoder::PrintFormat(Instruction* instr) {
......@@ -2651,8 +2654,8 @@ void Decoder::DecodeTypeMsa2RF(Instruction* instr) {
int Decoder::InstructionDecode(byte* instr_ptr) {
Instruction* instr = Instruction::At(instr_ptr);
// Print raw instruction bytes.
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%08x ",
instr->InstructionBits());
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_,
"%08x ", instr->InstructionBits());
switch (instr->InstructionType()) {
case Instruction::kRegisterType: {
DecodeTypeRegister(instr);
......@@ -2682,7 +2685,7 @@ int Decoder::InstructionDecode(byte* instr_ptr) {
namespace disasm {
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();
}
......
......@@ -295,10 +295,9 @@ void Decoder::PrintSs3(Instruction* instr) {
// Print the integer value of dinsm size from the msbminus32 and lsb fields.
void Decoder::PrintSs4(Instruction* instr) {
int msbminus32 = instr->RdValue();
int lsb = instr->S_buffer_pos_ +=
base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d",
msbminus32 + 32 - lsb + 1);
int lsb = instr->SaValue();
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d",
msbminus32 + 32 - lsb + 1);
}
// Print the integer value of dextu/dinsu pos from the lsbminus32 field.
......@@ -316,7 +315,7 @@ void Decoder::PrintBc(Instruction* instr) {
// Print the integer value of the cc field for the FP compare instructions.
void Decoder::PrintCc(Instruction* instr) {
int cc = instr->FC ccValue();
int cc = instr->FCccValue();
out_buffer_pos_ +=
base::SNPrintF(out_buffer_ + out_buffer_pos_, "cc(%d)", cc);
}
......@@ -358,9 +357,9 @@ void Decoder::PrintXImm16(Instruction* instr) {
void Decoder::PrintPCImm16(Instruction* instr, int delta_pc, int n_bits) {
int16_t offset = instr->Imm16Value();
out_buffer_pos_ +=
base::SNP rintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (offset << n_bits)));
base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (offset << n_bits)));
}
// Print 18-bit signed immediate value.
......@@ -415,9 +414,9 @@ void Decoder::PrintPCImm21(Instruction* instr, int delta_pc, int n_bits) {
imm21 <<= (32 - kImm21Bits);
imm21 >>= (32 - kImm21Bits);
out_buffer_pos_ +=
base::SNP rintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (imm21 << n_bits)));
base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (imm21 << n_bits)));
}
// Print 26-bit hex immediate value.
......@@ -447,9 +446,9 @@ void Decoder::PrintPCImm26(Instruction* instr, int delta_pc, int n_bits) {
imm26 <<= (32 - kImm26Bits);
imm26 >>= (32 - kImm26Bits);
out_buffer_pos_ +=
base::SNP rintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (imm26 << n_bits)));
base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
delta_pc + (imm26 << n_bits)));
}
// Print absoulte address for 26-bit offset or immediate value.
......@@ -460,8 +459,8 @@ void Decoder::PrintPCImm26(Instruction* instr) {
uint64_t pc_mask = ~0xFFFFFFF;
uint64_t pc = ((uint64_t)(instr + 1) & pc_mask) | (imm26 << 2);
out_buffer_pos_ +=
base::SNP rintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress((reinterpret_cast<byte*>(pc))));
base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s",
converter_.NameOfAddress((reinterpret_cast<byte*>(pc))));
}
void Decoder::PrintBp2(Instruction* instr) {
......@@ -480,10 +479,9 @@ void Decoder::PrintCode(Instruction* instr) {
return; // Not a break or trap instruction.
switch (instr->FunctionFieldRaw()) {
case BREAK: {
int32_t code = ins_buffer_pos_ +=
base::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%05x (%d)", code,
code);
int32_t code = instr->Bits(25, 6);
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_,
"0x%05x (%d)", code, code);
break;
}
case TGE:
......@@ -544,9 +542,10 @@ void Decoder::PrintMsaImmElm(Instruction* instr) {
void Decoder::PrintMsaCopy(Instruction* instr) {
int32_t rd = instr->WdValue();
int32_t ws = instr->WsValue();
int32_t n = instr - buffer_pos_ +=
rintF(out_buffer_ + out_buffer_po _, "%s, %s[%u]",
converter_.NameOfCPURegister(rd), MSARegisters::Name(ws), n);
int32_t n = instr->MsaElmNValue();
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%s, %s[%u]",
converter_.NameOfCPURegister(rd),
MSARegisters::Name(ws), n);
}
void Decoder::PrintFormat(Instruction* instr) {
......@@ -2976,7 +2975,7 @@ int Decoder::InstructionDecode(byte* instr_ptr) {
namespace disasm {
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();
}
......
......@@ -36,6 +36,7 @@ T Nabs(T a) {
// Running with a simulator.
#include "src/base/hashmap.h"
#include "src/base/strings.h"
#include "src/codegen/assembler.h"
#include "src/codegen/mips/constants-mips.h"
#include "src/execution/simulator-base.h"
......@@ -548,7 +549,7 @@ class Simulator : public SimulatorBase {
instr->OpcodeValue());
}
InstructionDecode(instr);
SNPrintF(trace_buf_, " ");
base::SNPrintF(trace_buf_, " ");
}
// ICache.
......
......@@ -16,6 +16,7 @@
#include "src/base/bits.h"
#include "src/base/platform/platform.h"
#include "src/base/platform/wrappers.h"
#include "src/base/strings.h"
#include "src/base/vector.h"
#include "src/codegen/assembler-inl.h"
#include "src/codegen/macro-assembler.h"
......@@ -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
// 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
// Library does not provide vsscanf.
// ::v8::internal::OS in the same way as base::SNPrintF is that the Windows C
// Run-Time Library does not provide vsscanf.
#define SScanF sscanf
// The MipsDebugger class is used by the simulator while debugging simulated
......@@ -1578,35 +1579,36 @@ void Simulator::TraceRegWr(int64_t value, TraceType t) {
switch (t) {
case WORD:
SNPrintF(trace_buf_,
"%016" PRIx64 " (%" PRId64 ") int32:%" PRId32
" uint32:%" PRIu32,
v.fmt_int64, icount_, v.fmt_int32[0], v.fmt_int32[0]);
base::SNPrintF(trace_buf_,
"%016" PRIx64 " (%" PRId64 ") int32:%" PRId32
" uint32:%" PRIu32,
v.fmt_int64, icount_, v.fmt_int32[0], v.fmt_int32[0]);
break;
case DWORD:
SNPrintF(trace_buf_,
"%016" PRIx64 " (%" PRId64 ") int64:%" PRId64
" uint64:%" PRIu64,
value, icount_, value, value);
base::SNPrintF(trace_buf_,
"%016" PRIx64 " (%" PRId64 ") int64:%" PRId64
" uint64:%" PRIu64,
value, icount_, value, value);
break;
case FLOAT:
SNPrintF(trace_buf_, "%016" PRIx64 " (%" PRId64 ") flt:%e",
v.fmt_int64, icount_, v.fmt_float[0]);
base::SNPrintF(trace_buf_, "%016" PRIx64 " (%" PRId64 ") flt:%e",
v.fmt_int64, icount_, v.fmt_float[0]);
break;
case DOUBLE:
SNPrintF(trace_buf_, "%016" PRIx64 " (%" PRId64 ") dbl:%e",
v.fmt_int64, icount_, v.fmt_double);
base::SNPrintF(trace_buf_, "%016" PRIx64 " (%" PRId64 ") dbl:%e",
v.fmt_int64, icount_, v.fmt_double);
break;
case FLOAT_DOUBLE:
SNPrintF(trace_buf_, "%016" PRIx64 " (%" PRId64 ") flt:%e dbl:%e",
v.fmt_int64, icount_, v.fmt_float[0], v.fmt_double);
base::SNPrintF(trace_buf_,
"%016" PRIx64 " (%" PRId64 ") flt:%e dbl:%e",
v.fmt_int64, icount_, v.fmt_float[0], v.fmt_double);
break;
case WORD_DWORD:
SNPrintF(trace_buf_,
"%016" PRIx64 " (%" PRId64 ") int32:%" PRId32
" uint32:%" PRIu32 " int64:%" PRId64 " uint64:%" PRIu64,
v.fmt_int64, icount_, v.fmt_int32[0], v.fmt_int32[0],
v.fmt_int64, v.fmt_int64);
base::SNPrintF(trace_buf_,
"%016" PRIx64 " (%" PRId64 ") int32:%" PRId32
" uint32:%" PRIu32 " int64:%" PRId64 " uint64:%" PRIu64,
v.fmt_int64, icount_, v.fmt_int32[0], v.fmt_int32[0],
v.fmt_int64, v.fmt_int64);
break;
default:
UNREACHABLE();
......@@ -1628,38 +1630,41 @@ void Simulator::TraceMSARegWr(T* value, TraceType t) {
memcpy(v.b, value, kSimd128Size);
switch (t) {
case BYTE:
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 ")",
v.d[0], v.d[1], icount_);
base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
")",
v.d[0], v.d[1], icount_);
break;
case HALF:
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 ")",
v.d[0], v.d[1], icount_);
base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
")",
v.d[0], v.d[1], icount_);
break;
case WORD:
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") int32[0..3]:%" PRId32 " %" PRId32 " %" PRId32
" %" PRId32,
v.d[0], v.d[1], icount_, v.w[0], v.w[1], v.w[2], v.w[3]);
base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") int32[0..3]:%" PRId32 " %" PRId32 " %" PRId32
" %" PRId32,
v.d[0], v.d[1], icount_, v.w[0], v.w[1], v.w[2], v.w[3]);
break;
case DWORD:
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 ")",
v.d[0], v.d[1], icount_);
base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
")",
v.d[0], v.d[1], icount_);
break;
case FLOAT:
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") 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]);
base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") 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]);
break;
case DOUBLE:
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") dbl[0..1]:%e %e",
v.d[0], v.d[1], icount_, v.df[0], v.df[1]);
base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") dbl[0..1]:%e %e",
v.d[0], v.d[1], icount_, v.df[0], v.df[1]);
break;
default:
UNREACHABLE();
......@@ -1681,25 +1686,25 @@ void Simulator::TraceMSARegWr(T* value) {
memcpy(v.b, value, kMSALanesByte);
if (std::is_same<T, int32_t>::value) {
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") int32[0..3]:%" PRId32 " %" PRId32 " %" PRId32
" %" PRId32,
v.d[0], v.d[1], icount_, v.w[0], v.w[1], v.w[2], v.w[3]);
base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") int32[0..3]:%" PRId32 " %" PRId32 " %" PRId32
" %" PRId32,
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) {
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") 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]);
base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") 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]);
} else if (std::is_same<T, double>::value) {
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") dbl[0..1]:%e %e",
v.d[0], v.d[1], icount_, v.df[0], v.df[1]);
base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64
") dbl[0..1]:%e %e",
v.d[0], v.d[1], icount_, v.df[0], v.df[1]);
} else {
SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 ")",
v.d[0], v.d[1], icount_);
base::SNPrintF(trace_buf_,
"LO: %016" PRIx64 " HI: %016" PRIx64 " (%" PRIu64 ")",
v.d[0], v.d[1], icount_);
}
}
}
......@@ -1717,34 +1722,36 @@ void Simulator::TraceMemRd(int64_t addr, int64_t value, TraceType t) {
switch (t) {
case WORD:
SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") int32:%" PRId32 " uint32:%" PRIu32,
v.fmt_int64, addr, icount_, v.fmt_int32[0], v.fmt_int32[0]);
base::SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") int32:%" PRId32 " uint32:%" PRIu32,
v.fmt_int64, addr, icount_, v.fmt_int32[0],
v.fmt_int32[0]);
break;
case DWORD:
SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") int64:%" PRId64 " uint64:%" PRIu64,
value, addr, icount_, value, value);
base::SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") int64:%" PRId64 " uint64:%" PRIu64,
value, addr, icount_, value, value);
break;
case FLOAT:
SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") flt:%e",
v.fmt_int64, addr, icount_, v.fmt_float[0]);
base::SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") flt:%e",
v.fmt_int64, addr, icount_, v.fmt_float[0]);
break;
case DOUBLE:
SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") dbl:%e",
v.fmt_int64, addr, icount_, v.fmt_double);
base::SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") dbl:%e",
v.fmt_int64, addr, icount_, v.fmt_double);
break;
case FLOAT_DOUBLE:
SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") flt:%e dbl:%e",
v.fmt_int64, addr, icount_, v.fmt_float[0], v.fmt_double);
base::SNPrintF(trace_buf_,
"%016" PRIx64 " <-- [%016" PRIx64 "] (%" PRId64
") flt:%e dbl:%e",
v.fmt_int64, addr, icount_, v.fmt_float[0],
v.fmt_double);
break;
default:
UNREACHABLE();
......@@ -1756,26 +1763,27 @@ void Simulator::TraceMemWr(int64_t addr, int64_t value, TraceType t) {
if (::v8::internal::FLAG_trace_sim) {
switch (t) {
case BYTE:
SNPrintF(trace_buf_,
" %02" PRIx8 " --> [%016" PRIx64 "] (%" PRId64
")",
static_cast<uint8_t>(value), addr, icount_);
base::SNPrintF(trace_buf_,
" %02" PRIx8 " --> [%016" PRIx64
"] (%" PRId64 ")",
static_cast<uint8_t>(value), addr, icount_);
break;
case HALF:
SNPrintF(trace_buf_,
" %04" PRIx16 " --> [%016" PRIx64 "] (%" PRId64
")",
static_cast<uint16_t>(value), addr, icount_);
base::SNPrintF(trace_buf_,
" %04" PRIx16 " --> [%016" PRIx64
"] (%" PRId64 ")",
static_cast<uint16_t>(value), addr, icount_);
break;
case WORD:
SNPrintF(trace_buf_,
" %08" PRIx32 " --> [%016" PRIx64 "] (%" PRId64 ")",
static_cast<uint32_t>(value), addr, icount_);
base::SNPrintF(trace_buf_,
" %08" PRIx32 " --> [%016" PRIx64 "] (%" PRId64
")",
static_cast<uint32_t>(value), addr, icount_);
break;
case DWORD:
SNPrintF(trace_buf_,
"%016" PRIx64 " --> [%016" PRIx64 "] (%" PRId64 " )",
value, addr, icount_);
base::SNPrintF(trace_buf_,
"%016" PRIx64 " --> [%016" PRIx64 "] (%" PRId64 " )",
value, addr, icount_);
break;
default:
UNREACHABLE();
......@@ -1788,32 +1796,35 @@ void Simulator::TraceMemRd(int64_t addr, T value) {
if (::v8::internal::FLAG_trace_sim) {
switch (sizeof(T)) {
case 1:
SNPrintF(trace_buf_,
"%08" PRIx8 " <-- [%08" PRIx64 "] (%" PRIu64
") int8:%" PRId8 " uint8:%" PRIu8,
static_cast<uint8_t>(value), addr, icount_,
static_cast<int8_t>(value), static_cast<uint8_t>(value));
base::SNPrintF(trace_buf_,
"%08" PRIx8 " <-- [%08" PRIx64 "] (%" PRIu64
") int8:%" PRId8 " uint8:%" PRIu8,
static_cast<uint8_t>(value), addr, icount_,
static_cast<int8_t>(value), static_cast<uint8_t>(value));
break;
case 2:
SNPrintF(trace_buf_,
"%08" PRIx16 " <-- [%08" PRIx64 "] (%" PRIu64
") int16:%" PRId16 " uint16:%" PRIu16,
static_cast<uint16_t>(value), addr, icount_,
static_cast<int16_t>(value), static_cast<uint16_t>(value));
base::SNPrintF(trace_buf_,
"%08" PRIx16 " <-- [%08" PRIx64 "] (%" PRIu64
") int16:%" PRId16 " uint16:%" PRIu16,
static_cast<uint16_t>(value), addr, icount_,
static_cast<int16_t>(value),
static_cast<uint16_t>(value));
break;
case 4:
SNPrintF(trace_buf_,
"%08" PRIx32 " <-- [%08" PRIx64 "] (%" PRIu64
") int32:%" PRId32 " uint32:%" PRIu32,
static_cast<uint32_t>(value), addr, icount_,
static_cast<int32_t>(value), static_cast<uint32_t>(value));
base::SNPrintF(trace_buf_,
"%08" PRIx32 " <-- [%08" PRIx64 "] (%" PRIu64
") int32:%" PRId32 " uint32:%" PRIu32,
static_cast<uint32_t>(value), addr, icount_,
static_cast<int32_t>(value),
static_cast<uint32_t>(value));
break;
case 8:
SNPrintF(trace_buf_,
"%08" PRIx64 " <-- [%08" PRIx64 "] (%" PRIu64
") int64:%" PRId64 " uint64:%" PRIu64,
static_cast<uint64_t>(value), addr, icount_,
static_cast<int64_t>(value), static_cast<uint64_t>(value));
base::SNPrintF(trace_buf_,
"%08" PRIx64 " <-- [%08" PRIx64 "] (%" PRIu64
") int64:%" PRId64 " uint64:%" PRIu64,
static_cast<uint64_t>(value), addr, icount_,
static_cast<int64_t>(value),
static_cast<uint64_t>(value));
break;
default:
UNREACHABLE();
......@@ -1826,24 +1837,25 @@ void Simulator::TraceMemWr(int64_t addr, T value) {
if (::v8::internal::FLAG_trace_sim) {
switch (sizeof(T)) {
case 1:
SNPrintF(trace_buf_,
" %02" PRIx8 " --> [%08" PRIx64 "] (%" PRIu64 ")",
static_cast<uint8_t>(value), addr, icount_);
base::SNPrintF(trace_buf_,
" %02" PRIx8 " --> [%08" PRIx64 "] (%" PRIu64
")",
static_cast<uint8_t>(value), addr, icount_);
break;
case 2:
SNPrintF(trace_buf_,
" %04" PRIx16 " --> [%08" PRIx64 "] (%" PRIu64 ")",
static_cast<uint16_t>(value), addr, icount_);
base::SNPrintF(trace_buf_,
" %04" PRIx16 " --> [%08" PRIx64 "] (%" PRIu64 ")",
static_cast<uint16_t>(value), addr, icount_);
break;
case 4:
SNPrintF(trace_buf_,
"%08" PRIx32 " --> [%08" PRIx64 "] (%" PRIu64 ")",
static_cast<uint32_t>(value), addr, icount_);
base::SNPrintF(trace_buf_,
"%08" PRIx32 " --> [%08" PRIx64 "] (%" PRIu64 ")",
static_cast<uint32_t>(value), addr, icount_);
break;
case 8:
SNPrintF(trace_buf_,
"%16" PRIx64 " --> [%08" PRIx64 "] (%" PRIu64 ")",
static_cast<uint64_t>(value), addr, icount_);
base::SNPrintF(trace_buf_,
"%16" PRIx64 " --> [%08" PRIx64 "] (%" PRIu64 ")",
static_cast<uint64_t>(value), addr, icount_);
break;
default:
UNREACHABLE();
......@@ -7319,7 +7331,7 @@ void Simulator::InstructionDecode(Instruction* instr) {
v8::base::EmbeddedVector<char, 256> buffer;
if (::v8::internal::FLAG_trace_sim) {
SNPrintF(trace_buf_, " ");
base::SNPrintF(trace_buf_, " ");
disasm::NameConverter converter;
disasm::Disassembler dasm(converter);
// Use a reasonably large buffer.
......
......@@ -36,6 +36,7 @@ T Nabs(T a) {
// Running with a simulator.
#include "src/base/hashmap.h"
#include "src/base/strings.h"
#include "src/codegen/assembler.h"
#include "src/codegen/mips64/constants-mips64.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