Reland "Reland "Reland "cppgc: Enable checks for assignments in prefinalizers"""

This is a reland of 2db5067031

crrev.com/c/3182223 resolves all known issues (and should prevent
additional issues in the future).

Original change's description:
> Reland "Reland "cppgc: Enable checks for assignments in prefinalizers""
>
> This is a reland of adb6276f4a
>
> Causes for previous revert was addressed by crbug.com/3140387 and
> crbug.com/3163579.
>
> Original change's description:
> > Reland "cppgc: Enable checks for assignments in prefinalizers"
> >
> > This is a reland of edcc8ff5b5
> >
> > Cause for previous revert was addressed by crbug.com/1241773.
> >
> > Original change's description:
> > > cppgc: Enable checks for assignments in prefinalizers
> > >
> > > Bug: v8:11749
> > > Change-Id: Ic027f732030fb6a2befeffeca9db2eacfd0830a5
> > > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3099953
> > > Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> > > Commit-Queue: Omer Katz <omerkatz@chromium.org>
> > > Cr-Commit-Position: refs/heads/main@{#76370}
> >
> > Bug: v8:11749
> > Change-Id: I57fc138ace002d41e54f7f70250e4d19bc9262b0
> > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3122153
> > Auto-Submit: Omer Katz <omerkatz@chromium.org>
> > Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> > Commit-Queue: Omer Katz <omerkatz@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#76553}
>
> Bug: v8:11749
> Change-Id: I138ca374314108f0f23e234a8fd90d15d912120d
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3168280
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Omer Katz <omerkatz@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#76971}

Bug: v8:11749
Change-Id: I8bf48cecde910e74f40cf0cd6aa8a5ed19de1584
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3182224
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77143}
This commit is contained in:
Omer Katz 2021-09-28 15:39:55 +02:00 committed by V8 LUCI CQ
parent 010d43d2de
commit f001bfd787
5 changed files with 4 additions and 17 deletions

View File

@ -165,7 +165,6 @@ config_setting(
# v8_control_flow_integrity
# v8_enable_virtual_memory_cage
# cppgc_enable_caged_heap
# cppgc_enable_check_assignments_in_prefinalizers
# cppgc_enable_object_names
# cppgc_enable_verify_heap
# cppgc_enable_young_generation

View File

@ -293,10 +293,6 @@ declare_args() {
# Enables additional heap verification phases and checks.
cppgc_enable_verify_heap = ""
# Enable assignment checks for Members/Persistents during prefinalizer invocations.
# TODO(v8:11749): Enable by default after fixing any existing issues in Blink.
cppgc_enable_check_assignments_in_prefinalizers = false
# Enable allocations during prefinalizer invocations.
cppgc_allow_allocations_in_prefinalizers = false
@ -791,10 +787,6 @@ config("features") {
defines += [ "CPPGC_VERIFY_HEAP" ]
}
if (cppgc_enable_check_assignments_in_prefinalizers) {
defines += [ "CPPGC_CHECK_ASSIGNMENTS_IN_PREFINALIZERS" ]
}
if (cppgc_allow_allocations_in_prefinalizers) {
defines += [ "CPPGC_ALLOW_ALLOCATIONS_IN_PREFINALIZERS" ]
}

View File

@ -70,7 +70,7 @@ void EnabledCheckingPolicyBase::CheckPointerImpl(
DCHECK(!header->IsFree());
}
#ifdef CPPGC_CHECK_ASSIGNMENTS_IN_PREFINALIZERS
#ifdef CPPGC_VERIFY_HEAP
if (check_off_heap_assignments || is_on_heap) {
if (heap_->prefinalizer_handler()->IsInvokingPreFinalizers()) {
// During prefinalizers invocation, check that |ptr| refers to a live
@ -88,7 +88,7 @@ void EnabledCheckingPolicyBase::CheckPointerImpl(
}
#else
USE(is_on_heap);
#endif // CPPGC_CHECK_ASSIGNMENTS_IN_PREFINALIZERS
#endif // CPPGC_VERIFY_HEAP
}
PersistentRegion& StrongPersistentPolicy::GetPersistentRegion(

View File

@ -292,7 +292,7 @@ class GCedHolder : public GarbageCollected<GCedHolder> {
} // namespace
#if V8_ENABLE_CHECKS
#ifdef CPPGC_CHECK_ASSIGNMENTS_IN_PREFINALIZERS
#ifdef CPPGC_VERIFY_HEAP
TEST_F(PrefinalizerDeathTest, PrefinalizerCantRewireGraphWithDeadObjects) {
Persistent<LinkedNode> root{MakeGarbageCollected<LinkedNode>(
@ -325,7 +325,7 @@ TEST_F(PrefinalizerDeathTest, PrefinalizerCantRessurectObjectOnHeap) {
EXPECT_DEATH_IF_SUPPORTED(PreciseGC(), "");
}
#endif // CPPGC_CHECK_ASSIGNMENTS_IN_PREFINALIZERS
#endif // CPPGC_VERIFY_HEAP
#endif // V8_ENABLE_CHECKS
#ifdef CPPGC_ALLOW_ALLOCATIONS_IN_PREFINALIZERS

View File

@ -245,7 +245,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(CPPGC_ENABLE_OBJECT_NAMES "Enable object names in cppgc for debug purposes" OFF)
option(CPPGC_ENABLE_CAGED_HEAP "Enable heap reservation of size 4GB, only possible for 64bit archs" OFF)
option(CPPGC_ENABLE_VERIFY_HEAP "Enables additional heap verification phases and checks" OFF)
option(CPPGC_CHECK_ASSIGNMENTS_IN_PREFINALIZERS " Enable assignment checks for Members/Persistents during prefinalizer invocations" OFF)
option(CPPGC_ENABLE_YOUNG_GENERATION "Enable young generation in cppgc" OFF)
set(CPPGC_TARGET_ARCH "x64" CACHE STRING "Target architecture, possible options: x64, x86, arm, arm64, ppc64, s390x, mipsel, mips64el")
@ -438,9 +437,6 @@ endif()
if(CPPGC_ENABLE_VERIFY_HEAP)
target_compile_definitions({target.name} PRIVATE "-DCPPGC_ENABLE_VERIFY_HEAP")
endif()
if(CPPGC_CHECK_ASSIGNMENTS_IN_PREFINALIZERS)
target_compile_definitions({target.name} PRIVATE "-DCPPGC_CHECK_ASSIGNMENTS_IN_PREFINALIZERS")
endif()
if(CPPGC_ENABLE_YOUNG_GENERATION)
target_compile_definitions({target.name} PRIVATE "-DCPPGC_YOUNG_GENERATION")
endif()"""