Reunite CSSPropertyValue and CSSPropertyValueMetadata.

At some point in 2012, the metadata was split out of CSSPropertyValue,
seemingly to reduce memory usage on 64-bit platforms. Among others,
this lead to an awkward setup where mutable CSS property sets would
be stored as a vector of value/metadata pairs (an array of structs,
aka AoS) and immutable CSS property sets would be stored as two
separate arrays (a struct of arrays, aka SoA), with PropertyReference
to arbitrate between the different structure.

However, since then, the structure has changed a bit, especially with
Oilpan and pointer compression, and due to alignment issues, the
CSSValue can now actually fit into the padding of CSSPropertyValue.
This reduces the value+metadata pair from 24 to 16 bytes, and means
that we can make both types of property sets into a more natural
AoS layout.

This also means we can make spanification much more natural;
both get a Properties() member function that return a span of
CSSPropertyValue (now including metadata), which we can trivially
iterate over with much less bounds-checking overhead, making safe
code much shorter (both in source and the binary).

It saves a fair bit of Oilpan memory, as shown by the style perftest:

  Video:         12320 → 11943  (-377 kB)
  Extension:     11227 → 11224  (  -3 kB)
  News:           6822 →  6716  (-106 kB)
  ECommerce:      2459 →  2465  (  +6 kB)
  Social1:        6216 →  6107  (-109 kB)
  Social2:        4420 →  4427  (  +7 kB)
  Encyclopedia:  10253 → 10165  ( -88 kB)
  Sports:        14786 → 13825  (-961 kB)
  Search:         3585 →  3588  (  +3 kB)

The actual performance in the style perftest is a bit all over the map,
as the reduced allocation makes GC move around between tests; it is,
however, overall slightly positive. Zen 3, LTO but no PGO:

  Parse (µs)             Before     After    Perf      95% CI (BCa)
  =================== ========= ========= ======= =================
  ECommerce                 902       903   -0.2%  [ -0.5%,  +0.2%]
  Encyclopedia             5179      5137   +0.8%  [ +0.6%,  +1.0%]
  Extension                 921       942   -2.2%  [ -2.6%,  -1.8%]
  News                     5431      5388   +0.8%  [ +0.6%,  +1.1%]
  Search                   3414      3377   +1.1%  [ +0.9%,  +1.3%]
  Social1                  9561      9495   +0.7%  [ +0.5%,  +0.9%]
  Social2                   419       419   +0.0%  [ -0.4%,  +0.4%]
  Sports                  35853     35475   +1.1%  [ +0.8%,  +1.3%]
  Video                   24796     23616   +5.0%  [ +4.6%,  +5.3%]
  Geometric mean                            +0.8%  [ +0.6%,  +1.0%]

  Initial style (µs)     Before     After    Perf      95% CI (BCa)
  =================== ========= ========= ======= =================
  ECommerce                5114      5088   +0.5%  [ +0.4%,  +0.7%]
  Encyclopedia            46472     46274   +0.4%  [ +0.2%,  +0.6%]
  Extension               52044     52157   -0.2%  [ -0.4%,  -0.1%]
  News                    20928     20804   +0.6%  [ +0.4%,  +0.8%]
  Search                   7347      7332   +0.2%  [ +0.0%,  +0.4%]
  Social1                 13142     13133   +0.1%  [ -0.1%,  +0.2%]
  Social2                  8237      8147   +1.1%  [ +1.0%,  +1.3%]
  Sports                  29039     28916   +0.4%  [ +0.3%,  +0.6%]
  Video                   19043     19630   -3.0%  [ -3.3%,  -2.7%]
  Geometric mean                            +0.0%  [ -0.1%,  +0.1%]

  Recalc style (µs)      Before     After    Perf      95% CI (BCa)
  =================== ========= ========= ======= =================
  ECommerce                2977      2936   +1.4%  [ +1.2%,  +1.7%]
  Encyclopedia            35209     34804   +1.2%  [ +0.9%,  +1.5%]
  Extension               40907     40507   +1.0%  [ +0.8%,  +1.2%]
  News                    11054     10895   +1.5%  [ +1.3%,  +1.7%]
  Search                   2910      2884   +0.9%  [ +0.6%,  +1.1%]
  Social1                  6640      6583   +0.9%  [ +0.6%,  +1.1%]
  Social2                  4631      4590   +0.9%  [ +0.7%,  +1.1%]
  Sports                  13702     13559   +1.1%  [ +0.9%,  +1.2%]
  Video                    7899      7761   +1.8%  [ +1.6%,  +2.0%]
  Geometric mean                            +1.2%  [ +1.0%,  +1.3%]

Speedometer 3 (M1 Pinpoint, LTO but no PGO, significant results
at 99% significance only, more negative is better):

  NewsSite-Nuxt                               [ +0.3%,  +0.8%]
  TodoMVC-Backbone                            [ -0.6%,  -0.1%]
  TodoMVC-JavaScript-ES6-Webpack-Complex-DOM  [ -0.7%,  -0.1%]
  TodoMVC-Vue                                 [ -0.8%,  -0.0%]
  TodoMVC-JavaScript-ES5                      [ -2.3%,  -0.0%]

Change-Id: Ie2cdbc0f000e0ba41244dcc497b421ba0057fd84
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6087961
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Steinar H Gunderson <sesse@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1395313}
24 files changed
tree: 7288c85d9b06330309587ff835306bccbb6c0e2e
  1. android_webview/
  2. apps/
  3. ash/
  4. base/
  5. build/
  6. build_overrides/
  7. buildtools/
  8. cc/
  9. chrome/
  10. chromecast/
  11. chromeos/
  12. codelabs/
  13. components/
  14. content/
  15. crypto/
  16. dbus/
  17. device/
  18. docs/
  19. extensions/
  20. fuchsia_web/
  21. gin/
  22. google_apis/
  23. gpu/
  24. headless/
  25. infra/
  26. ios/
  27. ipc/
  28. media/
  29. mojo/
  30. native_client_sdk/
  31. net/
  32. pdf/
  33. ppapi/
  34. printing/
  35. remoting/
  36. rlz/
  37. sandbox/
  38. services/
  39. skia/
  40. sql/
  41. storage/
  42. styleguide/
  43. testing/
  44. third_party/
  45. tools/
  46. ui/
  47. url/
  48. webkit/
  49. .clang-format
  50. .clang-tidy
  51. .clangd
  52. .git-blame-ignore-revs
  53. .gitallowed
  54. .gitattributes
  55. .gitignore
  56. .gitmodules
  57. .gn
  58. .mailmap
  59. .rustfmt.toml
  60. .vpython3
  61. .yapfignore
  62. ATL_OWNERS
  63. AUTHORS
  64. BUILD.gn
  65. CODE_OF_CONDUCT.md
  66. codereview.settings
  67. CPPLINT.cfg
  68. CRYPTO_OWNERS
  69. DEPS
  70. DIR_METADATA
  71. LICENSE
  72. LICENSE.chromium_os
  73. OWNERS
  74. PRESUBMIT.py
  75. PRESUBMIT_test.py
  76. PRESUBMIT_test_mocks.py
  77. README.md
  78. WATCHLISTS
README.md

Logo Chromium

Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.

The project's web site is https://www.chromium.org.

To check out the source code locally, don't use git clone! Instead, follow the instructions on how to get the code.

Documentation in the source is rooted in docs/README.md.

Learn how to Get Around the Chromium Source Code Directory Structure.

For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.

If you found a bug, please file it at https://crbug.com/new.