Index: third_party/WebKit/Source/platform/heap/Heap.cpp |
diff --git a/third_party/WebKit/Source/platform/heap/Heap.cpp b/third_party/WebKit/Source/platform/heap/Heap.cpp |
index 046c80f9f47ef72e7bdf9b641fac5b585df8b917..c0717ccc5b961442b80bcd7b723cbebfeac5987e 100644 |
--- a/third_party/WebKit/Source/platform/heap/Heap.cpp |
+++ b/third_party/WebKit/Source/platform/heap/Heap.cpp |
@@ -117,17 +117,17 @@ void ProcessHeap::resetHeapCounters() { |
} |
void ProcessHeap::shutdown() { |
- ASSERT(!s_shutdownComplete); |
+ DCHECK(!s_shutdownComplete); |
{ |
// The main thread must be the last thread that gets detached. |
MutexLocker locker(ThreadHeap::allHeapsMutex()); |
- RELEASE_ASSERT(ThreadHeap::allHeaps().isEmpty()); |
+ CHECK(ThreadHeap::allHeaps().isEmpty()); |
} |
CallbackStackMemoryPool::instance().shutdown(); |
GCInfoTable::shutdown(); |
- ASSERT(ProcessHeap::totalAllocatedSpace() == 0); |
+ DCHECK_EQ(ProcessHeap::totalAllocatedSpace(), 0UL); |
s_shutdownComplete = true; |
} |
@@ -240,7 +240,7 @@ void ThreadHeap::attach(ThreadState* thread) { |
} |
void ThreadHeap::detach(ThreadState* thread) { |
- ASSERT(ThreadState::current() == thread); |
+ DCHECK_EQ(ThreadState::current(), thread); |
bool isLastThread = false; |
{ |
// Grab the threadAttachMutex to ensure only one thread can shutdown at |
@@ -252,7 +252,7 @@ void ThreadHeap::detach(ThreadState* thread) { |
SafePointAwareMutexLocker locker(m_threadAttachMutex, |
BlinkGC::NoHeapPointersOnStack); |
thread->runTerminationGC(); |
- ASSERT(m_threads.contains(thread)); |
+ DCHECK(m_threads.contains(thread)); |
m_threads.remove(thread); |
isLastThread = m_threads.isEmpty(); |
} |
@@ -276,7 +276,7 @@ void ThreadHeap::resume() { |
m_safePointBarrier->resumeOthers(); |
} |
-#if ENABLE(ASSERT) |
+#if DCHECK_IS_ON() |
BasePage* ThreadHeap::findPageFromAddress(Address address) { |
MutexLocker locker(m_threadAttachMutex); |
for (ThreadState* state : m_threads) { |
@@ -297,23 +297,23 @@ bool ThreadHeap::isAtSafePoint() { |
#endif |
Address ThreadHeap::checkAndMarkPointer(Visitor* visitor, Address address) { |
- ASSERT(ThreadState::current()->isInGC()); |
+ DCHECK(ThreadState::current()->isInGC()); |
-#if !ENABLE(ASSERT) |
+#if !DCHECK_IS_ON() |
if (m_heapDoesNotContainCache->lookup(address)) |
return nullptr; |
#endif |
if (BasePage* page = lookupPageForAddress(address)) { |
- ASSERT(page->contains(address)); |
- ASSERT(!page->orphaned()); |
- ASSERT(!m_heapDoesNotContainCache->lookup(address)); |
- DCHECK(&visitor->heap() == &page->arena()->getThreadState()->heap()); |
+ DCHECK(page->contains(address)); |
+ DCHECK(!page->orphaned()); |
+ DCHECK(!m_heapDoesNotContainCache->lookup(address)); |
+ DCHECK_EQ(&visitor->heap(), &page->arena()->getThreadState()->heap()); |
page->checkAndMarkPointer(visitor, address); |
return address; |
} |
-#if !ENABLE(ASSERT) |
+#if !DCHECK_IS_ON() |
m_heapDoesNotContainCache->addEntry(address); |
#else |
if (!m_heapDoesNotContainCache->lookup(address)) |
@@ -323,10 +323,10 @@ Address ThreadHeap::checkAndMarkPointer(Visitor* visitor, Address address) { |
} |
void ThreadHeap::pushTraceCallback(void* object, TraceCallback callback) { |
- ASSERT(ThreadState::current()->isInGC()); |
+ DCHECK(ThreadState::current()->isInGC()); |
// Trace should never reach an orphaned page. |
- ASSERT(!getOrphanedPagePool()->contains(object)); |
+ DCHECK(!getOrphanedPagePool()->contains(object)); |
CallbackStack::Item* slot = m_markingStack->allocateEntry(); |
*slot = CallbackStack::Item(object, callback); |
} |
@@ -340,10 +340,10 @@ bool ThreadHeap::popAndInvokeTraceCallback(Visitor* visitor) { |
} |
void ThreadHeap::pushPostMarkingCallback(void* object, TraceCallback callback) { |
- ASSERT(ThreadState::current()->isInGC()); |
+ DCHECK(ThreadState::current()->isInGC()); |
// Trace should never reach an orphaned page. |
- ASSERT(!getOrphanedPagePool()->contains(object)); |
+ DCHECK(!getOrphanedPagePool()->contains(object)); |
CallbackStack::Item* slot = m_postMarkingCallbackStack->allocateEntry(); |
*slot = CallbackStack::Item(object, callback); |
} |
@@ -357,10 +357,10 @@ bool ThreadHeap::popAndInvokePostMarkingCallback(Visitor* visitor) { |
} |
void ThreadHeap::pushGlobalWeakCallback(void** cell, WeakCallback callback) { |
- ASSERT(ThreadState::current()->isInGC()); |
+ DCHECK(ThreadState::current()->isInGC()); |
// Trace should never reach an orphaned page. |
- ASSERT(!getOrphanedPagePool()->contains(cell)); |
+ DCHECK(!getOrphanedPagePool()->contains(cell)); |
CallbackStack::Item* slot = m_globalWeakCallbackStack->allocateEntry(); |
*slot = CallbackStack::Item(cell, callback); |
} |
@@ -368,10 +368,10 @@ void ThreadHeap::pushGlobalWeakCallback(void** cell, WeakCallback callback) { |
void ThreadHeap::pushThreadLocalWeakCallback(void* closure, |
void* object, |
WeakCallback callback) { |
- ASSERT(ThreadState::current()->isInGC()); |
+ DCHECK(ThreadState::current()->isInGC()); |
// Trace should never reach an orphaned page. |
- ASSERT(!getOrphanedPagePool()->contains(object)); |
+ DCHECK(!getOrphanedPagePool()->contains(object)); |
ThreadState* state = pageFromObject(object)->arena()->getThreadState(); |
state->pushThreadLocalWeakCallback(closure, callback); |
} |
@@ -387,10 +387,10 @@ bool ThreadHeap::popAndInvokeGlobalWeakCallback(Visitor* visitor) { |
void ThreadHeap::registerWeakTable(void* table, |
EphemeronCallback iterationCallback, |
EphemeronCallback iterationDoneCallback) { |
- ASSERT(ThreadState::current()->isInGC()); |
+ DCHECK(ThreadState::current()->isInGC()); |
// Trace should never reach an orphaned page. |
- ASSERT(!getOrphanedPagePool()->contains(table)); |
+ DCHECK(!getOrphanedPagePool()->contains(table)); |
CallbackStack::Item* slot = m_ephemeronStack->allocateEntry(); |
*slot = CallbackStack::Item(table, iterationCallback); |
@@ -399,9 +399,9 @@ void ThreadHeap::registerWeakTable(void* table, |
pushPostMarkingCallback(table, iterationDoneCallback); |
} |
-#if ENABLE(ASSERT) |
+#if DCHECK_IS_ON() |
bool ThreadHeap::weakTableRegistered(const void* table) { |
- ASSERT(m_ephemeronStack); |
+ DCHECK(m_ephemeronStack); |
return m_ephemeronStack->hasCallbackForObject(table); |
} |
#endif |
@@ -440,13 +440,13 @@ void ThreadHeap::decommitCallbackStacks() { |
} |
void ThreadHeap::preGC() { |
- ASSERT(!ThreadState::current()->isInGC()); |
+ DCHECK(!ThreadState::current()->isInGC()); |
for (ThreadState* state : m_threads) |
state->preGC(); |
} |
void ThreadHeap::postGC(BlinkGC::GCType gcType) { |
- ASSERT(ThreadState::current()->isInGC()); |
+ DCHECK(ThreadState::current()->isInGC()); |
for (ThreadState* state : m_threads) |
state->postGC(gcType); |
} |
@@ -486,7 +486,7 @@ void ThreadHeap::postMarkingProcessing(Visitor* visitor) { |
// Post-marking callbacks should not trace any objects and |
// therefore the marking stack should be empty after the |
// post-marking callbacks. |
- ASSERT(m_markingStack->isEmpty()); |
+ DCHECK(m_markingStack->isEmpty()); |
} |
void ThreadHeap::globalWeakProcessing(Visitor* visitor) { |
@@ -499,7 +499,7 @@ void ThreadHeap::globalWeakProcessing(Visitor* visitor) { |
// It is not permitted to trace pointers of live objects in the weak |
// callback phase, so the marking stack should still be empty here. |
- ASSERT(m_markingStack->isEmpty()); |
+ DCHECK(m_markingStack->isEmpty()); |
double timeForGlobalWeakProcessing = WTF::currentTimeMS() - startTime; |
DEFINE_THREAD_SAFE_STATIC_LOCAL( |
@@ -614,7 +614,7 @@ size_t ThreadHeap::objectPayloadSizeForTesting() { |
} |
void ThreadHeap::visitPersistentRoots(Visitor* visitor) { |
- ASSERT(ThreadState::current()->isInGC()); |
+ DCHECK(ThreadState::current()->isInGC()); |
TRACE_EVENT0("blink_gc", "ThreadHeap::visitPersistentRoots"); |
ProcessHeap::crossThreadPersistentRegion().tracePersistentNodes(visitor); |
@@ -623,7 +623,7 @@ void ThreadHeap::visitPersistentRoots(Visitor* visitor) { |
} |
void ThreadHeap::visitStackRoots(Visitor* visitor) { |
- ASSERT(ThreadState::current()->isInGC()); |
+ DCHECK(ThreadState::current()->isInGC()); |
TRACE_EVENT0("blink_gc", "ThreadHeap::visitStackRoots"); |
for (ThreadState* state : m_threads) |
state->visitStack(visitor); |
@@ -644,7 +644,7 @@ void ThreadHeap::leaveSafePoint(ThreadState* threadState, |
} |
BasePage* ThreadHeap::lookupPageForAddress(Address address) { |
- ASSERT(ThreadState::current()->isInGC()); |
+ DCHECK(ThreadState::current()->isInGC()); |
if (PageMemoryRegion* region = m_regionTree->lookup(address)) { |
BasePage* page = region->pageFromAddress(address); |
return page && !page->orphaned() ? page : nullptr; |
@@ -653,7 +653,7 @@ BasePage* ThreadHeap::lookupPageForAddress(Address address) { |
} |
void ThreadHeap::resetHeapCounters() { |
- ASSERT(ThreadState::current()->isInGC()); |
+ DCHECK(ThreadState::current()->isInGC()); |
ThreadHeap::reportMemoryUsageForTracing(); |