Commit 10429d9f authored by mlippautz's avatar mlippautz Committed by Commit bot

Revert "[heap] Make survival counters concurrent (atomic)"

This reverts commit 7cf64f40.

Tanks octane. Will use a different approach here.

BUG=chromium:578871, chromium:524425
LOG=N
TBR=hpayer@chromium.org

Review URL: https://codereview.chromium.org/1605813004

Cr-Commit-Position: refs/heads/master@{#33382}
parent 6d384788
...@@ -437,9 +437,9 @@ void Heap::GarbageCollectionPrologue() { ...@@ -437,9 +437,9 @@ void Heap::GarbageCollectionPrologue() {
} }
// Reset GC statistics. // Reset GC statistics.
promoted_objects_size_.SetValue(0); promoted_objects_size_ = 0;
previous_semi_space_copied_object_size_ = semi_space_copied_object_size(); previous_semi_space_copied_object_size_ = semi_space_copied_object_size_;
semi_space_copied_object_size_.SetValue(0); semi_space_copied_object_size_ = 0;
nodes_died_in_new_space_ = 0; nodes_died_in_new_space_ = 0;
nodes_copied_in_new_space_ = 0; nodes_copied_in_new_space_ = 0;
nodes_promoted_ = 0; nodes_promoted_ = 0;
...@@ -1234,19 +1234,19 @@ void Heap::ClearNormalizedMapCaches() { ...@@ -1234,19 +1234,19 @@ void Heap::ClearNormalizedMapCaches() {
void Heap::UpdateSurvivalStatistics(int start_new_space_size) { void Heap::UpdateSurvivalStatistics(int start_new_space_size) {
if (start_new_space_size == 0) return; 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); static_cast<double>(start_new_space_size) * 100);
if (previous_semi_space_copied_object_size_ > 0) { if (previous_semi_space_copied_object_size_ > 0) {
promotion_rate_ = promotion_rate_ =
(static_cast<double>(promoted_objects_size()) / (static_cast<double>(promoted_objects_size_) /
static_cast<double>(previous_semi_space_copied_object_size_) * 100); static_cast<double>(previous_semi_space_copied_object_size_) * 100);
} else { } else {
promotion_rate_ = 0; promotion_rate_ = 0;
} }
semi_space_copied_rate_ = 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); static_cast<double>(start_new_space_size) * 100);
double survival_rate = promotion_ratio_ + semi_space_copied_rate_; double survival_rate = promotion_ratio_ + semi_space_copied_rate_;
...@@ -1309,7 +1309,7 @@ bool Heap::PerformGarbageCollection( ...@@ -1309,7 +1309,7 @@ bool Heap::PerformGarbageCollection(
// This should be updated before PostGarbageCollectionProcessing, which // This should be updated before PostGarbageCollectionProcessing, which
// can cause another GC. Take into account the objects promoted during GC. // can cause another GC. Take into account the objects promoted during GC.
old_generation_allocation_counter_ += 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(); old_generation_size_at_last_gc_ = PromotedSpaceSizeOfObjects();
} else { } else {
Scavenge(); Scavenge();
...@@ -1513,18 +1513,18 @@ static void VerifyNonPointerSpacePointers(Heap* heap) { ...@@ -1513,18 +1513,18 @@ static void VerifyNonPointerSpacePointers(Heap* heap) {
void Heap::CheckNewSpaceExpansionCriteria() { void Heap::CheckNewSpaceExpansionCriteria() {
if (FLAG_experimental_new_space_growth_heuristic) { if (FLAG_experimental_new_space_growth_heuristic) {
if (new_space_.TotalCapacity() < new_space_.MaximumCapacity() && 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% // Grow the size of new space if there is room to grow, and more than 10%
// have survived the last scavenge. // have survived the last scavenge.
new_space_.Grow(); new_space_.Grow();
survived_since_last_expansion_.SetValue(0); survived_since_last_expansion_ = 0;
} }
} else if (new_space_.TotalCapacity() < new_space_.MaximumCapacity() && } 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 // Grow the size of new space if there is room to grow, and enough data
// has survived scavenge since the last expansion. // has survived scavenge since the last expansion.
new_space_.Grow(); new_space_.Grow();
survived_since_last_expansion_.SetValue(0); survived_since_last_expansion_ = 0;
} }
} }
...@@ -1761,8 +1761,8 @@ void Heap::Scavenge() { ...@@ -1761,8 +1761,8 @@ void Heap::Scavenge() {
array_buffer_tracker()->FreeDead(true); array_buffer_tracker()->FreeDead(true);
// Update how much has survived scavenge. // Update how much has survived scavenge.
IncrementYoungSurvivorsCounter(PromotedSpaceSizeOfObjects() - IncrementYoungSurvivorsCounter(static_cast<int>(
survived_watermark + new_space_.Size()); (PromotedSpaceSizeOfObjects() - survived_watermark) + new_space_.Size()));
LOG(isolate_, ResourceEvent("scavenge", "end")); LOG(isolate_, ResourceEvent("scavenge", "end"));
......
...@@ -1408,26 +1408,22 @@ class Heap { ...@@ -1408,26 +1408,22 @@ class Heap {
void UpdateSurvivalStatistics(int start_new_space_size); void UpdateSurvivalStatistics(int start_new_space_size);
inline void IncrementPromotedObjectsSize(intptr_t object_size) { inline void IncrementPromotedObjectsSize(int object_size) {
DCHECK_GE(object_size, 0); DCHECK_GE(object_size, 0);
promoted_objects_size_.Increment(object_size); promoted_objects_size_ += object_size;
} }
inline intptr_t promoted_objects_size() { return promoted_objects_size_; }
inline intptr_t promoted_objects_size() { inline void IncrementSemiSpaceCopiedObjectSize(int object_size) {
return promoted_objects_size_.Value();
}
inline void IncrementSemiSpaceCopiedObjectSize(intptr_t object_size) {
DCHECK_GE(object_size, 0); DCHECK_GE(object_size, 0);
semi_space_copied_object_size_.Increment(object_size); semi_space_copied_object_size_ += object_size;
} }
inline intptr_t semi_space_copied_object_size() { inline intptr_t semi_space_copied_object_size() {
return semi_space_copied_object_size_.Value(); return semi_space_copied_object_size_;
} }
inline intptr_t SurvivedNewSpaceObjectSize() { inline intptr_t SurvivedNewSpaceObjectSize() {
return promoted_objects_size() + semi_space_copied_object_size(); return promoted_objects_size_ + semi_space_copied_object_size_;
} }
inline void IncrementNodesDiedInNewSpace() { nodes_died_in_new_space_++; } inline void IncrementNodesDiedInNewSpace() { nodes_died_in_new_space_++; }
...@@ -1436,18 +1432,10 @@ class Heap { ...@@ -1436,18 +1432,10 @@ class Heap {
inline void IncrementNodesPromoted() { nodes_promoted_++; } inline void IncrementNodesPromoted() { nodes_promoted_++; }
inline void IncrementYoungSurvivorsCounter(intptr_t survived) { inline void IncrementYoungSurvivorsCounter(int survived) {
DCHECK_GE(survived, 0); DCHECK(survived >= 0);
survived_last_scavenge_.SetValue(survived); survived_last_scavenge_ = survived;
survived_since_last_expansion_.Increment(survived); survived_since_last_expansion_ += survived;
}
inline intptr_t survived_last_scavenge() {
return survived_last_scavenge_.Value();
}
inline intptr_t survived_since_last_expansion() {
return survived_since_last_expansion_.Value();
} }
inline intptr_t PromotedTotalSize() { inline intptr_t PromotedTotalSize() {
...@@ -2194,10 +2182,10 @@ class Heap { ...@@ -2194,10 +2182,10 @@ class Heap {
// For keeping track of how much data has survived // For keeping track of how much data has survived
// scavenge since last new space expansion. // scavenge since last new space expansion.
AtomicNumber<intptr_t> survived_since_last_expansion_; int survived_since_last_expansion_;
// ... and since the last scavenge. // ... and since the last scavenge.
AtomicNumber<intptr_t> survived_last_scavenge_; int survived_last_scavenge_;
// This is not the depth of nested AlwaysAllocateScope's but rather a single // This is not the depth of nested AlwaysAllocateScope's but rather a single
// count, as scopes can be acquired from multiple tasks (read: threads). // count, as scopes can be acquired from multiple tasks (read: threads).
...@@ -2295,10 +2283,10 @@ class Heap { ...@@ -2295,10 +2283,10 @@ class Heap {
GCTracer* tracer_; GCTracer* tracer_;
int high_survival_rate_period_length_; int high_survival_rate_period_length_;
AtomicNumber<intptr_t> promoted_objects_size_; intptr_t promoted_objects_size_;
double promotion_ratio_; double promotion_ratio_;
double promotion_rate_; double promotion_rate_;
AtomicNumber<intptr_t> semi_space_copied_object_size_; intptr_t semi_space_copied_object_size_;
intptr_t previous_semi_space_copied_object_size_; intptr_t previous_semi_space_copied_object_size_;
double semi_space_copied_rate_; double semi_space_copied_rate_;
int nodes_died_in_new_space_; int nodes_died_in_new_space_;
......
...@@ -3097,12 +3097,13 @@ HashMap* MarkCompactCollector::EvacuateNewSpaceInParallel() { ...@@ -3097,12 +3097,13 @@ HashMap* MarkCompactCollector::EvacuateNewSpaceInParallel() {
USE(ok); USE(ok);
DCHECK(ok); DCHECK(ok);
} }
heap_->IncrementPromotedObjectsSize(new_space_visitor.promoted_size()); heap_->IncrementPromotedObjectsSize(
static_cast<int>(new_space_visitor.promoted_size()));
heap_->IncrementSemiSpaceCopiedObjectSize( heap_->IncrementSemiSpaceCopiedObjectSize(
new_space_visitor.semispace_copied_size()); static_cast<int>(new_space_visitor.semispace_copied_size()));
heap_->IncrementYoungSurvivorsCounter( heap_->IncrementYoungSurvivorsCounter(
new_space_visitor.promoted_size() + static_cast<int>(new_space_visitor.promoted_size()) +
new_space_visitor.semispace_copied_size()); static_cast<int>(new_space_visitor.semispace_copied_size()));
return local_pretenuring_feedback; return local_pretenuring_feedback;
} }
......
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