Index: base/memory/aligned_memory_unittest.cc |
diff --git a/base/memory/aligned_memory_unittest.cc b/base/memory/aligned_memory_unittest.cc |
index abe0cf3ff5739ccc7443d4e15f45fa89461d6a4d..8c82a0351f576b9d6196b8163c96108d9db05ccc 100644 |
--- a/base/memory/aligned_memory_unittest.cc |
+++ b/base/memory/aligned_memory_unittest.cc |
@@ -16,59 +16,43 @@ namespace { |
using base::AlignedMemory; |
+// Note: there are a number of compatibility issues with large alignments. |
+// On ARM, gcc doesn't support alignment >64 bytes. In addition, the NaCl x86-64 |
+// compiler emits non-validating instructions for >128 bytes alignment. See |
+// https://www.chromium.org/nativeclient/design-documents/nacl-sfi-model-on-x86-64-systems |
+// and https://code.google.com/p/nativeclient/issues/detail?id=3463 |
TEST(AlignedMemoryTest, StaticAlignment) { |
static AlignedMemory<8, 8> raw8; |
static AlignedMemory<8, 16> raw16; |
- static AlignedMemory<8, 256> raw256; |
- static AlignedMemory<8, 4096> raw4096; |
+ static AlignedMemory<8, 32> raw32; |
+ static AlignedMemory<8, 64> raw64; |
- EXPECT_EQ(8u, ALIGNOF(raw8)); |
- EXPECT_EQ(16u, ALIGNOF(raw16)); |
- EXPECT_EQ(256u, ALIGNOF(raw256)); |
- EXPECT_EQ(4096u, ALIGNOF(raw4096)); |
+ EXPECT_EQ(8u, alignof(decltype(raw8))); |
+ EXPECT_EQ(16u, alignof(decltype(raw16))); |
+ EXPECT_EQ(32u, alignof(decltype(raw32))); |
+ EXPECT_EQ(64u, alignof(decltype(raw64))); |
EXPECT_ALIGNED(raw8.void_data(), 8); |
EXPECT_ALIGNED(raw16.void_data(), 16); |
- EXPECT_ALIGNED(raw256.void_data(), 256); |
- EXPECT_ALIGNED(raw4096.void_data(), 4096); |
+ EXPECT_ALIGNED(raw32.void_data(), 32); |
+ EXPECT_ALIGNED(raw64.void_data(), 64); |
} |
TEST(AlignedMemoryTest, StackAlignment) { |
AlignedMemory<8, 8> raw8; |
AlignedMemory<8, 16> raw16; |
- AlignedMemory<8, 128> raw128; |
+ AlignedMemory<8, 32> raw32; |
+ AlignedMemory<8, 64> raw64; |
- EXPECT_EQ(8u, ALIGNOF(raw8)); |
- EXPECT_EQ(16u, ALIGNOF(raw16)); |
- EXPECT_EQ(128u, ALIGNOF(raw128)); |
+ EXPECT_EQ(8u, alignof(decltype(raw8))); |
+ EXPECT_EQ(16u, alignof(decltype(raw16))); |
+ EXPECT_EQ(32u, alignof(decltype(raw32))); |
+ EXPECT_EQ(64u, alignof(decltype(raw64))); |
EXPECT_ALIGNED(raw8.void_data(), 8); |
EXPECT_ALIGNED(raw16.void_data(), 16); |
- |
- // TODO(ios): __attribute__((aligned(X))) with X >= 128 does not works on |
- // the stack when building for arm64 on iOS, http://crbug.com/349003 |
-#if !(defined(OS_IOS) && defined(ARCH_CPU_ARM64)) |
- EXPECT_ALIGNED(raw128.void_data(), 128); |
- |
- // NaCl x86-64 compiler emits non-validating instructions for >128 |
- // bytes alignment. |
- // http://www.chromium.org/nativeclient/design-documents/nacl-sfi-model-on-x86-64-systems |
- // TODO(hamaji): Ideally, NaCl compiler for x86-64 should workaround |
- // this limitation and this #if should be removed. |
- // https://code.google.com/p/nativeclient/issues/detail?id=3463 |
-#if !(defined(OS_NACL) && defined(ARCH_CPU_X86_64)) |
- AlignedMemory<8, 256> raw256; |
- EXPECT_EQ(256u, ALIGNOF(raw256)); |
- EXPECT_ALIGNED(raw256.void_data(), 256); |
- |
- // TODO(ios): This test hits an armv7 bug in clang. crbug.com/138066 |
-#if !(defined(OS_IOS) && defined(ARCH_CPU_ARM_FAMILY)) |
- AlignedMemory<8, 4096> raw4096; |
- EXPECT_EQ(4096u, ALIGNOF(raw4096)); |
- EXPECT_ALIGNED(raw4096.void_data(), 4096); |
-#endif // !(defined(OS_IOS) && defined(ARCH_CPU_ARM_FAMILY)) |
-#endif // !(defined(OS_NACL) && defined(ARCH_CPU_X86_64)) |
-#endif // !(defined(OS_IOS) && defined(ARCH_CPU_ARM64)) |
+ EXPECT_ALIGNED(raw32.void_data(), 32); |
+ EXPECT_ALIGNED(raw64.void_data(), 64); |
} |
TEST(AlignedMemoryTest, DynamicAllocation) { |