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

Unified Diff: Source/wtf/PartitionAlloc.h

Issue 301743006: Report DOM partitionAlloc size to V8 GC. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: undo changes on Partitions.cpp Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/wtf/PartitionAlloc.h
diff --git a/Source/wtf/PartitionAlloc.h b/Source/wtf/PartitionAlloc.h
index 74871483107e1b6dff4e01454d7f9dfb07605085..c0709d9d62b1e200e83aa112513ee0395bb5e65c 100644
--- a/Source/wtf/PartitionAlloc.h
+++ b/Source/wtf/PartitionAlloc.h
@@ -254,6 +254,7 @@ struct PartitionSuperPageExtentEntry {
};
struct WTF_EXPORT PartitionRootBase {
+ size_t totalAllocationSize;
size_t totalSizeOfSuperPages;
unsigned numBuckets;
unsigned maxAllocation;
@@ -464,6 +465,7 @@ ALWAYS_INLINE void* partitionBucketAlloc(PartitionRootBase* root, int flags, siz
// The value given to the application is actually just after the cookie.
ret = static_cast<char*>(ret) + kCookieSize;
#endif
+ root->totalAllocationSize += bucket->slotSize;
Chris Evans 2014/06/05 18:00:26 My gut reaction is I don't like this. It adds over
return ret;
}
@@ -487,8 +489,8 @@ ALWAYS_INLINE void* partitionAlloc(PartitionRoot* root, size_t size)
ALWAYS_INLINE void partitionFreeWithPage(void* ptr, PartitionPage* page)
{
// If these asserts fire, you probably corrupted memory.
-#ifndef NDEBUG
size_t bucketSize = page->bucket->slotSize;
+#ifndef NDEBUG
partitionCookieCheckValue(ptr);
partitionCookieCheckValue(reinterpret_cast<char*>(ptr) + bucketSize - kCookieSize);
memset(ptr, kFreedByte, bucketSize);
@@ -502,6 +504,10 @@ ALWAYS_INLINE void partitionFreeWithPage(void* ptr, PartitionPage* page)
entry->next = partitionFreelistMask(freelistHead);
page->freelistHead = entry;
--page->numAllocatedSlots;
+
+ PartitionRootBase* root = partitionPageToRoot(page);
+ root->totalAllocationSize -= bucketSize;
Tom Sepez 2014/06/05 17:52:01 nit: assert you don't underflow here.
+
if (UNLIKELY(page->numAllocatedSlots <= 0))
partitionFreeSlowPath(page);
}

Powered by Google App Engine
This is Rietveld 408576698