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

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

Issue 1845923005: CL for perf tryjob on android Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 partitionCookieWriteValue(charRet); 651 partitionCookieWriteValue(charRet);
652 partitionCookieWriteValue(charRet + kCookieSize + noCookieSize); 652 partitionCookieWriteValue(charRet + kCookieSize + noCookieSize);
653 #endif 653 #endif
654 return ret; 654 return ret;
655 } 655 }
656 656
657 ALWAYS_INLINE void* partitionAlloc(PartitionRoot* root, size_t size, const char* typeName) 657 ALWAYS_INLINE void* partitionAlloc(PartitionRoot* root, size_t size, const char* typeName)
658 { 658 {
659 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) 659 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
660 void* result = malloc(size); 660 void* result = malloc(size);
661 CHECK(result); 661 RELEASE_ASSERT(result);
662 return result; 662 return result;
663 #else 663 #else
664 size_t requestedSize = size; 664 size_t requestedSize = size;
665 size = partitionCookieSizeAdjustAdd(size); 665 size = partitionCookieSizeAdjustAdd(size);
666 ASSERT(root->initialized); 666 ASSERT(root->initialized);
667 size_t index = size >> kBucketShift; 667 size_t index = size >> kBucketShift;
668 ASSERT(index < root->numBuckets); 668 ASSERT(index < root->numBuckets);
669 ASSERT(size == index << kBucketShift); 669 ASSERT(size == index << kBucketShift);
670 PartitionBucket* bucket = &root->buckets()[index]; 670 PartitionBucket* bucket = &root->buckets()[index];
671 void* result = partitionBucketAlloc(root, 0, size, bucket); 671 void* result = partitionBucketAlloc(root, 0, size, bucket);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 PartitionBucket* bucket = root->bucketLookups[(order << kGenericNumBucketsPe rOrderBits) + orderIndex + !!subOrderIndex]; 727 PartitionBucket* bucket = root->bucketLookups[(order << kGenericNumBucketsPe rOrderBits) + orderIndex + !!subOrderIndex];
728 ASSERT(!bucket->slotSize || bucket->slotSize >= size); 728 ASSERT(!bucket->slotSize || bucket->slotSize >= size);
729 ASSERT(!(bucket->slotSize % kGenericSmallestBucket)); 729 ASSERT(!(bucket->slotSize % kGenericSmallestBucket));
730 return bucket; 730 return bucket;
731 } 731 }
732 732
733 ALWAYS_INLINE void* partitionAllocGenericFlags(PartitionRootGeneric* root, int f lags, size_t size, const char* typeName) 733 ALWAYS_INLINE void* partitionAllocGenericFlags(PartitionRootGeneric* root, int f lags, size_t size, const char* typeName)
734 { 734 {
735 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) 735 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
736 void* result = malloc(size); 736 void* result = malloc(size);
737 CHECK(result); 737 RELEASE_ASSERT(result);
738 return result; 738 return result;
739 #else 739 #else
740 ASSERT(root->initialized); 740 ASSERT(root->initialized);
741 size_t requestedSize = size; 741 size_t requestedSize = size;
742 size = partitionCookieSizeAdjustAdd(size); 742 size = partitionCookieSizeAdjustAdd(size);
743 PartitionBucket* bucket = partitionGenericSizeToBucket(root, size); 743 PartitionBucket* bucket = partitionGenericSizeToBucket(root, size);
744 void* ret = nullptr; 744 void* ret = nullptr;
745 { 745 {
746 SpinLock::Guard guard(root->lock); 746 SpinLock::Guard guard(root->lock);
747 // TODO(bashi): Remove following RELEAE_ASSERT()s once we find the cause of 747 // TODO(bashi): Remove following RELEAE_ASSERT()s once we find the cause of
748 // http://crbug.com/514141 748 // http://crbug.com/514141
749 #if OS(ANDROID) 749 #if OS(ANDROID)
750 CHECK(bucket >= &root->buckets[0] || bucket == &PartitionRootGeneric::gP agedBucket); 750 RELEASE_ASSERT(bucket >= &root->buckets[0] || bucket == &PartitionRootGe neric::gPagedBucket);
751 CHECK(bucket <= &root->buckets[kGenericNumBuckets - 1] || bucket == &Par titionRootGeneric::gPagedBucket); 751 RELEASE_ASSERT(bucket <= &root->buckets[kGenericNumBuckets - 1] || bucke t == &PartitionRootGeneric::gPagedBucket);
752 CHECK(root->initialized); 752 RELEASE_ASSERT(root->initialized);
753 #endif 753 #endif
754 ret = partitionBucketAlloc(root, flags, size, bucket); 754 ret = partitionBucketAlloc(root, flags, size, bucket);
755 } 755 }
756 PartitionAllocHooks::allocationHookIfEnabled(ret, requestedSize, typeName); 756 PartitionAllocHooks::allocationHookIfEnabled(ret, requestedSize, typeName);
757 return ret; 757 return ret;
758 #endif 758 #endif
759 } 759 }
760 760
761 ALWAYS_INLINE void* partitionAllocGeneric(PartitionRootGeneric* root, size_t siz e, const char* typeName) 761 ALWAYS_INLINE void* partitionAllocGeneric(PartitionRootGeneric* root, size_t siz e, const char* typeName)
762 { 762 {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 using WTF::partitionAlloc; 869 using WTF::partitionAlloc;
870 using WTF::partitionFree; 870 using WTF::partitionFree;
871 using WTF::partitionAllocGeneric; 871 using WTF::partitionAllocGeneric;
872 using WTF::partitionFreeGeneric; 872 using WTF::partitionFreeGeneric;
873 using WTF::partitionReallocGeneric; 873 using WTF::partitionReallocGeneric;
874 using WTF::partitionAllocActualSize; 874 using WTF::partitionAllocActualSize;
875 using WTF::partitionAllocSupportsGetSize; 875 using WTF::partitionAllocSupportsGetSize;
876 using WTF::partitionAllocGetSize; 876 using WTF::partitionAllocGetSize;
877 877
878 #endif // WTF_PartitionAlloc_h 878 #endif // WTF_PartitionAlloc_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/PageAllocator.cpp ('k') | third_party/WebKit/Source/wtf/PartitionAlloc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698