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

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

Issue 1477023003: Refactor the Heap into ThreadHeap to prepare for per thread heaps Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 1bec0e5432e1d006055b40eef3277e4ab54ec7ad..4d0c2c6246763a080f4d512e9ad020799b5281d8 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(ThreadState::current()->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(ThreadState::current()->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(ThreadState::current()->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, ThreadState::current()->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, ThreadState::current()->allocatedSpace() & (blinkPageSize - 1));
}
clearOutOldGarbage();
total -= 96;
slack -= 8;
if (testPagesAllocated)
- EXPECT_EQ(0ul, Heap::allocatedSpace() & (blinkPageSize - 1));
+ EXPECT_EQ(0ul, ThreadState::current()->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, ThreadState::current()->allocatedSpace() & (blinkPageSize - 1));
CheckWithSlack(baseLevel + total, Heap::objectPayloadSizeForTesting(), slack);
if (testPagesAllocated)
- EXPECT_EQ(0ul, Heap::allocatedSpace() & (blinkPageSize - 1));
+ EXPECT_EQ(0ul, ThreadState::current()->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 = ThreadState::current()->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 = ThreadState::current()->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(ThreadState::current()->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 == ThreadState::current()->allocatedSpace());
EXPECT_EQ(11, IntWrapper::s_destructorCalls);
EXPECT_EQ(11, LargeHeapObject::s_destructorCalls);
preciselyCollectGarbage();
@@ -3792,7 +3792,7 @@ TEST(HeapTest, CheckAndMarkPointer)
{
TestGCScope scope(BlinkGC::HeapPointersOnStack);
EXPECT_TRUE(scope.allThreadsParked()); // Fail the test if we could not park all threads.
- Heap::flushHeapDoesNotContainCache();
+ ThreadState::current()->flushHeapDoesNotContainCache();
for (size_t i = 0; i < objectAddresses.size(); i++) {
EXPECT_TRUE(Heap::checkAndMarkPointer(&visitor, objectAddresses[i]));
EXPECT_TRUE(Heap::checkAndMarkPointer(&visitor, endAddresses[i]));
@@ -3811,7 +3811,7 @@ TEST(HeapTest, CheckAndMarkPointer)
{
TestGCScope scope(BlinkGC::HeapPointersOnStack);
EXPECT_TRUE(scope.allThreadsParked());
- Heap::flushHeapDoesNotContainCache();
+ ThreadState::current()->flushHeapDoesNotContainCache();
for (size_t i = 0; i < objectAddresses.size(); i++) {
// We would like to assert that checkAndMarkPointer returned false
// here because the pointers no longer point into a valid object

Powered by Google App Engine
This is Rietveld 408576698