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

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

Issue 2816033003: Replace ASSERT with DHCECK_op in platform/heap (Closed)
Patch Set: Replace ASSERT with CHECK_op in platform/heap Created 3 years, 8 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/HeapPage.h
diff --git a/third_party/WebKit/Source/platform/heap/HeapPage.h b/third_party/WebKit/Source/platform/heap/HeapPage.h
index 5ee17b839ad67eb7c64c4537072a01f0c2a08273..43019c6299e57537d1a05d14f7644581254f666b 100644
--- a/third_party/WebKit/Source/platform/heap/HeapPage.h
+++ b/third_party/WebKit/Source/platform/heap/HeapPage.h
@@ -187,9 +187,9 @@ class PLATFORM_EXPORT HeapObjectHeader {
magic_ = GetMagic();
#endif
- ASSERT(gc_info_index < GCInfoTable::kMaxIndex);
- ASSERT(size < kNonLargeObjectPageSizeMax);
- ASSERT(!(size & kAllocationMask));
+ DCHECK(gc_info_index < GCInfoTable::kMaxIndex);
Hwanseung Lee 2017/04/20 00:30:43 when replaced to DCHECK_LT, it was cause of build
+ DCHECK_LT(size, kNonLargeObjectPageSizeMax);
+ DCHECK(!(size & kAllocationMask));
encoded_ = static_cast<uint32_t>(
(gc_info_index << kHeaderGCInfoIndexShift) | size |
(gc_info_index == kGcInfoIndexForFreeListHeader ? kHeaderFreedBitMask
@@ -216,7 +216,7 @@ class PLATFORM_EXPORT HeapObjectHeader {
}
NO_SANITIZE_ADDRESS void SetSize(size_t size) {
- ASSERT(size < kNonLargeObjectPageSizeMax);
+ DCHECK_LT(size, kNonLargeObjectPageSizeMax);
CheckHeader();
encoded_ = static_cast<uint32_t>(size) | (encoded_ & ~kHeaderSizeMask);
}
@@ -275,7 +275,7 @@ class FreeListEntry final : public HeapObjectHeader {
explicit FreeListEntry(size_t size)
: HeapObjectHeader(size, kGcInfoIndexForFreeListHeader), next_(nullptr) {
#if DCHECK_IS_ON() && CPU(64BIT)
- ASSERT(size >= sizeof(HeapObjectHeader));
+ DCHECK_GE(size, sizeof(HeapObjectHeader));
ZapMagic();
#endif
}
@@ -299,7 +299,7 @@ class FreeListEntry final : public HeapObjectHeader {
NO_SANITIZE_ADDRESS
void Append(FreeListEntry* next) {
- ASSERT(!next_);
+ DCHECK(!next_);
next_ = next;
}
@@ -434,12 +434,12 @@ class BasePage {
bool HasBeenSwept() const { return swept_; }
void MarkAsSwept() {
- ASSERT(!swept_);
+ DCHECK(!swept_);
swept_ = true;
}
void MarkAsUnswept() {
- ASSERT(swept_);
+ DCHECK(swept_);
swept_ = false;
}
@@ -753,8 +753,10 @@ class PLATFORM_EXPORT NormalPageArena final : public BaseArena {
public:
NormalPageArena(ThreadState*, int);
void AddToFreeList(Address address, size_t size) {
- ASSERT(FindPageFromAddress(address));
- ASSERT(FindPageFromAddress(address + size - 1));
+#if DCHECK_IS_ON()
+ DCHECK(FindPageFromAddress(address));
+ DCHECK(FindPageFromAddress(address + size - 1));
+#endif
free_list_.AddToFreeList(address, size);
}
void ClearFreeLists() override;
@@ -837,7 +839,9 @@ PLATFORM_EXPORT inline BasePage* PageFromObject(const void* object) {
Address address = reinterpret_cast<Address>(const_cast<void*>(object));
BasePage* page = reinterpret_cast<BasePage*>(BlinkPageAddress(address) +
kBlinkGuardPageSize);
- ASSERT(page->Contains(address));
+#if DCHECK_IS_ON()
+ DCHECK(page->Contains(address));
+#endif
return page;
}
@@ -845,8 +849,8 @@ NO_SANITIZE_ADDRESS inline size_t HeapObjectHeader::size() const {
size_t result = encoded_ & kHeaderSizeMask;
// Large objects should not refer to header->size(). The actual size of a
// large object is stored in |LargeObjectPage::m_payloadSize|.
- ASSERT(result != kLargeObjectSizeInHeader);
- ASSERT(!PageFromObject(this)->IsLargeObjectPage());
+ DCHECK(result != kLargeObjectSizeInHeader);
+ DCHECK(!PageFromObject(this)->IsLargeObjectPage());
return result;
}
@@ -869,10 +873,10 @@ NO_SANITIZE_ADDRESS inline size_t HeapObjectHeader::PayloadSize() {
CheckHeader();
size_t size = encoded_ & kHeaderSizeMask;
if (UNLIKELY(size == kLargeObjectSizeInHeader)) {
- ASSERT(PageFromObject(this)->IsLargeObjectPage());
+ DCHECK(PageFromObject(this)->IsLargeObjectPage());
return static_cast<LargeObjectPage*>(PageFromObject(this))->PayloadSize();
}
- ASSERT(!PageFromObject(this)->IsLargeObjectPage());
+ DCHECK(!PageFromObject(this)->IsLargeObjectPage());
return size - sizeof(HeapObjectHeader);
}
@@ -950,13 +954,13 @@ NO_SANITIZE_ADDRESS inline bool HeapObjectHeader::IsWrapperHeaderMarked()
NO_SANITIZE_ADDRESS inline void HeapObjectHeader::MarkWrapperHeader() {
CheckHeader();
- ASSERT(!IsWrapperHeaderMarked());
+ DCHECK(!IsWrapperHeaderMarked());
encoded_ |= kHeaderWrapperMarkBitMask;
}
NO_SANITIZE_ADDRESS inline void HeapObjectHeader::UnmarkWrapperHeader() {
CheckHeader();
- ASSERT(IsWrapperHeaderMarked());
+ DCHECK(IsWrapperHeaderMarked());
encoded_ &= ~kHeaderWrapperMarkBitMask;
}
@@ -967,13 +971,13 @@ NO_SANITIZE_ADDRESS inline bool HeapObjectHeader::IsMarked() const {
NO_SANITIZE_ADDRESS inline void HeapObjectHeader::Mark() {
CheckHeader();
- ASSERT(!IsMarked());
+ DCHECK(!IsMarked());
encoded_ = encoded_ | kHeaderMarkBitMask;
}
NO_SANITIZE_ADDRESS inline void HeapObjectHeader::Unmark() {
CheckHeader();
- ASSERT(IsMarked());
+ DCHECK(IsMarked());
encoded_ &= ~kHeaderMarkBitMask;
}
@@ -983,14 +987,16 @@ inline Address NormalPageArena::AllocateObject(size_t allocation_size,
Address header_address = current_allocation_point_;
current_allocation_point_ += allocation_size;
remaining_allocation_size_ -= allocation_size;
- ASSERT(gc_info_index > 0);
+ DCHECK_GT(gc_info_index, 0u);
new (NotNull, header_address)
HeapObjectHeader(allocation_size, gc_info_index);
Address result = header_address + sizeof(HeapObjectHeader);
- ASSERT(!(reinterpret_cast<uintptr_t>(result) & kAllocationMask));
+ DCHECK(!(reinterpret_cast<uintptr_t>(result) & kAllocationMask));
SET_MEMORY_ACCESSIBLE(result, allocation_size - sizeof(HeapObjectHeader));
- ASSERT(FindPageFromAddress(header_address + allocation_size - 1));
+#if DCHECK_IS_ON()
+ DCHECK(FindPageFromAddress(header_address + allocation_size - 1));
+#endif
return result;
}
return OutOfLineAllocate(allocation_size, gc_info_index);

Powered by Google App Engine
This is Rietveld 408576698