Index: Source/wtf/PartitionAlloc.h |
diff --git a/Source/wtf/PartitionAlloc.h b/Source/wtf/PartitionAlloc.h |
index aa779f3d0fb9e1a1f10f8813994630e3f930fead..28360116267f93ed7f2490b89c5e7c3310429c49 100644 |
--- a/Source/wtf/PartitionAlloc.h |
+++ b/Source/wtf/PartitionAlloc.h |
@@ -88,7 +88,9 @@ |
#include "wtf/Assertions.h" |
#include "wtf/FastMalloc.h" |
+#include "wtf/PageAllocator.h" |
#include "wtf/SpinLock.h" |
+#include "wtf/UnusedParam.h" |
#if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
#include <stdlib.h> |
@@ -266,6 +268,16 @@ ALWAYS_INLINE void partitionFreeWithPage(void* ptr, PartitionPageHeader* page) |
ALWAYS_INLINE bool partitionPointerIsValid(PartitionRoot* root, void* ptr) |
{ |
+#if CPU(32BIT) |
+ // On 32-bit systems, we have an optimization where we have a bitmap that |
+ // can instantly tell us if a pointer is in a super page or not. |
+ // It is a global bitmap instead of a per-partition bitmap but this is a |
+ // reasonable space vs. accuracy trade off. |
+ UNUSED_PARAM(root); |
+ return SuperPageBitmap::isPointerInSuperPage(ptr); |
+#else |
+ // On 64-bit systems, we check the list of super page extents. Due to the |
+ // massive address space, we typically have a single extent. |
// Dominant case: the pointer is in the first extent, which grew without any collision. |
if (LIKELY(ptr >= root->firstExtent.superPageBase) && LIKELY(ptr < root->firstExtent.superPagesEnd)) |
return true; |
@@ -279,6 +291,7 @@ ALWAYS_INLINE bool partitionPointerIsValid(PartitionRoot* root, void* ptr) |
} |
return false; |
+#endif |
} |
ALWAYS_INLINE void partitionFree(void* ptr) |