Proper Reland "[wasm] Track meta data size with code size"

This is a proper reland of commit
c44de52316bae332be3e7b18d7f8a67931a08a7a

The reland https://crrev.com/c/5668528 somehow didn't contain the
original changes, just the fix for the lock inversion.

The issue with the original change:
There was a lock-order inversion between the WasmEngine::mutex_ and
the WasmImportWrapperCache::mutex_. The different orders:
1. create ModificationScope (cache mutex) and then call PublishCode()
-> LogCode() (engine mutex);
2. GC callback (engine mutex) which calls SampleCodeSize() (cache
mutex). (The callback is created in AddIsolate()).

Solution: We don't have to lock on the cache mutex while calling
PublishCode().

Original change's description:
> [wasm] Track meta data size with code size
>
> This CL adds two histograms to track the meta data size with code size
> for:
> - code flushing (WasmFlushedLiftoffCodeSizeAndMetadataBytes)
> - NativeModule::SampleCodeSize (WasmModuleCodeAndMetadataSizeKiB)
>
> Bug: 349610478
> Change-Id: If948f65c336cf4cdfcbfc5c50e88799f4993eedd
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5660561
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Eva Herencsárová <evih@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#94736}

Bug: 349610478
Change-Id: I3ea7113668b2b826c5efddc24928fd5fc693014b
Cq-Include-Trybots: luci.v8.try:v8_linux64_tsan_dbg,v8_linux64_tsan_isolates_rel,v8_linux64_tsan_no_cm_rel,v8_linux64_tsan_rel,v8_numfuzz_tsan_rel
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5671345
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Eva Herencsárová <evih@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94781}
7 files changed
tree: 08fceae761901301e73a9f53da8b3bbdb8dc224f
  1. .github/
  2. bazel/
  3. build_overrides/
  4. custom_deps/
  5. docs/
  6. gni/
  7. include/
  8. infra/
  9. samples/
  10. src/
  11. test/
  12. testing/
  13. third_party/
  14. tools/
  15. .bazelrc
  16. .clang-format
  17. .clang-tidy
  18. .editorconfig
  19. .flake8
  20. .git-blame-ignore-revs
  21. .gitattributes
  22. .gitignore
  23. .gn
  24. .mailmap
  25. .style.yapf
  26. .vpython3
  27. .ycm_extra_conf.py
  28. AUTHORS
  29. BUILD.bazel
  30. BUILD.gn
  31. CODE_OF_CONDUCT.md
  32. codereview.settings
  33. COMMON_OWNERS
  34. DEPS
  35. DIR_METADATA
  36. ENG_REVIEW_OWNERS
  37. INFRA_OWNERS
  38. INTL_OWNERS
  39. LICENSE
  40. LICENSE.fdlibm
  41. LICENSE.strongtalk
  42. LICENSE.v8
  43. LOONG_OWNERS
  44. MIPS_OWNERS
  45. OWNERS
  46. PPC_OWNERS
  47. PRESUBMIT.py
  48. README.md
  49. RISCV_OWNERS
  50. S390_OWNERS
  51. WATCHLISTS
  52. WORKSPACE
README.md

V8 JavaScript Engine

V8 is Google's open source JavaScript engine.

V8 implements ECMAScript as specified in ECMA-262.

V8 is written in C++ and is used in Google Chrome, the open source browser from Google.

V8 can run standalone, or can be embedded into any C++ application.

V8 Project page: https://v8.dev/docs

Getting the Code

Checkout depot tools, and run

    fetch v8

This will checkout V8 into the directory v8 and fetch all of its dependencies. To stay up to date, run

    git pull origin
    gclient sync

For fetching all branches, add the following into your remote configuration in .git/config:

    fetch = +refs/branch-heads/*:refs/remotes/branch-heads/*
    fetch = +refs/tags/*:refs/tags/*

Contributing

Please follow the instructions mentioned at v8.dev/docs/contribute.