cppgc: Move interesting checks behind DEBUG
v8_enable_v8_checks has very little coverage outside of V8 itself. Move pointer verification checks behind DEBUG so that they fire in regular debug or dcheck_always_on builds. Change-Id: Ib2803240dd996f4223e403d20e927aff2955afbc Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3242006 Reviewed-by: Omer Katz <omerkatz@chromium.org> Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/main@{#77534}
This commit is contained in:
parent
447c3f3c2a
commit
59fe961804
@ -141,21 +141,17 @@ class V8_EXPORT PersistentRegion final : public PersistentRegionBase {
|
||||
PersistentRegion& operator=(const PersistentRegion&) = delete;
|
||||
|
||||
V8_INLINE PersistentNode* AllocateNode(void* owner, TraceCallback trace) {
|
||||
#if V8_ENABLE_CHECKS
|
||||
CheckIsCreationThread();
|
||||
#endif // V8_ENABLE_CHECKS
|
||||
CPPGC_DCHECK(IsCreationThread());
|
||||
return PersistentRegionBase::AllocateNode(owner, trace);
|
||||
}
|
||||
|
||||
V8_INLINE void FreeNode(PersistentNode* node) {
|
||||
#if V8_ENABLE_CHECKS
|
||||
CheckIsCreationThread();
|
||||
#endif // V8_ENABLE_CHECKS
|
||||
CPPGC_DCHECK(IsCreationThread());
|
||||
PersistentRegionBase::FreeNode(node);
|
||||
}
|
||||
|
||||
private:
|
||||
void CheckIsCreationThread();
|
||||
bool IsCreationThread();
|
||||
|
||||
int creation_thread_id_;
|
||||
};
|
||||
|
@ -92,19 +92,19 @@ class DisabledCheckingPolicy {
|
||||
void CheckPointer(const void*) {}
|
||||
};
|
||||
|
||||
#if V8_ENABLE_CHECKS
|
||||
#ifdef DEBUG
|
||||
// Off heap members are not connected to object graph and thus cannot ressurect
|
||||
// dead objects.
|
||||
using DefaultMemberCheckingPolicy =
|
||||
SameThreadEnabledCheckingPolicy<false /* kCheckOffHeapAssignments*/>;
|
||||
using DefaultPersistentCheckingPolicy =
|
||||
SameThreadEnabledCheckingPolicy<true /* kCheckOffHeapAssignments*/>;
|
||||
#else
|
||||
#else // !DEBUG
|
||||
using DefaultMemberCheckingPolicy = DisabledCheckingPolicy;
|
||||
using DefaultPersistentCheckingPolicy = DisabledCheckingPolicy;
|
||||
#endif
|
||||
#endif // !DEBUG
|
||||
// For CT(W)P neither marking information (for value), nor objectstart bitmap
|
||||
// (for slot) are guaranteed to be present because there's no synchonization
|
||||
// (for slot) are guaranteed to be present because there's no synchronization
|
||||
// between heaps after marking.
|
||||
using DefaultCrossThreadPersistentCheckingPolicy = DisabledCheckingPolicy;
|
||||
|
||||
|
@ -109,8 +109,8 @@ PersistentRegion::PersistentRegion(const FatalOutOfMemoryHandler& oom_handler)
|
||||
USE(creation_thread_id_);
|
||||
}
|
||||
|
||||
void PersistentRegion::CheckIsCreationThread() {
|
||||
DCHECK_EQ(creation_thread_id_, v8::base::OS::GetCurrentThreadId());
|
||||
bool PersistentRegion::IsCreationThread() {
|
||||
return creation_thread_id_ == v8::base::OS::GetCurrentThreadId();
|
||||
}
|
||||
|
||||
PersistentRegionLock::PersistentRegionLock() {
|
||||
|
@ -291,7 +291,7 @@ class GCedHolder : public GarbageCollected<GCedHolder> {
|
||||
|
||||
} // namespace
|
||||
|
||||
#if V8_ENABLE_CHECKS
|
||||
#if DEBUG
|
||||
#ifdef CPPGC_VERIFY_HEAP
|
||||
|
||||
TEST_F(PrefinalizerDeathTest, PrefinalizerCanRewireGraphWithDeadObjects) {
|
||||
@ -328,7 +328,7 @@ TEST_F(PrefinalizerDeathTest, PrefinalizerCantRessurectObjectOnHeap) {
|
||||
}
|
||||
|
||||
#endif // CPPGC_VERIFY_HEAP
|
||||
#endif // V8_ENABLE_CHECKS
|
||||
#endif // DEBUG
|
||||
|
||||
#ifdef CPPGC_ALLOW_ALLOCATIONS_IN_PREFINALIZERS
|
||||
TEST_F(PrefinalizerTest, AllocatingPrefinalizersInMultipleGCCycles) {
|
||||
|
Loading…
Reference in New Issue
Block a user