Commit d1538091 authored by Michael Lippautz's avatar Michael Lippautz Committed by V8 LUCI CQ

cppgc: Add temporary CHECK for diagnosing issue

Bug: chromium:1253650
Change-Id: I634501d5f092263ebd0f96826c79655c49ddce3b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3302792Reviewed-by: 's avatarAnton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78096}
parent befbf715
......@@ -189,6 +189,9 @@ class BasicPersistent final : public PersistentBase,
// heterogeneous assignments between different Member and Persistent handles
// based on their actual types.
V8_CLANG_NO_SANITIZE("cfi-unrelated-cast") T* Get() const {
#ifdef V8_TARGET_OS_ANDROID
IsValid();
#endif // V8_TARGET_OS_ANDROID
// The const_cast below removes the constness from PersistentBase storage.
// The following static_cast re-adds any constness if specified through the
// user-visible template parameter T.
......@@ -231,7 +234,12 @@ class BasicPersistent final : public PersistentBase,
// Ideally, handling kSentinelPointer would be done by the embedder. On the
// other hand, having Persistent aware of it is beneficial since no node
// gets wasted.
return GetValue() != nullptr && GetValue() != kSentinelPointer;
const auto* value = GetValue();
const bool is_valid = value != nullptr && value != kSentinelPointer;
#ifdef V8_TARGET_OS_ANDROID
CPPGC_CHECK(!is_valid || GetNode());
#endif // V8_TARGET_OS_ANDROID
return is_valid;
}
void Assign(T* ptr) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment