Index: third_party/WebKit/Source/platform/heap/HeapTest.cpp |
diff --git a/third_party/WebKit/Source/platform/heap/HeapTest.cpp b/third_party/WebKit/Source/platform/heap/HeapTest.cpp |
index fc3d4adf304aa95229f460c7d9d406c4717e528a..9d23282097a178dcf2db0e4799be97c6443e8c56 100644 |
--- a/third_party/WebKit/Source/platform/heap/HeapTest.cpp |
+++ b/third_party/WebKit/Source/platform/heap/HeapTest.cpp |
@@ -138,7 +138,7 @@ struct PairWithWeakHandling : public StrongWeakPair { |
// Regular constructor. |
PairWithWeakHandling(IntWrapper* one, IntWrapper* two) |
: StrongWeakPair(one, two) { |
- ASSERT(one); // We use null first field to indicate empty slots in the hash |
+ DCHECK(one); // We use null first field to indicate empty slots in the hash |
// table. |
} |
@@ -281,7 +281,7 @@ class TestGCScope { |
: m_state(ThreadState::current()), |
m_safePointScope(state), |
m_parkedAllThreads(false) { |
- ASSERT(m_state->checkThread()); |
+ DCHECK(m_state->checkThread()); |
if (LIKELY(m_state->heap().park())) { |
m_state->heap().preGC(); |
m_parkedAllThreads = true; |
@@ -328,7 +328,7 @@ class CountingVisitor : public Visitor { |
} |
void markHeader(HeapObjectHeader* header, TraceCallback callback) override { |
- ASSERT(header->payload()); |
+ DCHECK(header->payload()); |
m_count++; |
} |
@@ -337,7 +337,7 @@ class CountingVisitor : public Visitor { |
void registerWeakTable(const void*, |
EphemeronCallback, |
EphemeronCallback) override {} |
-#if ENABLE(ASSERT) |
+#if DCHECK_IS_ON() |
bool weakTableRegistered(const void*) override { return false; } |
#endif |
void registerWeakCellWithCallback(void**, WeakCallback) override {} |
@@ -538,7 +538,7 @@ class ThreadedHeapTester : public ThreadedTesterBase { |
// Verify that the threads cleared their CTPs when |
// terminating, preventing access to a finalized heap. |
for (auto& globalIntWrapper : m_crossPersistents) { |
- ASSERT(globalIntWrapper.get()); |
+ DCHECK(globalIntWrapper.get()); |
EXPECT_FALSE(globalIntWrapper.get()->get()); |
} |
} |
@@ -962,7 +962,7 @@ class RefCountedAndGarbageCollected |
void ref() { |
if (UNLIKELY(!m_refCount)) { |
- ASSERT(ThreadState::current()->findPageFromAddress( |
+ DCHECK(ThreadState::current()->findPageFromAddress( |
reinterpret_cast<Address>(this))); |
m_keepAlive = this; |
} |
@@ -970,7 +970,7 @@ class RefCountedAndGarbageCollected |
} |
void deref() { |
- ASSERT(m_refCount > 0); |
+ DCHECK_GT(m_refCount, 0); |
if (!--m_refCount) |
m_keepAlive.clear(); |
} |
@@ -1000,7 +1000,7 @@ class RefCountedAndGarbageCollected2 |
void ref() { |
if (UNLIKELY(!m_refCount)) { |
- ASSERT(ThreadState::current()->findPageFromAddress( |
+ DCHECK(ThreadState::current()->findPageFromAddress( |
reinterpret_cast<Address>(this))); |
m_keepAlive = this; |
} |
@@ -1008,7 +1008,7 @@ class RefCountedAndGarbageCollected2 |
} |
void deref() { |
- ASSERT(m_refCount > 0); |
+ DCHECK_GT(m_refCount, 0); |
if (!--m_refCount) |
m_keepAlive.clear(); |
} |
@@ -1296,7 +1296,7 @@ class FinalizationObserverWithHashMap { |
result.storedValue->value = |
WTF::makeUnique<FinalizationObserverWithHashMap>(target); |
} else { |
- ASSERT(result.storedValue->value); |
+ DCHECK(result.storedValue->value); |
} |
return map; |
} |
@@ -1832,7 +1832,7 @@ TEST(HeapTest, SimpleFinalization) { |
EXPECT_EQ(1, SimpleFinalizedObject::s_destructorCalls); |
} |
-#if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) |
+#if DCHECK_IS_ON() || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) |
TEST(HeapTest, FreelistReuse) { |
clearOutOldGarbage(); |
@@ -2057,11 +2057,11 @@ TEST(HeapTest, MarkTest) { |
{ |
Bar::s_live = 0; |
Persistent<Bar> bar = Bar::create(); |
- ASSERT(ThreadState::current()->findPageFromAddress(bar)); |
+ DCHECK(ThreadState::current()->findPageFromAddress(bar)); |
EXPECT_EQ(1u, Bar::s_live); |
{ |
Foo* foo = Foo::create(bar); |
- ASSERT(ThreadState::current()->findPageFromAddress(foo)); |
+ DCHECK(ThreadState::current()->findPageFromAddress(foo)); |
EXPECT_EQ(2u, Bar::s_live); |
EXPECT_TRUE(reinterpret_cast<Address>(foo) != |
reinterpret_cast<Address>(bar.get())); |
@@ -2081,14 +2081,14 @@ TEST(HeapTest, DeepTest) { |
Bar::s_live = 0; |
{ |
Bar* bar = Bar::create(); |
- ASSERT(ThreadState::current()->findPageFromAddress(bar)); |
+ DCHECK(ThreadState::current()->findPageFromAddress(bar)); |
Foo* foo = Foo::create(bar); |
- ASSERT(ThreadState::current()->findPageFromAddress(foo)); |
+ DCHECK(ThreadState::current()->findPageFromAddress(foo)); |
EXPECT_EQ(2u, Bar::s_live); |
for (unsigned i = 0; i < depth; i++) { |
Foo* foo2 = Foo::create(foo); |
foo = foo2; |
- ASSERT(ThreadState::current()->findPageFromAddress(foo)); |
+ DCHECK(ThreadState::current()->findPageFromAddress(foo)); |
} |
EXPECT_EQ(depth + 2, Bar::s_live); |
conservativelyCollectGarbage(); |
@@ -2231,8 +2231,8 @@ TEST(HeapTest, LargeHeapObjects) { |
int slack = |
8; // LargeHeapObject points to an IntWrapper that is also allocated. |
Persistent<LargeHeapObject> object = LargeHeapObject::create(); |
- ASSERT(ThreadState::current()->findPageFromAddress(object)); |
- ASSERT(ThreadState::current()->findPageFromAddress( |
+ DCHECK(ThreadState::current()->findPageFromAddress(object)); |
+ DCHECK(ThreadState::current()->findPageFromAddress( |
reinterpret_cast<char*>(object.get()) + sizeof(LargeHeapObject) - 1)); |
clearOutOldGarbage(); |
size_t afterAllocation = heap.heapStats().allocatedSpace(); |
@@ -3619,13 +3619,13 @@ TEST(HeapTest, HeapWeakCollectionTypes) { |
if (!deleteAfterwards) |
count++; |
} else if (collectionNumber == weakSetIndex && firstAlive) { |
- ASSERT_TRUE(weakSet->contains(keepNumbersAlive[i])); |
+ DCHECK(weakSet->contains(keepNumbersAlive[i])); |
if (deleteAfterwards) |
weakSet->remove(keepNumbersAlive[i]); |
else |
count++; |
} else if (collectionNumber == weakOrderedSetIndex && firstAlive) { |
- ASSERT_TRUE(weakOrderedSet->contains(keepNumbersAlive[i])); |
+ DCHECK(weakOrderedSet->contains(keepNumbersAlive[i])); |
if (deleteAfterwards) |
weakOrderedSet->remove(keepNumbersAlive[i]); |
else |
@@ -3700,7 +3700,7 @@ TEST(HeapTest, HeapHashCountedSetToVector) { |
for (const auto& i : vector) |
intVector.append(i->value()); |
std::sort(intVector.begin(), intVector.end()); |
- ASSERT_EQ(3u, intVector.size()); |
+ DCHECK_EQ(3u, intVector.size()); |
EXPECT_EQ(1, intVector[0]); |
EXPECT_EQ(1, intVector[1]); |
EXPECT_EQ(2, intVector[2]); |
@@ -3821,7 +3821,7 @@ TEST(HeapTest, WeakMembers) { |
Persistent<Weak> h4; |
Persistent<WithWeakMember> h5; |
preciselyCollectGarbage(); |
- ASSERT_EQ(1u, Bar::s_live); // h1 is live. |
+ DCHECK_EQ(1u, Bar::s_live); // h1 is live. |
{ |
Bar* h2 = Bar::create(); |
Bar* h3 = Bar::create(); |
@@ -5685,7 +5685,7 @@ static bool allocateAndReturnBool() { |
} |
static bool checkGCForbidden() { |
- ASSERT(ThreadState::current()->isGCForbidden()); |
+ DCHECK(ThreadState::current()->isGCForbidden()); |
return true; |
} |
@@ -6144,7 +6144,7 @@ TEST(HeapTest, TraceDeepEagerly) { |
// The allocation & GC overhead is considerable for this test, |
// straining debug builds and lower-end targets too much to be |
// worth running. |
-#if !ENABLE(ASSERT) && !OS(ANDROID) |
+#if !DCHECK_IS_ON() && !OS(ANDROID) |
DeepEagerly* obj = nullptr; |
for (int i = 0; i < 10000000; i++) |
obj = new DeepEagerly(obj); |
@@ -6354,7 +6354,7 @@ NEVER_INLINE NO_SANITIZE_ADDRESS GrowthDirection stackGrowthDirection() { |
previous = nullptr; |
return result; |
} |
- ASSERT(&dummy != previous); |
+ DCHECK_NE(&dummy, previous); |
return &dummy < previous ? GrowsTowardsLower : GrowsTowardsHigher; |
} |
@@ -6375,7 +6375,7 @@ class TestMixinAllocationA : public GarbageCollected<TestMixinAllocationA>, |
TestMixinAllocationA() { |
// Completely wrong in general, but test only |
// runs this constructor while constructing another mixin. |
- ASSERT(ThreadState::current()->isGCForbidden()); |
+ DCHECK(ThreadState::current()->isGCForbidden()); |
} |
DEFINE_INLINE_VIRTUAL_TRACE() {} |
@@ -6391,7 +6391,7 @@ class TestMixinAllocationB : public TestMixinAllocationA { |
{ |
// Completely wrong in general, but test only |
// runs this constructor while constructing another mixin. |
- ASSERT(ThreadState::current()->isGCForbidden()); |
+ DCHECK(ThreadState::current()->isGCForbidden()); |
} |
DEFINE_INLINE_TRACE() { |
@@ -6407,7 +6407,7 @@ class TestMixinAllocationC final : public TestMixinAllocationB { |
USING_GARBAGE_COLLECTED_MIXIN(TestMixinAllocationC); |
public: |
- TestMixinAllocationC() { ASSERT(!ThreadState::current()->isGCForbidden()); } |
+ TestMixinAllocationC() { DCHECK(!ThreadState::current()->isGCForbidden()); } |
DEFINE_INLINE_TRACE() { TestMixinAllocationB::trace(visitor); } |
}; |
@@ -6426,7 +6426,7 @@ class ObjectWithLargeAmountsOfAllocationInConstructor { |
// and it is a base of GC mixin, GCs will remain locked out |
// regardless, as we cannot safely trace the leftmost GC |
// mixin base. |
- ASSERT(ThreadState::current()->isGCForbidden()); |
+ DCHECK(ThreadState::current()->isGCForbidden()); |
for (size_t i = 0; i < numberOfLargeObjectsToAllocate; i++) { |
LargeHeapObject* largeObject = LargeHeapObject::create(); |
EXPECT_TRUE(largeObject); |
@@ -6456,7 +6456,7 @@ class TestMixinAllocatingObject final |
TestMixinAllocatingObject(ClassWithMember* member) |
: ObjectWithLargeAmountsOfAllocationInConstructor(600, member), |
m_traceCounter(TraceCounter::create()) { |
- ASSERT(!ThreadState::current()->isGCForbidden()); |
+ DCHECK(!ThreadState::current()->isGCForbidden()); |
conservativelyCollectGarbage(); |
EXPECT_GT(member->traceCount(), 0); |
EXPECT_GT(traceCount(), 0); |
@@ -6540,7 +6540,7 @@ TEST(HeapTest, CrossThreadWeakPersistent) { |
parkMainThread(); |
// Step 3: Set up a CrossThreadWeakPersistent. |
- ASSERT_TRUE(object); |
+ DCHECK(object); |
CrossThreadWeakPersistent<DestructorLockingObject> crossThreadWeakPersistent( |
object); |
object = nullptr; |