40c6892643
This fixes a problem where ICs for transitioning stores go MEGAMORPHIC if the transition target map dies in between invocations of the IC, which is totally possible, since we only hold on weakly to these transition targets (both from the FeedbackVectors and also from the TransitonArrays). The root problem here was an inconsistency in how the maps and handlers are being reported by the FeedbackVector. On the on hand side the method FeedbackVector::ExtractMaps() will report all receiver maps that are still present (i.e. which haven't died themselves), but then the other method FeedbackVector::FindHandlers() will only report handlers that are still alive (i.e. which in case of transition target maps being used as handlers haven't died yet). If the length of these lists don't match the IC chickens out and goes MEGAMORPHIC. But this is exactly the case with the transitioning stores, where there's no handler anymore, i.e. as can be seen in this simple example: ``` // Flags: --expose-gc function C() { this.x = 1; } new C(); new C(); gc(); // map with the `C.x` property dies new C(); // now the STORE_IC in C goes MEGAMORPHIC ``` So the problem is that we have these two methods that don't agree with each other. Now FeedbackVector::ExtractMaps() is also used by TurboFan and it even reports receiver maps for PREMONOMORPHIC state, which is different from the use case that the ICs need. So I replaced the FeedbackVector::FindHandlers() with a completely new method FeedbackVector::ExtractMapsAndHandlers(), which returns both the maps and handlers, exactly as the ICs need it. And only returns pairs for which both the receiver map and the handler are still alive. This fixes the odd problem that sometimes STORE_ICs going MEGAMORPHIC for no apparent reason. Due to the weakness of the transition target maps, they can still die and cause deoptimizations, but at least TurboFan will now be able to reoptimize again later with the new maps and still generate proper code. Bug: v8:9316 Cq-Include-Trybots: luci.chromium.try:linux-rel,win7-rel Change-Id: I74c8b60f792f310dc813f997e69efe9ad434296a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1637878 Auto-Submit: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Michael Stanton <mvstanton@chromium.org> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#61948} |
||
---|---|---|
benchmarks | ||
build_overrides | ||
custom_deps | ||
docs | ||
gni | ||
include | ||
infra | ||
samples | ||
src | ||
test | ||
testing | ||
third_party | ||
tools | ||
.clang-format | ||
.clang-tidy | ||
.editorconfig | ||
.git-blame-ignore-revs | ||
.gitattributes | ||
.gitignore | ||
.gn | ||
.vpython | ||
.ycm_extra_conf.py | ||
AUTHORS | ||
BUILD.gn | ||
ChangeLog | ||
CODE_OF_CONDUCT.md | ||
codereview.settings | ||
COMMON_OWNERS | ||
DEPS | ||
ENG_REVIEW_OWNERS | ||
INFRA_OWNERS | ||
INTL_OWNERS | ||
LICENSE | ||
LICENSE.fdlibm | ||
LICENSE.strongtalk | ||
LICENSE.v8 | ||
LICENSE.valgrind | ||
MIPS_OWNERS | ||
OWNERS | ||
PPC_OWNERS | ||
PRESUBMIT.py | ||
README.md | ||
S390_OWNERS | ||
WATCHLISTS |
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.