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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 size_t numSlots = (page->bucket->numSystemPagesPerSlotSpan * WTF::kSystemPag
eSize) / size; | 112 size_t numSlots = (page->bucket->numSystemPagesPerSlotSpan * WTF::kSystemPag
eSize) / size; |
113 EXPECT_EQ(numSlots, static_cast<size_t>(abs(page->numAllocatedSlots))); | 113 EXPECT_EQ(numSlots, static_cast<size_t>(abs(page->numAllocatedSlots))); |
114 char* ptr = reinterpret_cast<char*>(partitionPageToPointer(page)); | 114 char* ptr = reinterpret_cast<char*>(partitionPageToPointer(page)); |
115 size_t i; | 115 size_t i; |
116 for (i = 0; i < numSlots; ++i) { | 116 for (i = 0; i < numSlots; ++i) { |
117 partitionFree(ptr + kPointerOffset); | 117 partitionFree(ptr + kPointerOffset); |
118 ptr += size; | 118 ptr += size; |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
| 122 static void CycleFreeCache(size_t size) |
| 123 { |
| 124 size_t realSize = size + kExtraAllocSize; |
| 125 size_t bucketIdx = realSize >> WTF::kBucketShift; |
| 126 WTF::PartitionBucket* bucket = &allocator.root()->buckets()[bucketIdx]; |
| 127 ASSERT(!bucket->activePagesHead->numAllocatedSlots); |
| 128 |
| 129 for (size_t i = 0; i < WTF::kMaxFreeableSpans; ++i) { |
| 130 void* ptr = partitionAlloc(allocator.root(), size); |
| 131 EXPECT_EQ(1, bucket->activePagesHead->numAllocatedSlots); |
| 132 partitionFree(ptr); |
| 133 EXPECT_EQ(0, bucket->activePagesHead->numAllocatedSlots); |
| 134 EXPECT_TRUE(bucket->activePagesHead->freeCacheIndex); |
| 135 } |
| 136 } |
| 137 |
122 // Check that the most basic of allocate / free pairs work. | 138 // Check that the most basic of allocate / free pairs work. |
123 TEST(WTF_PartitionAlloc, Basic) | 139 TEST(WTF_PartitionAlloc, Basic) |
124 { | 140 { |
125 TestSetup(); | 141 TestSetup(); |
126 WTF::PartitionBucket* bucket = &allocator.root()->buckets()[kTestBucketIndex
]; | 142 WTF::PartitionBucket* bucket = &allocator.root()->buckets()[kTestBucketIndex
]; |
127 WTF::PartitionPage* seedPage = &WTF::PartitionRootGeneric::gSeedPage; | 143 WTF::PartitionPage* seedPage = &WTF::PartitionRootGeneric::gSeedPage; |
128 | 144 |
129 EXPECT_FALSE(bucket->freePagesHead); | 145 EXPECT_FALSE(bucket->freePagesHead); |
130 EXPECT_EQ(seedPage, bucket->activePagesHead); | 146 EXPECT_EQ(seedPage, bucket->activePagesHead); |
131 EXPECT_EQ(0, bucket->activePagesHead->nextPage); | 147 EXPECT_EQ(0, bucket->activePagesHead->nextPage); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 // Allocate a new page, it should pull from the freelist. | 237 // Allocate a new page, it should pull from the freelist. |
222 page = GetFullPage(kTestAllocSize); | 238 page = GetFullPage(kTestAllocSize); |
223 EXPECT_FALSE(bucket->freePagesHead); | 239 EXPECT_FALSE(bucket->freePagesHead); |
224 EXPECT_EQ(page, bucket->activePagesHead); | 240 EXPECT_EQ(page, bucket->activePagesHead); |
225 | 241 |
226 FreeFullPage(page); | 242 FreeFullPage(page); |
227 FreeFullPage(page2); | 243 FreeFullPage(page2); |
228 EXPECT_EQ(0, page->numAllocatedSlots); | 244 EXPECT_EQ(0, page->numAllocatedSlots); |
229 EXPECT_EQ(0, page2->numAllocatedSlots); | 245 EXPECT_EQ(0, page2->numAllocatedSlots); |
230 EXPECT_EQ(0, page2->numUnprovisionedSlots); | 246 EXPECT_EQ(0, page2->numUnprovisionedSlots); |
231 EXPECT_EQ(0, page2->freelistHead); | 247 EXPECT_TRUE(page2->freeCacheIndex); |
232 | 248 |
233 TestShutdown(); | 249 TestShutdown(); |
234 } | 250 } |
235 | 251 |
236 // Test some finer aspects of internal page transitions. | 252 // Test some finer aspects of internal page transitions. |
237 TEST(WTF_PartitionAlloc, PageTransitions) | 253 TEST(WTF_PartitionAlloc, PageTransitions) |
238 { | 254 { |
239 TestSetup(); | 255 TestSetup(); |
240 WTF::PartitionBucket* bucket = &allocator.root()->buckets()[kTestBucketIndex
]; | 256 WTF::PartitionBucket* bucket = &allocator.root()->buckets()[kTestBucketIndex
]; |
241 | 257 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 OwnPtr<WTF::PartitionPage*[]> pages = adoptArrayPtr(new WTF::PartitionPage*[
numToFillFreeListPage]); | 322 OwnPtr<WTF::PartitionPage*[]> pages = adoptArrayPtr(new WTF::PartitionPage*[
numToFillFreeListPage]); |
307 | 323 |
308 size_t i; | 324 size_t i; |
309 for (i = 0; i < numToFillFreeListPage; ++i) { | 325 for (i = 0; i < numToFillFreeListPage; ++i) { |
310 pages[i] = GetFullPage(kTestAllocSize); | 326 pages[i] = GetFullPage(kTestAllocSize); |
311 } | 327 } |
312 EXPECT_EQ(pages[numToFillFreeListPage - 1], bucket->activePagesHead); | 328 EXPECT_EQ(pages[numToFillFreeListPage - 1], bucket->activePagesHead); |
313 for (i = 0; i < numToFillFreeListPage; ++i) | 329 for (i = 0; i < numToFillFreeListPage; ++i) |
314 FreeFullPage(pages[i]); | 330 FreeFullPage(pages[i]); |
315 EXPECT_EQ(0, bucket->activePagesHead->numAllocatedSlots); | 331 EXPECT_EQ(0, bucket->activePagesHead->numAllocatedSlots); |
316 EXPECT_EQ(0, bucket->activePagesHead->nextPage->freelistHead); | 332 EXPECT_TRUE(bucket->activePagesHead->nextPage->freeCacheIndex); |
317 EXPECT_EQ(0, bucket->activePagesHead->nextPage->numAllocatedSlots); | 333 EXPECT_EQ(0, bucket->activePagesHead->nextPage->numAllocatedSlots); |
318 EXPECT_EQ(0, bucket->activePagesHead->nextPage->numUnprovisionedSlots); | 334 EXPECT_EQ(0, bucket->activePagesHead->nextPage->numUnprovisionedSlots); |
319 | 335 |
320 // Allocate / free in a different bucket size so we get control of a | 336 // Allocate / free in a different bucket size so we get control of a |
321 // different free page list. We need two pages because one will be the last | 337 // different free page list. We need two pages because one will be the last |
322 // active page and not get freed. | 338 // active page and not get freed. |
323 WTF::PartitionPage* page1 = GetFullPage(kTestAllocSize * 2); | 339 WTF::PartitionPage* page1 = GetFullPage(kTestAllocSize * 2); |
324 WTF::PartitionPage* page2 = GetFullPage(kTestAllocSize * 2); | 340 WTF::PartitionPage* page2 = GetFullPage(kTestAllocSize * 2); |
325 FreeFullPage(page1); | 341 FreeFullPage(page1); |
326 FreeFullPage(page2); | 342 FreeFullPage(page2); |
327 | 343 |
328 // If we re-allocate all kTestAllocSize allocations, we'll pull all the | 344 // If we re-allocate all kTestAllocSize allocations, we'll pull all the |
329 // free pages and end up freeing the first page for free page objects. | 345 // free pages and end up freeing the first page for free page objects. |
330 // It's getting a bit tricky but a nice re-entrancy is going on: | 346 // It's getting a bit tricky but a nice re-entrancy is going on: |
331 // alloc(kTestAllocSize) -> pulls page from free page list -> | 347 // alloc(kTestAllocSize) -> pulls page from free page list -> |
332 // free(PartitionFreepagelistEntry) -> last entry in page freed -> | 348 // free(PartitionFreepagelistEntry) -> last entry in page freed -> |
333 // alloc(PartitionFreepagelistEntry). | 349 // alloc(PartitionFreepagelistEntry). |
334 for (i = 0; i < numToFillFreeListPage; ++i) { | 350 for (i = 0; i < numToFillFreeListPage; ++i) { |
335 pages[i] = GetFullPage(kTestAllocSize); | 351 pages[i] = GetFullPage(kTestAllocSize); |
336 } | 352 } |
337 EXPECT_EQ(pages[numToFillFreeListPage - 1], bucket->activePagesHead); | 353 EXPECT_EQ(pages[numToFillFreeListPage - 1], bucket->activePagesHead); |
338 | 354 |
339 // As part of the final free-up, we'll test another re-entrancy: | 355 // As part of the final free-up, we'll test another re-entrancy: |
340 // free(kTestAllocSize) -> last entry in page freed -> | 356 // free(kTestAllocSize) -> last entry in page freed -> |
341 // alloc(PartitionFreepagelistEntry) -> pulls page from free page list -> | 357 // alloc(PartitionFreepagelistEntry) -> pulls page from free page list -> |
342 // free(PartitionFreepagelistEntry) | 358 // free(PartitionFreepagelistEntry) |
343 for (i = 0; i < numToFillFreeListPage; ++i) | 359 for (i = 0; i < numToFillFreeListPage; ++i) |
344 FreeFullPage(pages[i]); | 360 FreeFullPage(pages[i]); |
345 EXPECT_EQ(0, bucket->activePagesHead->numAllocatedSlots); | 361 EXPECT_EQ(0, bucket->activePagesHead->numAllocatedSlots); |
346 EXPECT_EQ(0, bucket->activePagesHead->nextPage->freelistHead); | 362 EXPECT_TRUE(bucket->activePagesHead->nextPage->freeCacheIndex); |
347 EXPECT_EQ(0, bucket->activePagesHead->nextPage->numAllocatedSlots); | 363 EXPECT_EQ(0, bucket->activePagesHead->nextPage->numAllocatedSlots); |
348 EXPECT_EQ(0, bucket->activePagesHead->nextPage->numUnprovisionedSlots); | 364 EXPECT_EQ(0, bucket->activePagesHead->nextPage->numUnprovisionedSlots); |
349 | 365 |
350 TestShutdown(); | 366 TestShutdown(); |
351 } | 367 } |
352 | 368 |
353 // Test a large series of allocations that cross more than one underlying | 369 // Test a large series of allocations that cross more than one underlying |
354 // 64KB super page allocation. | 370 // 64KB super page allocation. |
355 TEST(WTF_PartitionAlloc, MultiPageAllocs) | 371 TEST(WTF_PartitionAlloc, MultiPageAllocs) |
356 { | 372 { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 partitionFreeGeneric(genericAllocator.root(), ptr); | 500 partitionFreeGeneric(genericAllocator.root(), ptr); |
485 | 501 |
486 // kPartitionPageSize is interesting because it results in just one | 502 // kPartitionPageSize is interesting because it results in just one |
487 // allocation per page, which tripped up some corner cases. | 503 // allocation per page, which tripped up some corner cases. |
488 size_t size = WTF::kPartitionPageSize - kExtraAllocSize; | 504 size_t size = WTF::kPartitionPageSize - kExtraAllocSize; |
489 ptr = partitionAllocGeneric(genericAllocator.root(), size); | 505 ptr = partitionAllocGeneric(genericAllocator.root(), size); |
490 EXPECT_TRUE(ptr); | 506 EXPECT_TRUE(ptr); |
491 void* ptr2 = partitionAllocGeneric(genericAllocator.root(), size); | 507 void* ptr2 = partitionAllocGeneric(genericAllocator.root(), size); |
492 EXPECT_TRUE(ptr2); | 508 EXPECT_TRUE(ptr2); |
493 partitionFreeGeneric(genericAllocator.root(), ptr); | 509 partitionFreeGeneric(genericAllocator.root(), ptr); |
494 // Should have freelisted at this point. | 510 // Should be freeable at this point. |
495 WTF::PartitionPage* page = WTF::partitionPointerToPage(WTF::partitionCookieF
reePointerAdjust(ptr)); | 511 WTF::PartitionPage* page = WTF::partitionPointerToPage(WTF::partitionCookieF
reePointerAdjust(ptr)); |
496 #if 0 // Temporarily disabled, see crbug.com/332282 | 512 EXPECT_TRUE(page->freeCacheIndex); |
497 EXPECT_TRUE(page->bucket->freePagesHead); | |
498 #endif | |
499 partitionFreeGeneric(genericAllocator.root(), ptr2); | 513 partitionFreeGeneric(genericAllocator.root(), ptr2); |
500 | 514 |
501 size = WTF::kGenericMaxBucketed - kExtraAllocSize; | 515 size = WTF::kGenericMaxBucketed - kExtraAllocSize; |
502 ptr = partitionAllocGeneric(genericAllocator.root(), size); | 516 ptr = partitionAllocGeneric(genericAllocator.root(), size); |
503 EXPECT_TRUE(ptr); | 517 EXPECT_TRUE(ptr); |
504 memset(ptr, 'A', size); | 518 memset(ptr, 'A', size); |
505 ptr2 = partitionAllocGeneric(genericAllocator.root(), size); | 519 ptr2 = partitionAllocGeneric(genericAllocator.root(), size); |
506 EXPECT_TRUE(ptr2); | 520 EXPECT_TRUE(ptr2); |
507 void* ptr3 = partitionAllocGeneric(genericAllocator.root(), size); | 521 void* ptr3 = partitionAllocGeneric(genericAllocator.root(), size); |
508 EXPECT_TRUE(ptr3); | 522 EXPECT_TRUE(ptr3); |
509 void* ptr4 = partitionAllocGeneric(genericAllocator.root(), size); | 523 void* ptr4 = partitionAllocGeneric(genericAllocator.root(), size); |
510 EXPECT_TRUE(ptr4); | 524 EXPECT_TRUE(ptr4); |
511 | 525 |
512 page = WTF::partitionPointerToPage(WTF::partitionCookieFreePointerAdjust(ptr
)); | 526 page = WTF::partitionPointerToPage(WTF::partitionCookieFreePointerAdjust(ptr
)); |
513 WTF::PartitionPage* page2 = WTF::partitionPointerToPage(WTF::partitionCookie
FreePointerAdjust(ptr3)); | 527 WTF::PartitionPage* page2 = WTF::partitionPointerToPage(WTF::partitionCookie
FreePointerAdjust(ptr3)); |
514 EXPECT_NE(page, page2); | 528 EXPECT_NE(page, page2); |
515 | 529 |
516 partitionFreeGeneric(genericAllocator.root(), ptr); | 530 partitionFreeGeneric(genericAllocator.root(), ptr); |
517 partitionFreeGeneric(genericAllocator.root(), ptr3); | 531 partitionFreeGeneric(genericAllocator.root(), ptr3); |
518 partitionFreeGeneric(genericAllocator.root(), ptr2); | 532 partitionFreeGeneric(genericAllocator.root(), ptr2); |
519 // Should have been freed at this point. | 533 // Should be freeable at this point. |
520 EXPECT_FALSE(page->freelistHead); | 534 EXPECT_TRUE(page->freeCacheIndex); |
521 EXPECT_EQ(0, page->numAllocatedSlots); | 535 EXPECT_EQ(0, page->numAllocatedSlots); |
522 EXPECT_EQ(0, page->numUnprovisionedSlots); | 536 EXPECT_EQ(0, page->numUnprovisionedSlots); |
523 void* newPtr = partitionAllocGeneric(genericAllocator.root(), size); | 537 void* newPtr = partitionAllocGeneric(genericAllocator.root(), size); |
524 EXPECT_EQ(ptr3, newPtr); | 538 EXPECT_EQ(ptr3, newPtr); |
525 newPtr = partitionAllocGeneric(genericAllocator.root(), size); | 539 newPtr = partitionAllocGeneric(genericAllocator.root(), size); |
526 EXPECT_EQ(ptr, newPtr); | 540 EXPECT_EQ(ptr2, newPtr); |
527 #if OS(LINUX) && defined(NDEBUG) | 541 #if OS(LINUX) && defined(NDEBUG) |
528 // On Linux, we have a guarantee that freelisting a page should cause its | 542 // On Linux, we have a guarantee that freelisting a page should cause its |
529 // contents to be nulled out. We check for null here to detect an bug we | 543 // contents to be nulled out. We check for null here to detect an bug we |
530 // had where a large slot size was causing us to not properly free all | 544 // had where a large slot size was causing us to not properly free all |
531 // resources back to the system. | 545 // resources back to the system. |
532 // We only run the check in optimized builds because the debug build | 546 // We only run the check in optimized builds because the debug build |
533 // writes over the allocated area with an "uninitialized" byte pattern. | 547 // writes over the allocated area with an "uninitialized" byte pattern. |
534 EXPECT_EQ(0, *(reinterpret_cast<char*>(newPtr) + (size - 1))); | 548 EXPECT_EQ(0, *(reinterpret_cast<char*>(newPtr) + (size - 1))); |
535 #endif | 549 #endif |
536 partitionFreeGeneric(genericAllocator.root(), newPtr); | 550 partitionFreeGeneric(genericAllocator.root(), newPtr); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 partitionFree(ptr); | 606 partitionFree(ptr); |
593 ptr = partitionAlloc(allocator.root(), bigSize); | 607 ptr = partitionAlloc(allocator.root(), bigSize); |
594 void* ptr6 = partitionAlloc(allocator.root(), bigSize); | 608 void* ptr6 = partitionAlloc(allocator.root(), bigSize); |
595 | 609 |
596 partitionFree(ptr); | 610 partitionFree(ptr); |
597 partitionFree(ptr2); | 611 partitionFree(ptr2); |
598 partitionFree(ptr3); | 612 partitionFree(ptr3); |
599 partitionFree(ptr4); | 613 partitionFree(ptr4); |
600 partitionFree(ptr5); | 614 partitionFree(ptr5); |
601 partitionFree(ptr6); | 615 partitionFree(ptr6); |
602 EXPECT_TRUE(bucket->freePagesHead); | 616 EXPECT_TRUE(page->freeCacheIndex); |
603 EXPECT_EQ(page, bucket->freePagesHead); | 617 EXPECT_TRUE(page2->freeCacheIndex); |
604 EXPECT_TRUE(page2->freelistHead); | 618 EXPECT_TRUE(page2->freelistHead); |
605 EXPECT_EQ(0, page2->numAllocatedSlots); | 619 EXPECT_EQ(0, page2->numAllocatedSlots); |
606 | 620 |
607 // And test a couple of sizes that do not cross kSystemPageSize with a singl
e allocation. | 621 // And test a couple of sizes that do not cross kSystemPageSize with a singl
e allocation. |
608 size_t mediumSize = (WTF::kSystemPageSize / 2) - kExtraAllocSize; | 622 size_t mediumSize = (WTF::kSystemPageSize / 2) - kExtraAllocSize; |
609 bucketIdx = (mediumSize + kExtraAllocSize) >> WTF::kBucketShift; | 623 bucketIdx = (mediumSize + kExtraAllocSize) >> WTF::kBucketShift; |
610 bucket = &allocator.root()->buckets()[bucketIdx]; | 624 bucket = &allocator.root()->buckets()[bucketIdx]; |
611 EXPECT_EQ(0, bucket->freePagesHead); | 625 EXPECT_EQ(0, bucket->freePagesHead); |
612 | 626 |
613 ptr = partitionAlloc(allocator.root(), mediumSize); | 627 ptr = partitionAlloc(allocator.root(), mediumSize); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 | 810 |
797 FreeFullPage(pageInThirdSuperPage); | 811 FreeFullPage(pageInThirdSuperPage); |
798 for (i = 0; i < numPartitionPagesNeeded; ++i) { | 812 for (i = 0; i < numPartitionPagesNeeded; ++i) { |
799 FreeFullPage(firstSuperPagePages[i]); | 813 FreeFullPage(firstSuperPagePages[i]); |
800 FreeFullPage(secondSuperPagePages[i]); | 814 FreeFullPage(secondSuperPagePages[i]); |
801 } | 815 } |
802 | 816 |
803 TestShutdown(); | 817 TestShutdown(); |
804 } | 818 } |
805 | 819 |
| 820 // Tests that pages in the free page cache do get freed as appropriate. |
| 821 TEST(WTF_PartitionAlloc, FreeCache) |
| 822 { |
| 823 TestSetup(); |
| 824 |
| 825 size_t bigSize = allocator.root()->maxAllocation - kExtraAllocSize; |
| 826 size_t bucketIdx = (bigSize + kExtraAllocSize) >> WTF::kBucketShift; |
| 827 WTF::PartitionBucket* bucket = &allocator.root()->buckets()[bucketIdx]; |
| 828 |
| 829 void* ptr = partitionAlloc(allocator.root(), bigSize); |
| 830 EXPECT_TRUE(ptr); |
| 831 WTF::PartitionPage* page = WTF::partitionPointerToPage(WTF::partitionCookieF
reePointerAdjust(ptr)); |
| 832 EXPECT_EQ(0, bucket->freePagesHead); |
| 833 EXPECT_EQ(1, page->numAllocatedSlots); |
| 834 partitionFree(ptr); |
| 835 EXPECT_EQ(0, page->numAllocatedSlots); |
| 836 EXPECT_TRUE(page->freeCacheIndex); |
| 837 EXPECT_TRUE(page->freelistHead); |
| 838 |
| 839 CycleFreeCache(kTestAllocSize); |
| 840 |
| 841 // Flushing the cache should have really freed the unused page. |
| 842 EXPECT_FALSE(page->freelistHead); |
| 843 EXPECT_FALSE(page->freeCacheIndex); |
| 844 EXPECT_EQ(0, page->numAllocatedSlots); |
| 845 |
| 846 // Check that an allocation works ok whilst in this state (a free'd page |
| 847 // as the active pages head). |
| 848 ptr = partitionAlloc(allocator.root(), bigSize); |
| 849 EXPECT_FALSE(bucket->freePagesHead); |
| 850 partitionFree(ptr); |
| 851 |
| 852 // Also check that a page that is bouncing immediately between empty and |
| 853 // used does not get freed. |
| 854 for (size_t i = 0; i < WTF::kMaxFreeableSpans * 2; ++i) { |
| 855 ptr = partitionAlloc(allocator.root(), bigSize); |
| 856 EXPECT_TRUE(page->freelistHead); |
| 857 partitionFree(ptr); |
| 858 EXPECT_TRUE(page->freelistHead); |
| 859 } |
| 860 |
| 861 TestShutdown(); |
| 862 } |
| 863 |
806 // Make sure that malloc(-1) dies. | 864 // Make sure that malloc(-1) dies. |
807 // In the past, we had an integer overflow that would alias malloc(-1) to | 865 // In the past, we had an integer overflow that would alias malloc(-1) to |
808 // malloc(0), which is not good. | 866 // malloc(0), which is not good. |
809 TEST(WTF_PartitionAllocDeathTest, LargeAllocs) | 867 TEST(WTF_PartitionAllocDeathTest, LargeAllocs) |
810 { | 868 { |
811 TestSetup(); | 869 TestSetup(); |
812 // Largest alloc. | 870 // Largest alloc. |
813 EXPECT_DEATH(partitionAllocGeneric(genericAllocator.root(), static_cast<size
_t>(-1)), ""); | 871 EXPECT_DEATH(partitionAllocGeneric(genericAllocator.root(), static_cast<size
_t>(-1)), ""); |
814 // And the smallest allocation we expect to die. | 872 // And the smallest allocation we expect to die. |
815 EXPECT_DEATH(partitionAllocGeneric(genericAllocator.root(), static_cast<size
_t>(INT_MAX) + 1), ""); | 873 EXPECT_DEATH(partitionAllocGeneric(genericAllocator.root(), static_cast<size
_t>(INT_MAX) + 1), ""); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 EXPECT_EQ(32u, WTF::countLeadingZerosSizet(0)); | 910 EXPECT_EQ(32u, WTF::countLeadingZerosSizet(0)); |
853 EXPECT_EQ(31u, WTF::countLeadingZerosSizet(1)); | 911 EXPECT_EQ(31u, WTF::countLeadingZerosSizet(1)); |
854 EXPECT_EQ(1u, WTF::countLeadingZerosSizet(1 << 30)); | 912 EXPECT_EQ(1u, WTF::countLeadingZerosSizet(1 << 30)); |
855 EXPECT_EQ(0u, WTF::countLeadingZerosSizet(1 << 31)); | 913 EXPECT_EQ(0u, WTF::countLeadingZerosSizet(1 << 31)); |
856 #endif | 914 #endif |
857 } | 915 } |
858 | 916 |
859 } // namespace | 917 } // namespace |
860 | 918 |
861 #endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) | 919 #endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
OLD | NEW |