From cf1925b0f8529420a2207c8e308b05b22f7d392f Mon Sep 17 00:00:00 2001
From: Santiago Aboy Solanes <solanes@chromium.org>
Date: Fri, 27 Sep 2019 17:04:29 +0100
Subject: [PATCH] [builtins][x64] Save an instruction by doing the Tagging
 in-place

If we SmiTag using the same register we will save a mov instruction.

Bug: v8:9771
Change-Id: Iadfa332e76115688eac6c3ec5262ca751ec02405
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1826735
Reviewed-by: Dan Elphick <delphick@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64029}
---
 src/builtins/x64/builtins-x64.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/builtins/x64/builtins-x64.cc b/src/builtins/x64/builtins-x64.cc
index 96834b4a01..92d1533334 100644
--- a/src/builtins/x64/builtins-x64.cc
+++ b/src/builtins/x64/builtins-x64.cc
@@ -1455,8 +1455,9 @@ void Builtins::Generate_InterpreterEnterBytecodeAdvance(MacroAssembler* masm) {
                                 &if_return);
 
   // Convert new bytecode offset to a Smi and save in the stackframe.
-  __ SmiTag(rbx, kInterpreterBytecodeOffsetRegister);
-  __ movq(Operand(rbp, InterpreterFrameConstants::kBytecodeOffsetFromFp), rbx);
+  __ SmiTag(kInterpreterBytecodeOffsetRegister);
+  __ movq(Operand(rbp, InterpreterFrameConstants::kBytecodeOffsetFromFp),
+          kInterpreterBytecodeOffsetRegister);
 
   Generate_InterpreterEnterBytecode(masm);