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/+/1874384 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Irina Yatsenko <irinayat@microsoft.com> Cr-Commit-Position: refs/heads/master@{#64523}
This commit is contained in:
parent
642bffa07f
commit
845f06338d
@ -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(),
|
||||
¶llel_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(
|
||||
|
Loading…
Reference in New Issue
Block a user