Index: runtime/vm/os_macos.cc |
diff --git a/runtime/vm/os_macos.cc b/runtime/vm/os_macos.cc |
index 6d2d02ac1ffdb59bd3233aa9023d7d43e465a786..e231e5ccbc100f16f368468b12534c571d013a16 100644 |
--- a/runtime/vm/os_macos.cc |
+++ b/runtime/vm/os_macos.cc |
@@ -204,8 +204,24 @@ intptr_t OS::ActivationFrameAlignment() { |
intptr_t OS::PreferredCodeAlignment() { |
- ASSERT(32 <= OS::kMaxPreferredCodeAlignment); |
- return 32; |
+#if defined(TARGET_ARCH_IA32) || \ |
+ defined(TARGET_ARCH_X64) || \ |
+ defined(TARGET_ARCH_ARM64) || \ |
+ defined(TARGET_ARCH_DBC) |
+ const int kMinimumAlignment = 32; |
+#elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) |
+ const int kMinimumAlignment = 16; |
+#else |
+#error Unsupported architecture. |
+#endif |
+ intptr_t alignment = kMinimumAlignment; |
+ // TODO(5411554): Allow overriding default code alignment for |
+ // testing purposes. |
+ // Flags::DebugIsInt("codealign", &alignment); |
+ ASSERT(Utils::IsPowerOfTwo(alignment)); |
+ ASSERT(alignment >= kMinimumAlignment); |
+ ASSERT(alignment <= OS::kMaxPreferredCodeAlignment); |
+ return alignment; |
} |