OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/heap/heap.h" | 5 #include "src/heap/heap.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/ast/context-slot-cache.h" | 9 #include "src/ast/context-slot-cache.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2007 | 2007 |
2008 | 2008 |
2009 void Heap::UnregisterArrayBuffer(JSArrayBuffer* buffer) { | 2009 void Heap::UnregisterArrayBuffer(JSArrayBuffer* buffer) { |
2010 ArrayBufferTracker::Unregister(this, buffer); | 2010 ArrayBufferTracker::Unregister(this, buffer); |
2011 } | 2011 } |
2012 | 2012 |
2013 | 2013 |
2014 void Heap::ConfigureInitialOldGenerationSize() { | 2014 void Heap::ConfigureInitialOldGenerationSize() { |
2015 if (!old_generation_size_configured_ && tracer()->SurvivalEventsRecorded()) { | 2015 if (!old_generation_size_configured_ && tracer()->SurvivalEventsRecorded()) { |
2016 old_generation_allocation_limit_ = | 2016 old_generation_allocation_limit_ = |
2017 Max(kMinimumOldGenerationAllocationLimit, | 2017 Max(MinimumAllocationLimitGrowingStep(), |
2018 static_cast<intptr_t>( | 2018 static_cast<intptr_t>( |
2019 static_cast<double>(old_generation_allocation_limit_) * | 2019 static_cast<double>(old_generation_allocation_limit_) * |
2020 (tracer()->AverageSurvivalRatio() / 100))); | 2020 (tracer()->AverageSurvivalRatio() / 100))); |
2021 } | 2021 } |
2022 } | 2022 } |
2023 | 2023 |
2024 | 2024 |
2025 AllocationResult Heap::AllocatePartialMap(InstanceType instance_type, | 2025 AllocationResult Heap::AllocatePartialMap(InstanceType instance_type, |
2026 int instance_size) { | 2026 int instance_size) { |
2027 Object* result = nullptr; | 2027 Object* result = nullptr; |
(...skipping 3116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5144 factor = Max(factor, kMinHeapGrowingFactor); | 5144 factor = Max(factor, kMinHeapGrowingFactor); |
5145 return factor; | 5145 return factor; |
5146 } | 5146 } |
5147 | 5147 |
5148 | 5148 |
5149 intptr_t Heap::CalculateOldGenerationAllocationLimit(double factor, | 5149 intptr_t Heap::CalculateOldGenerationAllocationLimit(double factor, |
5150 intptr_t old_gen_size) { | 5150 intptr_t old_gen_size) { |
5151 CHECK(factor > 1.0); | 5151 CHECK(factor > 1.0); |
5152 CHECK(old_gen_size > 0); | 5152 CHECK(old_gen_size > 0); |
5153 intptr_t limit = static_cast<intptr_t>(old_gen_size * factor); | 5153 intptr_t limit = static_cast<intptr_t>(old_gen_size * factor); |
5154 limit = Max(limit, old_gen_size + kMinimumOldGenerationAllocationLimit); | 5154 limit = Max(limit, old_gen_size + MinimumAllocationLimitGrowingStep()); |
5155 limit += new_space_.Capacity(); | 5155 limit += new_space_.Capacity(); |
5156 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; | 5156 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; |
5157 return Min(limit, halfway_to_the_max); | 5157 return Min(limit, halfway_to_the_max); |
5158 } | 5158 } |
5159 | 5159 |
5160 | 5160 |
5161 void Heap::SetOldGenerationAllocationLimit(intptr_t old_gen_size, | 5161 void Heap::SetOldGenerationAllocationLimit(intptr_t old_gen_size, |
5162 double gc_speed, | 5162 double gc_speed, |
5163 double mutator_speed) { | 5163 double mutator_speed) { |
5164 double factor = HeapGrowingFactor(gc_speed, mutator_speed); | 5164 double factor = HeapGrowingFactor(gc_speed, mutator_speed); |
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6461 } | 6461 } |
6462 | 6462 |
6463 | 6463 |
6464 // static | 6464 // static |
6465 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6465 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6466 return StaticVisitorBase::GetVisitorId(map); | 6466 return StaticVisitorBase::GetVisitorId(map); |
6467 } | 6467 } |
6468 | 6468 |
6469 } // namespace internal | 6469 } // namespace internal |
6470 } // namespace v8 | 6470 } // namespace v8 |
OLD | NEW |