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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 | 719 |
720 ptr = partitionCookieFreePointerAdjust(ptr); | 720 ptr = partitionCookieFreePointerAdjust(ptr); |
721 ASSERT(partitionPointerIsValid(ptr)); | 721 ASSERT(partitionPointerIsValid(ptr)); |
722 PartitionPage* page = partitionPointerToPage(ptr); | 722 PartitionPage* page = partitionPointerToPage(ptr); |
723 spinLockLock(&root->lock); | 723 spinLockLock(&root->lock); |
724 partitionFreeWithPage(ptr, page); | 724 partitionFreeWithPage(ptr, page); |
725 spinLockUnlock(&root->lock); | 725 spinLockUnlock(&root->lock); |
726 #endif | 726 #endif |
727 } | 727 } |
728 | 728 |
| 729 ALWAYS_INLINE size_t partitionRoundUpToSystemPage(size_t size) |
| 730 { |
| 731 return (size + kSystemPageOffsetMask) & kSystemPageBaseMask; |
| 732 } |
| 733 |
729 ALWAYS_INLINE size_t partitionDirectMapSize(size_t size) | 734 ALWAYS_INLINE size_t partitionDirectMapSize(size_t size) |
730 { | 735 { |
731 // Caller must check that the size is not above the kGenericMaxDirectMapped | 736 // Caller must check that the size is not above the kGenericMaxDirectMapped |
732 // limit before calling. This also guards against integer overflow in the | 737 // limit before calling. This also guards against integer overflow in the |
733 // calculation here. | 738 // calculation here. |
734 ASSERT(size <= kGenericMaxDirectMapped); | 739 ASSERT(size <= kGenericMaxDirectMapped); |
735 return (size + kSystemPageOffsetMask) & kSystemPageBaseMask; | 740 return partitionRoundUpToSystemPage(size); |
736 } | 741 } |
737 | 742 |
738 ALWAYS_INLINE size_t partitionAllocActualSize(PartitionRootGeneric* root, size_t
size) | 743 ALWAYS_INLINE size_t partitionAllocActualSize(PartitionRootGeneric* root, size_t
size) |
739 { | 744 { |
740 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) | 745 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
741 return size; | 746 return size; |
742 #else | 747 #else |
743 ASSERT(root->initialized); | 748 ASSERT(root->initialized); |
744 size = partitionCookieSizeAdjustAdd(size); | 749 size = partitionCookieSizeAdjustAdd(size); |
745 PartitionBucket* bucket = partitionGenericSizeToBucket(root, size); | 750 PartitionBucket* bucket = partitionGenericSizeToBucket(root, size); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 using WTF::partitionAlloc; | 816 using WTF::partitionAlloc; |
812 using WTF::partitionFree; | 817 using WTF::partitionFree; |
813 using WTF::partitionAllocGeneric; | 818 using WTF::partitionAllocGeneric; |
814 using WTF::partitionFreeGeneric; | 819 using WTF::partitionFreeGeneric; |
815 using WTF::partitionReallocGeneric; | 820 using WTF::partitionReallocGeneric; |
816 using WTF::partitionAllocActualSize; | 821 using WTF::partitionAllocActualSize; |
817 using WTF::partitionAllocSupportsGetSize; | 822 using WTF::partitionAllocSupportsGetSize; |
818 using WTF::partitionAllocGetSize; | 823 using WTF::partitionAllocGetSize; |
819 | 824 |
820 #endif // WTF_PartitionAlloc_h | 825 #endif // WTF_PartitionAlloc_h |
OLD | NEW |