From 859dc641dfb486d6d70b88a2fad2d251e4523316 Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Mon, 11 Jun 2018 11:50:42 -0700 Subject: [PATCH] deps: V8: cherry-pick 5ebd6fcd from upstream Original commit message: [heap] Lower external allocation limit when external memory shrinks. BUG=chromium:728228 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_rel_ng Review-Url: https://codereview.chromium.org/2921883002 Cr-Commit-Position: refs/heads/master@{#45726} PR-URL: https://github.com/nodejs/node/pull/21269 Fixes: https://github.com/nodejs/node/issues/21021 Reviewed-By: Myles Borins --- deps/v8/include/v8-version.h | 2 +- deps/v8/include/v8.h | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 7bbdf1cc3e6911..38950df2a4fa77 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 6 #define V8_MINOR_VERSION 2 #define V8_BUILD_NUMBER 414 -#define V8_PATCH_LEVEL 56 +#define V8_PATCH_LEVEL 57 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index a4ed3439494513..d964675407deb1 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -10251,7 +10251,7 @@ int64_t Isolate::AdjustAmountOfExternalAllocatedMemory( typedef internal::Internals I; int64_t* external_memory = reinterpret_cast( reinterpret_cast(this) + I::kExternalMemoryOffset); - const int64_t external_memory_limit = *reinterpret_cast( + int64_t* external_memory_limit = reinterpret_cast( reinterpret_cast(this) + I::kExternalMemoryLimitOffset); int64_t* external_memory_at_last_mc = reinterpret_cast(reinterpret_cast(this) + @@ -10269,7 +10269,11 @@ int64_t Isolate::AdjustAmountOfExternalAllocatedMemory( CheckMemoryPressure(); } - if (change_in_bytes > 0 && amount > external_memory_limit) { + if (change_in_bytes < 0) { + *external_memory_limit += change_in_bytes; + } + + if (change_in_bytes > 0 && amount > *external_memory_limit) { ReportExternalAllocationLimitReached(); } return *external_memory;