Commit aacd4162 authored by Milad Fa's avatar Milad Fa Committed by V8 LUCI CQ

PPC/s390: [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.

R=jkummerow@chromium.org, joransiu@ca.ibm.com, junyan@redhat.com, midawson@redhat.com
BUG=
LOG=N

Change-Id: Id94a8a00e00877213b017d1ccf06ae0ea988539b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3576126Reviewed-by: 's avatarJoran Siu <joransiu@ca.ibm.com>
Reviewed-by: 's avatarJunliang Yan <junyan@redhat.com>
Commit-Queue: Milad Farazmand <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/main@{#79862}
parent 2fbb686e
......@@ -792,6 +792,12 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
SmiUntag(smi);
}
// Shift left by kSmiShift
void SmiTag(Register reg, RCBit rc = LeaveRC) { SmiTag(reg, reg, rc); }
void SmiTag(Register dst, Register src, RCBit rc = LeaveRC) {
ShiftLeftU64(dst, src, Operand(kSmiShift), rc);
}
// Abort execution if argument is a smi, enabled via --debug-code.
void AssertNotSmi(Register object);
void AssertSmi(Register object);
......@@ -1299,12 +1305,6 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
// ---------------------------------------------------------------------------
// Smi utilities
// Shift left by kSmiShift
void SmiTag(Register reg, RCBit rc = LeaveRC) { SmiTag(reg, reg, rc); }
void SmiTag(Register dst, Register src, RCBit rc = LeaveRC) {
ShiftLeftU64(dst, src, Operand(kSmiShift), rc);
}
// Jump if either of the registers contain a non-smi.
inline void JumpIfNotSmi(Register value, Label* not_smi_label) {
TestIfSmi(value, r0);
......
......@@ -1054,6 +1054,12 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
SmiUntag(smi);
}
// Shift left by kSmiShift
void SmiTag(Register reg) { SmiTag(reg, reg); }
void SmiTag(Register dst, Register src) {
ShiftLeftU64(dst, src, Operand(kSmiShift));
}
// Abort execution if argument is a smi, enabled via --debug-code.
void AssertNotSmi(Register object);
void AssertSmi(Register object);
......@@ -1682,12 +1688,6 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
// ---------------------------------------------------------------------------
// Smi utilities
// Shift left by kSmiShift
void SmiTag(Register reg) { SmiTag(reg, reg); }
void SmiTag(Register dst, Register src) {
ShiftLeftU64(dst, src, Operand(kSmiShift));
}
// Jump if either of the registers contain a non-smi.
inline void JumpIfNotSmi(Register value, Label* not_smi_label) {
TestIfSmi(value);
......
......@@ -1255,6 +1255,23 @@ bool LiftoffAssembler::emit_f64_nearest_int(DoubleRegister dst,
return false;
}
void LiftoffAssembler::IncrementSmi(LiftoffRegister dst, int offset) {
UseScratchRegisterScope temps(this);
if (COMPRESS_POINTERS_BOOL) {
DCHECK(SmiValuesAre31Bits());
Register scratch = temps.Acquire();
LoadS32(scratch, MemOperand(dst.gp(), offset), r0);
AddS64(scratch, scratch, Operand(Smi::FromInt(1)));
StoreU32(scratch, MemOperand(dst.gp(), offset), r0);
} else {
Register scratch = temps.Acquire();
SmiUntag(scratch, MemOperand(dst.gp(), offset), LeaveRC, r0);
AddS64(scratch, scratch, Operand(1));
SmiTag(scratch);
StoreU64(scratch, MemOperand(dst.gp(), offset), r0);
}
}
void LiftoffAssembler::emit_i32_divs(Register dst, Register lhs, Register rhs,
Label* trap_div_by_zero,
Label* trap_div_unrepresentable) {
......
......@@ -1697,6 +1697,23 @@ BINOP_LIST(EMIT_BINOP_FUNCTION)
#undef REGISTER_AND_WITH_1F
#undef LFR_TO_REG
void LiftoffAssembler::IncrementSmi(LiftoffRegister dst, int offset) {
UseScratchRegisterScope temps(this);
if (COMPRESS_POINTERS_BOOL) {
DCHECK(SmiValuesAre31Bits());
Register scratch = temps.Acquire();
LoadS32(scratch, MemOperand(dst.gp(), offset));
AddU32(scratch, Operand(Smi::FromInt(1)));
StoreU32(scratch, MemOperand(dst.gp(), offset));
} else {
Register scratch = temps.Acquire();
SmiUntag(scratch, MemOperand(dst.gp(), offset));
AddU64(scratch, Operand(1));
SmiTag(scratch);
StoreU64(scratch, MemOperand(dst.gp(), offset));
}
}
void LiftoffAssembler::emit_i32_divs(Register dst, Register lhs, Register rhs,
Label* trap_div_by_zero,
Label* trap_div_unrepresentable) {
......
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