From e3c1119174cc668a16291de2f16cd155179b5e7d 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 f51efbdf503671..a096a7b2fbd110 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -5900,8 +5900,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 1b8bafacc29919..74d8768d4d5fe8 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -810,7 +810,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) {} @@ -832,24 +831,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); } @@ -868,13 +863,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 8f21ddecd69f36..e40d5bedeaa9d2 100644 --- a/deps/v8/src/flag-definitions.h +++ b/deps/v8/src/flag-definitions.h @@ -625,7 +625,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 028a793fd1df02..49334173594d9f 100644 --- a/deps/v8/src/heap/heap.cc +++ b/deps/v8/src/heap/heap.cc @@ -5085,9 +5085,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 819055b6a933ad..2be558999593c5 100644 --- a/deps/v8/src/heap/heap.h +++ b/deps/v8/src/heap/heap.h @@ -609,16 +609,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;