Correctly handle AdjustAmountOfExternalAllocatedMemory(0).

R=yangguo@chromium.org
BUG=v8:2440

Review URL: https://chromiumcodereview.appspot.com/11412299

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13114 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
ulan@chromium.org 2012-12-03 14:31:11 +00:00
parent 45fc19124f
commit 8a1a926e07

View File

@ -460,7 +460,7 @@ intptr_t Heap::AdjustAmountOfExternalAllocatedMemory(
intptr_t change_in_bytes) { intptr_t change_in_bytes) {
ASSERT(HasBeenSetUp()); ASSERT(HasBeenSetUp());
intptr_t amount = amount_of_external_allocated_memory_ + change_in_bytes; intptr_t amount = amount_of_external_allocated_memory_ + change_in_bytes;
if (change_in_bytes >= 0) { if (change_in_bytes > 0) {
// Avoid overflow. // Avoid overflow.
if (amount > amount_of_external_allocated_memory_) { if (amount > amount_of_external_allocated_memory_) {
amount_of_external_allocated_memory_ = amount; amount_of_external_allocated_memory_ = amount;