[maps] Avoid self-prototype transition in Map::GetDerivedMap

When Map::GetDerivedMap is called with a non-JSObject prototype (such
as a JSProxy) that matches from->prototype(), it previously called
TransitionRootMapToPrototypeForNewObject unconditionally, creating a
prototype transition to a new map with the same prototype and
back-pointer set to the original root map.

Subsequent MapUpdater runs walked the back-pointer to the original root
map and skipped the prototype transition because root_map_->prototype()
equals *new_prototype_, causing a CHECK_EQ failure in
LookupIterator::IsCacheableTransition().

Fixed: 565836459

TAG=agy
CONV=9d3c2c3d-d780-4e2c-b8ce-ad0e25cd2825

Change-Id: Icdc5ddcdcaf7bd24956bc75f7dabeca1e7fa7b4e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8468367
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#110107}
3 files changed
tree: dad90d383d3533939eb12c28a5d7b69a32efa2b3
  1. .github/
  2. agents/
  3. bazel/
  4. build_overrides/
  5. custom_deps/
  6. docs/
  7. experimental/
  8. gni/
  9. include/
  10. infra/
  11. samples/
  12. src/
  13. test/
  14. testing/
  15. third_party/
  16. tools/
  17. .bazelrc
  18. .clang-format
  19. .clang-tidy
  20. .editorconfig
  21. .flake8
  22. .git-blame-ignore-revs
  23. .gitattributes
  24. .gitignore
  25. .gn
  26. .mailmap
  27. .style.yapf
  28. .ycm_extra_conf.py
  29. AUTHORS
  30. BUILD.bazel
  31. BUILD.gn
  32. CODE_OF_CONDUCT.md
  33. codereview.settings
  34. COMMON_OWNERS
  35. DEPS
  36. DIR_METADATA
  37. ENG_REVIEW_OWNERS
  38. INFRA_OWNERS
  39. INTL_OWNERS
  40. LICENSE
  41. LICENSE.fdlibm
  42. LICENSE.strongtalk
  43. LICENSE.v8
  44. LOONG_OWNERS
  45. MIPS_OWNERS
  46. MODULE.bazel
  47. OWNERS
  48. PPC_OWNERS
  49. PRESUBMIT.py
  50. pyrightconfig.json
  51. README.md
  52. RISCV_OWNERS
  53. S390_OWNERS
  54. SECURITY.md
  55. vpython.toml
  56. vpython.toml.uv.lock
  57. 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.