summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Heap/Heap.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-04-18 18:12:33 +0200
committerLinus Groh <mail@linusgroh.de>2021-04-18 18:14:44 +0200
commit87a43fa87c4bf787e92973edc6f5503d7dcce798 (patch)
tree7ff0594df6bff9478c49ede514e1f978a1b610e1 /Userland/Libraries/LibJS/Heap/Heap.cpp
parent51676d7c336a3a76bc92a50ad9c8cebac6b3eb06 (diff)
downloadserenity-87a43fa87c4bf787e92973edc6f5503d7dcce798.zip
LibJS: Use 'if constexpr' instead of '#if HEAP_DEBUG'
Diffstat (limited to 'Userland/Libraries/LibJS/Heap/Heap.cpp')
-rw-r--r--Userland/Libraries/LibJS/Heap/Heap.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/Userland/Libraries/LibJS/Heap/Heap.cpp b/Userland/Libraries/LibJS/Heap/Heap.cpp
index d0351af1be..b27586f112 100644
--- a/Userland/Libraries/LibJS/Heap/Heap.cpp
+++ b/Userland/Libraries/LibJS/Heap/Heap.cpp
@@ -116,11 +116,11 @@ void Heap::gather_roots(HashTable<Cell*>& roots)
}
}
-#if HEAP_DEBUG
- dbgln("gather_roots:");
- for (auto* root : roots)
- dbgln(" + {}", root);
-#endif
+ if constexpr (HEAP_DEBUG) {
+ dbgln("gather_roots:");
+ for (auto* root : roots)
+ dbgln(" + {}", root);
+ }
}
__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);
}
-#if HEAP_DEBUG
- for_each_block([&](auto& block) {
- dbgln(" > Live HeapBlock @ {}: cell_size={}", &block, block.cell_size());
- return IterationDecision::Continue;
- });
-#endif
+ if constexpr (HEAP_DEBUG) {
+ for_each_block([&](auto& block) {
+ dbgln(" > Live HeapBlock @ {}: cell_size={}", &block, block.cell_size());
+ return IterationDecision::Continue;
+ });
+ }
int time_spent = measurement_timer.elapsed();