Revert of [heap] Decouple old generation allocation limit from external memory. (patchset #1 id:1 of https://codereview.chromium.org/2329993002/ )

Reason for revert:
Regressions in telemetry benchmarks:
crbug.com/646819.

Original issue's description:
> [heap] Decouple old generation allocation limit from external memory.
>
> We check for external memory limit in Heap::ReportExternalMemoryPressure.
>
> BUG=chromium:616434
>
> Committed: https://crrev.com/672d079ccba686019fa1457c83b42c2e692ef88b
> Cr-Commit-Position: refs/heads/master@{#39374}

TBR=hpayer@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=chromium:616434

Review-Url: https://codereview.chromium.org/2339033005
Cr-Commit-Position: refs/heads/master@{#39442}
This commit is contained in:
ulan 2016-09-15 03:13:40 -07:00 committed by Commit bot
parent f84f45f9ca
commit eeb4f28aed
3 changed files with 15 additions and 5 deletions

View File

@ -192,7 +192,7 @@ bool Heap::HeapIsFullEnoughToStartIncrementalMarking(intptr_t limit) {
intptr_t adjusted_allocation_limit = limit - new_space_->Capacity();
if (PromotedSpaceSizeOfObjects() >= adjusted_allocation_limit) return true;
if (PromotedTotalSize() >= adjusted_allocation_limit) return true;
if (HighMemoryPressure()) return true;

View File

@ -1353,6 +1353,16 @@ class Heap {
survived_since_last_expansion_ += survived;
}
inline intptr_t PromotedTotalSize() {
int64_t total = PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize();
if (total > std::numeric_limits<intptr_t>::max()) {
// TODO(erikcorry): Use uintptr_t everywhere we do heap size calculations.
return std::numeric_limits<intptr_t>::max();
}
if (total < 0) return 0;
return static_cast<intptr_t>(total);
}
inline void UpdateNewSpaceAllocationCounter();
inline size_t NewSpaceAllocationCounter();
@ -1795,7 +1805,7 @@ class Heap {
// ===========================================================================
inline intptr_t OldGenerationSpaceAvailable() {
return old_generation_allocation_limit_ - PromotedSpaceSizeOfObjects();
return old_generation_allocation_limit_ - PromotedTotalSize();
}
// Returns maximum GC pause.

View File

@ -1112,7 +1112,7 @@ void IncrementalMarking::SpeedUp() {
}
bool size_of_old_space_multiplied_by_n_during_marking =
(heap_->PromotedSpaceSizeOfObjects() >
(heap_->PromotedTotalSize() >
(marking_speed_ + 1) *
old_generation_space_used_at_start_of_incremental_);
if (size_of_old_space_multiplied_by_n_during_marking) {
@ -1125,7 +1125,7 @@ void IncrementalMarking::SpeedUp() {
}
int64_t promoted_during_marking =
heap_->PromotedSpaceSizeOfObjects() -
heap_->PromotedTotalSize() -
old_generation_space_used_at_start_of_incremental_;
intptr_t delay = marking_speed_ * MB;
intptr_t scavenge_slack = heap_->MaxSemiSpaceSize();
@ -1300,7 +1300,7 @@ void IncrementalMarking::ResetStepCounters() {
old_generation_space_available_at_start_of_incremental_ =
SpaceLeftInOldSpace();
old_generation_space_used_at_start_of_incremental_ =
heap_->PromotedSpaceSizeOfObjects();
heap_->PromotedTotalSize();
bytes_rescanned_ = 0;
marking_speed_ = kInitialMarkingSpeed;
bytes_scanned_ = 0;