[liftoff] Add early check in TransferStackSlot

Inline TransferStackSlot and compare the slots first. This is redundant
if they are different, but in most cases they are the same and doing
this check is beneficial.
Other methods of StackTransferRecipe are not called as often, and
inlining them seems negligible.

R=clemensb@chromium.org

Bug: v8:10576
Change-Id: Ibdaa714e3e40c95a79a0da3ca3170d1da7b62cf3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2249677
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68392}
This commit is contained in:
Thibaud Michaud 2020-06-17 16:11:07 +02:00 committed by Commit Bot
parent 1c3f45a002
commit c4c2895202

View File

@ -82,35 +82,31 @@ class StackTransferRecipe {
DCHECK(load_dst_regs_.is_empty());
}
void TransferStackSlot(const VarState& dst, const VarState& src) {
V8_INLINE void TransferStackSlot(const VarState& dst, const VarState& src) {
DCHECK_EQ(dst.type(), src.type());
switch (dst.loc()) {
if (dst == src) return;
if (dst.is_reg()) {
LoadIntoRegister(dst.reg(), src, src.offset());
return;
}
DCHECK(dst.is_stack());
switch (src.loc()) {
case VarState::kStack:
switch (src.loc()) {
case VarState::kStack:
if (src.offset() == dst.offset()) break;
asm_->MoveStackValue(dst.offset(), src.offset(), src.type());
break;
case VarState::kRegister:
asm_->Spill(dst.offset(), src.reg(), src.type());
break;
case VarState::kIntConst:
asm_->Spill(dst.offset(), src.constant());
break;
}
DCHECK_NE(src.offset(), dst.offset());
asm_->MoveStackValue(dst.offset(), src.offset(), src.type());
break;
case VarState::kRegister:
LoadIntoRegister(dst.reg(), src, src.offset());
asm_->Spill(dst.offset(), src.reg(), src.type());
break;
case VarState::kIntConst:
DCHECK_EQ(dst, src);
asm_->Spill(dst.offset(), src.constant());
break;
}
}
void LoadIntoRegister(LiftoffRegister dst,
const LiftoffAssembler::VarState& src,
uint32_t src_offset) {
V8_INLINE void LoadIntoRegister(LiftoffRegister dst,
const LiftoffAssembler::VarState& src,
uint32_t src_offset) {
switch (src.loc()) {
case VarState::kStack:
LoadStackSlot(dst, src_offset, src.type());