393 Commits
Author SHA1 Message Date
Omer Katz fec11869eb [M157] [cppgc] Update the Steele-style barrier to always retrace
Original change's description:
> [cppgc] Update the Steele-style barrier to always retrace
>
> The barrier retraced objects only if they were already marked. This
> doesn't work well with concurrent marking because the object could be
> marked and the main thread hasn't observed it yet. Instead change the
> barrier to mark regardless of whether the object was already marked.
>
> Bug: 575143870
> Change-Id: I5f027c5c5c28cc23fc25d562d266081afe216dc1
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8614239
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Omer Katz <omerkatz@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#111098}

(cherry picked from commit e19035b316)

Bug: 577337027,575143870
Change-Id: I5f027c5c5c28cc23fc25d562d266081afe216dc1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8663653
Commit-Queue: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: chrome-cherry-picker@chops-service-accounts.iam.gserviceaccount.com <chrome-cherry-picker@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/15.7@{#22}
Cr-Branched-From: d2463ed6f2dfd0bdbb642624bd3d0e7d3e792555-refs/heads/15.7.112@{#1}
Cr-Branched-From: e691155d010ebfd5dbc3204c53a14426e724dca7-refs/heads/main@{#110573}
2026-10-27 01:05:57 -07:00
Shelley Vohr 5404e0f85a [cppgc] Use _AddressOfReturnAddress() for StackStartMarker under MSVC
include/cppgc/heap.h is a public header, and since b3cb54c7e6
("[heap] Add StackStartMarker for cppgc") it calls
__builtin_frame_address(0) unconditionally. That builtin does not exist
in MSVC, so any translation unit built with cl.exe that includes the
header (directly or through v8-cppgc.h) fails to compile, even if it
never constructs a StackStartMarker.

Use _AddressOfReturnAddress() when V8_CC_MSVC is set, which is what
base::Stack::GetCurrentStackPosition() already does for the same
purpose, and keep __builtin_frame_address(0) elsewhere.

Bug: none
Change-Id: Icd4c0238cb277c8e1b73454534ffb2519b302ce9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8361192
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Shelley Vohr <shelley.vohr@gmail.com>
Cr-Commit-Position: refs/heads/main@{#109737}
2026-09-08 13:28:08 -07:00
Omer Katz ca9dfd252d [cppgc] Check for overflow in subtle::Resize
Bug: 547027737
Change-Id: Ibc35f4826a2024a2f8c900bf8d165a5de53e8007
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8256439
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#109418}
2026-08-21 02:35:46 -07:00
Michael Lippautz eb0d8fda0c cppgc: Annotate all write barrier slow paths with preserve most
The most critical barrier (CombinedWriteBarrierSlow) was already
annotated. Add more annotations to cover all the collection use cases
as well.

Speedometer3
👍 TodoMVC-Preact-Complex-DOM                  [ -1.1%,  -0.0%]

Bug: 537244297
Change-Id: Ie9f1823ba99f5e2ca8b15d446c10acf88b302d49
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8126059
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#108791}
2026-07-21 09:21:18 -07:00
Anton Bikineev dab56f9319 cppgc: Optimize allocation by placing GCInfo in separate section
Place GCInfo objects into a separate section (`gc_info_section` or
`__DATA,gc_info_section`) and compute the index directly as an offset
from the start of the section. This avoids the overhead of dynamic
registration and checking on allocation. This also eliminates the need
for `GCInfoTable` when active.

The optimization is enabled by default on desktop (Linux and macOS)
under the `cppgc_enable_object_section_gcinfo` GN flag for non-component
builds.

ELF and MachO platforms are supported.

TAG=agy

Change-Id: I83b5bf36dd8f0d0f469caf3dc8db4eb9464c2250
Bug: 522693606
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7918333
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#107939}
2026-06-12 03:53:46 -07:00
Anton Bikineev 0ade545a38 [cppgc] Don't set object start bit on regular LAB allocations
To improve allocation performance, this CL avoids setting the object
start bit in the ObjectStartBitmap during fast-path LAB allocations for
regular (non-mixin) objects.

Since the concurrent/incremental marker only needs to perform
inner-pointer resolution for mixin types, we can safely omit setting
the start bit for non-mixin objects during allocation. The bitmap is
instead repaired on-the-fly by the mutator when needed, and fully
populated during sweeping.

Detailed changes:
1. Allocation Optimization: Removed the `SetBit` call in `ObjectAllocator`
   for LAB allocations, except when `may_contain_mixins == kYes`. Mixins
   continue to set their start bit immediately to ensure they can be
   reliably found by the concurrent marker.
2. On-the-fly Repair (Mutator): `BasePage::ObjectHeaderFromInnerAddress`
   now detects if the bitmap has gaps and repairs it on-the-fly by
   linearizing the bitmap from the last known set bit up to the requested
   address. This is safe as it is only called by the mutator.
3. Concurrent Lookup (Marker): Introduced
   `BasePage::ObjectHeaderFromInnerAddressConcurrent` for the concurrent
   marker. To avoid data races with the mutator, it strictly reads from
   the bitmap and does not attempt to repair it. This is safe because the
   concurrent marker only resolves inner pointers for mixin objects, which
   are guaranteed to have had their start bits set upon allocation.
4. Sweeper Updates: The sweeper now populates the start bit for all
   live objects and free-list entries, restoring the bitmap to a fully
   consistent state at the end of the sweep phase.

Design Doc: https://docs.google.com/document/d/1i4Sx-p6a_toYLwEt4HnQeJ9Xm28FmevwT2e5DzkGIaQ/edit?usp=sharing
Bug: 516682115


Change-Id: Ib8a3dfd28778d3b07beb5bf8f38331861b384b6b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7828550
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#107560}
2026-05-26 05:06:38 -07:00
Dominik Inführ ec3ca53c8a [cppgc] Fix ASAN false positive in handle location
Enabling cppgc_enable_object_names causes ASAN false positives
when iterating cross-thread persistents. This is because of the
access to the location_ field. This CL fixes this by silencing
ASAN for this access similar to what we do for GetNodeFromGC() or
ClearFromGC().

Bug: 497855658
Change-Id: I6af31de5b6273a8cfde835388dbf64e826a65ef9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7865927
Auto-Submit: Dominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#107520}
2026-05-22 03:06:03 -07:00
Leszek Swirski d1db2e5992 Revert "[heap] Enable cppgc_enable_object_names by default on Desktop"
This reverts commit e1dbd978b6.

Reason for revert: https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux64%20-%20official/14106/overview

Original change's description:
> [heap] Enable cppgc_enable_object_names by default on Desktop
>
> This CL initially enables this "gn arg" on Desktop platforms. Android
> and Fuchsia can be enabled later as well.
>
> Bug: 497855658
> Change-Id: I09696c4df93f403a7eff349a74037e1ee167a557
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7807042
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#107492}

Bug: 497855658
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I04cade7ef4886dff232768779eefd90f9816fafa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7867736
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#107500}
2026-05-21 10:40:16 -07:00
Dominik Inführ e1dbd978b6 [heap] Enable cppgc_enable_object_names by default on Desktop
This CL initially enables this "gn arg" on Desktop platforms. Android
and Fuchsia can be enabled later as well.

Bug: 497855658
Change-Id: I09696c4df93f403a7eff349a74037e1ee167a557
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7807042
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#107492}
2026-05-21 05:53:02 -07:00
Matthias Liedtke 32d567d072 [cleanup] Apply readability-braces-around-statements
Change-Id: Icb5b0ab02689c969ec2a14be7abf1759f1954e45
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7827654
SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#107187}
2026-05-08 07:40:22 -07:00
Scott Haseley 5a113ffdf2 [cppgc] Clear EphemeronPair::key when the key is dead
EphemeronPair's value is automatically cleared when the key is dead, but
the key is not, which leaves a dangling pointer when the weak key is
GCed. This CL fixes that by clearing the key also.

Bug: chromium:508082779
Change-Id: Icbd3d3ccadb4f12ff89dbac7ceee83f63fe256c4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7817830
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Scott Haseley <shaseley@chromium.org>
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/main@{#107080}
2026-05-05 16:40:42 -07:00
Dominik Inführ b3cb54c7e6 [heap] Add StackStartMarker for cppgc
For conservative stack scanning we currently scan for references up
until the stack top. But this includes stack frames like that of
_start which definitely do not have pointers into the cppgc heap.

This CL adds a StackStartMarker class which embedders can optionally
use to decrease the stack height considered during conservative
stack scanning. This reduces the chance of false positives.

Bug: 492198560
Change-Id: Ic9a7d428684bb835d372873beb821e412e131246
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7666257
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#105816}
2026-03-16 05:40:16 -07:00
Steinar H Gunderson 99205e3f1e Revert "Make Uncompress(Compress(ptr)) into a no-op."
This reverts commit b284c48c16.

Reason for revert: Performance regressions in event dispatch, presumably from LLVM [[assume]] weaknesses; since we don't see any clear wins anywhere else (besides a bit in size), it's easier to just revert.

Original change's description:
> Make Uncompress(Compress(ptr)) into a no-op.
>
> Add an [[assume]] annotation so that Clang understands this; it doesn't
> by itself (because it requires information about high bits in the
> uncompressed pointer that we've found it hard to teach it).
>
> Doesn't give a Speedometer win by itself, but it reduces the APK size
> of 64-bit Chrome by ~11 kB.
>
> Change-Id: I1480f0032e3733972553b1e34eb4a7def5f157ed
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7277326
> Reviewed-by: Anton Bikineev <bikineev@chromium.org>
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Steinar H Gunderson <sesse@chromium.org>
> Auto-Submit: Steinar H Gunderson <sesse@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#104529}

Fixed: 474389112
Change-Id: I924a6613291a7f422736b3b914e7cc8dd58b2676
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7487369
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Steinar H Gunderson <sesse@chromium.org>
Cr-Commit-Position: refs/heads/main@{#104742}
2026-01-16 05:02:43 -08:00
Steinar H. Gunderson b284c48c16 Make Uncompress(Compress(ptr)) into a no-op.
Add an [[assume]] annotation so that Clang understands this; it doesn't
by itself (because it requires information about high bits in the
uncompressed pointer that we've found it hard to teach it).

Doesn't give a Speedometer win by itself, but it reduces the APK size
of 64-bit Chrome by ~11 kB.

Change-Id: I1480f0032e3733972553b1e34eb4a7def5f157ed
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7277326
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Steinar H Gunderson <sesse@chromium.org>
Auto-Submit: Steinar H Gunderson <sesse@chromium.org>
Cr-Commit-Position: refs/heads/main@{#104529}
2026-01-07 10:15:21 -08:00
Michael Lippautz 6d7526671e [heap] HoH: Use lower bits for GCInfoIndex
The GCInfoIndex is always written on allocation. This does not affect
writing/reading the construction bit which happens with a mask.

This safes one shift in the allocation fast path (for GCInfoIndex).

Drive-by: Use std::atomic_ref instead of casts to std::atomic.

Change-Id: I8932f46ef582558d30eded9bab9b8d210a0ee1cb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7213182
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#104077}
2025-12-03 03:53:20 -08:00
Omer Katz 95caad629e [cppgc] Add static_assert to Visitor::Trace(const T&)
Enforce that the Visitor::Trace(const T&) method that is used for
non-reference fields (e.g. embedded DISALLOW_NEW objects) is never
called for GCed types.

Change-Id: Id896ff1dcec3c42a7e9bc11c4a64e850d8e7e143
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7046265
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#103236}
2025-10-21 03:10:49 -07:00
Kevin Wang 98b1320334 Display size and count of blink dom objects in memory-infra.
The blink contains two type of object: the dom objects have explicitly
specified names via using NameProvider, and other cpp internal objects
have hide names 'InternalNode'. Now we must enable
CPPGC_SUPPORTS_OBJECT_NAMES macro to show the name and size of all blink
objects in memory-infra. I think it is better that display the count and
size of these dom objects inherited from NameProvider without enabling
 CPPGC_SUPPORTS_OBJECT_NAMES macro in release version.
It will provide great convenience to help us debug the memory issues of
the blink object.

Bug: 445232188
Change-Id: I436cd08e0ec337f72ac95529f0a73d734d2c0bd3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6950858
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#103057}
2025-10-10 05:20:13 -07:00
Leszek Swirski 44f769baca [debug] Only pass SourceLocation in debug in TurboShaft
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}
2025-08-27 06:56:09 -07:00
Takuto Ikuta cbae911f49 cppgc: Add missing includes
This is to fix error in clang modules build.

Bug: 40263312
Change-Id: I058a376ac17acaa29962aa30622f50c2e4e7051e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6586224
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Cr-Commit-Position: refs/heads/main@{#100491}
2025-05-26 04:35:32 -07:00
Anton Bikineev 4a7f704b35 cppgc: Avoid static_cast to Pointee* on tracing TaggedUncompressedMember
This is done by
 - rename GetRawAtomic to GetAtomic
 - add GetRawAtomic that doesn't static_cast

Bug: 418024460
Change-Id: I9fb22057857ebcf195e21fca202106d686a82c12
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6554249
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#100320}
2025-05-16 06:45:53 -07:00
Anton Bikineev 2d06338e74 cppgc: Add Visitor::IsConcurrent() API
The recent change that got rid of clearing HeapVector's inlined storage
introduced an issue for the barrier, which may still invoke the regular
tracing routines for scanning on-stack inlined storages, which may run
into unitialized storage.

The CL introduces a way to distinguish the main-thread visitor (plus the
write barrier) and the concurrent marker. For the main thread marker the
main thread visitor may simply scan inlined storage up until the actual
size, not capacity.

Bug: 417904220
Change-Id: I8caf2ae644fc1ee975958d102414d369595d63e4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6550401
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#100307}
2025-05-15 10:42:43 -07:00
Anton Bikineev 90682fa80e cppgc: Fix race in TaggedUncompressedMember
The load by the marker must be atomic.

Bug: 416590537
Change-Id: Icce5f93c972d5b2cc9e36c1cd2631c533f08f137
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6550019
Auto-Submit: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#100287}
2025-05-15 03:23:25 -07:00
Jakob Kummerow 6ef89d114b [cleanup] Modernize std::*::value and ::type
Mechanically replacing `std::foo<X>::value` with `std::foo_v<X>`,
and the same for `::type` -> `_t`.

Change-Id: I543dda07ba4c95534cdcd51f1f438f2626be8273
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6491388
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#99940}
2025-04-28 03:59:57 -07:00
Anton Bikineev fa8a3723d5 cppgc: Introduce subtle::TaggedUncompressedMember<>.
The new class allows to use one alignment bit for tagging.

Bug: 413291844
Change-Id: I00fb1b4f52c5e8830a3c69463f63192ab199986a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6488987
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#99923}
2025-04-25 11:28:04 -07:00
Omer Katz 374de77513 [cppgc] Remove CPPGC_PLUGIN_IGNORE annotations
The macro is kept unused for now in case it is needed again.

Bug: 402564649
Change-Id: I2c050d31c9b14624bdfa5069ca455e22c5a4b498
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6368659
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Omer Katz <omerkatz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#99351}
2025-03-20 04:33:15 -07:00
Andreas Haas 3c9c275521 Reland^2 "[cppgc] Automatically set up CppHeap if not specially provided"
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}
2025-03-19 16:10:22 -07:00
Omer Katz bb32540d5c [cppgc] Cleanup ephemeron-pair.h
The file is empty and no longer needed.

Bug: 402564649
Change-Id: Ia51a38ef571ffc070e79c98dd704411517ec53dc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6369298
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#99324}
2025-03-19 01:24:00 -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
Omer Katz 943b16366f Fix clang plugin violations in V8
Bug: 402564649
Change-Id: Ib81be42ab888210e5269ab1c5a0fae3d3c73aee1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6348644
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#99256}
2025-03-14 04:57:31 -07:00
Matthias Liedtke 12d2d166eb Revert "Reland "[cppgc] Automatically set up CppHeap if not specially provided""
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}
2025-03-12 04:22:18 -07:00
Andreas Haas 3863ce60d3 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}
2025-03-11 11:52:25 -07:00
Manos Koukoutos 22d3f0d64c Revert "[cppgc] Automatically set up CppHeap if not specially provided"
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}
2025-03-06 03:55:15 -08:00
Andreas Haas fe8642e294 [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}
2025-03-06 02:19:21 -08:00
Michael Lippautz 4697757e4c cppgc: Avoid transitively including cppgc/allocation.h
The include is mostly not necessary and gates using CppHeap.

The CL also updates AlignVal to use std::align_val_t.

Bug: 42203693
Change-Id: I010b0ec147441d749c75b7409e7000e09ccef178
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6309525
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#99012}
2025-02-28 09:41:02 -08:00
Michael Lippautz 43479135b3 cppgc: Fix handling of intermediate values on the stack for 16G cages
This fixes the handling of intermediate values when conservatively
iterating memory (stack, but also heap).

To this end we will scan through memory word-by-word and consider:
1. Full pointers;
2. Compressed pointers in both half words;
3. A half-decompressed 35-bit value as intermediate state that doesn't
   assume sign extension happened;

We also bring back the optimization from https://crrev.com/c/6198226
which relied on the fact that the full pointer will be reached through
the intermediate state. This is now actually the case and handling 3.
implicitly also handles 1.

The CL also adds a bunch of tests that would have caught the original
problem.

Change-Id: Ibde3af33894b1f044cde49e97492b46c3e4b4e24
Bug: 391018461
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6198347
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#98372}
2025-01-28 08:51:32 -08:00
Peter Kasting 0538f502bf Mark BasicMember<T> and T* as having a common reference type of T*.
Allows porting base::ranges algorithm use to std::, e.g. finding a T*
in a HeapVector<Member<T>>.

Also removes unnecessary use of `internal::` inside namespace internal.

Bug: chromium:386918226
Change-Id: I25699ce871fdf7fc7c81dfebbe13cd6cd9082cf7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6163296
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#98049}
2025-01-10 05:04:55 -08:00
Michael Lippautz 94c4e3ab86 cppgc: Remove guard pages
Guard pages have effectively been disabled in
  https://crrev.com/c/6074477

This change merely removes the underlying GC infrastructure.

Bug: 378017037
Change-Id: I425ffa924cf2797e0abf88483054334528583d62
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6074521
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#97980}
2025-01-08 02:19:38 -08:00
Dominik Inführ a60ea98a83 [cppgc] Remove support for 2GB cage
The 2GB cage was already disabled for some time due to OOM errors. We
have also increased the cage from 4GB to 16GB already on non-Android
systems. So it seems unlikely that we could launch it again.

Bug: 343959927
Change-Id: I27c26256c84f4e592bb991d7b8a0582b54685e18
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6089581
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Auto-Submit: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#97791}
2024-12-16 03:44:48 -08:00
Takuto Ikuta 978f825220 add missing includes for the build with use_libcxx_modules
This is to fix build error when we set use_libcxx_modules=true in
chromium build.

Bug: 40440396
Change-Id: I8d099affe3e6228229e03306afb5e4a75b48ed67
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6083971
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#97659}
2024-12-10 15:16:33 +00:00
Michael Lippautz 239841592e Reland "cppgc: Remove guard pages and avoid discarding pages on Windows"
This is a reland of commit 48bdf7ae9f

Original change's description:
> cppgc: Remove guard pages and avoid discarding pages on Windows
>
> This is a reland of https://crrev.com/c/6049213 with improved handling
> for Windows.
>
> This CL changes the guard page size to 0 on all platforms. Individual
> Oilpan pages thus have no more guard regions. The infrastructure will
> be removed in a subsequent CL.
>
> On Windows discarding memory on 128K-aligned 128K in size chunks
> caused massive performance regressions on syscalls.
>
> The CL works around this by removing discarding in the following ways:
> 1. On destroying pages the memory is not discarded anymore. This is
>    okay because we only discard pages on memory reducing GCs which is
>    also when we drop pages from the pool which decommits the memory
>    anyways.
> 2. Discarding free list entries is disabled on Windows. This is in
>    line with the JS heap part which has a similar exemption.
>
> Change-Id: I8623467ef06eb3be63cd62718db09dde65e4a763
> Bug: 378017037
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6055482
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Reviewed-by: Omer Katz <omerkatz@chromium.org>
> Reviewed-by: Anton Bikineev <bikineev@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#97600}

Cq-Include-Trybots: luci.v8.try:v8_win64_nodcheck_rel
Bug: 378017037
Change-Id: If02d76b37e39eb14949bc7a7769ce2771eaf1eab
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6074477
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/main@{#97629}
2024-12-09 12:10:18 +00:00
Eva Herencsárová 306d0e55a8 Revert "cppgc: Remove guard pages and avoid discarding pages on Windows"
This reverts commit 48bdf7ae9f.

Reason for revert: Fails on https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Win64/61462/overview

Original change's description:
> cppgc: Remove guard pages and avoid discarding pages on Windows
>
> This is a reland of https://crrev.com/c/6049213 with improved handling
> for Windows.
>
> This CL changes the guard page size to 0 on all platforms. Individual
> Oilpan pages thus have no more guard regions. The infrastructure will
> be removed in a subsequent CL.
>
> On Windows discarding memory on 128K-aligned 128K in size chunks
> caused massive performance regressions on syscalls.
>
> The CL works around this by removing discarding in the following ways:
> 1. On destroying pages the memory is not discarded anymore. This is
>    okay because we only discard pages on memory reducing GCs which is
>    also when we drop pages from the pool which decommits the memory
>    anyways.
> 2. Discarding free list entries is disabled on Windows. This is in
>    line with the JS heap part which has a similar exemption.
>
> Change-Id: I8623467ef06eb3be63cd62718db09dde65e4a763
> Bug: 378017037
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6055482
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Reviewed-by: Omer Katz <omerkatz@chromium.org>
> Reviewed-by: Anton Bikineev <bikineev@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#97600}

Bug: 378017037
Change-Id: I50949ea0085c60908984cf9489f9eac6fd466db0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6074950
Commit-Queue: Eva Herencsárová <evih@chromium.org>
Owners-Override: Eva Herencsárová <evih@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#97602}
2024-12-06 11:01:27 +00:00
Michael Lippautz 48bdf7ae9f cppgc: Remove guard pages and avoid discarding pages on Windows
This is a reland of https://crrev.com/c/6049213 with improved handling
for Windows.

This CL changes the guard page size to 0 on all platforms. Individual
Oilpan pages thus have no more guard regions. The infrastructure will
be removed in a subsequent CL.

On Windows discarding memory on 128K-aligned 128K in size chunks
caused massive performance regressions on syscalls.

The CL works around this by removing discarding in the following ways:
1. On destroying pages the memory is not discarded anymore. This is
   okay because we only discard pages on memory reducing GCs which is
   also when we drop pages from the pool which decommits the memory
   anyways.
2. Discarding free list entries is disabled on Windows. This is in
   line with the JS heap part which has a similar exemption.

Change-Id: I8623467ef06eb3be63cd62718db09dde65e4a763
Bug: 378017037
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6055482
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#97600}
2024-12-06 10:25:46 +00:00
Michael Lippautz 88ac58d006 Revert "cppgc: Remove guard pages"
This reverts commit e56d2eafd0.

Reason for revert: Heavily regresses Windows discarding time.

Original change's description:
> cppgc: Remove guard pages
>
> Guard pages (4K, 16K) were added on certain platforms within the 128K
> logical cppgc page. These regions have been implemented and dragged
> along from the initial version of Oilpan.
>
> For tooling these pages have no real use as we rely on ASAN for
> poisoning unused areas. OOB access for large objects is generally
> trapped on access in bounds checks.  Other OOB access has to hit
> exactly the guard pages to trap which is not generally the case.
>
> The mechanism had no relevance for actual security as the sizes were
> small and their positiion was deterministic.
>
> This CL removes the guard page support. This gets us back some virtual
> address space in the cage and slightly makes getting to page handles
> cheaper (over the public API).
>
> Bug: 378017037
> Change-Id: I8bb2c17e2daa4ee76c8a29aeaeb46827948160c3
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6049213
> Reviewed-by: Samuel Groß <saelo@chromium.org>
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Reviewed-by: Anton Bikineev <bikineev@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#97389}

Bug: 378017037, 381201234, 381120830, 380922994
Change-Id: Ia2b55934891fb176acb3473d15151e184c75d44d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6055557
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#97458}
2024-11-28 11:39:59 +00:00
Michael Lippautz e56d2eafd0 cppgc: Remove guard pages
Guard pages (4K, 16K) were added on certain platforms within the 128K
logical cppgc page. These regions have been implemented and dragged
along from the initial version of Oilpan.

For tooling these pages have no real use as we rely on ASAN for
poisoning unused areas. OOB access for large objects is generally
trapped on access in bounds checks.  Other OOB access has to hit
exactly the guard pages to trap which is not generally the case.

The mechanism had no relevance for actual security as the sizes were
small and their positiion was deterministic.

This CL removes the guard page support. This gets us back some virtual
address space in the cage and slightly makes getting to page handles
cheaper (over the public API).

Bug: 378017037
Change-Id: I8bb2c17e2daa4ee76c8a29aeaeb46827948160c3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6049213
Reviewed-by: Samuel Groß <saelo@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#97389}
2024-11-26 07:58:26 +00:00
Michael Lippautz 9be9b0197a cppgc: Fix slow checks on cppgc API
These checks are currently not run in Blink at all because the debug
macros are different. Move them behind v8_enable_slow_dchecks to allow
some testing and try to later enable them more broadly.

This also fixes the issue that for DEBUG builds the sizeof(Member) is
out of sync between V8 and Blink.

Change-Id: I332fb82ffe8f7bb2b1a9a8fee3630be0b06ce471
Bug: 373485798
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5952933
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#96769}
2024-10-23 10:40:14 +00:00
Michael Lippautz 58c6966683 cppgc: Fix atomic initialization
While the store of the actual pointer was atomic we also used
non-atomic initializers that would create a race.

Bug: 374122150
Change-Id: Id472529cee1d67f3a5f1449af7ccec6eb6fe2885
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5940377
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#96675}
2024-10-18 09:11:59 +00:00
Michael Lippautz 338e13d0ea cppgc: Properly enable API-level checks
cppgc's API-level checks have been gated behind `DEBUG` whereas Blink
always passes `_DEBUG` as symbol for debugging/dcheck builds.

Put the checks now behind a separate define that follows the common
practice of pairing a gn flag with a define for external usage.

This CL only enabled `CPPGC_DCHECK()` and leaves more expensive
verificaton for a follow up.

Bug: 373485798
Change-Id: Ic45738bb34569f3046118142350ecf7b6ac4439d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5934873
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#96665}
2024-10-17 18:31:46 +00:00
Michael Lippautz 3b42ac1ef3 cppgc: Avoid decompressions for pointer policies
Currently policies just use `Get()` which will trigger a
decompression, even if the result is then not used in some
configurations.

This is a possible small perf win on some configurations
where the decompression was not optimized away.

Bug: 373485798
Change-Id: I72a4c79652c64f5461790dd5d5d8e54874c7e5bd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5938964
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#96663}
2024-10-17 17:03:20 +00:00