diff --git a/BUILD.gn b/BUILD.gn index 480d68d646..9a9c02f524 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -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" ] } diff --git a/gni/snapshot_toolchain.gni b/gni/snapshot_toolchain.gni index 99de816372..c7faa8ca58 100644 --- a/gni/snapshot_toolchain.gni +++ b/gni/snapshot_toolchain.gni @@ -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 } } diff --git a/src/base/build_config.h b/src/base/build_config.h index ff4a936709..e3152f9718 100644 --- a/src/base/build_config.h +++ b/src/base/build_config.h @@ -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) && \ diff --git a/src/codegen/arm64/assembler-arm64.cc b/src/codegen/arm64/assembler-arm64.cc index 65ba1bdad6..59c22907de 100644 --- a/src/codegen/arm64/assembler-arm64.cc +++ b/src/codegen/arm64/assembler-arm64.cc @@ -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) diff --git a/src/flags/flag-definitions.h b/src/flags/flag-definitions.h index af293f0533..ad305f1891 100644 --- a/src/flags/flag-definitions.h +++ b/src/flags/flag-definitions.h @@ -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)