1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:17:35 +00:00

LibJS: Use 'if constexpr' instead of '#if HEAP_DEBUG'

This commit is contained in:
Linus Groh 2021-04-18 18:12:33 +02:00
parent 51676d7c33
commit 87a43fa87c

View file

@ -116,11 +116,11 @@ void Heap::gather_roots(HashTable<Cell*>& roots)
} }
} }
#if HEAP_DEBUG if constexpr (HEAP_DEBUG) {
dbgln("gather_roots:"); dbgln("gather_roots:");
for (auto* root : roots) for (auto* root : roots)
dbgln(" + {}", root); dbgln(" + {}", root);
#endif }
} }
__attribute__((no_sanitize("address"))) void Heap::gather_conservative_roots(HashTable<Cell*>& roots) __attribute__((no_sanitize("address"))) void Heap::gather_conservative_roots(HashTable<Cell*>& roots)
@ -239,12 +239,12 @@ void Heap::sweep_dead_cells(bool print_report, const Core::ElapsedTimer& measure
allocator_for_size(block->cell_size()).block_did_become_usable({}, *block); allocator_for_size(block->cell_size()).block_did_become_usable({}, *block);
} }
#if HEAP_DEBUG if constexpr (HEAP_DEBUG) {
for_each_block([&](auto& block) { for_each_block([&](auto& block) {
dbgln(" > Live HeapBlock @ {}: cell_size={}", &block, block.cell_size()); dbgln(" > Live HeapBlock @ {}: cell_size={}", &block, block.cell_size());
return IterationDecision::Continue; return IterationDecision::Continue;
}); });
#endif }
int time_spent = measurement_timer.elapsed(); int time_spent = measurement_timer.elapsed();