Reviewers: Hannes Payer,
Description:
Lower limit for external allocation and improve tracing.
R=
hpa...@chromium.org
Please review this at
https://codereview.chromium.org/16896012/
SVN Base:
https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/heap-inl.h
M src/heap.cc
Index: src/heap-inl.h
diff --git a/src/heap-inl.h b/src/heap-inl.h
index
eb9d9c09d37f79c57a88fc8598a7172bfc4c8bf0..2d0968d34195d7ab6a2f1c87f2518323facf55b4
100644
--- a/src/heap-inl.h
+++ b/src/heap-inl.h
@@ -550,7 +550,7 @@ intptr_t Heap::AdjustAmountOfExternalAllocatedMemory(
if (amount >= 0) {
amount_of_external_allocated_memory_ = amount;
} else {
- // Give up and reset the counters in case of an overflow.
+ // 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;
}
@@ -558,8 +558,11 @@ intptr_t Heap::AdjustAmountOfExternalAllocatedMemory(
if (FLAG_trace_external_memory) {
PrintPID("%8.0f ms: ", isolate()->time_millis_since_init());
PrintF("Adjust amount of external memory: delta=%6" V8_PTR_PREFIX "d
KB, "
- " amount=%6" V8_PTR_PREFIX "d KB, isolate=0x%08"
V8PRIxPTR ".\n",
- change_in_bytes / 1024, amount_of_external_allocated_memory_ /
1024,
+ "amount=%6" V8_PTR_PREFIX "d KB, since_gc=%6" V8_PTR_PREFIX "d
KB, "
+ "isolate=0x%08" V8PRIxPTR ".\n",
+ change_in_bytes / KB,
+ amount_of_external_allocated_memory_ / KB,
+ PromotedExternalMemorySize() / KB,
reinterpret_cast<intptr_t>(isolate()));
}
ASSERT(amount_of_external_allocated_memory_ >= 0);
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index
43c83e40a5aecfd74ed46f00ec678dde9d9436cb..0eb75f4f30f2a95086fa05f128de7244be971fa1
100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -6620,7 +6620,12 @@ bool Heap::ConfigureHeap(int max_semispace_size,
max_semispace_size_ = RoundUpToPowerOf2(max_semispace_size_);
reserved_semispace_size_ = RoundUpToPowerOf2(reserved_semispace_size_);
initial_semispace_size_ = Min(initial_semispace_size_,
max_semispace_size_);
- external_allocation_limit_ = 16 * max_semispace_size_;
+
+ // The external allocation limit should be below 256 MB on all
architectures
+ // to avoid unnecessary low memory notifications, as that is the
threshold
+ // for some embedders.
+ external_allocation_limit_ = 12 * max_semispace_size_;
+ ASSERT(external_allocation_limit_ <= 256 * MB);
// The old generation is paged and needs at least one page for each
space.
int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1;