summaryrefslogtreecommitdiff
path: root/deps/v8/src/heap/heap-controller.cc
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2019-08-16 11:32:46 +0200
committerMichaël Zasso <targos@protonmail.com>2019-08-19 09:25:23 +0200
commite31f0a7d25668d3c1531294d2ef44a9f3bde4ef4 (patch)
tree6c6bed9804be9df6162b2483f0a56f371f66464d /deps/v8/src/heap/heap-controller.cc
parentec16fdae540adaf710b1a86c620170b2880088f0 (diff)
downloadnode-new-e31f0a7d25668d3c1531294d2ef44a9f3bde4ef4.tar.gz
deps: update V8 to 7.7.299.4
PR-URL: https://github.com/nodejs/node/pull/28918 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'deps/v8/src/heap/heap-controller.cc')
-rw-r--r--deps/v8/src/heap/heap-controller.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/deps/v8/src/heap/heap-controller.cc b/deps/v8/src/heap/heap-controller.cc
index 77e4870913..d59f8abe9f 100644
--- a/deps/v8/src/heap/heap-controller.cc
+++ b/deps/v8/src/heap/heap-controller.cc
@@ -33,20 +33,20 @@ double MemoryController<Trait>::MaxGrowingFactor(size_t max_heap_size) {
constexpr double kMaxSmallFactor = 2.0;
constexpr double kHighFactor = 4.0;
- size_t max_size_in_mb = max_heap_size / MB;
- max_size_in_mb = Max(max_size_in_mb, Trait::kMinSize);
+ size_t max_size = max_heap_size;
+ max_size = Max(max_size, Trait::kMinSize);
// If we are on a device with lots of memory, we allow a high heap
// growing factor.
- if (max_size_in_mb >= Trait::kMaxSize) {
+ if (max_size >= Trait::kMaxSize) {
return kHighFactor;
}
- DCHECK_GE(max_size_in_mb, Trait::kMinSize);
- DCHECK_LT(max_size_in_mb, Trait::kMaxSize);
+ DCHECK_GE(max_size, Trait::kMinSize);
+ DCHECK_LT(max_size, Trait::kMaxSize);
// On smaller devices we linearly scale the factor: (X-A)/(B-A)*(D-C)+C
- double factor = (max_size_in_mb - Trait::kMinSize) *
+ double factor = (max_size - Trait::kMinSize) *
(kMaxSmallFactor - kMinSmallFactor) /
(Trait::kMaxSize - Trait::kMinSize) +
kMinSmallFactor;
@@ -126,8 +126,9 @@ size_t MemoryController<Trait>::MinimumAllocationLimitGrowingStep(
template <typename Trait>
size_t MemoryController<Trait>::CalculateAllocationLimit(
- Heap* heap, size_t current_size, size_t max_size, size_t new_space_capacity,
- double factor, Heap::HeapGrowingMode growing_mode) {
+ Heap* heap, size_t current_size, size_t min_size, size_t max_size,
+ size_t new_space_capacity, double factor,
+ Heap::HeapGrowingMode growing_mode) {
switch (growing_mode) {
case Heap::HeapGrowingMode::kConservative:
case Heap::HeapGrowingMode::kSlow:
@@ -155,9 +156,11 @@ size_t MemoryController<Trait>::CalculateAllocationLimit(
static_cast<uint64_t>(current_size) +
MinimumAllocationLimitGrowingStep(growing_mode)) +
new_space_capacity;
+ const uint64_t limit_above_min_size = Max<uint64_t>(limit, min_size);
const uint64_t halfway_to_the_max =
(static_cast<uint64_t>(current_size) + max_size) / 2;
- const size_t result = static_cast<size_t>(Min(limit, halfway_to_the_max));
+ const size_t result =
+ static_cast<size_t>(Min(limit_above_min_size, halfway_to_the_max));
if (FLAG_trace_gc_verbose) {
Isolate::FromHeap(heap)->PrintWithTimestamp(
"[%s] Limit: old size: %zu KB, new limit: %zu KB (%.1f)\n",