[ios] Enable ability to run V8 in jitless mode on iOS device

Forcibly enable jitless mode since we do not have access to executable
code pages. This will also disables wasm.

Do not enable JSCVT based on the compiler since older iPhones may not
have the JSVCT instruction. This will eventually need to be done
dynamically.

Use the host toolchain when compiling on M1 Macbooks for iOS devices.

Ensure we use 16k alignment for pages.

Bug: chromium:1411704
Change-Id: I0019a2fc7b645b96ae105504d915cd0c3e3eafdf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4206250
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#85569}
This commit is contained in:
Dave Tapuska 2023-01-31 11:05:35 -05:00 committed by V8 LUCI CQ
parent 5d8afae6d4
commit d3f27e067e
5 changed files with 22 additions and 7 deletions

View File

@ -3950,7 +3950,7 @@ v8_header_set("v8_internal_headers") {
if (v8_enable_webassembly) {
# Trap handling is enabled on arm64 Mac and in simulators on x64 on Linux
# and Mac.
if ((current_cpu == "arm64" && is_mac) ||
if ((current_cpu == "arm64" && (is_mac || is_ios)) ||
(current_cpu == "x64" && (is_linux || is_chromeos || is_mac))) {
sources += [ "src/trap-handler/handler-inside-posix.h" ]
}

View File

@ -104,6 +104,10 @@ if (v8_snapshot_toolchain == "") {
# cross compile Windows arm64 with host toolchain.
v8_snapshot_toolchain = host_toolchain
}
} else if (host_cpu == "arm64" && current_cpu == "arm64" &&
host_os == "mac") {
# cross compile iOS arm64 with host_toolchain
v8_snapshot_toolchain = host_toolchain
}
}

View File

@ -70,9 +70,10 @@ constexpr int kPageSizeBits = 18;
// The minimal supported page size by the operation system. Any region aligned
// to that size needs to be individually protectable via
// {base::OS::SetPermission} and friends.
#if (defined(V8_OS_MACOS) && defined(V8_HOST_ARCH_ARM64)) || \
defined(V8_HOST_ARCH_LOONG64) || defined(V8_HOST_ARCH_MIPS64)
// MacOS on arm64 uses 16kB pages.
#if (defined(V8_OS_MACOS) && defined(V8_HOST_ARCH_ARM64)) || \
defined(V8_HOST_ARCH_LOONG64) || defined(V8_HOST_ARCH_MIPS64) || \
defined(V8_OS_IOS)
// MacOS & iOS on arm64 uses 16kB pages.
// LOONG64 and MIPS64 also use 16kB pages.
constexpr int kMinimumOSPageSize = 16 * 1024;
#elif defined(V8_OS_LINUX) && !defined(V8_OS_ANDROID) && \

View File

@ -64,7 +64,7 @@ unsigned SimulatorFeaturesFromCommandLine() {
constexpr unsigned CpuFeaturesFromCompiler() {
unsigned features = 0;
#if defined(__ARM_FEATURE_JCVT)
#if defined(__ARM_FEATURE_JCVT) && !defined(V8_TARGET_OS_IOS)
features |= 1u << JSCVT;
#endif
#if defined(__ARM_FEATURE_DOTPROD)

View File

@ -521,9 +521,19 @@ DEFINE_STRING(
"Select which native code sequence to use for wasm trace instruction: "
"default or cpuid")
// iOS does not support executable code pages for 3rd party applications so
// we need to forcibly disable the JIT.
#if defined(V8_TARGET_OS_IOS)
#define V8_JITLESS_BOOL true
#define DEFINE_JITLESS_BOOL DEFINE_BOOL_READONLY
#else
#define V8_JITLESS_BOOL V8_LITE_BOOL
#define DEFINE_JITLESS_BOOL DEFINE_BOOL
#endif
// Flags for jitless
DEFINE_BOOL(jitless, V8_LITE_BOOL,
"Disable runtime allocation of executable memory.")
DEFINE_JITLESS_BOOL(jitless, V8_JITLESS_BOOL,
"Disable runtime allocation of executable memory.")
DEFINE_WEAK_IMPLICATION(jitless, lower_tier_as_toptier)