| 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 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 partitionFree(ptr2); | 914 partitionFree(ptr2); |
| 915 partitionFree(ptr3); | 915 partitionFree(ptr3); |
| 916 partitionFree(ptr4); | 916 partitionFree(ptr4); |
| 917 partitionFree(ptr5); | 917 partitionFree(ptr5); |
| 918 partitionFree(ptr6); | 918 partitionFree(ptr6); |
| 919 EXPECT_NE(-1, page->emptyCacheIndex); | 919 EXPECT_NE(-1, page->emptyCacheIndex); |
| 920 EXPECT_NE(-1, page2->emptyCacheIndex); | 920 EXPECT_NE(-1, page2->emptyCacheIndex); |
| 921 EXPECT_TRUE(page2->freelistHead); | 921 EXPECT_TRUE(page2->freelistHead); |
| 922 EXPECT_EQ(0, page2->numAllocatedSlots); | 922 EXPECT_EQ(0, page2->numAllocatedSlots); |
| 923 | 923 |
| 924 // And test a couple of sizes that do not cross kSystemPageSize with a single
allocation. | 924 // And test a couple of sizes that do not cross kSystemPageSize with a single |
| 925 // allocation. |
| 925 size_t mediumSize = (kSystemPageSize / 2) - kExtraAllocSize; | 926 size_t mediumSize = (kSystemPageSize / 2) - kExtraAllocSize; |
| 926 bucketIdx = (mediumSize + kExtraAllocSize) >> kBucketShift; | 927 bucketIdx = (mediumSize + kExtraAllocSize) >> kBucketShift; |
| 927 bucket = &allocator.root()->buckets()[bucketIdx]; | 928 bucket = &allocator.root()->buckets()[bucketIdx]; |
| 928 EXPECT_EQ(0, bucket->emptyPagesHead); | 929 EXPECT_EQ(0, bucket->emptyPagesHead); |
| 929 | 930 |
| 930 ptr = partitionAlloc(allocator.root(), mediumSize, typeName); | 931 ptr = partitionAlloc(allocator.root(), mediumSize, typeName); |
| 931 EXPECT_TRUE(ptr); | 932 EXPECT_TRUE(ptr); |
| 932 page = partitionPointerToPage(partitionCookieFreePointerAdjust(ptr)); | 933 page = partitionPointerToPage(partitionCookieFreePointerAdjust(ptr)); |
| 933 EXPECT_EQ(1, page->numAllocatedSlots); | 934 EXPECT_EQ(1, page->numAllocatedSlots); |
| 934 totalSlots = (page->bucket->numSystemPagesPerSlotSpan * kSystemPageSize) / | 935 totalSlots = (page->bucket->numSystemPagesPerSlotSpan * kSystemPageSize) / |
| (...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2132 EXPECT_EQ(32u, countLeadingZerosSizet(0u)); | 2133 EXPECT_EQ(32u, countLeadingZerosSizet(0u)); |
| 2133 EXPECT_EQ(31u, countLeadingZerosSizet(1u)); | 2134 EXPECT_EQ(31u, countLeadingZerosSizet(1u)); |
| 2134 EXPECT_EQ(1u, countLeadingZerosSizet(1u << 30)); | 2135 EXPECT_EQ(1u, countLeadingZerosSizet(1u << 30)); |
| 2135 EXPECT_EQ(0u, countLeadingZerosSizet(1u << 31)); | 2136 EXPECT_EQ(0u, countLeadingZerosSizet(1u << 31)); |
| 2136 #endif | 2137 #endif |
| 2137 } | 2138 } |
| 2138 | 2139 |
| 2139 } // namespace WTF | 2140 } // namespace WTF |
| 2140 | 2141 |
| 2141 #endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) | 2142 #endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
| OLD | NEW |