Commit 73d76e01 authored by Lu Yahan's avatar Lu Yahan Committed by V8 LUCI CQ

[riscv64][wasm] Count direct calls

Port 9ca0bfef

Original Commit Message:

    This adds feedback collection to count the number of executions of
    call_direct instructions in Liftoff code. The purpose is better
    inlining decisions in Turbofan, which are enabled by having call
    count information for all kinds of calls.
    The new feature is gated on --wasm-speculative-inlining. While
    direct calls don't need to speculate about their target, the whole
    feedback collection infrastructure depends on that flag.

Change-Id: I91e34d765e5a08c382d678acdb0fca57d5d3fb7e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3578235
Auto-Submit: Yahan Lu <yahan@iscas.ac.cn>
Reviewed-by: 's avatarji qiu <qiuji@iscas.ac.cn>
Commit-Queue: ji qiu <qiuji@iscas.ac.cn>
Cr-Commit-Position: refs/heads/main@{#79878}
parent f096405a
......@@ -862,6 +862,24 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
VRegister v_scratch);
void Round_d(VRegister dst, VRegister src, Register scratch,
VRegister v_scratch);
// -------------------------------------------------------------------------
// Smi utilities.
void SmiTag(Register dst, Register src) {
STATIC_ASSERT(kSmiTag == 0);
if (SmiValuesAre32Bits()) {
// Smi goes to upper 32
slli(dst, src, 32);
} else {
DCHECK(SmiValuesAre31Bits());
// Smi is shifted left by 1
Add32(dst, src, src);
}
}
void SmiTag(Register reg) { SmiTag(reg, reg); }
// Jump the register contains a smi.
void JumpIfSmi(Register value, Label* smi_label);
......@@ -1231,23 +1249,6 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
Register scratch2, Label* stack_overflow,
Label* done = nullptr);
// -------------------------------------------------------------------------
// Smi utilities.
void SmiTag(Register dst, Register src) {
STATIC_ASSERT(kSmiTag == 0);
if (SmiValuesAre32Bits()) {
// Smi goes to upper 32
slli(dst, src, 32);
} else {
DCHECK(SmiValuesAre31Bits());
// Smi is shifted left by 1
Add32(dst, src, src);
}
}
void SmiTag(Register reg) { SmiTag(reg, reg); }
// Left-shifted from int32 equivalent of Smi.
void SmiScale(Register dst, Register src, int scale) {
if (SmiValuesAre32Bits()) {
......
......@@ -1697,6 +1697,23 @@ void LiftoffAssembler::emit_smi_check(Register obj, Label* target,
Branch(target, condition, scratch, Operand(zero_reg));
}
void LiftoffAssembler::IncrementSmi(LiftoffRegister dst, int offset) {
UseScratchRegisterScope temps(this);
if (COMPRESS_POINTERS_BOOL) {
DCHECK(SmiValuesAre31Bits());
Register scratch = temps.Acquire();
Lw(scratch, MemOperand(dst.gp(), offset));
Add32(scratch, scratch, Operand(Smi::FromInt(1)));
Sw(scratch, MemOperand(dst.gp(), offset));
} else {
Register scratch = temps.Acquire();
SmiUntag(scratch, MemOperand(dst.gp(), offset));
Add64(scratch, scratch, Operand(1));
SmiTag(scratch);
Sd(scratch, MemOperand(dst.gp(), offset));
}
}
void LiftoffAssembler::LoadTransform(LiftoffRegister dst, Register src_addr,
Register offset_reg, uintptr_t offset_imm,
LoadType type,
......
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