Index: src/heap.h |
diff --git a/src/heap.h b/src/heap.h |
index 7e2eda2529cdd42e2eed94127c5421f46f0c019b..cbe9805929b51c7096f8e408e6f64b2674f79326 100644 |
--- a/src/heap.h |
+++ b/src/heap.h |
@@ -1497,8 +1497,8 @@ class Heap { |
// Adjusts the amount of registered external memory. |
// Returns the adjusted value. |
- inline intptr_t AdjustAmountOfExternalAllocatedMemory( |
- intptr_t change_in_bytes); |
+ inline int64_t AdjustAmountOfExternalAllocatedMemory( |
+ int64_t change_in_bytes); |
// This is only needed for testing high promotion mode. |
void SetNewSpaceHighPromotionModeActive(bool mode) { |
@@ -1517,7 +1517,10 @@ class Heap { |
} |
inline intptr_t PromotedTotalSize() { |
- return PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); |
+ int64_t total = PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); |
+ if (total > kMaxInt) return static_cast<intptr_t>(kMaxInt); |
+ if (total < 0) return 0; |
+ return static_cast<intptr_t>(total); |
} |
inline intptr_t OldGenerationSpaceAvailable() { |
@@ -1930,7 +1933,7 @@ class Heap { |
int gc_post_processing_depth_; |
// Returns the amount of external memory registered since last global gc. |
- intptr_t PromotedExternalMemorySize(); |
+ int64_t PromotedExternalMemorySize(); |
unsigned int ms_count_; // how many mark-sweep collections happened |
unsigned int gc_count_; // how many gc happened |
@@ -1984,10 +1987,10 @@ class Heap { |
// The amount of external memory registered through the API kept alive |
// by global handles |
- intptr_t amount_of_external_allocated_memory_; |
+ int64_t amount_of_external_allocated_memory_; |
// Caches the amount of external memory registered at the last global gc. |
- intptr_t amount_of_external_allocated_memory_at_last_global_gc_; |
+ int64_t amount_of_external_allocated_memory_at_last_global_gc_; |
// Indicates that an allocation has failed in the old generation since the |
// last GC. |