Skip to content

Commit

Permalink
deps: V8: cherry-pick 5ebd6fcd from upstream
Browse files Browse the repository at this point in the history
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: #21269
Fixes: #21021
Reviewed-By: Myles Borins <[email protected]>
  • Loading branch information
ofrobots authored and rvagg committed Aug 16, 2018
1 parent d868eb7 commit e6cd7e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand Down
8 changes: 6 additions & 2 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -10251,7 +10251,7 @@ int64_t Isolate::AdjustAmountOfExternalAllocatedMemory(
typedef internal::Internals I;
int64_t* external_memory = reinterpret_cast<int64_t*>(
reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryOffset);
const int64_t external_memory_limit = *reinterpret_cast<int64_t*>(
int64_t* external_memory_limit = reinterpret_cast<int64_t*>(
reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryLimitOffset);
int64_t* external_memory_at_last_mc =
reinterpret_cast<int64_t*>(reinterpret_cast<uint8_t*>(this) +
Expand All @@ -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;
Expand Down

0 comments on commit e6cd7e5

Please sign in to comment.