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

Side by Side Diff: third_party/WebKit/Source/wtf/allocator/PartitionAlloc.h

Issue 2512593002: Move wtf/BitwiseOperations.h into base/bits.h. (Closed)
Patch Set: Add a TODO. Created 4 years, 1 month 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
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 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 ptr = partitionCookieFreePointerAdjust(ptr); 792 ptr = partitionCookieFreePointerAdjust(ptr);
793 ASSERT(partitionPointerIsValid(ptr)); 793 ASSERT(partitionPointerIsValid(ptr));
794 PartitionPage* page = partitionPointerToPage(ptr); 794 PartitionPage* page = partitionPointerToPage(ptr);
795 partitionFreeWithPage(ptr, page); 795 partitionFreeWithPage(ptr, page);
796 #endif 796 #endif
797 } 797 }
798 798
799 ALWAYS_INLINE PartitionBucket* partitionGenericSizeToBucket( 799 ALWAYS_INLINE PartitionBucket* partitionGenericSizeToBucket(
800 PartitionRootGeneric* root, 800 PartitionRootGeneric* root,
801 size_t size) { 801 size_t size) {
802 size_t order = kBitsPerSizet - countLeadingZerosSizet(size); 802 size_t order = kBitsPerSizet - CountLeadingZeroBitsSizeT(size);
803 // The order index is simply the next few bits after the most significant bit. 803 // The order index is simply the next few bits after the most significant bit.
804 size_t orderIndex = (size >> root->orderIndexShifts[order]) & 804 size_t orderIndex = (size >> root->orderIndexShifts[order]) &
805 (kGenericNumBucketsPerOrder - 1); 805 (kGenericNumBucketsPerOrder - 1);
806 // And if the remaining bits are non-zero we must bump the bucket up. 806 // And if the remaining bits are non-zero we must bump the bucket up.
807 size_t subOrderIndex = size & root->orderSubIndexMasks[order]; 807 size_t subOrderIndex = size & root->orderSubIndexMasks[order];
808 PartitionBucket* bucket = 808 PartitionBucket* bucket =
809 root->bucketLookups[(order << kGenericNumBucketsPerOrderBits) + 809 root->bucketLookups[(order << kGenericNumBucketsPerOrderBits) +
810 orderIndex + !!subOrderIndex]; 810 orderIndex + !!subOrderIndex];
811 ASSERT(!bucket->slotSize || bucket->slotSize >= size); 811 ASSERT(!bucket->slotSize || bucket->slotSize >= size);
812 ASSERT(!(bucket->slotSize % kGenericSmallestBucket)); 812 ASSERT(!(bucket->slotSize % kGenericSmallestBucket));
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 using WTF::partitionAlloc; 948 using WTF::partitionAlloc;
949 using WTF::partitionFree; 949 using WTF::partitionFree;
950 using WTF::partitionAllocGeneric; 950 using WTF::partitionAllocGeneric;
951 using WTF::partitionFreeGeneric; 951 using WTF::partitionFreeGeneric;
952 using WTF::partitionReallocGeneric; 952 using WTF::partitionReallocGeneric;
953 using WTF::partitionAllocActualSize; 953 using WTF::partitionAllocActualSize;
954 using WTF::partitionAllocSupportsGetSize; 954 using WTF::partitionAllocSupportsGetSize;
955 using WTF::partitionAllocGetSize; 955 using WTF::partitionAllocGetSize;
956 956
957 #endif // WTF_PartitionAlloc_h 957 #endif // WTF_PartitionAlloc_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/DEPS ('k') | third_party/WebKit/Source/wtf/allocator/PartitionAllocTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698