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

Unified Diff: third_party/WebKit/Source/platform/heap/HeapAllocator.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/HeapAllocator.h
diff --git a/third_party/WebKit/Source/platform/heap/HeapAllocator.h b/third_party/WebKit/Source/platform/heap/HeapAllocator.h
index 649135bacc6c6e042a8983e22a0beed97afbb71b..0cde4d4f4712b52fd8c4f7f4cf95c72fc694407a 100644
--- a/third_party/WebKit/Source/platform/heap/HeapAllocator.h
+++ b/third_party/WebKit/Source/platform/heap/HeapAllocator.h
@@ -53,14 +53,14 @@ class PLATFORM_EXPORT HeapAllocator {
template <typename T>
static size_t quantizedSize(size_t count) {
- RELEASE_ASSERT(count <= maxHeapObjectSize / sizeof(T));
+ CHECK(count <= maxHeapObjectSize / sizeof(T));
return ThreadHeap::allocationSizeFromSize(count * sizeof(T)) -
sizeof(HeapObjectHeader);
}
template <typename T>
static T* allocateVectorBacking(size_t size) {
ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state();
- ASSERT(state->isAllocationAllowed());
+ DCHECK(state->isAllocationAllowed());
size_t gcInfoIndex = GCInfoTrait<HeapVectorBacking<T>>::index();
NormalPageArena* arena =
static_cast<NormalPageArena*>(state->vectorBackingArena(gcInfoIndex));
@@ -70,7 +70,7 @@ class PLATFORM_EXPORT HeapAllocator {
template <typename T>
static T* allocateExpandedVectorBacking(size_t size) {
ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state();
- ASSERT(state->isAllocationAllowed());
+ DCHECK(state->isAllocationAllowed());
size_t gcInfoIndex = GCInfoTrait<HeapVectorBacking<T>>::index();
NormalPageArena* arena = static_cast<NormalPageArena*>(
state->expandedVectorBackingArena(gcInfoIndex));
@@ -130,11 +130,11 @@ class PLATFORM_EXPORT HeapAllocator {
template <typename T>
static void* newArray(size_t bytes) {
- ASSERT_NOT_REACHED();
+ NOTREACHED();
return 0;
}
- static void deleteArray(void* ptr) { ASSERT_NOT_REACHED(); }
+ static void deleteArray(void* ptr) { NOTREACHED(); }
static bool isAllocationAllowed() {
return ThreadState::current()->isAllocationAllowed();
@@ -180,7 +180,7 @@ class PLATFORM_EXPORT HeapAllocator {
iterationDoneCallback);
}
-#if ENABLE(ASSERT)
+#if DCHECK_IS_ON()
template <typename VisitorDispatcher>
static bool weakTableRegistered(VisitorDispatcher visitor,
const void* closure) {
@@ -307,9 +307,9 @@ void HeapVectorBacking<T, Traits>::finalize(void* pointer) {
"HeapVectorBacking doesn't support objects that cannot be cleared as "
"unused with memset or don't have a vtable");
- ASSERT(!WTF::IsTriviallyDestructible<T>::value);
+ DCHECK(!WTF::IsTriviallyDestructible<T>::value);
HeapObjectHeader* header = HeapObjectHeader::fromPayload(pointer);
- ASSERT(header->checkHeader());
+ DCHECK(header->checkHeader());
// Use the payload size as recorded by the heap to determine how many
// elements to finalize.
size_t length = header->payloadSize() / sizeof(T);
@@ -336,9 +336,9 @@ void HeapVectorBacking<T, Traits>::finalize(void* pointer) {
template <typename Table>
void HeapHashTableBacking<Table>::finalize(void* pointer) {
using Value = typename Table::ValueType;
- ASSERT(!WTF::IsTriviallyDestructible<Value>::value);
+ DCHECK(!WTF::IsTriviallyDestructible<Value>::value);
HeapObjectHeader* header = HeapObjectHeader::fromPayload(pointer);
- ASSERT(header->checkHeader());
+ DCHECK(header->checkHeader());
// Use the payload size as recorded by the heap to determine how many
// elements to finalize.
size_t length = header->payloadSize() / sizeof(Value);

Powered by Google App Engine
This is Rietveld 408576698