| 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 22bcedae5f3f64bb3b750faae9356ccd3e65906a..2558be5a93e3e70dd9e7d5b91df8169da9c5e083 100644
|
| --- a/third_party/WebKit/Source/platform/heap/HeapTest.cpp
|
| +++ b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
|
| @@ -514,7 +514,7 @@ protected:
|
| void runThread() override
|
| {
|
| OwnPtr<GlobalIntWrapperPersistent> longLivingPersistent;
|
| - ThreadState::attach();
|
| + ThreadState::attach(ThreadState::PerThreadHeapDisabled);
|
|
|
| longLivingPersistent = createGlobalPersistent(0x2a2a2a2a);
|
| int gcCount = 0;
|
| @@ -573,7 +573,7 @@ public:
|
| private:
|
| void runThread() override
|
| {
|
| - ThreadState::attach();
|
| + ThreadState::attach(ThreadState::PerThreadHeapDisabled);
|
|
|
| int gcCount = 0;
|
| while (!done()) {
|
| @@ -667,7 +667,7 @@ protected:
|
|
|
| void runThread() override
|
| {
|
| - ThreadState::attach();
|
| + ThreadState::attach(ThreadState::PerThreadHeapDisabled);
|
|
|
| PersistentChain::create(100);
|
|
|
| @@ -1771,7 +1771,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);
|
| @@ -1785,7 +1785,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);
|
| @@ -1806,7 +1806,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);
|
| @@ -1824,7 +1824,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));
|
| }
|
|
|
| {
|
| @@ -1839,14 +1839,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();
|
| @@ -1856,11 +1856,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];
|
| @@ -2323,7 +2323,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;
|
| {
|
| @@ -2332,7 +2332,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));
|
| @@ -2356,13 +2356,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();
|
| @@ -3789,7 +3789,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]));
|
| @@ -3808,7 +3808,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
|
| @@ -4734,7 +4734,7 @@ public:
|
| private:
|
| static void sleeperMainFunc()
|
| {
|
| - ThreadState::attach();
|
| + ThreadState::attach(ThreadState::PerThreadHeapDisabled);
|
| s_sleeperRunning = true;
|
|
|
| // Simulate a long running op that is not entering a safepoint.
|
| @@ -5424,7 +5424,7 @@ private:
|
| {
|
| MutexLocker locker(workerThreadMutex());
|
|
|
| - ThreadState::attach();
|
| + ThreadState::attach(ThreadState::PerThreadHeapDisabled);
|
|
|
| {
|
| // Create a worker object that is not kept alive except the
|
| @@ -5545,7 +5545,7 @@ private:
|
| {
|
| MutexLocker locker(workerThreadMutex());
|
|
|
| - ThreadState::attach();
|
| + ThreadState::attach(ThreadState::PerThreadHeapDisabled);
|
|
|
| {
|
| Persistent<WeakCollectionType> collection = allocateCollection();
|
| @@ -5706,7 +5706,7 @@ private:
|
| static void workerThreadMain()
|
| {
|
| MutexLocker locker(workerThreadMutex());
|
| - ThreadState::attach();
|
| + ThreadState::attach(ThreadState::PerThreadHeapDisabled);
|
|
|
| DestructorLockingObject* dlo = DestructorLockingObject::create();
|
| ASSERT_UNUSED(dlo, dlo);
|
| @@ -5774,7 +5774,7 @@ private:
|
| // Do this to verify that CrossThreadPersistent<>s referring to objects
|
| // on one of the main thread's heaps does not upset the CTP invalidation
|
| // pass that ThreadState::detach() performs.
|
| - ThreadState::attach();
|
| + ThreadState::attach(ThreadState::PerThreadHeapDisabled);
|
|
|
| CrossThreadPersistent<IntWrapper> persistent(IntWrapper::create(43));
|
|
|
| @@ -6440,7 +6440,7 @@ void workerThreadMainForCrossThreadWeakPersistentTest(DestructorLockingObject**
|
| {
|
| // Step 2: Create an object and store the pointer.
|
| MutexLocker locker(workerThreadMutex());
|
| - ThreadState::attach();
|
| + ThreadState::attach(ThreadState::PerThreadHeapDisabled);
|
| *object = DestructorLockingObject::create();
|
| wakeMainThread();
|
| parkWorkerThread();
|
|
|