| Index: src/heap/heap.cc
|
| diff --git a/src/heap/heap.cc b/src/heap/heap.cc
|
| index d7f07b85eb0369689532f9d20271fe916c750ff9..f6bf24652e0e82afed19c440026652121b191a71 100644
|
| --- a/src/heap/heap.cc
|
| +++ b/src/heap/heap.cc
|
| @@ -518,17 +518,19 @@ void Heap::MergeAllocationSitePretenuringFeedback(
|
| if (map_word.IsForwardingAddress()) {
|
| site = AllocationSite::cast(map_word.ToForwardingAddress());
|
| }
|
| - DCHECK(site->IsAllocationSite());
|
| +
|
| + // We have not validated the allocation site yet, since we have not
|
| + // dereferenced the site during collecting information.
|
| + // This is an inlined check of AllocationMemento::IsValid.
|
| + if (!site->IsAllocationSite() || site->IsZombie()) continue;
|
| +
|
| int value =
|
| static_cast<int>(reinterpret_cast<intptr_t>(local_entry->value));
|
| DCHECK_GT(value, 0);
|
|
|
| - {
|
| - // TODO(mlippautz): For parallel processing we need synchronization here.
|
| - if (site->IncrementMementoFoundCount(value)) {
|
| - global_pretenuring_feedback_->LookupOrInsert(
|
| - site, static_cast<uint32_t>(bit_cast<uintptr_t>(site)));
|
| - }
|
| + if (site->IncrementMementoFoundCount(value)) {
|
| + global_pretenuring_feedback_->LookupOrInsert(site,
|
| + ObjectHash(site->address()));
|
| }
|
| }
|
| }
|
| @@ -566,22 +568,24 @@ void Heap::ProcessPretenuringFeedback() {
|
| bool maximum_size_scavenge = MaximumSizeScavenge();
|
| for (HashMap::Entry* e = global_pretenuring_feedback_->Start();
|
| e != nullptr; e = global_pretenuring_feedback_->Next(e)) {
|
| + allocation_sites++;
|
| site = reinterpret_cast<AllocationSite*>(e->key);
|
| int found_count = site->memento_found_count();
|
| - // The fact that we have an entry in the storage means that we've found
|
| - // the site at least once.
|
| - DCHECK_GT(found_count, 0);
|
| - DCHECK(site->IsAllocationSite());
|
| - allocation_sites++;
|
| - active_allocation_sites++;
|
| - allocation_mementos_found += found_count;
|
| - if (site->DigestPretenuringFeedback(maximum_size_scavenge)) {
|
| - trigger_deoptimization = true;
|
| - }
|
| - if (site->GetPretenureMode() == TENURED) {
|
| - tenure_decisions++;
|
| - } else {
|
| - dont_tenure_decisions++;
|
| + // An entry in the storage does not imply that the count is > 0 because
|
| + // allocation sites might have been reset due to too many objects dying
|
| + // in old space.
|
| + if (found_count > 0) {
|
| + DCHECK(site->IsAllocationSite());
|
| + active_allocation_sites++;
|
| + allocation_mementos_found += found_count;
|
| + if (site->DigestPretenuringFeedback(maximum_size_scavenge)) {
|
| + trigger_deoptimization = true;
|
| + }
|
| + if (site->GetPretenureMode() == TENURED) {
|
| + tenure_decisions++;
|
| + } else {
|
| + dont_tenure_decisions++;
|
| + }
|
| }
|
| }
|
|
|
|
|