v8/test/unittests/base
Benoit Lize da1a2d127d [builtins] Remap embedded builtins into the heap on ARM64 macOS
For short builtin calls, the builtins are copied on the heap when they
cannot be put close enough to be in range of relative calls. This costs
memory, as the embedded builtins are part of the binary, and mapped from
the binary, and as a consequence shared with all running processes.

Rather than copying the memory, we can remap it at a different address,
avoiding the memory cost. This CL does that, on ARM64 macOS only for
now.

This saves at least ~1.4MiB of memory per V8 process. See below the
output of vmmap <PID>:

[...]
Memory Tag 255             7408308000-740833c000   [  208K   144K   144K     0K] r-x/rwx SM=ZER
Memory Tag 255             740833c000-7408340000   [   16K     0K     0K     0K] ---/rwx SM=ZER
Memory Tag 255             7408344000-7408348000   [   16K     0K     0K     0K] ---/rwx SM=ZER
Memory Tag 255             7408348000-740837c000   [  208K   144K   144K     0K] r-x/rwx SM=ZER
Memory Tag 255             740837c000-740fe80000   [123.0M     0K     0K     0K] ---/rwx SM=ZER
mapped file                740fe80000-740ffe4000   [ 1424K  1328K     0K     0K] r-x/rwx SM=COW          ...pp/Contents/Frameworks/Chromium Framework.framework/Versions/102.0.4958.0/Chromium Framework
Memory Tag 255             740ffe4000-7410000000   [  112K     0K     0K     0K] ---/rwx SM=ZER

The "208K" regions are 256kiB code pages, minus the header and guard
pages, meaning that they are code chunks. The mapped file are the
remapped builtins, showing that they aren't copied, but remapped from
the binary.

Bug: chromium:1298417
Change-Id: Ia30a43e671726d01450a7db0ecb7777b34763053
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3553006
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Benoit Lize <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79716}
2022-04-01 17:55:21 +00:00
..
platform [builtins] Remap embedded builtins into the heap on ARM64 macOS 2022-04-01 17:55:21 +00:00
utils Fix v8 unittests broken on official builds by recent crash logging changes 2021-07-05 07:38:47 +00:00
address-region-unittest.cc Fix -Wc++11-narrowing in V8. 2021-06-09 22:47:37 +00:00
atomic-utils-unittest.cc Reland "[d8] Remove maximum workers limitation" 2019-07-30 07:56:17 +00:00
bits-unittest.cc Fix CountPopulation non-builtin implementation 2020-05-14 14:24:13 +00:00
cpu-unittest.cc [ia32][x64] Detect AVX2 2020-12-17 05:44:54 +00:00
division-by-constant-unittest.cc [cleanup][test] Remove redundant NOLINT annotations 2021-04-30 11:46:14 +00:00
flags-unittest.cc [cleanup] Replace simple typedefs by using 2019-05-27 12:39:49 +00:00
functional-unittest.cc [cleanup] Remove DISALLOW_COPY_AND_ASSIGN in test/{common,unittests} 2020-11-06 06:07:54 +00:00
ieee754-unittest.cc [ubsan] Fix various cases of undefined behavior 2019-01-10 13:52:04 +00:00
iterator-unittest.cc Improve iterator_range to take non-&& arguments 2020-01-28 13:03:43 +00:00
logging-unittest.cc Fix v8 unittests broken on official builds by recent crash logging changes 2021-07-05 07:38:47 +00:00
macros-unittest.cc Account for different interpretations of "trivially copyable" 2018-03-02 15:45:14 +00:00
ostreams-unittest.cc Move utility code to src/utils 2019-05-23 14:13:34 +00:00
region-allocator-unittest.cc Introduce v8_enable_virtual_memory_cage 2021-08-11 16:13:42 +00:00
sys-info-unittest.cc Remove NaCl support. 2016-07-27 07:50:31 +00:00
template-utils-unittest.cc Replace base::make_unique by std::make_unique 2019-09-10 11:21:51 +00:00
threaded-list-unittest.cc Move remaining files in src/ 2019-05-24 18:24:36 +00:00
vector-unittest.cc [base] Move utils/vector.h to base/vector.h 2021-06-18 13:33:13 +00:00
virtual-address-space-unittest.cc [base] Don't return bool from VirtualAddressSpace::Free* routines 2022-03-07 16:53:23 +00:00
vlq-base64-unittest.cc Add Base64 VLQ decoding support 2019-07-16 16:16:24 +00:00
vlq-unittest.cc [sparkplug][cleanup] Add helper to en-/decode VLQ. 2021-02-25 15:05:01 +00:00