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

Unified Diff: third_party/WebKit/Source/platform/heap/Heap.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/Heap.h
diff --git a/third_party/WebKit/Source/platform/heap/Heap.h b/third_party/WebKit/Source/platform/heap/Heap.h
index 846f71a08f412faaf55a88261d9f9a7efb5ac0fc..97bf923e0f5af56deec8fa3733e818dd716a52e8 100644
--- a/third_party/WebKit/Source/platform/heap/Heap.h
+++ b/third_party/WebKit/Source/platform/heap/Heap.h
@@ -234,7 +234,7 @@ class PLATFORM_EXPORT ThreadHeap {
bool isMainThreadHeap() { return this == ThreadHeap::mainThreadHeap(); }
static ThreadHeap* mainThreadHeap() { return s_mainThreadHeap; }
-#if ENABLE(ASSERT)
+#if DCHECK_IS_ON()
bool isAtSafePoint();
BasePage* findPageFromAddress(Address);
#endif
@@ -330,7 +330,7 @@ class PLATFORM_EXPORT ThreadHeap {
// Page has been swept and it is still alive.
if (page->hasBeenSwept())
return false;
- ASSERT(page->arena()->getThreadState()->isSweepingInProgress());
+ DCHECK(page->arena()->getThreadState()->isSweepingInProgress());
// If marked and alive, the object hasn't yet been swept..and won't
// be once its page is processed.
@@ -378,7 +378,7 @@ class PLATFORM_EXPORT ThreadHeap {
void registerWeakTable(void* containerObject,
EphemeronCallback,
EphemeronCallback);
-#if ENABLE(ASSERT)
+#if DCHECK_IS_ON()
bool weakTableRegistered(const void*);
#endif
@@ -410,7 +410,7 @@ class PLATFORM_EXPORT ThreadHeap {
// Add space for header.
size_t allocationSize = size + sizeof(HeapObjectHeader);
// The allocation size calculation can overflow for large sizes.
- RELEASE_ASSERT(allocationSize > size);
+ CHECK(allocationSize > size);
// Align size with allocation granularity.
allocationSize = (allocationSize + allocationMask) & ~allocationMask;
return allocationSize;
@@ -449,11 +449,11 @@ class PLATFORM_EXPORT ThreadHeap {
BasePage* lookupPageForAddress(Address);
static const GCInfo* gcInfo(size_t gcInfoIndex) {
- ASSERT(gcInfoIndex >= 1);
- ASSERT(gcInfoIndex < GCInfoTable::maxIndex);
- ASSERT(s_gcInfoTable);
+ DCHECK_GE(gcInfoIndex, 1UL);
+ DCHECK_LT(gcInfoIndex, gcInfoMaxIndex);
+ DCHECK(s_gcInfoTable);
const GCInfo* info = s_gcInfoTable[gcInfoIndex];
- ASSERT(info);
+ DCHECK(info);
return info;
}
@@ -526,7 +526,7 @@ class GarbageCollected {
// the delete[] operator in the GarbageCollected subclasses as it
// is called when a class is exported in a DLL.
protected:
- void operator delete[](void* p) { ASSERT_NOT_REACHED(); }
+ void operator delete[](void* p) { NOTREACHED(); }
#else
void operator delete[](void* p);
#endif
@@ -542,7 +542,7 @@ class GarbageCollected {
return ThreadHeap::allocate<T>(size, eagerlySweep);
}
- void operator delete(void* p) { ASSERT_NOT_REACHED(); }
+ void operator delete(void* p) { NOTREACHED(); }
protected:
GarbageCollected() {}
@@ -590,7 +590,7 @@ inline bool ThreadHeap::isNormalArenaIndex(int index) {
#define IS_EAGERLY_FINALIZED() \
(pageFromObject(this)->arena()->arenaIndex() == BlinkGC::EagerSweepArenaIndex)
-#if ENABLE(ASSERT)
+#if DCHECK_IS_ON()
class VerifyEagerFinalization {
DISALLOW_NEW();
@@ -604,7 +604,7 @@ class VerifyEagerFinalization {
// eagerly finalized. Declaring and defining an 'operator new'
// for this class is what's required -- consider using
// DECLARE_EAGER_FINALIZATION_OPERATOR_NEW().
- ASSERT(IS_EAGERLY_FINALIZED());
+ DCHECK(IS_EAGERLY_FINALIZED());
}
};
#define EAGERLY_FINALIZE() \
@@ -624,8 +624,8 @@ inline Address ThreadHeap::allocateOnArenaIndex(ThreadState* state,
int arenaIndex,
size_t gcInfoIndex,
const char* typeName) {
- ASSERT(state->isAllocationAllowed());
- ASSERT(arenaIndex != BlinkGC::LargeObjectArenaIndex);
+ DCHECK(state->isAllocationAllowed());
+ DCHECK_NE(arenaIndex, BlinkGC::LargeObjectArenaIndex);
NormalPageArena* arena =
static_cast<NormalPageArena*>(state->arena(arenaIndex));
Address address =
@@ -658,7 +658,7 @@ Address ThreadHeap::reallocate(void* previous, size_t size) {
ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state();
HeapObjectHeader* previousHeader = HeapObjectHeader::fromPayload(previous);
BasePage* page = pageFromObject(previousHeader);
- ASSERT(page);
+ DCHECK(page);
// Determine arena index of new allocation.
int arenaIndex;
@@ -673,8 +673,8 @@ Address ThreadHeap::reallocate(void* previous, size_t size) {
size_t gcInfoIndex = GCInfoTrait<T>::index();
// TODO(haraken): We don't support reallocate() for finalizable objects.
- ASSERT(!ThreadHeap::gcInfo(previousHeader->gcInfoIndex())->hasFinalizer());
- ASSERT(previousHeader->gcInfoIndex() == gcInfoIndex);
+ DCHECK(!ThreadHeap::gcInfo(previousHeader->gcInfoIndex())->hasFinalizer());
+ DCHECK_EQ(previousHeader->gcInfoIndex(), gcInfoIndex);
HeapAllocHooks::freeHookIfEnabled(static_cast<Address>(previous));
Address address;
if (arenaIndex == BlinkGC::LargeObjectArenaIndex) {

Powered by Google App Engine
This is Rietveld 408576698