8e7737cb58
This implements the ideas outlined in the section "Microtask queue" of the exploration document "Promise and async/await performance" (at https://goo.gl/WHRar2), except that the microtask queue stays a linear FixedArray for now, to avoid running into trouble with the parallel scavenger. This way we can already save a significant amount of allocations, thereby reducing the GC frequency quite a bit. All items on the microtask queue are now proper structs that subclass Microtask, i.e. we also wrap JSFunction and MicrotaskCallback jobs into structs. We also consistently remember the context for every microtask (except for MicrotaskCallback where we don't have a context), and execute it later in exactly that context (as required by the spec anyways for the Promise related jobs). Particularly interesting is the PromiseReactionJobTask and its subclasses, since they are designed to have the same size as the PromiseReaction. When we resolve a JSPromise we just take the existing PromiseReaction instances and morph them into PromiseFulfillReactionJobTask or PromiseRejectReactionJobTask (depending whether you "Fulfill" or "Reject"). That way the JSPromise class is now only 6 words instead of 10 words. Also the PromiseReaction and the reaction tasks can either carry a JSPromise (for the fast native case) or a PromiseCapability (for the generic case), which means we don't always pay the overhead of having to also remember the "deferred resolve" and "deferred reject" handlers that are only relevant for the generic case anyways. It also fixes a spec violation where we called "then" before we actually enqueued the PromiseResolveThenableJob, which is observably wrong. Calling it later has the advantage that it should be fairly straight-forward now to completely avoid it for native Promise instances. This seems to save around 10-20% on the various Promise benchmarks and micro-benchmarks. We expect to gain even more as we're now able to inline various operations into TurboFan optimized code easily. Bug: v8:7253 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng Change-Id: I893d24ca5bb046974b4f5826a8f6dd22f1210b6a Reviewed-on: https://chromium-review.googlesource.com/892819 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#50980} |
||
---|---|---|
benchmarks | ||
build_overrides | ||
docs | ||
gni | ||
gypfiles | ||
include | ||
infra | ||
samples | ||
src | ||
test | ||
testing | ||
third_party | ||
tools | ||
.clang-format | ||
.editorconfig | ||
.git-blame-ignore-revs | ||
.gitignore | ||
.gn | ||
.vpython | ||
.ycm_extra_conf.py | ||
AUTHORS | ||
BUILD.gn | ||
ChangeLog | ||
CODE_OF_CONDUCT.md | ||
codereview.settings | ||
DEPS | ||
LICENSE | ||
LICENSE.fdlibm | ||
LICENSE.strongtalk | ||
LICENSE.v8 | ||
LICENSE.valgrind | ||
Makefile | ||
Makefile.android | ||
OWNERS | ||
PRESUBMIT.py | ||
README.md | ||
snapshot_toolchain.gni | ||
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://github.com/v8/v8/wiki
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 on the V8 wiki.