Commit 1b88676f authored by Liu Yu's avatar Liu Yu Committed by V8 LUCI CQ

[loong64][mips][wasm] Count direct calls

Port commit 9ca0bfef

Bug: v8:12166
Change-Id: I39708d61f823b4ef12ab5aac6b030eff89517b16
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3579870
Auto-Submit: Yu Liu <liuyu@loongson.cn>
Reviewed-by: 's avatarZhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/main@{#79901}
parent bb557a0a
......@@ -417,6 +417,18 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
#undef DEFINE_INSTRUCTION2
#undef DEFINE_INSTRUCTION3
void SmiTag(Register dst, Register src) {
STATIC_ASSERT(kSmiTag == 0);
if (SmiValuesAre32Bits()) {
slli_d(dst, src, 32);
} else {
DCHECK(SmiValuesAre31Bits());
add_w(dst, src, src);
}
}
void SmiTag(Register reg) { SmiTag(reg, reg); }
void SmiUntag(Register dst, const MemOperand& src);
void SmiUntag(Register dst, Register src) {
if (SmiValuesAre32Bits()) {
......@@ -998,18 +1010,6 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
// ---------------------------------------------------------------------------
// Smi utilities.
void SmiTag(Register dst, Register src) {
STATIC_ASSERT(kSmiTag == 0);
if (SmiValuesAre32Bits()) {
slli_d(dst, src, 32);
} else {
DCHECK(SmiValuesAre31Bits());
add_w(dst, src, src);
}
}
void SmiTag(Register reg) { SmiTag(reg, reg); }
// Test if the register contains a smi.
inline void SmiTst(Register value, Register scratch) {
And(scratch, value, Operand(kSmiTagMask));
......
......@@ -482,6 +482,18 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
#undef DEFINE_INSTRUCTION2
#undef DEFINE_INSTRUCTION3
void SmiTag(Register dst, Register src) {
STATIC_ASSERT(kSmiTag == 0);
if (SmiValuesAre32Bits()) {
dsll32(dst, src, 0);
} else {
DCHECK(SmiValuesAre31Bits());
Addu(dst, src, src);
}
}
void SmiTag(Register reg) { SmiTag(reg, reg); }
void SmiUntag(Register dst, const MemOperand& src);
void SmiUntag(Register dst, Register src) {
if (SmiValuesAre32Bits()) {
......@@ -1184,18 +1196,6 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
// ---------------------------------------------------------------------------
// Smi utilities.
void SmiTag(Register dst, Register src) {
STATIC_ASSERT(kSmiTag == 0);
if (SmiValuesAre32Bits()) {
dsll32(dst, src, 0);
} else {
DCHECK(SmiValuesAre31Bits());
Addu(dst, src, src);
}
}
void SmiTag(Register reg) { SmiTag(reg, reg); }
// Test if the register contains a smi.
inline void SmiTst(Register value, Register scratch) {
And(scratch, value, Operand(kSmiTagMask));
......
......@@ -996,6 +996,15 @@ bool LiftoffAssembler::emit_i64_popcnt(LiftoffRegister dst,
return true;
}
void LiftoffAssembler::IncrementSmi(LiftoffRegister dst, int offset) {
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
SmiUntag(scratch, MemOperand(dst.gp(), offset));
Add_d(scratch, scratch, Operand(1));
SmiTag(scratch);
St_d(scratch, MemOperand(dst.gp(), offset));
}
void LiftoffAssembler::emit_i32_mul(Register dst, Register lhs, Register rhs) {
TurboAssembler::Mul_w(dst, lhs, rhs);
}
......
......@@ -1234,6 +1234,14 @@ bool LiftoffAssembler::emit_i64_popcnt(LiftoffRegister dst,
return true;
}
void LiftoffAssembler::IncrementSmi(LiftoffRegister dst, int offset) {
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
lw(scratch, MemOperand(dst.gp(), offset));
Addu(scratch, scratch, Operand(Smi::FromInt(1)));
sw(scratch, MemOperand(dst.gp(), offset));
}
void LiftoffAssembler::emit_f32_neg(DoubleRegister dst, DoubleRegister src) {
TurboAssembler::Neg_s(dst, src);
}
......
......@@ -1098,6 +1098,15 @@ bool LiftoffAssembler::emit_i64_popcnt(LiftoffRegister dst,
return true;
}
void LiftoffAssembler::IncrementSmi(LiftoffRegister dst, int offset) {
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
SmiUntag(scratch, MemOperand(dst.gp(), offset));
Daddu(scratch, scratch, Operand(1));
SmiTag(scratch);
Sd(scratch, MemOperand(dst.gp(), offset));
}
void LiftoffAssembler::emit_i32_mul(Register dst, Register lhs, Register rhs) {
TurboAssembler::Mul(dst, lhs, rhs);
}
......
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