[class] fix undefined private name access in computed property keys

This patch implements https://github.com/tc39/proposal-class-fields/pull/269
and makes sure we always throw TypeError when there is invalid private
name access in computed property keys.

Before this patch, private name variables of private fields and methods
are initialized together with computed property keys in the order they
are declared. Accessing undefined private names in the computed property
keys thus fail silently.

After this patch, we initialize the private name variables of private
fields before we initialize the computed property keys, so that invalid
access to private fields in the computed keys can be checked in the IC.
We now also initialize the brand early, so that invalid access to private
methods or accessors in the computed keys throw TypeError during brand
checks - and since these accesses are guarded by brand checks, we can
create the private methods and accessors after the class is
defined, and merge the home object setting with the creation
of the closures.

Bug: v8:8330, v8:9611
Change-Id: I01363f7befac6cf9dd28ec229b99a99102bcf012
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1846571
Commit-Queue: Joyee Cheung <joyee@igalia.com>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64225}
17 files changed
tree: 93f5ece20007030a31a5ec2a9e94069cdf9446fc
  1. .clang-format
  2. .clang-tidy
  3. .editorconfig
  4. .flake8
  5. .git-blame-ignore-revs
  6. .gitattributes
  7. .gitignore
  8. .gn
  9. .vpython
  10. .ycm_extra_conf.py
  11. AUTHORS
  12. BUILD.gn
  13. CODE_OF_CONDUCT.md
  14. COMMON_OWNERS
  15. ChangeLog
  16. DEPS
  17. ENG_REVIEW_OWNERS
  18. INFRA_OWNERS
  19. INTL_OWNERS
  20. LICENSE
  21. LICENSE.fdlibm
  22. LICENSE.strongtalk
  23. LICENSE.v8
  24. LICENSE.valgrind
  25. MIPS_OWNERS
  26. OWNERS
  27. PPC_OWNERS
  28. PRESUBMIT.py
  29. README.md
  30. S390_OWNERS
  31. WATCHLISTS
  32. benchmarks/
  33. build_overrides/
  34. codereview.settings
  35. custom_deps/
  36. docs/
  37. gni/
  38. include/
  39. infra/
  40. samples/
  41. src/
  42. test/
  43. testing/
  44. third_party/
  45. tools/
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.