35 Commits
Author SHA1 Message Date
Takuto Ikuta db3548f67b [build] Avoid propagating run_torque and v8_tracing via public headers
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}
2026-09-28 04:47:28 -07:00
Andreas Haas 401e805dd6 [sandbox] Partition CppHeapPointerTags
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}
2026-09-21 14:37:24 -07:00
Igor Sheludko e74e6c524c [cppgc] Rename src/heap/cppgc/ to src/heap/cppgc-internal/
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}
2026-06-22 02:41:04 -07:00
Andreas Haas 0a48e20d91 [api] Enforce tag range for v8::Object::Wrap
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}
2026-06-11 01:03:30 -07:00
Camillo Bruni 23c5453bdc [d8] Better error messages for invalid icu data files
Bug: 493495639
Change-Id: I59157c059cbc016c319425d5f2279d6b3161f34e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7679153
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Jakob Linke <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/main@{#105903}
2026-03-19 03:43:38 -07:00
Andreas Haas b18d178dce [api] Promote the deprecation of API functions
Bug: 436799229, 433909571
Change-Id: I45d24cb828382be9053a1747c534a33bf511c9bd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7494936
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#104879}
2026-01-23 06:09:46 -08:00
Andreas Haas d0dfb45906 [api] Add tag parameter to Context::GetAlignedPointerFromEmbedderData
Bug: 433909571

Change-Id: I51bc8d628fcecf21ff4fc6867bfdbc03fbe837cb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6964617
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#102690}
2025-09-23 05:21:00 -07:00
Andreas Haas 4de1c836b1 [api] Add type tag parameters to apis writing EmbedderData
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}
2025-08-12 07:43:42 -07:00
Andreas Haas 05fcc0601a [api] Add base class for Object::Wrap() inputs
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}
2025-06-03 07:41:18 -07:00
Nikolaos Papaspyrou 9fcf2c75eb [test] Fix benchmark initialization
After https://crrev.com/c/6348469, V8::Initialize() calls
cppgc::InitializeProcess(), so the latter needs not be called
explicitly during benchmark initialization.

Change-Id: If4d429e5c776f530701d5a778c03da6644a9723a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6540508
Commit-Queue: Nikolaos Papaspyrou <nikolaos@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#100238}
2025-05-13 04:46:44 -07:00
Omer Katz 22c8aabfbc Reland "[cppgc] Use blink_gc_plugin in v8"
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}
2025-03-19 01:21:48 -07:00
Shu-yu Guo 25d41dd92f Revert "[cppgc] Use blink_gc_plugin in v8"
This reverts commit 017b2a5132.

Reason for revert: Suspicion for https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux64%20TSAN%20-%20debug/9422/overview

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
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: Ib77d269893bb7d4130e3efd82fb8086f143a1d3f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6369863
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#99318}
2025-03-18 17:13:09 -07:00
Omer Katz 017b2a5132 [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}
2025-03-18 11:28:10 -07:00
Andreas Haas 28984ccae9 [benchmark] Add a benchmark to compare fast API calls to regular ones
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}
2024-11-21 17:17:20 +00:00
Michael Lippautz 59b2e38692 [test] Fix bindings benchmark
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}
2024-05-06 18:25:43 +00:00
Michael Lippautz 6e3919b7a6 [api] Deprecate v8::WrapperDescriptor
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}
2024-05-06 07:38:54 +00:00
Michael Lippautz 5495678083 [api] Expose new ways to wrap C++ objects with JS wrapper objects
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}
2024-04-03 08:36:17 +00:00
Michael Lippautz 9729069a16 Add benchmark for bindings operations
Adds a benchmark representing bindings setup.

Results:
------------------------------------------------------------------
Benchmark                                     Time             CPU
------------------------------------------------------------------
OldBindings/AccessorReturningWrapper    1510244 ns      1510078 ns
NewBindings/AccessorReturningWrapper    1248103 ns      1247787 ns
OldBindings/AccessorReturningSmi         622348 ns       622332 ns
NewBindings/AccessorReturningSmi         581722 ns       581705 ns

Bug: chromium:328117814
Change-Id: I6557a39b4c05c69e3751f6d0b7e172b29e47126c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5382158
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93075}
2024-03-27 19:54:45 +00:00
Michael Achenbach 66253e1b99 [build] Use a new google_benchmark location to avoid conflicts
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}
2024-01-10 14:37:11 +00:00
Michael Achenbach 5e1afae87b [infra] Get google_benchmark from DEPS
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}
2024-01-04 10:00:57 +00:00
Matthias Liedtke 51fd29ca5d Update google_benchmark (trusted)
--- Manual changes: ---

1) Updated version of google_benchmark to fix windows compile error.
  New range: https://chromium.googlesource.com/external/github.com/google/benchmark/+log/e8baf26..b177433
2) Remove unused sleep.[cc|h] from BUILD.gn. (Removed here: https://github.com/google/benchmark/pull/1549)
3) Fix deprecation warnings (treated as errors) in allocation_perf.cc.
  benchmark::DoNotOptimize has deprecated overloads due to https://github.com/google/benchmark/pull/1493.

Bug: 1425054

--- Original message generated by autoroll: ---

Rolling v8/third_party/google_benchmark/src: https://chromium.googlesource.com/external/github.com/google/benchmark/+log/e8baf26..efc89f0

link to benchmark directly for tests that aren't link_main_test (#1576) (dominic)
https://chromium.googlesource.com/external/github.com/google/benchmark/+/efc89f0

Convert uses of `const char*` to `std::string` (#1567) (dominic)
https://chromium.googlesource.com/external/github.com/google/benchmark/+/46d3c84

add '@' to correctly reference build file for libpfm (#1575) (dominic)
https://chromium.googlesource.com/external/github.com/google/benchmark/+/68aa190

Address warnings on NVIDIA nvc++ (#1573) (Henrique Bucher)
https://chromium.googlesource.com/external/github.com/google/benchmark/+/9f7dc38

simplify setting C++ standard (Dominic Hamon)
https://chromium.googlesource.com/external/github.com/google/benchmark/+/1b507cb

[FR] Provide public accessors to benchmark name and arguments #1551 (#1563) (Mike Apodaca)
https://chromium.googlesource.com/external/github.com/google/benchmark/+/f32748c

use std::string for skip messages (#1571) (dominic)
https://chromium.googlesource.com/external/github.com/google/benchmark/+/060d762

[FR] state.SkipWithMessage #963 (#1564) (Mike Apodaca)
https://chromium.googlesource.com/external/github.com/google/benchmark/+/adb0d3d

...

Change-Id: I69218b84b88fb1da25e740d7fb623528d526b85b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4429376
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#87139}
2023-04-18 12:05:43 +00:00
Steinar H. Gunderson 6da6e45099 Microoptimizations in FastDtoa.
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}
2022-12-16 15:03:39 +00:00
Michael Lippautz 5ab4b89e12 cppgc: Add binary trees benchmark
Change-Id: I4886923bd3b2c29f5f317fbfab078af4d5dd8510
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3289156
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77981}
2021-11-18 16:42:24 +00:00
Michael Lippautz 3eae9d57ef cppgc: Initialize benchmark process only once
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}
2021-11-16 13:15:44 +00:00
Dan Elphick e3d63e962f [build] Fix gn check errors in test/benchmarks/cpp
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}
2021-04-27 10:35:33 +00:00
Michael Lippautz 707c5a0b38 cppgc: Fix empty benchmark on Windows
Keep idiomatic state loop but rely on USE() to avoid
warning about unused variables.

Bug: v8:11687
Change-Id: Icde295723c5d389d827280f70a65776866d4e7a9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2850645
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74200}
2021-04-27 07:52:52 +00:00
Almothana Athamneh 4a9810d85f Make Google benchmark dependency a default
Bug: v8:11639
Change-Id: I3352261c5593c33154aa8f1a931bf3ee351f536a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2831487
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Almothana Athamneh <almuthanna@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74098}
2021-04-21 12:19:40 +00:00
Michael Lippautz 224b7f079c cppgc: Fix trace performance benchmark
Bug: v8:11635
Change-Id: I71c5542a503ca4b94fc3c8746e96fb0bc4e6c1f8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2822628
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73922}
2021-04-12 19:31:33 +00:00
Chris Mumford 84d2527bb0 IWYU: Added missing include: include/cppgc/persistent.h
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}
2021-02-17 17:37:29 +00:00
Michael Lippautz a2cf158ad4 cppgc-js: Report C++ memory to V8's heap growing
Add reporting of C++ memory to V8's heap growing strategy via
existing EmbedderHeapTracer interface.

In addition, introduce API-level NoGarbageCollectionScope which
allows to temporarily avoid scheduling GC finalizations. Replace
internal NoGCScope with NoGarbageCollectionScope and remove
NoGCScope.

Bug: chromium:1056170
Change-Id: I0ad3dfd67eb81f09f48e2ab87f9bbece7491ed71
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2650210
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72345}
2021-01-27 00:32:05 +00:00
Omer Katz 0e0d1b0d7c cppgc: Fix cppgc build
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}
2020-11-24 09:35:50 +00:00
Omer Katz ab2b18e1be cppgc: Use object start bitmap to trace mixins
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}
2020-07-10 12:00:45 +00:00
Michael Lippautz 5ab2769012 cppgc: Add micro benchmark for tracing objects
The benchmarks cover static vs dynamic tracing of an object where the
header is computed statically vs using the object start bitmap,
respectively.

$ out/x64.release/cppgc_basic_benchmarks --benchmark_filter=Trace/*

Running out/x64.release/cppgc_basic_benchmarks
Run on (56 X 3500 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x28)
  L1 Instruction 32 KiB (x28)
  L2 Unified 256 KiB (x28)
  L3 Unified 35840 KiB (x2)
Load Average: 0.24, 0.26, 0.26
--------------------------------------------------------
Benchmark              Time             CPU   Iterations
--------------------------------------------------------
Trace/Static        1.78 ns         1.78 ns    393324147
Trace/Dynamic       3.27 ns         3.27 ns    215078276

2020-07-03T15: 21:25+02:00
Change-Id: I8bf5a8ed71a8991873160353e26f96214c038730
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2280099
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68675}
2020-07-03 14:50:43 +00:00
Michael Lippautz 66fc94313b cppgc: Add allocation benchmark
Output:

$ out/x64.release/cppgc_allocation_benchmark --benchmark_repetitions=3

Running out/x64.release/cppgc_allocation_benchmark
Run on (56 X 3500 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x28)
  L1 Instruction 32 KiB (x28)
  L2 Unified 256 KiB (x28)
  L3 Unified 35840 KiB (x2)
Load Average: 0.23, 0.27, 0.27
--------------------------------------------------------------------------------
Benchmark                      Time             CPU   Iterations UserCounters...
--------------------------------------------------------------------------------
Allocate/Tiny               17.0 ns         17.0 ns     40348381 bytes_per_second=55.9692M/s
Allocate/Tiny               17.1 ns         17.1 ns     40348381 bytes_per_second=55.8961M/s
Allocate/Tiny               17.2 ns         17.2 ns     40348381 bytes_per_second=55.3108M/s
Allocate/Tiny_mean          17.1 ns         17.1 ns            3 bytes_per_second=55.7254M/s
Allocate/Tiny_median        17.1 ns         17.1 ns            3 bytes_per_second=55.8961M/s
Allocate/Tiny_stddev       0.112 ns        0.111 ns            3 bytes_per_second=369.571k/s
Allocate/Large             40339 ns        40334 ns        17707 bytes_per_second=1.51326G/s
Allocate/Large             40350 ns        40343 ns        17707 bytes_per_second=1.51292G/s
Allocate/Large             40205 ns        40192 ns        17707 bytes_per_second=1.51861G/s
Allocate/Large_mean        40298 ns        40290 ns            3 bytes_per_second=1.51493G/s
Allocate/Large_median      40339 ns        40334 ns            3 bytes_per_second=1.51326G/s
Allocate/Large_stddev       81.2 ns         84.7 ns            3 bytes_per_second=3.26614M/s

2020-07-03T09: 14:23+02:00
Change-Id: I25a55beb5ea1718af76e638b752bf7d67cfe373e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2280086
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68672}
2020-07-03 11:58:21 +00:00
Michael Lippautz b804266f72 Add google_benchmark depdendency
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}
2020-07-02 20:11:29 +00:00