Commit 1fac1301 authored by Dominic Cooney's avatar Dominic Cooney Committed by V8 LUCI CQ

iOS: Use sysctlbyname to check if jscvt is supported

Bug: v8:13004
Change-Id: I6b29094a7fcea75d46328e686961e7a1f25343fd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3746216Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Dominic Cooney <dpc@fb.com>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81567}
parent 1545a716
......@@ -35,6 +35,9 @@
#define POWER_10 0x40000
#endif
#endif
#if V8_OS_DARWIN
#include <sys/sysctl.h> // sysctlbyname
#endif
#if V8_OS_POSIX
#include <unistd.h> // sysconf()
#endif
......@@ -785,10 +788,20 @@ CPU::CPU()
has_jscvt_ = HasListItem(features, "jscvt");
delete[] features;
}
#elif V8_OS_DARWIN && !V8_OS_IOS
#elif V8_OS_DARWIN
#if V8_OS_IOS
int64_t feat_jscvt = 0;
size_t feat_jscvt_size = sizeof(feat_jscvt);
if (sysctlbyname("hw.optional.arm.FEAT_JSCVT", &feat_jscvt, &feat_jscvt_size,
nullptr, 0) == -1) {
has_jscvt_ = false;
} else {
has_jscvt_ = feat_jscvt;
}
#else
// ARM64 Macs always have JSCVT.
// TODO(v8:13004): Detect if an iPhone is new enough to support jscvt.
has_jscvt_ = true;
#endif // V8_OS_IOS
#endif // V8_OS_WIN
#elif V8_HOST_ARCH_PPC || V8_HOST_ARCH_PPC64
......
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