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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 // Only consider used space in the slot span. If we consider wasted | 566 // Only consider used space in the slot span. If we consider wasted |
567 // space, we may get an off-by-one when a freelist pointer fits in the | 567 // space, we may get an off-by-one when a freelist pointer fits in the |
568 // wasted space, but a slot does not. | 568 // wasted space, but a slot does not. |
569 // We know we can fit at least one freelist pointer. | 569 // We know we can fit at least one freelist pointer. |
570 numNewFreelistEntries = 1; | 570 numNewFreelistEntries = 1; |
571 // Any further entries require space for the whole slot span. | 571 // Any further entries require space for the whole slot span. |
572 numNewFreelistEntries += static_cast<uint16_t>((freelistLimit - firstFre
elistPointerExtent) / size); | 572 numNewFreelistEntries += static_cast<uint16_t>((freelistLimit - firstFre
elistPointerExtent) / size); |
573 } | 573 } |
574 | 574 |
575 // We always return an object slot -- that's the +1 below. | 575 // We always return an object slot -- that's the +1 below. |
576 // We do not neccessarily create any new freelist entries, because we cross
sub page boundaries frequently for large bucket sizes. | 576 // We do not necessarily create any new freelist entries, because we cross s
ub page boundaries frequently for large bucket sizes. |
577 ASSERT(numNewFreelistEntries + 1 <= numSlots); | 577 ASSERT(numNewFreelistEntries + 1 <= numSlots); |
578 numSlots -= (numNewFreelistEntries + 1); | 578 numSlots -= (numNewFreelistEntries + 1); |
579 page->numUnprovisionedSlots = numSlots; | 579 page->numUnprovisionedSlots = numSlots; |
580 page->numAllocatedSlots++; | 580 page->numAllocatedSlots++; |
581 | 581 |
582 if (LIKELY(numNewFreelistEntries)) { | 582 if (LIKELY(numNewFreelistEntries)) { |
583 char* freelistPointer = firstFreelistPointer; | 583 char* freelistPointer = firstFreelistPointer; |
584 PartitionFreelistEntry* entry = reinterpret_cast<PartitionFreelistEntry*
>(freelistPointer); | 584 PartitionFreelistEntry* entry = reinterpret_cast<PartitionFreelistEntry*
>(freelistPointer); |
585 page->freelistHead = entry; | 585 page->freelistHead = entry; |
586 while (--numNewFreelistEntries) { | 586 while (--numNewFreelistEntries) { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 ASSERT(extent->prevExtent->nextExtent == extent); | 751 ASSERT(extent->prevExtent->nextExtent == extent); |
752 extent->prevExtent->nextExtent = extent->nextExtent; | 752 extent->prevExtent->nextExtent = extent->nextExtent; |
753 } else { | 753 } else { |
754 root->directMapList = extent->nextExtent; | 754 root->directMapList = extent->nextExtent; |
755 } | 755 } |
756 if (extent->nextExtent) { | 756 if (extent->nextExtent) { |
757 ASSERT(extent->nextExtent->prevExtent == extent); | 757 ASSERT(extent->nextExtent->prevExtent == extent); |
758 extent->nextExtent->prevExtent = extent->prevExtent; | 758 extent->nextExtent->prevExtent = extent->prevExtent; |
759 } | 759 } |
760 | 760 |
761 // Add on the size of the trailing guard page and preceeding partition | 761 // Add on the size of the trailing guard page and preceding partition |
762 // page. | 762 // page. |
763 unmapSize += kPartitionPageSize + kSystemPageSize; | 763 unmapSize += kPartitionPageSize + kSystemPageSize; |
764 | 764 |
765 size_t uncommittedPageSize = page->bucket->slotSize + kSystemPageSize; | 765 size_t uncommittedPageSize = page->bucket->slotSize + kSystemPageSize; |
766 partitionDecreaseCommittedPages(root, uncommittedPageSize); | 766 partitionDecreaseCommittedPages(root, uncommittedPageSize); |
767 ASSERT(root->totalSizeOfDirectMappedPages >= uncommittedPageSize); | 767 ASSERT(root->totalSizeOfDirectMappedPages >= uncommittedPageSize); |
768 root->totalSizeOfDirectMappedPages -= uncommittedPageSize; | 768 root->totalSizeOfDirectMappedPages -= uncommittedPageSize; |
769 | 769 |
770 ASSERT(!(unmapSize & kPageAllocationGranularityOffsetMask)); | 770 ASSERT(!(unmapSize & kPageAllocationGranularityOffsetMask)); |
771 | 771 |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 partitionStats.totalDiscardableBytes += memoryStats[i].discardableBy
tes; | 1413 partitionStats.totalDiscardableBytes += memoryStats[i].discardableBy
tes; |
1414 if (!isLightDump) | 1414 if (!isLightDump) |
1415 partitionStatsDumper->partitionsDumpBucketStats(partitionName, &
memoryStats[i]); | 1415 partitionStatsDumper->partitionsDumpBucketStats(partitionName, &
memoryStats[i]); |
1416 } | 1416 } |
1417 } | 1417 } |
1418 partitionStatsDumper->partitionDumpTotals(partitionName, &partitionStats); | 1418 partitionStatsDumper->partitionDumpTotals(partitionName, &partitionStats); |
1419 } | 1419 } |
1420 | 1420 |
1421 } // namespace WTF | 1421 } // namespace WTF |
1422 | 1422 |
OLD | NEW |