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

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

Issue 2044673003: Honour PartitionAllocReturnNull flag when MEMORY_TOOL_REPLACES_ALLOCATOR (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change CHECK back to RELEASE_ASSERT due to the reported "12.5%-56.9% perf regression" Created 4 years, 6 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 | no next file » | no next file with comments »
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 716 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 RELEASE_ASSERT(result); 737 RELEASE_ASSERT(result || flags & PartitionAllocReturnNull);
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
(...skipping 121 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 | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698