[vm/ffi] Fix MacOS arm64 register extension

Makes (u)int8 and (u)int16 extended to 32 bits in registers on arm64
MacOS. This makes it consistent with iOS. (Now the calling convention
on arm64 MacOS is fully identical to arm64 iOS.)

TEST=runtime/vm/compiler/ffi/native_calling_convention_test.cc
TEST=tests/ffi_2/function_test.dart

Bug: https://github.com/dart-lang/sdk/issues/46305

This CL makes all remaining failing tests pass listed in the bug,
except for tests using `--use-slow-path`.

Change-Id: If0d93bfa774e561f39468d2b63fc9381b7646b18
Cq-Include-Trybots: luci.dart.try:vm-kernel-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203305
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
diff --git a/runtime/vm/compiler/ffi/unit_tests/int8x10/arm64_macos.expect b/runtime/vm/compiler/ffi/unit_tests/int8x10/arm64_macos.expect
index 8efadc4..f8d22bc 100644
--- a/runtime/vm/compiler/ffi/unit_tests/int8x10/arm64_macos.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/int8x10/arm64_macos.expect
@@ -1,12 +1,12 @@
-r0 int8
-r1 int8
-r2 int8
-r3 int8
-r4 int8
-r5 int8
-r6 int8
-r7 int8
+r0 int32[int8]
+r1 int32[int8]
+r2 int32[int8]
+r3 int32[int8]
+r4 int32[int8]
+r5 int32[int8]
+r6 int32[int8]
+r7 int32[int8]
 S+0 int8
 S+1 int8
 =>
-r0 int8
+r0 int32[int8]
diff --git a/runtime/vm/compiler/ffi/unit_tests/struct16bytesHomogenousx10/arm64_macos.expect b/runtime/vm/compiler/ffi/unit_tests/struct16bytesHomogenousx10/arm64_macos.expect
index da95987..e62e479 100644
--- a/runtime/vm/compiler/ffi/unit_tests/struct16bytesHomogenousx10/arm64_macos.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/struct16bytesHomogenousx10/arm64_macos.expect
@@ -9,7 +9,7 @@
 S+96 Struct(size: 16)
 S+112 Struct(size: 16)
 S+128 float
-r0 int8
+r0 int32[int8]
 S+132 Struct(size: 16)
 =>
 M(v0 float, v1 float, v2 float, v3 float) Struct(size: 16)
diff --git a/runtime/vm/compiler/ffi/unit_tests/union16bytesHomogenousx10/arm64_macos.expect b/runtime/vm/compiler/ffi/unit_tests/union16bytesHomogenousx10/arm64_macos.expect
index c2dcf8c..198d331 100644
--- a/runtime/vm/compiler/ffi/unit_tests/union16bytesHomogenousx10/arm64_macos.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/union16bytesHomogenousx10/arm64_macos.expect
@@ -7,7 +7,7 @@
 S+64 Union(size: 16)
 S+80 Union(size: 16)
 S+96 Union(size: 16)
-r0 int8
+r0 int32[int8]
 S+112 Union(size: 16)
 =>
 M(v0 float, v1 float, v2 float, v3 float) Union(size: 16)
diff --git a/runtime/vm/constants_arm64.h b/runtime/vm/constants_arm64.h
index 9b93a3a..91ff40e 100644
--- a/runtime/vm/constants_arm64.h
+++ b/runtime/vm/constants_arm64.h
@@ -449,7 +449,7 @@
 
   // Whether 1 or 2 byte-sized arguments or return values are passed extended
   // to 4 bytes.
-#if defined(TARGET_OS_MACOS_IOS)
+#if defined(TARGET_OS_MACOS_IOS) || defined(TARGET_OS_MACOS)
   static constexpr ExtensionStrategy kReturnRegisterExtension = kExtendedTo4;
   static constexpr ExtensionStrategy kArgumentRegisterExtension = kExtendedTo4;
 #else