[x64] Eliminate unncessary push-pop pair in AssembleSwap

The current implementation in AssembleSwap will generate a push-pop pair to swap between a general register and a stack slot for both x64 and ia32 targets. This is unnecessary for x64 target, as we can use the kScratchRegister to save the general register and swap with the stack slot.

Change-Id: I10e0dc360dec22cdf5afa63ece3d5943685d7ecb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2394177
Reviewed-by: Bill Budge <bbudge@chromium.org>
Commit-Queue: Yolanda Chen <yolanda.chen@intel.com>
Cr-Commit-Position: refs/heads/master@{#69726}
This commit is contained in:
Yolanda Chen 2020-09-07 04:13:37 +08:00 committed by Commit Bot
parent 10348e8eb6
commit 60e452b7b2

View File

@ -4838,15 +4838,10 @@ void CodeGenerator::AssembleSwap(InstructionOperand* source,
case MoveType::kRegisterToStack: {
if (source->IsRegister()) {
Register src = g.ToRegister(source);
__ pushq(src);
frame_access_state()->IncreaseSPDelta(1);
unwinding_info_writer_.MaybeIncreaseBaseOffsetAt(__ pc_offset(),
kSystemPointerSize);
__ movq(src, g.ToOperand(destination));
frame_access_state()->IncreaseSPDelta(-1);
__ popq(g.ToOperand(destination));
unwinding_info_writer_.MaybeIncreaseBaseOffsetAt(__ pc_offset(),
-kSystemPointerSize);
Operand dst = g.ToOperand(destination);
__ movq(kScratchRegister, src);
__ movq(src, dst);
__ movq(dst, kScratchRegister);
} else {
DCHECK(source->IsFPRegister());
XMMRegister src = g.ToDoubleRegister(source);