SourceLocation is almost only used for debug messages in TurboShaft, so
pass it only in debug mode. Additionally, std::source_location (that it
wraps) is a single pointer, so we can efficiently pass it by value
rather than const ref.
This reduces release build d8 by ~170kb, of which ~4kb is the by-value
passing.
Change-Id: Ia6b592f094dad0987b8a886bf16a7d3fe8611eb1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6888815
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#102072}
This is a reland of commit 3863ce60d3
On Fuchsia, `base::OS::Initialize()`, called by `V8::Initialize()`,
initializes the VMEX resource, which is needed to allocate memory with
the PageAllocator of the default platform. However, the original CL
called `cppgc::InitializeProcess()` before `V8::Initialize()`, and
therefore the allocation of the GCInfoTable failed. Calling
`cppgc::InitializeProcess()` after `V8::Initialize()` fixed the issue.
Original change's description:
> Reland "[cppgc] Automatically set up CppHeap if not specially provided"
>
> This is a reland of commit fe8642e294
>
> The test `GlobalHandlesTest.TotalSizeTracedNode` tested that after a GC,
> traced handles would not exist anymore. However, with CSS a traced
> handle stayed alive. The test gets fixed by opening a
> DisableConservativeStackScanningScopeForTesting scope.
>
> Original change's description:
> > [cppgc] Automatically set up CppHeap if not specially provided
> >
> > It is planned to allow the usage of cppgc in V8. For that it has to be
> > guaranteed that a CppHeap exists for every isolate. So far the CppHeap
> > was provided by the embedder, and if the embedder did not set up a
> > CppHeap, it would not exist, and V8 could not use it. With this CL, a
> > default CppHeap gets created when no CppHeap is provided by the
> > embedder.
Bug: 42203693
Change-Id: Ieb8a11880af1621ed03e8a69e82ce22479be1d32
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6348469
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#99346}
This reverts commit 3863ce60d3.
Reason for revert: Suspected to failing the chromium roll:
https://ci.chromium.org/ui/p/chromium/builders/try/fuchsia-x64-cast-receiver-rel/960200/overview
> Fatal process out of memory: Oilpan: GCInfoTable initial
> reservation.
Original change's description:
> Reland "[cppgc] Automatically set up CppHeap if not specially provided"
>
> This is a reland of commit fe8642e294
>
> The test `GlobalHandlesTest.TotalSizeTracedNode` tested that after a GC,
> traced handles would not exist anymore. However, with CSS a traced
> handle stayed alive. The test gets fixed by opening a
> DisableConservativeStackScanningScopeForTesting scope.
>
> Original change's description:
> > [cppgc] Automatically set up CppHeap if not specially provided
> >
> > It is planned to allow the usage of cppgc in V8. For that it has to be
> > guaranteed that a CppHeap exists for every isolate. So far the CppHeap
> > was provided by the embedder, and if the embedder did not set up a
> > CppHeap, it would not exist, and V8 could not use it. With this CL, a
> > default CppHeap gets created when no CppHeap is provided by the
> > embedder.
> >
> > Bug: 42203693
> > Change-Id: I59e04618c1d6cdac8091216117a30519f65d7235
> > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6190932
> > Commit-Queue: Andreas Haas <ahaas@chromium.org>
> > Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#99090}
>
> Bug: 42203693
> Change-Id: Id548ef84aecf1d20b3da8c943e9dfa5f694eeaf7
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6333562
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Andreas Haas <ahaas@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#99191}
Bug: 42203693
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I795d21a27f5bf6ea17448add04d73f25e39eb81c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6346807
Owners-Override: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#99202}
This is a reland of commit fe8642e294
The test `GlobalHandlesTest.TotalSizeTracedNode` tested that after a GC,
traced handles would not exist anymore. However, with CSS a traced
handle stayed alive. The test gets fixed by opening a
DisableConservativeStackScanningScopeForTesting scope.
Original change's description:
> [cppgc] Automatically set up CppHeap if not specially provided
>
> It is planned to allow the usage of cppgc in V8. For that it has to be
> guaranteed that a CppHeap exists for every isolate. So far the CppHeap
> was provided by the embedder, and if the embedder did not set up a
> CppHeap, it would not exist, and V8 could not use it. With this CL, a
> default CppHeap gets created when no CppHeap is provided by the
> embedder.
>
> Bug: 42203693
> Change-Id: I59e04618c1d6cdac8091216117a30519f65d7235
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6190932
> Commit-Queue: Andreas Haas <ahaas@chromium.org>
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#99090}
Bug: 42203693
Change-Id: Id548ef84aecf1d20b3da8c943e9dfa5f694eeaf7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6333562
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#99191}
This reverts commit fe8642e294.
Reason for revert: https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux/59854/overview
Original change's description:
> [cppgc] Automatically set up CppHeap if not specially provided
>
> It is planned to allow the usage of cppgc in V8. For that it has to be
> guaranteed that a CppHeap exists for every isolate. So far the CppHeap
> was provided by the embedder, and if the embedder did not set up a
> CppHeap, it would not exist, and V8 could not use it. With this CL, a
> default CppHeap gets created when no CppHeap is provided by the
> embedder.
>
> Bug: 42203693
> Change-Id: I59e04618c1d6cdac8091216117a30519f65d7235
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6190932
> Commit-Queue: Andreas Haas <ahaas@chromium.org>
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#99090}
Bug: 42203693
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I56768116b576e48c657b5461113a9f34db9f764f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6330140
Owners-Override: Manos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#99091}
It is planned to allow the usage of cppgc in V8. For that it has to be
guaranteed that a CppHeap exists for every isolate. So far the CppHeap
was provided by the embedder, and if the embedder did not set up a
CppHeap, it would not exist, and V8 could not use it. With this CL, a
default CppHeap gets created when no CppHeap is provided by the
embedder.
Bug: 42203693
Change-Id: I59e04618c1d6cdac8091216117a30519f65d7235
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6190932
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#99090}
This CL makes GetForegroundTaskRunner() with priority usable
by providing a default implementation and overriding it in subclasses.
This will be use in follow-up to change priority of incremental marking
behind and experiment.
Follow-up: Delete GetForegroundTaskRunner() with no priority once
all embedders implement the version with priority.
Bug: chromium:1448758
Change-Id: I98423ac25a3eb12210ad127983be1a86a611e37c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5758110
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#95697}
This will allow the embedder to select a larger heap size if Oilpan was
compiled with CPPGC_ENABLE_LARGER_CAGE. For the time being, we
functionally snap to one of three sizes: 4GB (default), 8GB, 16GB.
Bug: chromium:1434388
Change-Id: If75812bf074659647f1e8c3e17a2d16253ce8034
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4582690
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Kevin Babbitt <kbabbitt@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#88329}
Before this CL, the caged heap was lazily initialized upon the first
call of HeapBase ctor. CagedHeap keeps a pointer to PageAllocator which
was provided from cppgc::Platform through the HeapBase ctor. This was
not generally safe: the platform is not enforced to be singleton. If it
happens to die first, then CagedHeap will have a stale pointer. The CL
fixes it simply by moving caged-heap initialization to
cppgc::InitializeProcess(), which already requires a constantly living
PageAllocator.
Bug: chromium:1338030
Change-Id: Ifb70a2db233ef36a99c919db09bed9ff9f3708ac
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3732107
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81422}
Outside of unittests, if someone tried to delete a GCed object manually
they would get a silent crash without a stacktrace or any error
messages. This CL replaces the silent crash with an informative message.
Change-Id: Ied8895dab43ce7e3a9bf778b13e77d377d269fce
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3468346
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Auto-Submit: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79141}
On OSes other than Windows and Fuchsia the write barrier assumes that
the caged heap is allocated below the stack.
Add CHECK that the assumption holds.
Bug: chromium:1056170
Change-Id: I64c790e61b4cfa2adb8274ed74111f0433e9aefb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3080570
Auto-Submit: Omer Katz <omerkatz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76173}
Model cppgc::InitializeProcess()/cppgc::ShutdownProcess() similar to
V8's InitializePlatform()/ShutdownPlatform() in that we allow the pair
to be called multiple times.
GCInfoTable will not be freed on ShutdownProcess though as the current
global design uses static indices to retrieve per-type metadata.
Drive-by: Remove stale ShutdownProcess() call.
Change-Id: Ia9b50325a964e85a72f3ef218e72bc386b69be51
Bug: chromium:1176416, chromium:1056170
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2685171
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72630}
This CL adds tracing scopes for the various cppgc classes.
Scopes use TRACE_EVENT_BEGIN and TRACE_EVENT_END macros to report trace
events. To do so they need to include trace-event.h. For unified heap
builds, trace-event.h forwards to v8's src/tracing/trace-event.h. For
other builds, trace-event.h provides a subset of
src/tracing/trace-event.h that covers just the parts used by cppgc.
This CL covers what we need for traces and blink gc metrics (up to
renaming events from BlinkGC.* to CppGC.*). UMA and UKM are not yet
handled.
Bug: chromium:1056170
Change-Id: Id92e84b27259ff0aadae7692f3d79d30896fb8e7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2540548
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71284}
Adds allocation-based heap growing strategy that triggers GC based on
some limit. The limit is computed based on previous live memory and a
constant growing factor.
For invoking GC, we support two modes: with and without conservative
stack scanning. Without conservative stack scanning, an invoker makes
sure that we schedule a GC without stack using the existing platform.
Bug: chromium:1056170
Change-Id: I1808aeb5806a6ddd5501b556d6b6b129a85b9cda
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2228887
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68235}
Split platform into a process-global initialization part and per-heap
platform objects.
These platform objects still contain allocators and executors. With
per-heap platforms GetForegroundTaskRunner() returns by definition the
correct runner.
In future, when initialized throuhg V8, an adapter can be used to
translate between the different platforms, avoiding the needed for V8
embedders to provide additional information.
Bug: chromium:1056170
Change-Id: I11bdd15e945687cfbdf38cae4137facb02559e0a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2218030
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68059}
This moves concurrent and incremental sweeping from Blink. This also
adds TestPlatform that makes it easier to test concurrent and
incremental sweeping.
Drive-by: fix unmarking of large pages.
Bug: chromium:1056170
Change-Id: Ifd50ff67b9df17ff117a5f4d4eb5a2937d3023be
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2207132
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67969}
- Fixes includes to be relative to include/ which allows embedders
to just add V8's include directory to get started.
- Adds public target for the library as "cppgc".
Bug: chromium:1056170
Change-Id: Iec9b644e20016a5d7281275b739821a050fd2540
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2157366
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67278}
This CL adds basic infrastructure for:
- MakeGarbageCollected
- GarbageCollected and related type traits
- Heap (API / internal)
- Basic allocation based on malloc
- CollectGarbage without marking
This allows for allocation and reclamation through an explicit GC
call. No objects are held alive from any source (stack, globals,
refs), yet.
The exact wiring of platform is future work.
Change-Id: I81b7c0ba7b525188f8c0bf9de3b7af35d34322af
Bug: chromium:1056170
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2120538
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66887}
GCInfo and its related infrastructure is used to record information
about types. Currently, we store finalization and vtable information.
Future changes will introduce naming and tracing, similar to Oilpan in
Blink.
Information is stored in a process-wide global table that is
maintained at runtime. For static builds such information can be
recorded in the binary without the runtime overhead which is future
work.
This ports `third_party/blink/renderer/platform/heap/gc_info.{h,cc}`
on a semantic level. In addition to adjusting to V8's needs, we also
re-commit the already filled parts of the info table as read-only when
possible, making it harder to override type information.
Bug: chromium:1056170
Change-Id: Ib01eb24e6f8a94a4a647efde7af37689f8c20ba2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2111214
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66847}