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

Unified Diff: third_party/WebKit/Source/platform/heap/HeapTest.cpp

Issue 1840103004: Introduce ThreadHeapStats (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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: third_party/WebKit/Source/platform/heap/HeapTest.cpp
diff --git a/third_party/WebKit/Source/platform/heap/HeapTest.cpp b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
index c45c657dae06e3100c97c78d58634360673462ca..b9805067acfd9a6c08e8ac89da6ae1f2d9a15967 100644
--- a/third_party/WebKit/Source/platform/heap/HeapTest.cpp
+++ b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
@@ -1774,7 +1774,7 @@ TEST(HeapTest, BasicFunctionality)
size_t baseLevel = initialObjectPayloadSize;
bool testPagesAllocated = !baseLevel;
if (testPagesAllocated)
- EXPECT_EQ(Heap::allocatedSpace(), 0ul);
+ EXPECT_EQ(Heap::heapStats().allocatedSpace(), 0ul);
// This allocates objects on the general heap which should add a page of memory.
DynamicallySizedObject* alloc32 = DynamicallySizedObject::create(32);
@@ -1788,7 +1788,7 @@ TEST(HeapTest, BasicFunctionality)
CheckWithSlack(baseLevel + total, Heap::objectPayloadSizeForTesting(), slack);
if (testPagesAllocated)
- EXPECT_EQ(Heap::allocatedSpace(), blinkPageSize * 2);
+ EXPECT_EQ(Heap::heapStats().allocatedSpace(), blinkPageSize * 2);
EXPECT_EQ(alloc32->get(0), 40);
EXPECT_EQ(alloc32->get(31), 40);
@@ -1809,7 +1809,7 @@ TEST(HeapTest, BasicFunctionality)
size_t baseLevel = Heap::objectPayloadSizeForTesting();
bool testPagesAllocated = !baseLevel;
if (testPagesAllocated)
- EXPECT_EQ(Heap::allocatedSpace(), 0ul);
+ EXPECT_EQ(Heap::heapStats().allocatedSpace(), 0ul);
size_t big = 1008;
Persistent<DynamicallySizedObject> bigArea = DynamicallySizedObject::create(big);
@@ -1827,7 +1827,7 @@ TEST(HeapTest, BasicFunctionality)
slack += 4;
CheckWithSlack(baseLevel + total, Heap::objectPayloadSizeForTesting(), slack);
if (testPagesAllocated)
- EXPECT_EQ(0ul, Heap::allocatedSpace() & (blinkPageSize - 1));
+ EXPECT_EQ(0ul, Heap::heapStats().allocatedSpace() & (blinkPageSize - 1));
}
{
@@ -1842,14 +1842,14 @@ TEST(HeapTest, BasicFunctionality)
total += 96;
CheckWithSlack(baseLevel + total, Heap::objectPayloadSizeForTesting(), slack);
if (testPagesAllocated)
- EXPECT_EQ(0ul, Heap::allocatedSpace() & (blinkPageSize - 1));
+ EXPECT_EQ(0ul, Heap::heapStats().allocatedSpace() & (blinkPageSize - 1));
}
clearOutOldGarbage();
total -= 96;
slack -= 8;
if (testPagesAllocated)
- EXPECT_EQ(0ul, Heap::allocatedSpace() & (blinkPageSize - 1));
+ EXPECT_EQ(0ul, Heap::heapStats().allocatedSpace() & (blinkPageSize - 1));
// Clear the persistent, so that the big area will be garbage collected.
bigArea.release();
@@ -1859,11 +1859,11 @@ TEST(HeapTest, BasicFunctionality)
slack -= 4;
CheckWithSlack(baseLevel + total, Heap::objectPayloadSizeForTesting(), slack);
if (testPagesAllocated)
- EXPECT_EQ(0ul, Heap::allocatedSpace() & (blinkPageSize - 1));
+ EXPECT_EQ(0ul, Heap::heapStats().allocatedSpace() & (blinkPageSize - 1));
CheckWithSlack(baseLevel + total, Heap::objectPayloadSizeForTesting(), slack);
if (testPagesAllocated)
- EXPECT_EQ(0ul, Heap::allocatedSpace() & (blinkPageSize - 1));
+ EXPECT_EQ(0ul, Heap::heapStats().allocatedSpace() & (blinkPageSize - 1));
for (size_t i = 0; i < persistentCount; i++) {
delete persistents[i];
@@ -2326,7 +2326,7 @@ TEST(HeapTest, LargeHeapObjects)
{
clearOutOldGarbage();
size_t initialObjectPayloadSize = Heap::objectPayloadSizeForTesting();
- size_t initialAllocatedSpace = Heap::allocatedSpace();
+ size_t initialAllocatedSpace = Heap::heapStats().allocatedSpace();
IntWrapper::s_destructorCalls = 0;
LargeHeapObject::s_destructorCalls = 0;
{
@@ -2335,7 +2335,7 @@ TEST(HeapTest, LargeHeapObjects)
ASSERT(ThreadState::current()->findPageFromAddress(object));
ASSERT(ThreadState::current()->findPageFromAddress(reinterpret_cast<char*>(object.get()) + sizeof(LargeHeapObject) - 1));
clearOutOldGarbage();
- size_t afterAllocation = Heap::allocatedSpace();
+ size_t afterAllocation = Heap::heapStats().allocatedSpace();
{
object->set(0, 'a');
EXPECT_EQ('a', object->get(0));
@@ -2359,13 +2359,13 @@ TEST(HeapTest, LargeHeapObjects)
object = LargeHeapObject::create();
}
clearOutOldGarbage();
- EXPECT_TRUE(Heap::allocatedSpace() == afterAllocation);
+ EXPECT_TRUE(Heap::heapStats().allocatedSpace() == afterAllocation);
EXPECT_EQ(10, IntWrapper::s_destructorCalls);
EXPECT_EQ(10, LargeHeapObject::s_destructorCalls);
}
clearOutOldGarbage();
EXPECT_TRUE(initialObjectPayloadSize == Heap::objectPayloadSizeForTesting());
- EXPECT_TRUE(initialAllocatedSpace == Heap::allocatedSpace());
+ EXPECT_TRUE(initialAllocatedSpace == Heap::heapStats().allocatedSpace());
EXPECT_EQ(11, IntWrapper::s_destructorCalls);
EXPECT_EQ(11, LargeHeapObject::s_destructorCalls);
preciselyCollectGarbage();
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapPage.cpp ('k') | third_party/WebKit/Source/platform/heap/PersistentNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698