Chromium Code Reviews| 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 partitionFreeWithPage(ptr, page); | 564 partitionFreeWithPage(ptr, page); |
| 565 spinLockUnlock(&root->lock); | 565 spinLockUnlock(&root->lock); |
| 566 #endif | 566 #endif |
| 567 } | 567 } |
| 568 | 568 |
| 569 ALWAYS_INLINE bool partitionBucketIsDirectMapped(PartitionBucket* bucket) | 569 ALWAYS_INLINE bool partitionBucketIsDirectMapped(PartitionBucket* bucket) |
| 570 { | 570 { |
| 571 return !bucket->numSystemPagesPerSlotSpan; | 571 return !bucket->numSystemPagesPerSlotSpan; |
| 572 } | 572 } |
| 573 | 573 |
| 574 ALWAYS_INLINE bool partitionSizeIsDirectMapped(size_t size) | |
|
Chris Evans
2014/03/05 07:57:04
I think we can make this private by moving to the
| |
| 575 { | |
| 576 size = partitionCookieSizeAdjustAdd(size); | |
| 577 return size > kGenericMaxBucketed && size <= kGenericMaxDirectMapped; | |
|
Chris Evans
2014/03/05 07:57:04
I think the second condition is a bit subtle here.
| |
| 578 } | |
| 579 | |
| 574 ALWAYS_INLINE size_t partitionDirectMapSize(size_t size) | 580 ALWAYS_INLINE size_t partitionDirectMapSize(size_t size) |
| 575 { | 581 { |
| 576 // Caller must check that the size is not above the kGenericMaxDirectMapped | 582 // Caller must check that the size is not above the kGenericMaxDirectMapped |
| 577 // limit before calling. This also guards against integer overflow in the | 583 // limit before calling. This also guards against integer overflow in the |
| 578 // calculation here. | 584 // calculation here. |
| 579 ASSERT(size <= kGenericMaxDirectMapped); | 585 ASSERT(size <= kGenericMaxDirectMapped); |
| 580 return (size + kSystemPageOffsetMask) & kSystemPageBaseMask; | 586 return (size + kSystemPageOffsetMask) & kSystemPageBaseMask; |
| 581 } | 587 } |
| 582 | 588 |
| 583 ALWAYS_INLINE size_t partitionAllocActualSize(PartitionRootGeneric* root, size_t size) | 589 ALWAYS_INLINE size_t partitionAllocActualSize(PartitionRootGeneric* root, size_t size) |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 656 using WTF::partitionAlloc; | 662 using WTF::partitionAlloc; |
| 657 using WTF::partitionFree; | 663 using WTF::partitionFree; |
| 658 using WTF::partitionAllocGeneric; | 664 using WTF::partitionAllocGeneric; |
| 659 using WTF::partitionFreeGeneric; | 665 using WTF::partitionFreeGeneric; |
| 660 using WTF::partitionReallocGeneric; | 666 using WTF::partitionReallocGeneric; |
| 661 using WTF::partitionAllocActualSize; | 667 using WTF::partitionAllocActualSize; |
| 662 using WTF::partitionAllocSupportsGetSize; | 668 using WTF::partitionAllocSupportsGetSize; |
| 663 using WTF::partitionAllocGetSize; | 669 using WTF::partitionAllocGetSize; |
| 664 | 670 |
| 665 #endif // WTF_PartitionAlloc_h | 671 #endif // WTF_PartitionAlloc_h |
| OLD | NEW |