Commit 5748a22f authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[heap] Fix context disposal heap limit

Fix two bugs:
- Initial configuration of limit allowed to go below the size of already
  allocated objects.
- Context disposal without dependend context reset the heap state to not
  configured without actually increasing the limit again.

Bug: chromium:843903
Change-Id: Ibdcf69b0b92b800f8919d5cc98186334945d811f
Reviewed-on: https://chromium-review.googlesource.com/c/1355143Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57946}
parent 69ab6954
......@@ -1377,6 +1377,7 @@ int Heap::NotifyContextDisposed(bool dependant_context) {
if (!dependant_context) {
tracer()->ResetSurvivalEvents();
old_generation_size_configured_ = false;
old_generation_allocation_limit_ = initial_old_generation_size_;
MemoryReducer::Event event;
event.type = MemoryReducer::kPossibleGarbage;
event.time_ms = MonotonicallyIncreasingTimeInMs();
......@@ -2395,8 +2396,9 @@ void Heap::UnregisterArrayBuffer(JSArrayBuffer* buffer) {
void Heap::ConfigureInitialOldGenerationSize() {
if (!old_generation_size_configured_ && tracer()->SurvivalEventsRecorded()) {
old_generation_allocation_limit_ =
Max(heap_controller()->MinimumAllocationLimitGrowingStep(
CurrentHeapGrowingMode()),
Max(OldGenerationSizeOfObjects() +
heap_controller()->MinimumAllocationLimitGrowingStep(
CurrentHeapGrowingMode()),
static_cast<size_t>(
static_cast<double>(old_generation_allocation_limit_) *
(tracer()->AverageSurvivalRatio() / 100)));
......
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