Commit 5ebd6fcd authored by hpayer's avatar hpayer Committed by Commit Bot

[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}
parent 4ca70222
......@@ -10045,7 +10045,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) +
......@@ -10063,7 +10063,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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment