| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2106 | 2106 |
| 2107 EXPECT_FALSE(page->freelistHead); | 2107 EXPECT_FALSE(page->freelistHead); |
| 2108 | 2108 |
| 2109 partitionFreeGeneric(genericAllocator.root(), ptr1); | 2109 partitionFreeGeneric(genericAllocator.root(), ptr1); |
| 2110 partitionFreeGeneric(genericAllocator.root(), ptr2); | 2110 partitionFreeGeneric(genericAllocator.root(), ptr2); |
| 2111 } | 2111 } |
| 2112 | 2112 |
| 2113 TestShutdown(); | 2113 TestShutdown(); |
| 2114 } | 2114 } |
| 2115 | 2115 |
| 2116 // Tests that the countLeadingZeros() functions work to our satisfaction. | |
| 2117 // It doesn't seem worth the overhead of a whole new file for these tests, so | |
| 2118 // we'll put them here since partitionAllocGeneric will depend heavily on these | |
| 2119 // functions working correctly. | |
| 2120 TEST(PartitionAllocTest, CLZWorks) { | |
| 2121 EXPECT_EQ(32u, countLeadingZeros32(0u)); | |
| 2122 EXPECT_EQ(31u, countLeadingZeros32(1u)); | |
| 2123 EXPECT_EQ(1u, countLeadingZeros32(1u << 30)); | |
| 2124 EXPECT_EQ(0u, countLeadingZeros32(1u << 31)); | |
| 2125 | |
| 2126 #if CPU(64BIT) | |
| 2127 EXPECT_EQ(64u, countLeadingZerosSizet(0ull)); | |
| 2128 EXPECT_EQ(63u, countLeadingZerosSizet(1ull)); | |
| 2129 EXPECT_EQ(32u, countLeadingZerosSizet(1ull << 31)); | |
| 2130 EXPECT_EQ(1u, countLeadingZerosSizet(1ull << 62)); | |
| 2131 EXPECT_EQ(0u, countLeadingZerosSizet(1ull << 63)); | |
| 2132 #else | |
| 2133 EXPECT_EQ(32u, countLeadingZerosSizet(0u)); | |
| 2134 EXPECT_EQ(31u, countLeadingZerosSizet(1u)); | |
| 2135 EXPECT_EQ(1u, countLeadingZerosSizet(1u << 30)); | |
| 2136 EXPECT_EQ(0u, countLeadingZerosSizet(1u << 31)); | |
| 2137 #endif | |
| 2138 } | |
| 2139 | |
| 2140 } // namespace WTF | 2116 } // namespace WTF |
| 2141 | 2117 |
| 2142 #endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) | 2118 #endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
| OLD | NEW |