Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(647)

Side by Side Diff: Source/wtf/PartitionAlloc.h

Issue 183113003: PartitionAlloc: support in-place resize of directly mapped allocation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix various issues Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/wtf/PartitionAlloc.cpp » ('j') | Source/wtf/PartitionAlloc.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | Source/wtf/PartitionAlloc.cpp » ('j') | Source/wtf/PartitionAlloc.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698