Previously, //v8:v8 exposed :v8_base via public_deps, which propagated
V8-internal codegen dependencies (such as :run_torque) to all downstream
embedder targets. In Chromium builds, this forced over 20,000 non-V8 C++
files (e.g. in Blink and Content) to wait for Torque code generation
before starting compilation, even though they only include public V8
headers. Additionally, :torque_base transitively depended on :v8_tracing
via :v8_headers and :cppgc_headers, blocking Torque compiler compilation
on Perfetto proto/IPC codegen.
To unblock downstream C++ compilation and allow :torque_base to compile
earlier:
1. Move :v8_base and :v8_snapshot from public_deps to deps in //v8:v8
(and :cppgc_base in //v8:cppgc), and add inspector_headers to expose
public inspector headers without pulling in internal Torque outputs.
2. Add public = [] to v8_base_without_compiler and v8_compiler so their
internal public_deps (like :run_torque) do not leak into v8.harddeps.
3. Move v8-trace-categories.h and :v8_tracing from v8_headers to
cppgc_base, and split v8_libplatform_headers from v8_libplatform so
torque_base does not wait on Perfetto codegen.
NO_IFTTT=GN-specific dependency restructuring; v8_headers_files updated in BUILD.bazel
Bug: 563098656
Change-Id: I62e55734f6c2f8c3dd551aec6ef18f031b059ffd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8474951
Commit-Queue: Simon Zünd <szuend@chromium.org>
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#110123}
The allocation of CppHeapPointerTags caused problems in the past, so
this CL is an attempt to partition CppHeapPointerTags to make it easier
to allocate them correctly. The idea is to split up the tag range into
sub-sections, and then let different components allocate tags in their
subsection freely. All we check is that the components stay within their
subsections.
Within V8, two different tag ranges have to be distinguished: the range
of tags of sub classes of Object::Wrappable, and the range of other
tags. These ranges are then split into the sub-ranges that are used
internally, and those that are used by the embedder.
Furthermore, as a cleanup, this CL moves the enums for tags that are
used V8 internally from v8-sandbox.h to a new header file,
cppheap-pointer-tag.h.
Bug: 563066864
Change-Id: I23de1e86c33da8eefacdc8ca26c2e5f267111a8d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8430419
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#109979}
Rename the internal cppgc directory to src/heap/cppgc-internal/ to
clearly distinguish it from the public include/cppgc/ headers and
avoid potential naming confusion.
The collision occurs on Windows builds where -Wmicrosoft-include
is enabled by Clang in MSVC compatible mode. MSVC on Windows uses
different order of directories where the files are searched by the
compiler and `#include "cppgc/blah.h"` in public headers might end up
including "src/heap/cppgc/blah.h" if it exists.
All internal #include paths, include guards, and build configurations
(BUILD.gn and BUILD.bazel) have been updated to reflect the new path.
TAG=agy
CONV=47b06028-d652-41a8-b4f1-39e3cc478096
Bug: 515252150
Change-Id: Idf7ca1d193a8b6bb9d53b22f01320f4363df36f4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7963663
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com>
Cr-Commit-Position: refs/heads/main@{#108143}
Add static assertions and a DCHECK to ensure that the CppHeapPointerTag
used in v8::Object::Wrap is always within the kObjectWrappableTagRange.
Additionally, this CL removes all uses of
`CppHeapPointerTag::kDefaultTag` in V8.
Bug: 519655841
Change-Id: I42e8a9a0f0ca7c16eb68e44941d1d283af3a7044
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7907082
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#107902}
We are working on replacing the generic type tag
kEmbedderDataSlotPayloadTag with type-specific tags. With this CL, API
methods that implicitly used kEmbedderDataSlotPayloadTag get a type tag.
A new enum gets introduced in the API for the type tag parameter, so
that the internal ExternalPointerTag enum does not get exposed. The
embedder is expected to introduce their own enum as well, where the
embedder type tags get organized. The embedder enum can then be cast to
the API enum.
Bug: 433909571
Change-Id: Ib74b57c10d3cf7b49b4e0e4f23b0b77e46a4fa23
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6836349
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#101855}
Object::Wrap() has the implicit assumption that its input is a cppgc
object. This CL introduces a new base class, called `Wrappable`, that
should eventually make this assumption explicit.
Most inputs of Object::Wrap() have already two kinds of information:
1) type information for type checking;
2) name information for debugging;
Both kinds of information could be organized by the embedder themselves,
but that would typically require multiple inheritance, which has
negative effects on the object size. Since most expected subclasses of
`Wrappable` will have these kinds of information anyways, they are
required by `Wrappable` already, which allows smaller object sizes.
Bug: 345640553
Change-Id: I859025eb6f7dda07da365051b3d40b05ba54dca4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6611420
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#100653}
This is a reland of commit 017b2a5132
Original change's description:
> [cppgc] Use blink_gc_plugin in v8
>
> This CL enables the plugin for v8 builds and fixes various violations
> found in the v8 codebase.
>
> Some ignore annotations remain for changes required in the plugin (e.g.
> treat TraceMultiple and TraceEphemeron as trace methods).
>
> Bug: 402564649
> Change-Id: I3f995cf2bf31672b7c5702338286cfb850af2dcf
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6366816
> Reviewed-by: Anton Bikineev <bikineev@chromium.org>
> Commit-Queue: Omer Katz <omerkatz@chromium.org>
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#99316}
Bug: 402564649
Change-Id: Ibb4c9efdd6f26a9d7de234c4f341b754c96fc345
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6369299
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#99323}
This CL enables the plugin for v8 builds and fixes various violations
found in the v8 codebase.
Some ignore annotations remain for changes required in the plugin (e.g.
treat TraceMultiple and TraceEphemeron as trace methods).
Bug: 402564649
Change-Id: I3f995cf2bf31672b7c5702338286cfb850af2dcf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6366816
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#99316}
This CL adds basic benchmarks for the V8 fast API. The following
workloads get added:
* Regular api call to an empty callback;
* Fast api call to an empty callback;
* Regular api call with one string parameter, returning the string
length;
* Fast api call with one string parameter, which gets passed as a
FastOneByteString;
* Fast api call with one string parameter, which gets passed as a
v8::Value;
Results on my workstation, with a normal release build:
-------------------------------------------
Benchmark
Time CPU Iterations
-------------------------------------------
FastApiBenchmark/FastCallToEmptyCallback
4061324 ns 4059959 ns 173
FastApiBenchmark/RegularCallToEmptyCallback
7513440 ns 7511993 ns 92
FastApiBenchmark/FastOneByteString
4827714 ns 4826396 ns 140
FastApiBenchmark/FastStringValueView
18685412 ns 18682020 ns 38
FastApiBenchmark/RegularString
21819803 ns 21812231 ns 32
Change-Id: I3ae9241a391299802a15e0d13f4bc0fa61b598f9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6035117
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#97326}
Managed pointers in embedder fields is no longer supported. Model the
benchmark using unamanged and managed bindings instead.
Bug: 338411141
Change-Id: I31d94b53695d39e33d7cb2b186f29541195334ab
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5513452
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93744}
This deprecates WrapperDescriptor which is used for providing GC support
in embedder fields. Embedders are supposed to rely on
- v8::Object::Wrap()
- v8::Object::Unwrap()
Bug: 338411141
Change-Id: I51911a0f2112e66adeef1e69c8b726f69dedf09a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5515168
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93715}
JS wrapper objects are generally constructed via ObjectTemplate. Such
objects can now be constructed with 0 embedder fields and use the
newly introduced Wrap/Unwrap methods to set and get the corresponding
C++ pointers.
Internally, these will use a CppHeapPointer field and dedicated
external pointer table.
Bug: chromium:328117814
Change-Id: I9cb79a86ccdca8d185eaf79efffb16051dd75dc0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5401858
Reviewed-by: Samuel Groß <saelo@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93129}
Using the same path for DEPS'ed and previously checked-in files
causes conflicts when going back and forth between new and old
revisions. Since all references here are v8 stand-alone, the
exact location shouldn't be important. Therefore we use some
new name to avoid conflicts when locally running `gclient sync`.
Bug: chromium:1513046
Change-Id: Icf1ecc4d9b1f9c7e67b5a542c2be08ff9738d045
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5184217
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Liviu Rau <liviurau@google.com>
Cr-Commit-Position: refs/heads/main@{#91760}
This uses the GN layer for google_benchmark from Chromium directly,
which will allow rolling without maintaining this layer in V8.
This comes with the cost of compiling google_benchmark in v8
stand-alone if no explicit compile target was specified on the
command line (i.e. the implicit "all" target). This seems to be
below 1% of overall compile time though and will likely be quickly
hot in the reclient cache, since these targets rarely change.
Bug: chromium:1513046
Change-Id: Ia086c67ddc50f28f396527523f437eeb87f03f4b
Cq-Include-Trybots: luci.chromium.try:linux-rel
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5144246
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Liviu Rau <liviurau@google.com>
Cr-Commit-Position: refs/heads/main@{#91674}
Optimize FastDtoa, in particular Grisu3. In addition to making
a microbenchmark, there are a number of smaller and larger
changes here:
- Replace divisions by power-of-ten with multiplications by
their inverses, using an algorithm very similar to the one
in libdivide.
- For DiyFp::Times(), use 128-bit hardware multiplication
if available (which it generally is on 64-bit platforms).
- Where possible, send around a pointer to the end of the string,
instead of a pointer and a length, reducing register pressure
(especially for Intel). Where not (easily) possible, add
a local variable to make the compiler understand that length
and decimal_point cannot alias.
- Change some ints to unsigneds where it helps us avoid sign
extensions.
- Some minor changes to reduce instruction dependency chains.
- Inline BiggestPowerTen().
Actual performance gain is wildly different between platforms.
On my 3990X workstation (Zen 2), gains are about 21%. On a M1
Mac Mini, they are about 17%. But on my i7-10610U laptop
(Comet Lake, so Skylake microarchitecture), the function is
78% faster. This is probably because large divisions
(divisor over 255) seem to hurt a lot on Skylake, but I haven't
gone through it in detail.
Change-Id: I5b67c257d788a3f7d1be7065d055456852451d68
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4110741
Commit-Queue: Steinar H Gunderson <sesse@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84906}
Otherwise, DCHECKs complain that the PageAllocator used for the
GlobalGCInfoTable may differ when setting up the platform repeatedly
through benchmarking SetUp().
Change-Id: I7e87e8c9d8c283105e1bd75a4cd176df7f304315
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3283075
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77920}
Expose third_party/google_benchmark:google_benchmark as a public dep
from third_party/google_benchmark:benchmark_main and a v8_libbase
dependency to empty_benchmark to expose base/macros.h.
Bug: v8:7330
Change-Id: I5205af365da2ac7c35647acff90ed65d831cfa07
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2851888
Commit-Queue: Dan Elphick <delphick@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Dan Elphick <delphick@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74217}
This missing include was undetected because trace_perf.cc is only
built if the checkout_google_benchmark custom gclient variable is
defined.
Bug: none
Change-Id: If2016edad4df382f14903593ea18066f7759c4d5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2698387
Reviewed-by: Marja Hölttä <marja@chromium.org>
Commit-Queue: Chris Mumford <cmumford@google.com>
Cr-Commit-Position: refs/heads/master@{#72825}
The CPPGC_BUILD_IN_V8 define (used for tracing) isn't propagated from
v8_base_without_compiler to cppgc_base, which breaks build with
perfetto. Instead use a gn args to specify standalone builds (defaulted
to false) and use that to choose the right tracing implementation.
Bug: chromium:1056170
Change-Id: I70bce819d45fb133b6f932a50a5d027e39f3e5b9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2555007
Auto-Submit: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71356}
This CL removes the GetTraceDescriptor virtual call from garbage
collected mixins and replaces it with querying the object start
bitmap.
The CL also removes the mixin macros which are now no longer needed.
Bug: chromium:1056170
Change-Id: I27ed299f93025d09a3bb3f0d17b14bed3c200565
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2287508
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68787}
This adds Google benchmark for microbenchmarking C++ code as an
optional dependency.
To enable, add the following to the .gclient before syncing
"custom_vars": {
"checkout_google_benchmark": True
}
Change-Id: Id0eab772dd71558906658ef4bb60e31acd665948
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2275964
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68663}