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