From 188630b84ca56a5079386bcdd764ae44580a6ff9 Mon Sep 17 00:00:00 2001 From: Peter Marshall Date: Thu, 25 May 2017 14:07:16 +0200 Subject: [PATCH] v8: backport a9e56f4f36d from upstream v8 Because 5.8 still had other uses of the removed flag, there are some extra changes in Heap::ConfigureHeap and api.cc:SetResourceConstraints. Original commit message: [heap] Remove max_executable_size resource constraint. BUG=chromium:716032 Review-Url: https://codereview.chromium.org/2890603007 Cr-Commit-Position: refs/heads/master@{#45400} PR-URL: https://github.com/nodejs/node/pull/13217 Reviewed-By: Franziska Hinkelmann Reviewed-By: Ben Noordhuis Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- deps/v8/include/v8.h | 8 ++++++-- deps/v8/src/api.cc | 11 ++--------- deps/v8/src/flag-definitions.h | 1 - deps/v8/src/heap/heap.cc | 3 --- deps/v8/src/heap/heap.h | 10 ---------- 5 files changed, 8 insertions(+), 25 deletions(-) diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index bbf0029abd45d2..5292ed423251ed 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -5723,8 +5723,12 @@ class V8_EXPORT ResourceConstraints { void set_max_old_space_size(int limit_in_mb) { max_old_space_size_ = limit_in_mb; } - int max_executable_size() const { return max_executable_size_; } - void set_max_executable_size(int limit_in_mb) { + V8_DEPRECATE_SOON("max_executable_size_ is subsumed by max_old_space_size_", + int max_executable_size() const) { + return max_executable_size_; + } + V8_DEPRECATE_SOON("max_executable_size_ is subsumed by max_old_space_size_", + void set_max_executable_size(int limit_in_mb)) { max_executable_size_ = limit_in_mb; } uint32_t* stack_limit() const { return stack_limit_; } diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index cf71831bb41890..432431d7e06d03 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -798,7 +798,6 @@ Extension::Extension(const char* name, ResourceConstraints::ResourceConstraints() : max_semi_space_size_(0), max_old_space_size_(0), - max_executable_size_(0), stack_limit_(NULL), code_range_size_(0), max_zone_pool_size_(0) {} @@ -820,24 +819,20 @@ void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory, if (physical_memory <= low_limit) { set_max_semi_space_size(i::Heap::kMaxSemiSpaceSizeLowMemoryDevice); set_max_old_space_size(i::Heap::kMaxOldSpaceSizeLowMemoryDevice); - set_max_executable_size(i::Heap::kMaxExecutableSizeLowMemoryDevice); set_max_zone_pool_size(i::AccountingAllocator::kMaxPoolSizeLowMemoryDevice); } else if (physical_memory <= medium_limit) { set_max_semi_space_size(i::Heap::kMaxSemiSpaceSizeMediumMemoryDevice); set_max_old_space_size(i::Heap::kMaxOldSpaceSizeMediumMemoryDevice); - set_max_executable_size(i::Heap::kMaxExecutableSizeMediumMemoryDevice); set_max_zone_pool_size( i::AccountingAllocator::kMaxPoolSizeMediumMemoryDevice); } else if (physical_memory <= high_limit) { set_max_semi_space_size(i::Heap::kMaxSemiSpaceSizeHighMemoryDevice); set_max_old_space_size(i::Heap::kMaxOldSpaceSizeHighMemoryDevice); - set_max_executable_size(i::Heap::kMaxExecutableSizeHighMemoryDevice); set_max_zone_pool_size( i::AccountingAllocator::kMaxPoolSizeHighMemoryDevice); } else { set_max_semi_space_size(i::Heap::kMaxSemiSpaceSizeHugeMemoryDevice); set_max_old_space_size(i::Heap::kMaxOldSpaceSizeHugeMemoryDevice); - set_max_executable_size(i::Heap::kMaxExecutableSizeHugeMemoryDevice); set_max_zone_pool_size( i::AccountingAllocator::kMaxPoolSizeHugeMemoryDevice); } @@ -856,13 +851,11 @@ void SetResourceConstraints(i::Isolate* isolate, const ResourceConstraints& constraints) { int semi_space_size = constraints.max_semi_space_size(); int old_space_size = constraints.max_old_space_size(); - int max_executable_size = constraints.max_executable_size(); size_t code_range_size = constraints.code_range_size(); size_t max_pool_size = constraints.max_zone_pool_size(); - if (semi_space_size != 0 || old_space_size != 0 || - max_executable_size != 0 || code_range_size != 0) { + if (semi_space_size != 0 || old_space_size != 0 || code_range_size != 0) { isolate->heap()->ConfigureHeap(semi_space_size, old_space_size, - max_executable_size, code_range_size); + 0 /*max_executable_size*/, code_range_size); } isolate->allocator()->ConfigureSegmentPool(max_pool_size); diff --git a/deps/v8/src/flag-definitions.h b/deps/v8/src/flag-definitions.h index e6e9b7eb7ab2ea..4ac9904495d7d3 100644 --- a/deps/v8/src/flag-definitions.h +++ b/deps/v8/src/flag-definitions.h @@ -604,7 +604,6 @@ DEFINE_BOOL(experimental_new_space_growth_heuristic, false, "of their absolute value.") DEFINE_INT(max_old_space_size, 0, "max size of the old space (in Mbytes)") DEFINE_INT(initial_old_space_size, 0, "initial old space size (in Mbytes)") -DEFINE_INT(max_executable_size, 0, "max size of executable memory (in Mbytes)") DEFINE_BOOL(gc_global, false, "always perform global GCs") DEFINE_INT(gc_interval, -1, "garbage collect after allocations") DEFINE_INT(retain_maps_for_n_gc, 2, diff --git a/deps/v8/src/heap/heap.cc b/deps/v8/src/heap/heap.cc index e1f0994a2501a6..2c5b6e21149e43 100644 --- a/deps/v8/src/heap/heap.cc +++ b/deps/v8/src/heap/heap.cc @@ -5077,9 +5077,6 @@ bool Heap::ConfigureHeap(size_t max_semi_space_size, size_t max_old_space_size, max_old_generation_size_ = static_cast(FLAG_max_old_space_size) * MB; } - if (FLAG_max_executable_size > 0) { - max_executable_size_ = static_cast(FLAG_max_executable_size) * MB; - } if (Page::kPageSize > MB) { max_semi_space_size_ = ROUND_UP(max_semi_space_size_, Page::kPageSize); diff --git a/deps/v8/src/heap/heap.h b/deps/v8/src/heap/heap.h index ad2623964fb1bf..299f9b74568f6c 100644 --- a/deps/v8/src/heap/heap.h +++ b/deps/v8/src/heap/heap.h @@ -614,16 +614,6 @@ class Heap { static const int kMaxOldSpaceSizeHighMemoryDevice = 512 * kPointerMultiplier; static const int kMaxOldSpaceSizeHugeMemoryDevice = 1024 * kPointerMultiplier; - // The executable size has to be a multiple of Page::kPageSize. - // Sizes are in MB. - static const int kMaxExecutableSizeLowMemoryDevice = 96 * kPointerMultiplier; - static const int kMaxExecutableSizeMediumMemoryDevice = - 192 * kPointerMultiplier; - static const int kMaxExecutableSizeHighMemoryDevice = - 256 * kPointerMultiplier; - static const int kMaxExecutableSizeHugeMemoryDevice = - 256 * kPointerMultiplier; - static const int kTraceRingBufferSize = 512; static const int kStacktraceBufferSize = 512;