Commit 823f2a6e authored by Vasili Skurydzin's avatar Vasili Skurydzin Committed by V8 LUCI CQ

Aix: Avoid using Malloc::GetUsableSize

Change-Id: I99b4c5d9ea6183acf629f5f76ebb0f84c88e7b20
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3855198
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarMilad Farazmand <mfarazma@redhat.com>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82715}
parent 538f7bd7
...@@ -1269,7 +1269,11 @@ Stack::StackSlot Stack::GetCurrentStackPosition() { ...@@ -1269,7 +1269,11 @@ Stack::StackSlot Stack::GetCurrentStackPosition() {
size_t Malloc::GetUsableSize(void* ptr) { size_t Malloc::GetUsableSize(void* ptr) {
#if defined(V8_OS_DARWIN) #if defined(V8_OS_DARWIN)
return malloc_size(ptr); return malloc_size(ptr);
#else // defined(V8_OS_DARWIN) #elif defined(V8_OS_AIX)
// malloc_usable_size is not available, and there is no equivalent
UNIMPLEMENTED();
return 0;
#else
return malloc_usable_size(ptr); return malloc_usable_size(ptr);
#endif // !defined(V8_OS_DARWIN) #endif // !defined(V8_OS_DARWIN)
} }
......
...@@ -683,6 +683,10 @@ class V8_BASE_EXPORT Malloc final { ...@@ -683,6 +683,10 @@ class V8_BASE_EXPORT Malloc final {
V8_NODISCARD static AllocationResult<T*> AllocateAtLeast(std::size_t n) { V8_NODISCARD static AllocationResult<T*> AllocateAtLeast(std::size_t n) {
const size_t min_wanted_size = n * sizeof(T); const size_t min_wanted_size = n * sizeof(T);
auto* memory = static_cast<T*>(malloc(min_wanted_size)); auto* memory = static_cast<T*>(malloc(min_wanted_size));
#if defined(V8_OS_AIX)
// GetUsableSize() is not implemented on Aix
return {memory, min_wanted_size};
#else
const size_t usable_size = v8::base::Malloc::GetUsableSize(memory); const size_t usable_size = v8::base::Malloc::GetUsableSize(memory);
#if V8_USE_UNDEFINED_BEHAVIOR_SANITIZER #if V8_USE_UNDEFINED_BEHAVIOR_SANITIZER
// UBSan (specifically, -fsanitize=bounds) assumes that any access outside // UBSan (specifically, -fsanitize=bounds) assumes that any access outside
...@@ -695,6 +699,7 @@ class V8_BASE_EXPORT Malloc final { ...@@ -695,6 +699,7 @@ class V8_BASE_EXPORT Malloc final {
} }
#endif // V8_USE_UNDEFINED_BEHAVIOR_SANITIZER #endif // V8_USE_UNDEFINED_BEHAVIOR_SANITIZER
return {memory, usable_size}; return {memory, usable_size};
#endif // defined(V8_OS_AIX)
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment