diff --git a/chromium/third_party/blink/renderer/core/dom/element_rare_data_vector.cc b/chromium/third_party/blink/renderer/core/dom/element_rare_data_vector.cc
index 5680187326b..816600005b8 100644
--- a/chromium/third_party/blink/renderer/core/dom/element_rare_data_vector.cc
+++ b/chromium/third_party/blink/renderer/core/dom/element_rare_data_vector.cc
@@ -45,12 +45,27 @@ ElementRareDataVector::~ElementRareDataVector() {
 unsigned ElementRareDataVector::GetFieldIndex(FieldId field_id) const {
   unsigned field_id_int = static_cast<unsigned>(field_id);
   DCHECK(fields_bitfield_ & (static_cast<BitfieldType>(1) << field_id_int));
+#if defined(__GNUC__) || defined(__clang__)
+  return __builtin_popcount(fields_bitfield_ &
+                            ~(~static_cast<BitfieldType>(0) << field_id_int));
+#elif _MSVC_LANG >= 202002L // C++20
+    return std::popcount(fields_bitfield_ &
+                         ~(~static_cast<BitfieldType>(0) << field_id_int));
+#else
+    uint32_t v = (fields_bitfield_ &
+                  ~(~static_cast<BitfieldType>(0) << field_id_int));
+    uint32_t c = v - ((v >> 1) & 0x55555555);
+    c = ((c >> 2) & 0x33333333) + (c & 0x33333333);
+    c = ((c >> 4) + c) & 0x0F0F0F0F;
+    c = ((c >> 8) + c) & 0x00FF00FF;
+    c = ((c >> 16) + c) & 0x0000FFFF;
+    return c;
+#endif
+
 #ifdef _MSC_VER
   return __popcnt(fields_bitfield_ &
                             ~(~static_cast<BitfieldType>(0) << field_id_int));
 #else
-  return __builtin_popcount(fields_bitfield_ &
-                            ~(~static_cast<BitfieldType>(0) << field_id_int));
 #endif
 }

diff --git a/chromium/third_party/blink/renderer/core/paint/sparse_vector.h b/chromium/third_party/blink/renderer/core/paint/sparse_vector.h
index 983d49f249e..ebc1c2a17bc 100644
--- a/chromium/third_party/blink/renderer/core/paint/sparse_vector.h
+++ b/chromium/third_party/blink/renderer/core/paint/sparse_vector.h
@@ -108,10 +108,18 @@ class CORE_EXPORT SparseVector {
     // Then count the total population of field IDs lower than that one we
     // are looking for. The target field ID should be located at the index of
     // of the total population.
-#ifdef _MSC_VER
-    return __popcnt(fields_bitfield_ & mask);
-#else
+#if defined(__GNUC__) || defined(__clang__)
     return __builtin_popcount(fields_bitfield_ & mask);
+#elif _MSVC_LANG >= 202002L // C++20
+    return std::popcount(fields_bitfield_ & mask);
+#else
+    uint32_t v = (fields_bitfield_ & mask);
+    uint32_t c = v - ((v >> 1) & 0x55555555);
+    c = ((c >> 2) & 0x33333333) + (c & 0x33333333);
+    c = ((c >> 4) + c) & 0x0F0F0F0F;
+    c = ((c >> 8) + c) & 0x00FF00FF;
+    c = ((c >> 16) + c) & 0x0000FFFF;
+    return c;
 #endif
   }

diff --git a/chromium/third_party/perfetto/include/perfetto/base/compiler.h b/chromium/third_party/perfetto/include/perfetto/base/compiler.h
index 85678cc768c..cb9dae36a42 100644
--- a/chromium/third_party/perfetto/include/perfetto/base/compiler.h
+++ b/chromium/third_party/perfetto/include/perfetto/base/compiler.h
@@ -76,9 +76,28 @@

 #if defined(__GNUC__) || defined(__clang__)
 #define PERFETTO_POPCOUNT(x) __builtin_popcountll(x)
-#else
+#elif defined(__AVX__) || defined(__SSE4_2__) || defined(__POPCNT__)
 #include <intrin.h>
 #define PERFETTO_POPCOUNT(x) __popcnt64(x)
+#else
+#if __has_include(<bit>) && __cplusplus > 201703L
+#include <bit>
+#endif
+inline uint32_t qPopulationCount(uint64_t v) noexcept
+{
+#if defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L
+    return std::popcount(v);
+#else
+    return
+        (((v      ) & 0xfff)    * 0x1001001001001ULL & 0x84210842108421ULL) % 0x1f +
+        (((v >> 12) & 0xfff)    * 0x1001001001001ULL & 0x84210842108421ULL) % 0x1f +
+        (((v >> 24) & 0xfff)    * 0x1001001001001ULL & 0x84210842108421ULL) % 0x1f +
+        (((v >> 36) & 0xfff)    * 0x1001001001001ULL & 0x84210842108421ULL) % 0x1f +
+        (((v >> 48) & 0xfff)    * 0x1001001001001ULL & 0x84210842108421ULL) % 0x1f +
+        (((v >> 60) & 0xfff)    * 0x1001001001001ULL & 0x84210842108421ULL) % 0x1f;
+#endif
+}
+#define PERFETTO_POPCOUNT(x) qPopulationCount(x)
 #endif

 #if defined(__clang__)
