Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(629)

Unified Diff: src/heap/heap.cc

Issue 1577853007: [heap] Parallel newspace evacuation, semispace copy, and compaction \o/ (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Various non-functional changes Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.h » ('j') | src/heap/heap-inl.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index c89a1e5c6be0bb64cbdad5f48346b6b867fbd463..d2f01775f8639fbfefc3fd440675cc9cff4c5050 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -437,9 +437,9 @@ void Heap::GarbageCollectionPrologue() {
}
// Reset GC statistics.
- promoted_objects_size_ = 0;
- previous_semi_space_copied_object_size_ = semi_space_copied_object_size_;
- semi_space_copied_object_size_ = 0;
+ promoted_objects_size_.SetValue(0);
+ previous_semi_space_copied_object_size_ = semi_space_copied_object_size();
+ semi_space_copied_object_size_.SetValue(0);
nodes_died_in_new_space_ = 0;
nodes_copied_in_new_space_ = 0;
nodes_promoted_ = 0;
@@ -519,17 +519,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, static_cast<uint32_t>(bit_cast<uintptr_t>(site)));
}
}
}
@@ -1234,19 +1236,19 @@ void Heap::ClearNormalizedMapCaches() {
void Heap::UpdateSurvivalStatistics(int start_new_space_size) {
if (start_new_space_size == 0) return;
- promotion_ratio_ = (static_cast<double>(promoted_objects_size_) /
+ promotion_ratio_ = (static_cast<double>(promoted_objects_size()) /
static_cast<double>(start_new_space_size) * 100);
if (previous_semi_space_copied_object_size_ > 0) {
promotion_rate_ =
- (static_cast<double>(promoted_objects_size_) /
+ (static_cast<double>(promoted_objects_size()) /
static_cast<double>(previous_semi_space_copied_object_size_) * 100);
} else {
promotion_rate_ = 0;
}
semi_space_copied_rate_ =
- (static_cast<double>(semi_space_copied_object_size_) /
+ (static_cast<double>(semi_space_copied_object_size()) /
static_cast<double>(start_new_space_size) * 100);
double survival_rate = promotion_ratio_ + semi_space_copied_rate_;
@@ -1309,7 +1311,7 @@ bool Heap::PerformGarbageCollection(
// This should be updated before PostGarbageCollectionProcessing, which
// can cause another GC. Take into account the objects promoted during GC.
old_generation_allocation_counter_ +=
- static_cast<size_t>(promoted_objects_size_);
+ static_cast<size_t>(promoted_objects_size());
old_generation_size_at_last_gc_ = PromotedSpaceSizeOfObjects();
} else {
Scavenge();
@@ -1513,18 +1515,18 @@ static void VerifyNonPointerSpacePointers(Heap* heap) {
void Heap::CheckNewSpaceExpansionCriteria() {
if (FLAG_experimental_new_space_growth_heuristic) {
if (new_space_.TotalCapacity() < new_space_.MaximumCapacity() &&
- survived_last_scavenge_ * 100 / new_space_.TotalCapacity() >= 10) {
+ survived_last_scavenge() * 100 / new_space_.TotalCapacity() >= 10) {
// Grow the size of new space if there is room to grow, and more than 10%
// have survived the last scavenge.
new_space_.Grow();
- survived_since_last_expansion_ = 0;
+ survived_since_last_expansion_.SetValue(0);
}
} else if (new_space_.TotalCapacity() < new_space_.MaximumCapacity() &&
- survived_since_last_expansion_ > new_space_.TotalCapacity()) {
+ survived_since_last_expansion() > new_space_.TotalCapacity()) {
// Grow the size of new space if there is room to grow, and enough data
// has survived scavenge since the last expansion.
new_space_.Grow();
- survived_since_last_expansion_ = 0;
+ survived_since_last_expansion_.SetValue(0);
}
}
@@ -1761,8 +1763,8 @@ void Heap::Scavenge() {
array_buffer_tracker()->FreeDead(true);
// Update how much has survived scavenge.
- IncrementYoungSurvivorsCounter(static_cast<int>(
- (PromotedSpaceSizeOfObjects() - survived_watermark) + new_space_.Size()));
+ IncrementYoungSurvivorsCounter(
+ (PromotedSpaceSizeOfObjects() - survived_watermark) + new_space_.Size());
LOG(isolate_, ResourceEvent("scavenge", "end"));
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.h » ('j') | src/heap/heap-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698