Go to file
Jakob Gruber 33e1a6e944 [compiler] Widen optimization for external reference loads
Turbofan applies the following optimization to external reference
loads on arm64 and x64: if the root-relative offset to an external
reference's address is known to be constant (and the root register has
been initialized), calculate the external reference as |kRootRegister
+ <offset>| instead of loading it from the external reference table.

There are two main cases to consider:

1. External references to arbitrary addresses in the native address
space, e.g. libc_memcpy. These kinds of external references have a
fixed address within the same running process, but may (and likely
will) change between processes (e.g.: mksnapshot and later chromium),
and the root-relative offset is different for each Isolate within the
same process.

These kinds of external references can be optimized as above when
*not* generating code which will later be serialized, and *not*
generating isolate-independent code.

2. External references to addresses within the fixed-size region of
the Isolate (essentially: within IsolateData). Since these move with
the Isolate, their root-relative offset is guaranteed to be constant
at all times.

The optimization can always be applied to these cases as long as the
root register has been initialized.

Prior to this CL, we only recognized and optimized for case 1. This CL
additionally adds support for 2.

An example of improved code generated due to this CL:

Before:
// r13 is the kRootRegister on x64.
// 0x3010 is the root-relative offset to Isolate::context_address.
leaq rdx, [r13+0x3010]
movq r8, [rdx]

After:
movq rdx, [r13+0x3010]

Bug: v8:9534
Change-Id: Idfcca751e98a56c0e5ead2c701c12a677df75399
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1748727
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63158}
2019-08-12 13:10:37 +00:00
benchmarks Add missing owners files 2019-05-31 07:21:01 +00:00
build_overrides [build] Dynamically decide if to use system xcode 2019-07-29 08:20:24 +00:00
custom_deps Clean up infra owners 2019-05-15 11:18:43 +00:00
docs Add OWNERS for docs/ 2019-05-15 12:06:15 +00:00
gni Reland "Add postmortem debugging helper library" 2019-07-31 14:30:19 +00:00
include profiler: Allow querying SnapshotObjectId for native objects 2019-08-09 08:41:03 +00:00
infra Revert "Reland "[ptr-compr][arm64] Temporarily enable pointer compression on arm64"" 2019-08-09 15:55:05 +00:00
samples [cleanup] Drop some occurrences of Isolate::Current 2019-06-26 19:39:21 +00:00
src [compiler] Widen optimization for external reference loads 2019-08-12 13:10:37 +00:00
test Roll Test262 2019-08-12 12:02:58 +00:00
testing Add missing owners files 2019-05-31 07:21:01 +00:00
third_party [wasm-c-api] Roll to upstream 70be7c6 2019-08-09 15:13:46 +00:00
tools [cleanup] Update turbolizer tooltip with the correct number 2019-08-09 09:35:01 +00:00
.clang-format
.clang-tidy [tool] Remove unfixed clang-tidy warnings to ease use. 2018-10-26 07:40:32 +00:00
.editorconfig
.flake8 Add .flake8 to allow for python style checking. 2019-07-19 21:44:03 +00:00
.git-blame-ignore-revs Add recent code rewrite to .git-blame-ignore-revs 2019-05-23 10:38:45 +00:00
.gitattributes .gitattributes: Mark minified emscripten js files as -diff 2018-09-19 16:27:10 +00:00
.gitignore [wasm-c-api] Un-.gitignore third_party/wasm-api/ 2019-06-17 08:52:37 +00:00
.gn [build] Dynamically decide if to use system xcode 2019-07-29 08:20:24 +00:00
.vpython [tools] Implement confidence-based number of runs 2019-05-09 09:42:28 +00:00
.ycm_extra_conf.py
AUTHORS random number generator seeding update for macOS 2019-07-26 11:55:01 +00:00
BUILD.gn Revert "Reland "[ptr-compr][arm64] Temporarily enable pointer compression on arm64"" 2019-08-09 15:55:05 +00:00
ChangeLog [release] Merge ChangeLog back to master 2018-12-07 15:41:59 +00:00
CODE_OF_CONDUCT.md
codereview.settings
COMMON_OWNERS [OWNERS] Add solanes@ to COMMON_OWNERS 2019-05-22 13:50:51 +00:00
DEPS Roll Test262 2019-08-12 12:02:58 +00:00
ENG_REVIEW_OWNERS Add eng review owners as escalation path 2019-05-15 19:12:10 +00:00
INFRA_OWNERS Clean up infra owners 2019-05-15 11:18:43 +00:00
INTL_OWNERS Add missing owners files 2019-05-31 07:21:01 +00:00
LICENSE [wasm] Draft version of C/C++ Wasm API 2019-04-17 16:00:26 +00:00
LICENSE.fdlibm
LICENSE.strongtalk
LICENSE.v8
LICENSE.valgrind
MIPS_OWNERS Move architecture dependent files 2019-05-28 14:02:15 +00:00
OWNERS Add .flake8 to allow for python style checking. 2019-07-19 21:44:03 +00:00
PPC_OWNERS Move architecture dependent files 2019-05-28 14:02:15 +00:00
PRESUBMIT.py Reland "Move logging and diagnostics related source files" 2019-05-20 09:54:57 +00:00
README.md [docs] Change links from old wiki to v8.dev 2019-03-07 12:13:30 +00:00
S390_OWNERS Move architecture dependent files 2019-05-28 14:02:15 +00:00
WATCHLISTS Move remaining files in src/ 2019-05-24 18:24:36 +00:00

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.