Skip to content

Commit

Permalink
v8: backport a9e56f4f36d from upstream v8
Browse files Browse the repository at this point in the history
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: #13217
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
psmarshall authored and jasnell committed May 28, 2017
1 parent 0f3bfaf commit 188630b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 25 deletions.
8 changes: 6 additions & 2 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_; }
Expand Down
11 changes: 2 additions & 9 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand All @@ -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);
}
Expand All @@ -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);

Expand Down
1 change: 0 additions & 1 deletion deps/v8/src/flag-definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <n> allocations")
DEFINE_INT(retain_maps_for_n_gc, 2,
Expand Down
3 changes: 0 additions & 3 deletions deps/v8/src/heap/heap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<size_t>(FLAG_max_old_space_size) * MB;
}
if (FLAG_max_executable_size > 0) {
max_executable_size_ = static_cast<size_t>(FLAG_max_executable_size) * MB;
}

if (Page::kPageSize > MB) {
max_semi_space_size_ = ROUND_UP(max_semi_space_size_, Page::kPageSize);
Expand Down
10 changes: 0 additions & 10 deletions deps/v8/src/heap/heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 188630b

Please sign in to comment.