Always adjust amount of external memory when change is reported.

BUG=

Review URL: https://codereview.chromium.org/866413002

Cr-Commit-Position: refs/heads/master@{#26247}
This commit is contained in:
hpayer 2015-01-23 03:37:33 -08:00 committed by Commit bot
parent 8c58ed1a0c
commit a18fdd61dc
2 changed files with 7 additions and 2 deletions

View File

@ -7289,9 +7289,8 @@ int64_t Isolate::AdjustAmountOfExternalAllocatedMemory(
amount - *amount_of_external_allocated_memory_at_last_global_gc >
I::kExternalAllocationLimit) {
CollectAllGarbage("external memory allocation limit reached.");
} else {
*amount_of_external_allocated_memory = amount;
}
*amount_of_external_allocated_memory = amount;
return *amount_of_external_allocated_memory;
}

View File

@ -15199,6 +15199,12 @@ THREADED_TEST(ExternalAllocatedMemory) {
isolate->AdjustAmountOfExternalAllocatedMemory(kSize));
CHECK_EQ(baseline,
isolate->AdjustAmountOfExternalAllocatedMemory(-kSize));
const int64_t kTriggerGCSize =
v8::internal::Internals::kExternalAllocationLimit + 1;
CHECK_EQ(baseline + kTriggerGCSize,
isolate->AdjustAmountOfExternalAllocatedMemory(kTriggerGCSize));
CHECK_EQ(baseline,
isolate->AdjustAmountOfExternalAllocatedMemory(-kTriggerGCSize));
}