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

Unified Diff: Source/platform/heap/Heap.h

Issue 397733004: Allow assertions to be enabled in Blink Release builds. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed config.gni. Minor cleanups. Created 6 years, 5 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: Source/platform/heap/Heap.h
diff --git a/Source/platform/heap/Heap.h b/Source/platform/heap/Heap.h
index 81bf4ad0cf68eb27e6c72f982c2e110a0707790b..b6915ebdc82c885363b716f94bb497f22ea233db 100644
--- a/Source/platform/heap/Heap.h
+++ b/Source/platform/heap/Heap.h
@@ -116,7 +116,7 @@ inline Address blinkPageAddress(Address address)
return reinterpret_cast<Address>(reinterpret_cast<uintptr_t>(address) & blinkPageBaseMask);
}
-#ifndef NDEBUG
+#if ENABLE(ASSERT)
// Sanity check for a page header address: the address of the page
// header should be OS page size away from being Blink page size
@@ -304,7 +304,7 @@ public:
NO_SANITIZE_ADDRESS
explicit HeapObjectHeader(size_t encodedSize)
: BasicObjectHeader(encodedSize)
-#ifndef NDEBUG
+#if ENABLE(ASSERT)
, m_magic(magic)
#endif
{ }
@@ -312,7 +312,7 @@ public:
NO_SANITIZE_ADDRESS
HeapObjectHeader(size_t encodedSize, const GCInfo*)
: BasicObjectHeader(encodedSize)
-#ifndef NDEBUG
+#if ENABLE(ASSERT)
, m_magic(magic)
#endif
{ }
@@ -348,7 +348,7 @@ public:
static const intptr_t zappedVTable = 0xd0d;
private:
-#ifndef NDEBUG
+#if ENABLE(ASSERT)
intptr_t m_magic;
#endif
};
@@ -398,7 +398,7 @@ public:
: HeapObjectHeader(freeListEncodedSize(size))
, m_next(0)
{
-#if !defined(NDEBUG) && !defined(ADDRESS_SANITIZER)
+#if ENABLE(ASSERT) && !defined(ADDRESS_SANITIZER)
// Zap free area with asterisks, aka 0x2a2a2a2a.
// For ASan don't zap since we keep accounting in the freelist entry.
for (size_t i = sizeof(*this); i < size; i++)
@@ -691,7 +691,7 @@ public:
, m_current(&(m_buffer[0]))
, m_next(*first)
{
-#ifndef NDEBUG
+#if ENABLE(ASSERT)
clearUnused();
#endif
*first = this;
@@ -737,7 +737,7 @@ public:
return (new CallbackStack(first))->allocateEntry(first);
}
-#ifndef NDEBUG
+#if ENABLE(ASSERT)
bool hasCallbackForObject(const void*);
#endif
@@ -777,7 +777,7 @@ public:
virtual void clearFreeLists() = 0;
virtual void clearMarks() = 0;
-#ifndef NDEBUG
+#if ENABLE(ASSERT)
virtual void getScannedStats(HeapStats&) = 0;
#endif
@@ -814,7 +814,7 @@ public:
virtual void assertEmpty();
virtual void clearFreeLists();
virtual void clearMarks();
-#ifndef NDEBUG
+#if ENABLE(ASSERT)
virtual void getScannedStats(HeapStats&);
#endif
@@ -942,7 +942,7 @@ public:
// Register an ephemeron table for fixed-point iteration.
static void registerWeakTable(void* containerObject, EphemeronCallback, EphemeronCallback);
-#ifndef NDEBUG
+#if ENABLE(ASSERT)
static bool weakTableRegistered(const void*);
#endif
@@ -1373,7 +1373,7 @@ Address ThreadHeap<Header>::allocate(size_t size, const GCInfo* gcInfo)
ASSERT(!(reinterpret_cast<uintptr_t>(result) & allocationMask));
// Unpoison the memory used for the object (payload).
ASAN_UNPOISON_MEMORY_REGION(result, payloadSize);
-#if !defined(NDEBUG) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER)
+#if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER)
memset(result, 0, payloadSize);
#endif
ASSERT(heapPageFromAddress(headerAddress + allocationSize - 1));
@@ -1497,7 +1497,7 @@ public:
visitor->registerWeakTable(closure, iterationCallback, iterationDoneCallback);
}
-#ifndef NDEBUG
+#if ENABLE(ASSERT)
static bool weakTableRegistered(Visitor* visitor, const void* closure)
{
return visitor->weakTableRegistered(closure);
@@ -2270,7 +2270,7 @@ struct TraceTrait<HeapVectorBacking<T, Traits> > {
}
static void checkGCInfo(Visitor* visitor, const Backing* backing)
{
-#ifndef NDEBUG
+#if ENABLE(ASSERT)
visitor->checkGCInfo(const_cast<Backing*>(backing), GCInfoTrait<Backing>::get());
#endif
}
@@ -2300,7 +2300,7 @@ struct TraceTrait<HeapHashTableBacking<Table> > {
}
static void checkGCInfo(Visitor* visitor, const Backing* backing)
{
-#ifndef NDEBUG
+#if ENABLE(ASSERT)
visitor->checkGCInfo(const_cast<Backing*>(backing), GCInfoTrait<Backing>::get());
#endif
}

Powered by Google App Engine
This is Rietveld 408576698