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

Unified Diff: third_party/WebKit/Source/platform/heap/ThreadState.h

Issue 2619493003: Replace ASSERTs in platform/heap/ with DCHECKs
Patch Set: temp Created 3 years, 11 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/ThreadState.h
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.h b/third_party/WebKit/Source/platform/heap/ThreadState.h
index aafbf309c7088989073e0210016f669032b37775..9fb2fef76f80afe7ee6b0a0885e96458a33c535d 100644
--- a/third_party/WebKit/Source/platform/heap/ThreadState.h
+++ b/third_party/WebKit/Source/platform/heap/ThreadState.h
@@ -152,11 +152,11 @@ class PLATFORM_EXPORT ThreadState {
public:
explicit SweepForbiddenScope(ThreadState* state) : m_state(state) {
- ASSERT(!m_state->m_sweepForbidden);
+ DCHECK(!m_state->m_sweepForbidden);
m_state->m_sweepForbidden = true;
}
~SweepForbiddenScope() {
- ASSERT(m_state->m_sweepForbidden);
+ DCHECK(m_state->m_sweepForbidden);
m_state->m_sweepForbidden = false;
}
@@ -197,7 +197,7 @@ class PLATFORM_EXPORT ThreadState {
// the stack start of the main thread, we judge that we are in
// the main thread.
if (LIKELY(addressDiff < s_mainThreadUnderestimatedStackSize)) {
- ASSERT(**s_threadSpecific == mainThreadState());
+ DCHECK_EQ(**s_threadSpecific, mainThreadState());
return mainThreadState();
}
// TLS lookup is slow.
@@ -212,7 +212,7 @@ class PLATFORM_EXPORT ThreadState {
static ThreadState* fromObject(const void*);
bool isMainThread() const { return this == mainThreadState(); }
-#if ENABLE(ASSERT)
+#if DCHECK_IS_ON()
bool checkThread() const { return m_thread == currentThread(); }
#endif
@@ -378,12 +378,12 @@ class PLATFORM_EXPORT ThreadState {
// The thread heap is split into multiple heap parts based on object types
// and object sizes.
BaseArena* arena(int arenaIndex) const {
- ASSERT(0 <= arenaIndex);
- ASSERT(arenaIndex < BlinkGC::NumberOfArenas);
+ DCHECK_LE(0, arenaIndex);
+ DCHECK_LT(arenaIndex, BlinkGC::NumberOfArenas);
return m_arenas[arenaIndex];
}
-#if ENABLE(ASSERT)
+#if DCHECK_IS_ON()
// Infrastructure to determine if an address is within one of the
// address ranges for the Blink heap. If the address is in the Blink
// heap the containing heap page is returned.
@@ -454,7 +454,7 @@ class PLATFORM_EXPORT ThreadState {
// constructed.
void enterGCForbiddenScopeIfNeeded(
GarbageCollectedMixinConstructorMarker* gcMixinMarker) {
- ASSERT(checkThread());
+ DCHECK(checkThread());
if (!m_gcMixinMarker) {
enterMixinConstructionScope();
m_gcMixinMarker = gcMixinMarker;
@@ -462,7 +462,7 @@ class PLATFORM_EXPORT ThreadState {
}
void leaveGCForbiddenScopeIfNeeded(
GarbageCollectedMixinConstructorMarker* gcMixinMarker) {
- ASSERT(checkThread());
+ DCHECK(checkThread());
if (m_gcMixinMarker == gcMixinMarker) {
leaveMixinConstructionScope();
m_gcMixinMarker = nullptr;
@@ -496,7 +496,7 @@ class PLATFORM_EXPORT ThreadState {
// freed since the last GC.
//
BaseArena* vectorBackingArena(size_t gcInfoIndex) {
- ASSERT(checkThread());
+ DCHECK(checkThread());
size_t entryIndex = gcInfoIndex & likelyToBePromptlyFreedArrayMask;
--m_likelyToBePromptlyFreed[entryIndex];
int arenaIndex = m_vectorBackingArenaIndex;
@@ -508,7 +508,7 @@ class PLATFORM_EXPORT ThreadState {
m_vectorBackingArenaIndex = arenaIndexOfVectorArenaLeastRecentlyExpanded(
BlinkGC::Vector1ArenaIndex, BlinkGC::Vector4ArenaIndex);
}
- ASSERT(isVectorArenaIndex(arenaIndex));
+ DCHECK(isVectorArenaIndex(arenaIndex));
return m_arenas[arenaIndex];
}
BaseArena* expandedVectorBackingArena(size_t gcInfoIndex);
@@ -561,7 +561,7 @@ class PLATFORM_EXPORT ThreadState {
static_assert(sizeof(&T::invokePreFinalizer) > 0,
"USING_PRE_FINALIZER(T) must be defined.");
ThreadState* state = ThreadState::current();
-#if ENABLE(ASSERT)
+#if DCHECK_IS_ON()
DCHECK(state->checkThread());
#endif
DCHECK(!state->sweepForbidden());
@@ -766,7 +766,7 @@ class ThreadStateFor<MainThreadOnly> {
public:
static ThreadState* state() {
// This specialization must only be used from the main thread.
- ASSERT(ThreadState::current()->isMainThread());
+ DCHECK(ThreadState::current()->isMainThread());
return ThreadState::mainThreadState();
}
};

Powered by Google App Engine
This is Rietveld 408576698