Commit 845f0633 authored by Irina Yatsenko's avatar Irina Yatsenko Committed by Commit Bot

Race between crashkeys for collecting heap dumps

Crashkeys are static and non-refcounted, so when one thread clears
a crashkey, it affects all other threads. This means, we cannot set
them in parallel running jobs such as ScavengePage. This change moves
the crashkey about heap collection up the stack into the main thread.

Change-Id: I28f16eaadd9b122c06a68d1d4207f27319994509
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1874384Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Irina Yatsenko <irinayat@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#64523}
parent 642bffa0
......@@ -220,7 +220,22 @@ class ScavengeWeakObjectRetainer : public WeakObjectRetainer {
ScavengerCollector::ScavengerCollector(Heap* heap)
: isolate_(heap->isolate()), heap_(heap), parallel_scavenge_semaphore_(0) {}
// Remove this crashkey after chromium:1010312 is fixed.
class ScopedFullHeapCrashKey {
public:
explicit ScopedFullHeapCrashKey(Isolate* isolate) : isolate_(isolate) {
isolate_->AddCrashKey(v8::CrashKeyId::kDumpType, "heap");
}
~ScopedFullHeapCrashKey() {
isolate_->AddCrashKey(v8::CrashKeyId::kDumpType, "");
}
private:
Isolate* isolate_ = nullptr;
};
void ScavengerCollector::CollectGarbage() {
ScopedFullHeapCrashKey collect_full_heap_dump_if_crash(isolate_);
DCHECK(surviving_new_large_objects_.empty());
ItemParallelJob job(isolate_->cancelable_task_manager(),
&parallel_scavenge_semaphore_);
......@@ -437,22 +452,7 @@ void Scavenger::AddPageToSweeperIfNecessary(MemoryChunk* page) {
}
}
// Remove this crashkey after chromium:1010312 is fixed.
class ScopedFullHeapCrashKey {
public:
explicit ScopedFullHeapCrashKey(Isolate* isolate) : isolate_(isolate) {
isolate_->AddCrashKey(v8::CrashKeyId::kDumpType, "heap");
}
~ScopedFullHeapCrashKey() {
isolate_->AddCrashKey(v8::CrashKeyId::kDumpType, "");
}
private:
Isolate* isolate_ = nullptr;
};
void Scavenger::ScavengePage(MemoryChunk* page) {
ScopedFullHeapCrashKey collect_full_heap_dump_if_crash(heap_->isolate());
CodePageMemoryModificationScope memory_modification_scope(page);
InvalidatedSlotsFilter filter = InvalidatedSlotsFilter::OldToNew(page);
RememberedSet<OLD_TO_NEW>::Iterate(
......
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