[builtins] Consult codegen callback per-argument in CreateDynamicFunction

Consult ModifyCodeGenerationFromStringsCallback for each non-string
parameter and body argument before ToString(). If the callback does not
provide a replacement,ToString() remains the fallback.

Add coverage for callback replacement, ToString() fallback, callback
invocation counts, and the no-callback path.

This depends on the Chromium TestExpectations CL:
https://chromium-review.googlesource.com/c/chromium/src/+/8253451

I've verified against a Chromium build with this patch; relevant WPT
trusted-types tests pass.

Follow-up: split out a dedicated GetCodeForEvalCallback rather than
reusing the existing struct-returning callback per argument.

Bug: 542045675
Bug: 540020372
Change-Id: I317b34c435dbb3e019bfafc93b75d10ddd763bc2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8252307
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Commit-Queue: Dmitry Bezhetskov <dima00782@gmail.com>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#110013}
3 files changed
tree: ec67026e799dbd2a1f45fa45b253662a1dc3d9cb
  1. .github/
  2. agents/
  3. bazel/
  4. build_overrides/
  5. custom_deps/
  6. docs/
  7. gni/
  8. include/
  9. infra/
  10. samples/
  11. src/
  12. test/
  13. testing/
  14. third_party/
  15. tools/
  16. .bazelrc
  17. .clang-format
  18. .clang-tidy
  19. .editorconfig
  20. .flake8
  21. .git-blame-ignore-revs
  22. .gitattributes
  23. .gitignore
  24. .gn
  25. .mailmap
  26. .style.yapf
  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. MODULE.bazel
  46. OWNERS
  47. PPC_OWNERS
  48. PRESUBMIT.py
  49. pyrightconfig.json
  50. README.md
  51. RISCV_OWNERS
  52. S390_OWNERS
  53. SECURITY.md
  54. vpython.toml
  55. vpython.toml.uv.lock
  56. WATCHLISTS
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 Chromium, 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.