diff --git a/deps/zlib/BUILD.gn b/deps/zlib/BUILD.gn index 9b3971041dffa0..074c2720fa460d 100644 --- a/deps/zlib/BUILD.gn +++ b/deps/zlib/BUILD.gn @@ -124,45 +124,40 @@ source_set("zlib_adler32_simd") { if (use_arm_neon_optimizations) { config("zlib_arm_crc32_config") { - # Disabled for iPhone, as described in DDI0487C_a_armv8_arm: - # "All implementations of the ARMv8.1 architecture are required to - # implement the CRC32* instructions. These are optional in ARMv8.0." - if (!is_ios) { - defines = [ "CRC32_ARMV8_CRC32" ] - if (is_android) { - defines += [ "ARMV8_OS_ANDROID" ] - } else if (is_linux || is_chromeos) { - defines += [ "ARMV8_OS_LINUX" ] - } else if (is_mac) { - defines += [ "ARMV8_OS_MACOS" ] - } else if (is_fuchsia) { - defines += [ "ARMV8_OS_FUCHSIA" ] - } else if (is_win) { - defines += [ "ARMV8_OS_WINDOWS" ] - } else { - assert(false, "Unsupported ARM OS") - } + defines = [ "CRC32_ARMV8_CRC32" ] + if (is_android) { + defines += [ "ARMV8_OS_ANDROID" ] + } else if (is_linux || is_chromeos) { + defines += [ "ARMV8_OS_LINUX" ] + } else if (is_mac) { + defines += [ "ARMV8_OS_MACOS" ] + } else if (is_ios) { + defines += [ "ARMV8_OS_IOS" ] + } else if (is_fuchsia) { + defines += [ "ARMV8_OS_FUCHSIA" ] + } else if (is_win) { + defines += [ "ARMV8_OS_WINDOWS" ] + } else { + assert(false, "Unsupported ARM OS") } } source_set("zlib_arm_crc32") { visibility = [ ":*" ] - if (!is_ios) { - include_dirs = [ "." ] - - if (!is_win && !is_clang) { - assert(!use_thin_lto, - "ThinLTO fails mixing different module-level targets") - cflags_c = [ "-march=armv8-a+aes+crc" ] - } + include_dirs = [ "." ] - sources = [ - "crc32_simd.c", - "crc32_simd.h", - ] + if (!is_win && !is_clang) { + assert(!use_thin_lto, + "ThinLTO fails mixing different module-level targets") + cflags_c = [ "-march=armv8-a+aes+crc" ] } + sources = [ + "crc32_simd.c", + "crc32_simd.h", + ] + configs += [ ":zlib_internal_config" ] public_configs = [ ":zlib_arm_crc32_config" ] @@ -332,14 +327,6 @@ component("zlib") { defines += [ "CPU_NO_SIMD" ] } - if (is_ios) { - # iOS@ARM is a special case where we always have NEON but don't check - # for crypto extensions. - # TODO(cavalcantii): verify what is the current state of CPU features - # shipped on latest iOS devices. - defines += [ "ARM_OS_IOS" ] - } - if (use_x86_x64_optimizations || use_arm_neon_optimizations) { deps += [ ":zlib_adler32_simd", diff --git a/deps/zlib/README.chromium b/deps/zlib/README.chromium index 190430f5325ce6..663ee0521ed30c 100644 --- a/deps/zlib/README.chromium +++ b/deps/zlib/README.chromium @@ -4,6 +4,7 @@ URL: http://zlib.net/ Version: 1.2.13 CPEPrefix: cpe:/a:zlib:zlib:1.2.13 Security Critical: yes +Shipped: yes License: Custom license License File: LICENSE License Android Compatible: yes diff --git a/deps/zlib/contrib/bench/zlib_bench.cc b/deps/zlib/contrib/bench/zlib_bench.cc index 8580319edf25bc..b65f9291bff500 100644 --- a/deps/zlib/contrib/bench/zlib_bench.cc +++ b/deps/zlib/contrib/bench/zlib_bench.cc @@ -236,7 +236,11 @@ void check_file(const Data& file, zlib_wrapper type, int mode) { error_exit("check file: error writing output", 3); } -void zlib_file(const char* name, zlib_wrapper type, int width, int check) { +void zlib_file(const char* name, + zlib_wrapper type, + int width, + int check, + bool output_csv_format) { /* * Read the file data. */ @@ -257,7 +261,9 @@ void zlib_file(const char* name, zlib_wrapper type, int width, int check) { * Report compression strategy and file name. */ const char* strategy = zlib_level_strategy_name(zlib_compression_level); - printf("%s%-40s :\n", strategy, name); + if (!output_csv_format) { + printf("%s%-40s :\n", strategy, name); + } /* * Chop the data into blocks. @@ -329,19 +335,28 @@ void zlib_file(const char* name, zlib_wrapper type, int width, int check) { std::sort(ctime, ctime + runs); std::sort(utime, utime + runs); - double deflate_rate_med = length * repeats / mega_byte / ctime[runs / 2]; - double inflate_rate_med = length * repeats / mega_byte / utime[runs / 2]; - double deflate_rate_max = length * repeats / mega_byte / ctime[0]; - double inflate_rate_max = length * repeats / mega_byte / utime[0]; - - // type, block size, compression ratio, etc - printf("%s: [b %dM] bytes %*d -> %*u %4.2f%%", - zlib_wrapper_name(type), block_size / (1 << 20), width, length, width, - unsigned(output_length), output_length * 100.0 / length); - - // compress / uncompress median (max) rates - printf(" comp %5.1f (%5.1f) MB/s uncomp %5.1f (%5.1f) MB/s\n", - deflate_rate_med, deflate_rate_max, inflate_rate_med, inflate_rate_max); + double deflate_rate_med, inflate_rate_med, deflate_rate_max, inflate_rate_max; + deflate_rate_med = length * repeats / mega_byte / ctime[runs / 2]; + inflate_rate_med = length * repeats / mega_byte / utime[runs / 2]; + deflate_rate_max = length * repeats / mega_byte / ctime[0]; + inflate_rate_max = length * repeats / mega_byte / utime[0]; + double compress_ratio = output_length * 100.0 / length; + + if (!output_csv_format) { + // type, block size, compression ratio, etc + printf("%s: [b %dM] bytes %*d -> %*u %4.2f%%", zlib_wrapper_name(type), + block_size / (1 << 20), width, length, width, + unsigned(output_length), compress_ratio); + + // compress / uncompress median (max) rates + printf(" comp %5.1f (%5.1f) MB/s uncomp %5.1f (%5.1f) MB/s\n", + deflate_rate_med, deflate_rate_max, inflate_rate_med, + inflate_rate_max); + } else { + printf("%s\t%.5lf\t%.5lf\t%.5lf\t%.5lf\t%.5lf\n", name, deflate_rate_med, + inflate_rate_med, deflate_rate_max, inflate_rate_max, + compress_ratio); + } } static int argn = 1; @@ -363,8 +378,10 @@ void get_field_width(int argc, char* argv[], int& value) { } void usage_exit(const char* program) { - static auto* options = "gzip|zlib|raw" - " [--compression 0:9] [--huffman|--rle] [--field width] [--check]"; + static auto* options = + "gzip|zlib|raw" + " [--compression 0:9] [--huffman|--rle] [--field width] [--check]" + " [--csv]"; printf("usage: %s %s files ...\n", program, options); printf("zlib version: %s\n", ZLIB_VERSION); exit(1); @@ -383,7 +400,7 @@ int main(int argc, char* argv[]) { int size_field_width = 0; int file_check = 0; - + bool output_csv = false; while (argn < argc && argv[argn][0] == '-') { if (get_option(argc, argv, "--compression")) { if (!get_compression(argc, argv, zlib_compression_level)) @@ -398,6 +415,11 @@ int main(int argc, char* argv[]) { file_check = 2; } else if (get_option(argc, argv, "--field")) { get_field_width(argc, argv, size_field_width); + } else if (get_option(argc, argv, "--csv")) { + output_csv = true; + printf( + "filename\tcompression\tdecompression\tcomp_max\t" + "decomp_max\tcompress_ratio\n"); } else { usage_exit(argv[0]); } @@ -408,8 +430,9 @@ int main(int argc, char* argv[]) { if (size_field_width < 6) size_field_width = 6; - while (argn < argc) - zlib_file(argv[argn++], type, size_field_width, file_check); + while (argn < argc) { + zlib_file(argv[argn++], type, size_field_width, file_check, output_csv); + } return 0; } diff --git a/deps/zlib/contrib/minizip/README.chromium b/deps/zlib/contrib/minizip/README.chromium index 1ad489a6780db2..5eac425720797f 100644 --- a/deps/zlib/contrib/minizip/README.chromium +++ b/deps/zlib/contrib/minizip/README.chromium @@ -4,6 +4,7 @@ URL: https://github.com/madler/zlib/tree/master/contrib/minizip Version: 1.2.12 License: Zlib Security Critical: yes +Shipped: yes Description: Minizip provides API on top of zlib that can enumerate and extract ZIP archive diff --git a/deps/zlib/cpu_features.c b/deps/zlib/cpu_features.c index ac6ee88e460e2e..64e0428cd2fc2d 100644 --- a/deps/zlib/cpu_features.c +++ b/deps/zlib/cpu_features.c @@ -35,7 +35,7 @@ int ZLIB_INTERNAL x86_cpu_enable_avx512 = 0; #ifndef CPU_NO_SIMD -#if defined(ARMV8_OS_ANDROID) || defined(ARMV8_OS_LINUX) || defined(ARMV8_OS_FUCHSIA) +#if defined(ARMV8_OS_ANDROID) || defined(ARMV8_OS_LINUX) || defined(ARMV8_OS_FUCHSIA) || defined(ARMV8_OS_IOS) #include #endif @@ -50,17 +50,19 @@ int ZLIB_INTERNAL x86_cpu_enable_avx512 = 0; #include #elif defined(ARMV8_OS_WINDOWS) || defined(X86_WINDOWS) #include +#elif defined(ARMV8_OS_IOS) +#include #elif !defined(_MSC_VER) #include #else #error cpu_features.c CPU feature detection in not defined for your platform #endif -#if !defined(CPU_NO_SIMD) && !defined(ARMV8_OS_MACOS) && !defined(ARM_OS_IOS) +#if !defined(CPU_NO_SIMD) && !defined(ARMV8_OS_MACOS) static void _cpu_check_features(void); #endif -#if defined(ARMV8_OS_ANDROID) || defined(ARMV8_OS_LINUX) || defined(ARMV8_OS_MACOS) || defined(ARMV8_OS_FUCHSIA) || defined(X86_NOT_WINDOWS) +#if defined(ARMV8_OS_ANDROID) || defined(ARMV8_OS_LINUX) || defined(ARMV8_OS_MACOS) || defined(ARMV8_OS_FUCHSIA) || defined(X86_NOT_WINDOWS) || defined(ARMV8_OS_IOS) #if !defined(ARMV8_OS_MACOS) // _cpu_check_features() doesn't need to do anything on mac/arm since all // features are known at build time, so don't call it. @@ -89,11 +91,7 @@ void ZLIB_INTERNAL cpu_check_features(void) #endif #if (defined(__ARM_NEON__) || defined(__ARM_NEON)) -/* - * iOS@ARM is a special case where we always have NEON but don't check - * for crypto extensions. - */ -#if !defined(ARMV8_OS_MACOS) && !defined(ARM_OS_IOS) +#if !defined(ARMV8_OS_MACOS) /* * See http://bit.ly/2CcoEsr for run-time detection of ARM features and also * crbug.com/931275 for android_getCpuFeatures() use in the Android sandbox. @@ -127,6 +125,18 @@ static void _cpu_check_features(void) #elif defined(ARMV8_OS_WINDOWS) arm_cpu_enable_crc32 = IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE); arm_cpu_enable_pmull = IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE); +#elif defined(ARMV8_OS_IOS) + // Determine what features are supported dynamically. This code is applicable to macOS + // as well if we wish to do that dynamically on that platform in the future. + // See https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics + int val = 0; + size_t len = sizeof(val); + arm_cpu_enable_crc32 = sysctlbyname("hw.optional.armv8_crc32", &val, &len, 0, 0) == 0 + && val != 0; + val = 0; + len = sizeof(val); + arm_cpu_enable_pmull = sysctlbyname("hw.optional.arm.FEAT_PMULL", &val, &len, 0, 0) == 0 + && val != 0; #endif } #endif diff --git a/deps/zlib/google/zip_internal.cc b/deps/zlib/google/zip_internal.cc index c986e763cccda3..9b20b421e24765 100644 --- a/deps/zlib/google/zip_internal.cc +++ b/deps/zlib/google/zip_internal.cc @@ -8,12 +8,12 @@ #include #include -#include +#include "base/containers/fixed_flat_set.h" #include "base/files/file_path.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/notreached.h" +#include "base/strings/string_piece.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" @@ -407,59 +407,59 @@ Compression GetCompressionMethod(const base::FilePath& path) { // Well known filename extensions of files that a likely to be already // compressed. The extensions are in lower case without the leading dot. - static const base::NoDestructor> exts( - std::initializer_list{ - FILE_PATH_LITERAL("3g2"), // - FILE_PATH_LITERAL("3gp"), // - FILE_PATH_LITERAL("7z"), // - FILE_PATH_LITERAL("7zip"), // - FILE_PATH_LITERAL("aac"), // - FILE_PATH_LITERAL("avi"), // - FILE_PATH_LITERAL("bz"), // - FILE_PATH_LITERAL("bz2"), // - FILE_PATH_LITERAL("crx"), // - FILE_PATH_LITERAL("gif"), // - FILE_PATH_LITERAL("gz"), // - FILE_PATH_LITERAL("jar"), // - FILE_PATH_LITERAL("jpeg"), // - FILE_PATH_LITERAL("jpg"), // - FILE_PATH_LITERAL("lz"), // - FILE_PATH_LITERAL("m2v"), // - FILE_PATH_LITERAL("m4p"), // - FILE_PATH_LITERAL("m4v"), // - FILE_PATH_LITERAL("mng"), // - FILE_PATH_LITERAL("mov"), // - FILE_PATH_LITERAL("mp2"), // - FILE_PATH_LITERAL("mp3"), // - FILE_PATH_LITERAL("mp4"), // - FILE_PATH_LITERAL("mpe"), // - FILE_PATH_LITERAL("mpeg"), // - FILE_PATH_LITERAL("mpg"), // - FILE_PATH_LITERAL("mpv"), // - FILE_PATH_LITERAL("ogg"), // - FILE_PATH_LITERAL("ogv"), // - FILE_PATH_LITERAL("png"), // - FILE_PATH_LITERAL("qt"), // - FILE_PATH_LITERAL("rar"), // - FILE_PATH_LITERAL("taz"), // - FILE_PATH_LITERAL("tb2"), // - FILE_PATH_LITERAL("tbz"), // - FILE_PATH_LITERAL("tbz2"), // - FILE_PATH_LITERAL("tgz"), // - FILE_PATH_LITERAL("tlz"), // - FILE_PATH_LITERAL("tz"), // - FILE_PATH_LITERAL("tz2"), // - FILE_PATH_LITERAL("vob"), // - FILE_PATH_LITERAL("webm"), // - FILE_PATH_LITERAL("wma"), // - FILE_PATH_LITERAL("wmv"), // - FILE_PATH_LITERAL("xz"), // - FILE_PATH_LITERAL("z"), // - FILE_PATH_LITERAL("zip"), // - }); - - if (exts->count(ext_without_dot)) + static constexpr auto kExts = base::MakeFixedFlatSet({ + FILE_PATH_LITERAL("3g2"), // + FILE_PATH_LITERAL("3gp"), // + FILE_PATH_LITERAL("7z"), // + FILE_PATH_LITERAL("7zip"), // + FILE_PATH_LITERAL("aac"), // + FILE_PATH_LITERAL("avi"), // + FILE_PATH_LITERAL("bz"), // + FILE_PATH_LITERAL("bz2"), // + FILE_PATH_LITERAL("crx"), // + FILE_PATH_LITERAL("gif"), // + FILE_PATH_LITERAL("gz"), // + FILE_PATH_LITERAL("jar"), // + FILE_PATH_LITERAL("jpeg"), // + FILE_PATH_LITERAL("jpg"), // + FILE_PATH_LITERAL("lz"), // + FILE_PATH_LITERAL("m2v"), // + FILE_PATH_LITERAL("m4p"), // + FILE_PATH_LITERAL("m4v"), // + FILE_PATH_LITERAL("mng"), // + FILE_PATH_LITERAL("mov"), // + FILE_PATH_LITERAL("mp2"), // + FILE_PATH_LITERAL("mp3"), // + FILE_PATH_LITERAL("mp4"), // + FILE_PATH_LITERAL("mpe"), // + FILE_PATH_LITERAL("mpeg"), // + FILE_PATH_LITERAL("mpg"), // + FILE_PATH_LITERAL("mpv"), // + FILE_PATH_LITERAL("ogg"), // + FILE_PATH_LITERAL("ogv"), // + FILE_PATH_LITERAL("png"), // + FILE_PATH_LITERAL("qt"), // + FILE_PATH_LITERAL("rar"), // + FILE_PATH_LITERAL("taz"), // + FILE_PATH_LITERAL("tb2"), // + FILE_PATH_LITERAL("tbz"), // + FILE_PATH_LITERAL("tbz2"), // + FILE_PATH_LITERAL("tgz"), // + FILE_PATH_LITERAL("tlz"), // + FILE_PATH_LITERAL("tz"), // + FILE_PATH_LITERAL("tz2"), // + FILE_PATH_LITERAL("vob"), // + FILE_PATH_LITERAL("webm"), // + FILE_PATH_LITERAL("wma"), // + FILE_PATH_LITERAL("wmv"), // + FILE_PATH_LITERAL("xz"), // + FILE_PATH_LITERAL("z"), // + FILE_PATH_LITERAL("zip"), // + }); + + if (kExts.count(ext_without_dot)) { return kStored; + } return kDeflated; } diff --git a/doc/contributing/maintaining/maintaining-dependencies.md b/doc/contributing/maintaining/maintaining-dependencies.md index 7f28a17d5ed916..f8b3385c93ad18 100644 --- a/doc/contributing/maintaining/maintaining-dependencies.md +++ b/doc/contributing/maintaining/maintaining-dependencies.md @@ -31,7 +31,7 @@ This a list of all the dependencies: * [undici 5.22.1][] * [uvwasi 0.0.16][] * [V8 11.3.244.8][] -* [zlib 1.2.13.1-motley-f81f385][] +* [zlib 1.2.13.1-motley-61dc0bd][] Any code which meets one or more of these conditions should be managed as a dependency: @@ -311,7 +311,7 @@ See [maintaining-web-assembly][] for more informations. high-performance JavaScript and WebAssembly engine, written in C++. See [maintaining-V8][] for more informations. -### zlib 1.2.13.1-motley-f81f385 +### zlib 1.2.13.1-motley-61dc0bd The [zlib](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/zlib) dependency lossless data-compression library, @@ -349,4 +349,4 @@ performance improvements not currently available in standard zlib. [update-openssl-action]: ../../../.github/workflows/update-openssl.yml [uvwasi 0.0.16]: #uvwasi-0016 [v8 11.3.244.8]: #v8-1132448 -[zlib 1.2.13.1-motley-f81f385]: #zlib-12131-motley-f81f385 +[zlib 1.2.13.1-motley-61dc0bd]: #zlib-12131-motley-61dc0bd