Home | History | Annotate | Download | only in wtf

Lines Matching refs:page

115 static void FreeFullPage(WTF::PartitionPage* page)
117 size_t size = page->bucket->slotSize;
118 size_t numSlots = (page->bucket->numSystemPagesPerSlotSpan * WTF::kSystemPageSize) / size;
119 EXPECT_EQ(numSlots, static_cast<size_t>(abs(page->numAllocatedSlots)));
120 char* ptr = reinterpret_cast<char*>(partitionPageToPointer(page));
148 WTF::PartitionPage* page = WTF::partitionPointerToPage(WTF::partitionCookieFreePointerAdjust(ptr));
149 WTF::PartitionBucket* bucket = page->bucket;
171 // Check that the offset appears to include a guard page.
175 // Expect that the last active page does not get tossed to the freelist.
235 WTF::PartitionPage* page = GetFullPage(kTestAllocSize);
236 FreeFullPage(page);
238 EXPECT_EQ(page, bucket->activePagesHead);
239 EXPECT_EQ(0, page->nextPage);
240 EXPECT_EQ(0, page->numAllocatedSlots);
242 page = GetFullPage(kTestAllocSize);
247 EXPECT_EQ(reinterpret_cast<uintptr_t>(partitionPageToPointer(page)) & WTF::kSuperPageBaseMask, reinterpret_cast<uintptr_t>(partitionPageToPointer(page2)) & WTF::kSuperPageBaseMask);
249 // Fully free the non-current page. It should not be freelisted because
250 // there is no other immediately useable page. The other page is full.
251 FreeFullPage(page);
252 EXPECT_EQ(0, page->numAllocatedSlots);
254 EXPECT_EQ(page, bucket->activePagesHead);
256 // Allocate a new page, it should pull from the freelist.
257 page = GetFullPage(kTestAllocSize);
259 EXPECT_EQ(page, bucket->activePagesHead);
261 FreeFullPage(page);
263 EXPECT_EQ(0, page->numAllocatedSlots);
271 // Test some finer aspects of internal page transitions.
292 // Allocating another page at this point should cause us to scan over page1
293 // (which is both full and NOT our current page), and evict it from the
309 // Work out a pointer into page1 and free it. This should pull the page
330 // Test some corner cases relating to page transitions in the internal
331 // free page list metadata bucket.
338 // The +1 is because we need to account for the fact that the current page
356 // different free page list. We need two pages because one will be the last
357 // active page and not get freed.
364 // free pages and end up freeing the first page for free page objects.
366 // alloc(kTestAllocSize) -> pulls page from free page list ->
367 // free(PartitionFreepagelistEntry) -> last entry in page freed ->
375 // free(kTestAllocSize) -> last entry in page freed ->
376 // alloc(PartitionFreepagelistEntry) -> pulls page from free page list ->
389 // 64KB super page allocation.
393 // This is guaranteed to cross a super page boundary because the first
394 // partition page "slot" will be taken up by a guard page.
396 // The super page should begin and end in a guard so we one less page in
397 // order to allocate a single page in the new super page.
414 // Check that we allocated a guard page for the second page.
522 // allocation per page, which tripped up some corner cases.
530 WTF::PartitionPage* page = WTF::partitionPointerToPage(WTF::partitionCookieFreePointerAdjust(ptr));
531 EXPECT_NE(-1, page->freeCacheIndex);
545 page = WTF::partitionPointerToPage(WTF::partitionCookieFreePointerAdjust(ptr));
547 EXPECT_NE(page, page2);
553 EXPECT_NE(-1, page->freeCacheIndex);
554 EXPECT_EQ(0, page->numAllocatedSlots);
555 EXPECT_EQ(0, page->numUnprovisionedSlots);
561 // On Linux, we have a guarantee that freelisting a page should cause its
579 // Chop a system page and a byte off to test for rounding errors.
628 // Allocate a size that is a system page smaller than a bucket. GetSize()
668 WTF::PartitionPage* page = WTF::partitionPointerToPage(WTF::partitionCookieFreePointerAdjust(ptr));
672 EXPECT_EQ(WTF::partitionCookieFreePointerAdjust(ptr), page->freelistHead);
740 WTF::PartitionPage* page = WTF::partitionPointerToPage(WTF::partitionCookieFreePointerAdjust(ptr));
741 size_t totalSlots = (page->bucket->numSystemPagesPerSlotSpan * WTF::kSystemPageSize) / (bigSize + kExtraAllocSize);
745 // to) into a system page.
746 EXPECT_TRUE(page->freelistHead);
747 EXPECT_EQ(1, page->numAllocatedSlots);
748 EXPECT_EQ(2, page->numUnprovisionedSlots);
752 EXPECT_FALSE(page->freelistHead);
753 EXPECT_EQ(2, page->numAllocatedSlots);
754 EXPECT_EQ(2, page->numUnprovisionedSlots);
758 EXPECT_TRUE(page->freelistHead);
759 EXPECT_EQ(3, page->numAllocatedSlots);
760 EXPECT_EQ(0, page->numUnprovisionedSlots);
764 EXPECT_FALSE(page->freelistHead);
765 EXPECT_EQ(4, page->numAllocatedSlots);
766 EXPECT_EQ(0, page->numUnprovisionedSlots);
774 // Churn things a little whilst there's a partial page freelist.
785 EXPECT_NE(-1, page->freeCacheIndex);
798 page = WTF::partitionPointerToPage(WTF::partitionCookieFreePointerAdjust(ptr));
799 EXPECT_EQ(1, page->numAllocatedSlots);
800 totalSlots = (page->bucket->numSystemPagesPerSlotSpan * WTF::kSystemPageSize) / (mediumSize + kExtraAllocSize);
803 EXPECT_EQ(totalSlots - firstPageSlots, page->numUnprovisionedSlots);
814 page = WTF::partitionPointerToPage(WTF::partitionCookieFreePointerAdjust(ptr));
815 EXPECT_EQ(1, page->numAllocatedSlots);
816 totalSlots = (page->bucket->numSystemPagesPerSlotSpan * WTF::kSystemPageSize) / (smallSize + kExtraAllocSize);
818 EXPECT_EQ(totalSlots - firstPageSlots, page->numUnprovisionedSlots);
821 EXPECT_TRUE(page->freelistHead);
822 EXPECT_EQ(0, page->numAllocatedSlots);
831 page = WTF::partitionPointerToPage(WTF::partitionCookieFreePointerAdjust(ptr));
832 EXPECT_EQ(1, page->numAllocatedSlots);
833 totalSlots = (page->bucket->numSystemPagesPerSlotSpan * WTF::kSystemPageSize) / (verySmallSize + kExtraAllocSize);
835 EXPECT_EQ(totalSlots - firstPageSlots, page->numUnprovisionedSlots);
838 EXPECT_TRUE(page->freelistHead);
839 EXPECT_EQ(0, page->numAllocatedSlots);
842 // larger than a system page.
846 page = WTF::partitionPointerToPage(WTF::partitionCookieFreePointerAdjust(ptr));
847 EXPECT_EQ(1, page->numAllocatedSlots);
848 EXPECT_TRUE(page->freelistHead);
849 totalSlots = (page->bucket->numSystemPagesPerSlotSpan * WTF::kSystemPageSize) / (pageAndAHalfSize + kExtraAllocSize);
850 EXPECT_EQ(totalSlots - 2, page->numUnprovisionedSlots);
853 // And then make sure than exactly the page size only faults one page.
857 page = WTF::partitionPointerToPage(WTF::partitionCookieFreePointerAdjust(ptr));
858 EXPECT_EQ(1, page->numAllocatedSlots);
859 EXPECT_FALSE(page->freelistHead);
860 totalSlots = (page->bucket->numSystemPagesPerSlotSpan * WTF::kSystemPageSize) / (pageSize + kExtraAllocSize);
861 EXPECT_EQ(totalSlots - 1, page->numUnprovisionedSlots);
873 // Grab two full pages and a non-full page.
880 WTF::PartitionPage* page = WTF::partitionPointerToPage(WTF::partitionCookieFreePointerAdjust(ptr));
881 EXPECT_EQ(1, page->numAllocatedSlots);
893 EXPECT_EQ(1, page->numAllocatedSlots);
902 // Basic tests to ensure that allocations work for partial page buckets.
907 // Find a size that is backed by a partial partition page.
930 // The -2 is because the first and last partition pages in a super page are
943 // Map a single system page either side of the mapping for our allocations,
961 // Map a single system page either side of the mapping for our allocations,
976 // And make sure we really did get a page in a new superpage.
989 // Tests that pages in the free page cache do get freed as appropriate.
1002 WTF::PartitionPage* page = WTF::partitionPointerToPage(WTF::partitionCookieFreePointerAdjust(ptr));
1004 EXPECT_EQ(1, page->numAllocatedSlots);
1007 EXPECT_EQ(0, page->numAllocatedSlots);
1008 EXPECT_NE(-1, page->freeCacheIndex);
1009 EXPECT_TRUE(page->freelistHead);
1013 // Flushing the cache should have really freed the unused page.
1014 EXPECT_FALSE(page->freelistHead);
1015 EXPECT_EQ(-1, page->freeCacheIndex);
1016 EXPECT_EQ(0, page->numAllocatedSlots);
1020 // Check that an allocation works ok whilst in this state (a free'd page
1026 // Also check that a page that is bouncing immediately between empty and
1030 EXPECT_TRUE(page->freelistHead);
1032 EXPECT_TRUE(page->freelistHead);
1050 WTF::PartitionPage* page = WTF::partitionPointerToPage(WTF::partitionCookieFreePointerAdjust(ptr));
1052 WTF::PartitionBucket* bucket = page->bucket;
1055 EXPECT_EQ(-1, page->numAllocatedSlots);
1062 EXPECT_EQ(0, page->numAllocatedSlots);
1064 EXPECT_TRUE(page->freelistHead);
1069 EXPECT_FALSE(page->freelistHead);
1088 // list, where the current active page is freed, and there exists at least
1089 // one freed page in the free pages list.
1142 // fire. However, it does take the "refcount" of the partition page to -1,