Add more debugging info for DCHECK

We recently ran into two separate issues with this DCHECK. To enhance
debugging, let's add some more information as to which property is
failing. That should make investigating of the problematic property
easier, as we now no longer need to printf the results.

R=jkummerow@chromium.org

Bug: chromium:1276617, chromium:1262066
Change-Id: I8613780fc9613af700e113bb6050d4cbbd4cb040
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3330467
Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Tim Van der Lippe <tvanderlippe@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78353}
This commit is contained in:
Tim van der Lippe 2021-12-13 16:33:39 +00:00 committed by V8 LUCI CQ
parent 282e678881
commit 0135cda64a

View File

@ -124,7 +124,15 @@ v8::Maybe<v8::PropertyAttribute> DebugPropertyIterator::attributes() {
// If you are running into this problem, check your embedder implementation
// and verify that the data from both sides matches. If there is a mismatch,
// V8 will crash.
DCHECK(result.FromJust() != ABSENT);
#if DEBUG
base::ScopedVector<char> property_message(128);
base::ScopedVector<char> name_buffer(100);
raw_name()->NameShortPrint(name_buffer);
v8::base::SNPrintF(property_message, "Invalid result for property \"%s\"\n",
name_buffer.begin());
DCHECK_WITH_MSG(result.FromJust() != ABSENT, property_message.begin());
#endif
return Just(static_cast<v8::PropertyAttribute>(result.FromJust()));
}