[handles] More diagnosing CHECKs

Adding diagnosing CHECKs. Will be reverted after fixing issue.

Bug: chromium:1380114, v8:13372
Change-Id: I1d174b0a2b4ac5e090e54d70e70eb6ca0442f07e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4042291
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84406}
This commit is contained in:
Michael Lippautz 2022-11-21 16:46:34 +01:00 committed by V8 LUCI CQ
parent 65cf467f63
commit 5b68765f7a
2 changed files with 20 additions and 3 deletions

View File

@ -796,7 +796,16 @@ void TracedHandlesImpl::ResetDeadNodes(
void TracedHandlesImpl::CheckNodeMarkingStateIsConsistent(
bool may_find_marked_nodes, WeakSlotCallbackWithHeap should_reset_handle) {
DCHECK(isolate_->heap()->concurrent_marking()->IsStopped());
CHECK(isolate_->heap()->concurrent_marking()->IsStopped());
for (TracedNode* node : young_nodes_) {
CHECK_IMPLIES(!node->is_in_use(), !node->markbit());
if (!node->is_in_use()) {
continue;
}
CHECK_IMPLIES(node->markbit(), may_find_marked_nodes);
CHECK_IMPLIES(node->markbit(),
!should_reset_handle(isolate_->heap(), node->location()));
}
for (const auto block : blocks_) {
for (const auto node : *block) {
CHECK_IMPLIES(!node->is_in_use(), !node->markbit());
@ -840,9 +849,10 @@ void TracedHandlesImpl::ProcessYoungObjects(
for (TracedNode* node : young_nodes_) {
if (!node->is_in_use()) continue;
DCHECK_IMPLIES(node->is_root(),
!should_reset_handle(isolate_->heap(), node->location()));
CHECK_IMPLIES(node->is_root(),
!should_reset_handle(isolate_->heap(), node->location()));
if (should_reset_handle(isolate_->heap(), node->location())) {
CHECK(!is_marking_);
v8::Value* value = ToApi<v8::Value>(node->handle());
handler->ResetRoot(
*reinterpret_cast<v8::TracedReference<v8::Value>*>(&value));
@ -882,6 +892,8 @@ void TracedHandlesImpl::IterateYoungRoots(RootVisitor* visitor) {
for (auto* node : young_nodes_) {
if (!node->is_in_use()) continue;
CHECK_IMPLIES(is_marking_, node->is_root());
if (!node->is_root()) continue;
visitor->VisitRootPointer(Root::kTracedHandles, nullptr, node->location());

View File

@ -384,6 +384,11 @@ void ScavengerCollector::CollectGarbage() {
&root_scavenge_visitor);
isolate_->traced_handles()->IterateYoungRoots(&root_scavenge_visitor);
scavengers[kMainThreadId]->Publish();
// Temporary checks for diagnosing https://crbug.com/1380114.
if (isolate_->heap()->incremental_marking()->IsMarking()) {
isolate_->traced_handles()->CheckNodeMarkingStateIsConsistent(
true, &MarkCompactCollector::IsUnmarkedHeapObject);
}
}
{
// Parallel phase scavenging all copied and promoted objects.