Only define DebugMemset if expensive dchecks are on
All calls to this function already have this ifdef, so no change in
functionality.
Change-Id: I2d99046db1e38e7b766235018f82a0869783d1c1
Bug: v8:13355
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3934728
Commit-Queue: Stephen Röttger <sroettger@google.com>
Reviewed-by: Bartek Nowierski <bartekn@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1055319}
diff --git a/base/allocator/partition_allocator/partition_alloc-inl.h b/base/allocator/partition_allocator/partition_alloc-inl.h
index f4b1d05..0eaea34 100644
--- a/base/allocator/partition_allocator/partition_alloc-inl.h
+++ b/base/allocator/partition_allocator/partition_alloc-inl.h
@@ -49,6 +49,7 @@
#pragma optimize("", on)
#endif
+#if BUILDFLAG(PA_EXPENSIVE_DCHECKS_ARE_ON)
// Used to memset() memory for debugging purposes only.
PA_ALWAYS_INLINE void DebugMemset(void* ptr, int value, size_t size) {
// Only set the first 512kiB of the allocation. This is enough to detect uses
@@ -58,6 +59,7 @@
size_t size_to_memset = std::min(size, size_t{1} << 19);
memset(ptr, value, size_to_memset);
}
+#endif // BUILDFLAG(PA_EXPENSIVE_DCHECKS_ARE_ON)
// Returns true if we've hit the end of a random-length period. We don't want to
// invoke `RandomValue` too often, because we call this function in a hot spot