Index: src/heap-inl.h |
diff --git a/src/heap-inl.h b/src/heap-inl.h |
index c697fedfdaac2d44da510712ef4e9fcc16df1e74..25acd9adce0cdd70c3cac43549b80484eb867494 100644 |
--- a/src/heap-inl.h |
+++ b/src/heap-inl.h |
@@ -532,27 +532,13 @@ int64_t Heap::AdjustAmountOfExternalAllocatedMemory( |
ASSERT(HasBeenSetUp()); |
int64_t amount = amount_of_external_allocated_memory_ + change_in_bytes; |
if (change_in_bytes > 0) { |
- // Avoid overflow. |
jochen (gone - plz use gerrit)
2014/06/04 11:53:07
note that signed overflow is undefined, so these c
|
- if (amount > amount_of_external_allocated_memory_) { |
- amount_of_external_allocated_memory_ = amount; |
- } else { |
- // Give up and reset the counters in case of an overflow. |
- amount_of_external_allocated_memory_ = 0; |
- amount_of_external_allocated_memory_at_last_global_gc_ = 0; |
- } |
+ amount_of_external_allocated_memory_ = amount; |
int64_t amount_since_last_global_gc = PromotedExternalMemorySize(); |
- if (amount_since_last_global_gc > external_allocation_limit_) { |
+ if (amount_since_last_global_gc > Internals::kExternalAllocationLimit) { |
CollectAllGarbage(kNoGCFlags, "external memory allocation limit reached"); |
} |
} else { |
- // Avoid underflow. |
- if (amount >= 0) { |
- amount_of_external_allocated_memory_ = amount; |
- } else { |
- // Give up and reset the counters in case of an underflow. |
- amount_of_external_allocated_memory_ = 0; |
- amount_of_external_allocated_memory_at_last_global_gc_ = 0; |
- } |
+ amount_of_external_allocated_memory_ = amount; |
} |
if (FLAG_trace_external_memory) { |
PrintPID("%8.0f ms: ", isolate()->time_millis_since_init()); |