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

Unified Diff: src/heap/heap.cc

Issue 1585843010: [heap] Make survival counters concurrent (atomic) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/mark-compact.cc » ('j') | no next file with comments »
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..64be15c828da13ce2838e798e090ac6aca1b50e1 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;
@@ -1234,19 +1234,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 +1309,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 +1513,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 +1761,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/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698