[nojit,x64] Tweak builtin pointer call sequence for pointer compression

This is to fix the pointer compression bot, which tests only x64.
Other 64-bit architectures will need similar work in the future.

On x64 with pointer compression, smi-untagging can be folded into the
Operand calculation since the left-shift for multiplying by
kSystemPointerSize is greater than the right-shift for untagging.

Bug: v8:7777
Change-Id: I5c46e9d3f51580341cfc3c12a7e32d17cf0b63ee
Reviewed-on: https://chromium-review.googlesource.com/c/1381452
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58328}
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
index 2414d4b..9acfcb3 100644
--- a/src/x64/macro-assembler-x64.cc
+++ b/src/x64/macro-assembler-x64.cc
@@ -1638,18 +1638,28 @@
 }
 
 void TurboAssembler::CallBuiltinPointer(Register builtin_pointer) {
+#if defined(V8_COMPRESS_POINTERS) || defined(V8_31BIT_SMIS_ON_64BIT_ARCH)
+  STATIC_ASSERT(kSystemPointerSize == 8);
+  STATIC_ASSERT(kSmiShiftSize == 0);
+  STATIC_ASSERT(kSmiTagSize == 1);
+  STATIC_ASSERT(kSmiTag == 0);
+
+  // The builtin_pointer register contains the builtin index as a Smi.
+  // Untagging is folded into the indexing operand below (we use times_4 instead
+  // of times_8 since smis are already shifted by one).
+  Call(Operand(kRootRegister, builtin_pointer, times_4,
+               IsolateData::builtin_entry_table_offset()));
+#else   // V8_COMPRESS_POINTERS
   STATIC_ASSERT(kSystemPointerSize == 8);
   STATIC_ASSERT(kSmiShiftSize == 31);
   STATIC_ASSERT(kSmiTagSize == 1);
   STATIC_ASSERT(kSmiTag == 0);
 
-  // TODO(jgruber,ishell): With pointer compression, untagging could be folded
-  // into the operand below.
-
   // The builtin_pointer register contains the builtin index as a Smi.
   SmiUntag(builtin_pointer, builtin_pointer);
   Call(Operand(kRootRegister, builtin_pointer, times_8,
                IsolateData::builtin_entry_table_offset()));
+#endif  // defined(V8_COMPRESS_POINTERS) || defined(V8_31BIT_SMIS_ON_64BIT_ARCH)
 }
 
 void TurboAssembler::RetpolineCall(Register reg) {