Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(675)

Unified Diff: src/heap/heap.h

Issue 1038653003: Change halfway-to-the-max GC trigger to measure committed pages, not allocated objects Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix thinko Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/heap/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index 8f5551aa5540864dd7a8ac51db68373cdf1637e1..90f26fbafee70680d1851f4f327f39eb3a1b4ba2 100644
--- a/src/heap/heap.h
+++ b/src/heap/heap.h
@@ -692,7 +692,7 @@ class Heap {
return old_data_space_->allocation_limit_address();
}
- // TODO(hpayer): There is still a missmatch between capacity and actual
+ // TODO(hpayer): There is still a mismatch between capacity and actual
// committed memory size.
bool CanExpandOldGeneration(int size) {
return (CommittedOldGenerationMemory() + size) < MaxOldGenerationSize();
@@ -1090,15 +1090,13 @@ class Heap {
return old_generation_allocation_limit_ - PromotedTotalSize();
}
- inline intptr_t OldGenerationCapacityAvailable() {
- return max_old_generation_size_ - PromotedTotalSize();
- }
-
static const intptr_t kMinimumOldGenerationAllocationLimit =
8 * (Page::kPageSize > MB ? Page::kPageSize : MB);
static const int kInitalOldGenerationLimitFactor = 2;
+ static const intptr_t kDefaultMaxOldGenSize = 700ul * (kPointerSize / 4) * MB;
+
#if V8_OS_ANDROID
// Don't apply pointer multiplier on Android since it has no swap space and
// should instead adapt it's heap size based on available physical memory.
@@ -1131,8 +1129,9 @@ class Heap {
static const int kMaxExecutableSizeHugeMemoryDevice =
256 * kPointerMultiplier;
- intptr_t OldGenerationAllocationLimit(intptr_t old_gen_size,
- int freed_global_handles);
+ void SetOldGenerationAllocationLimit(intptr_t old_gen_size,
+ int freed_global_handles,
+ bool weak_callbacks_completed);
// Indicates whether inline bump-pointer allocation has been disabled.
bool inline_allocation_disabled() { return inline_allocation_disabled_; }
@@ -1245,8 +1244,28 @@ class Heap {
intptr_t adjusted_allocation_limit =
old_generation_allocation_limit_ - new_space_.Capacity();
+ intptr_t adjusted_committed_limit =
+ old_generation_committed_memory_limit_ - new_space_.Capacity();
+
+ if (PromotedTotalSize() >= adjusted_allocation_limit) {
+ if (FLAG_trace_gc_verbose) {
+ PrintF("Next GC likely to be full: We are at %" V8_PTR_PREFIX
+ "dMbytes out of %" V8_PTR_PREFIX "dMbytes\n",
+ PromotedTotalSize() >> 20,
+ old_generation_allocation_limit_ >> 20);
+ }
+ return true;
+ }
- if (PromotedTotalSize() >= adjusted_allocation_limit) return true;
+ if (CommittedOldGenerationMemory() >= adjusted_committed_limit) {
+ if (FLAG_trace_gc_verbose) {
+ PrintF("Next GC likely to be full: We are at %" V8_PTR_PREFIX
+ "dMbytes committed out of %" V8_PTR_PREFIX "dMbytes\n",
+ CommittedOldGenerationMemory() >> 20,
+ old_generation_committed_memory_limit_ >> 20);
+ }
+ return true;
+ }
return false;
}
@@ -1645,9 +1664,14 @@ class Heap {
// Limit that triggers a global GC on the next (normally caused) GC. This
// is checked when we have already decided to do a GC to help determine
// which collector to invoke, before expanding a paged space in the old
- // generation and on every allocation in large object space.
+ // generation and on every allocation in large object space. This only
+ // measures objects, so it may be underreporting if we have fragmentation.
intptr_t old_generation_allocation_limit_;
+ // As above, but counts pages, not objects, so is more likely to trigger
+ // when we have fragmentation.
+ intptr_t old_generation_committed_memory_limit_;
+
// Indicates that an allocation has failed in the old generation since the
// last GC.
bool old_gen_exhausted_;
@@ -2080,8 +2104,6 @@ class Heap {
double idle_time_in_ms, size_t size_of_objects,
size_t mark_compact_speed_in_bytes_per_ms);
- bool WorthActivatingIncrementalMarking();
-
void ClearObjectStats(bool clear_last_time_stats = false);
inline void UpdateAllocationsHash(HeapObject* object);
« no previous file with comments | « no previous file | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698