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

Side by Side Diff: src/heap/heap.cc

Issue 1257833005: Use conservative heap growing factor for background tab. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add comment Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/heap/heap.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 dump_allocations_hash_countdown_(FLAG_dump_allocations_digest_at_alloc), 102 dump_allocations_hash_countdown_(FLAG_dump_allocations_digest_at_alloc),
103 ms_count_(0), 103 ms_count_(0),
104 gc_count_(0), 104 gc_count_(0),
105 remembered_unmapped_pages_index_(0), 105 remembered_unmapped_pages_index_(0),
106 unflattened_strings_length_(0), 106 unflattened_strings_length_(0),
107 #ifdef DEBUG 107 #ifdef DEBUG
108 allocation_timeout_(0), 108 allocation_timeout_(0),
109 #endif // DEBUG 109 #endif // DEBUG
110 old_generation_allocation_limit_(initial_old_generation_size_), 110 old_generation_allocation_limit_(initial_old_generation_size_),
111 old_gen_exhausted_(false), 111 old_gen_exhausted_(false),
112 optimize_for_memory_usage_(false),
112 inline_allocation_disabled_(false), 113 inline_allocation_disabled_(false),
113 store_buffer_rebuilder_(store_buffer()), 114 store_buffer_rebuilder_(store_buffer()),
114 hidden_string_(NULL), 115 hidden_string_(NULL),
115 gc_safe_size_of_old_object_(NULL), 116 gc_safe_size_of_old_object_(NULL),
116 total_regexp_code_generated_(0), 117 total_regexp_code_generated_(0),
117 tracer_(this), 118 tracer_(this),
118 high_survival_rate_period_length_(0), 119 high_survival_rate_period_length_(0),
119 promoted_objects_size_(0), 120 promoted_objects_size_(0),
120 promotion_ratio_(0), 121 promotion_ratio_(0),
121 semi_space_copied_object_size_(0), 122 semi_space_copied_object_size_(0),
(...skipping 4777 matching lines...) Expand 10 before | Expand all | Expand 10 after
4899 4900
4900 void Heap::CheckAndNotifyBackgroundIdleNotification(double idle_time_in_ms, 4901 void Heap::CheckAndNotifyBackgroundIdleNotification(double idle_time_in_ms,
4901 double now_ms) { 4902 double now_ms) {
4902 if (idle_time_in_ms >= GCIdleTimeHandler::kMinBackgroundIdleTime) { 4903 if (idle_time_in_ms >= GCIdleTimeHandler::kMinBackgroundIdleTime) {
4903 MemoryReducer::Event event; 4904 MemoryReducer::Event event;
4904 event.type = MemoryReducer::kBackgroundIdleNotification; 4905 event.type = MemoryReducer::kBackgroundIdleNotification;
4905 event.time_ms = now_ms; 4906 event.time_ms = now_ms;
4906 event.can_start_incremental_gc = incremental_marking()->IsStopped() && 4907 event.can_start_incremental_gc = incremental_marking()->IsStopped() &&
4907 incremental_marking()->CanBeActivated(); 4908 incremental_marking()->CanBeActivated();
4908 memory_reducer_.NotifyBackgroundIdleNotification(event); 4909 memory_reducer_.NotifyBackgroundIdleNotification(event);
4910 optimize_for_memory_usage_ = true;
4911 } else {
4912 optimize_for_memory_usage_ = false;
4909 } 4913 }
4910 } 4914 }
4911 4915
4912 4916
4913 double Heap::MonotonicallyIncreasingTimeInMs() { 4917 double Heap::MonotonicallyIncreasingTimeInMs() {
4914 return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() * 4918 return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() *
4915 static_cast<double>(base::Time::kMillisecondsPerSecond); 4919 static_cast<double>(base::Time::kMillisecondsPerSecond);
4916 } 4920 }
4917 4921
4918 4922
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
5594 } 5598 }
5595 5599
5596 // We set the old generation growing factor to 2 to grow the heap slower on 5600 // We set the old generation growing factor to 2 to grow the heap slower on
5597 // memory-constrained devices. 5601 // memory-constrained devices.
5598 if (max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice || 5602 if (max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice ||
5599 FLAG_optimize_for_size) { 5603 FLAG_optimize_for_size) {
5600 factor = Min(factor, kMaxHeapGrowingFactorMemoryConstrained); 5604 factor = Min(factor, kMaxHeapGrowingFactorMemoryConstrained);
5601 } 5605 }
5602 5606
5603 if (freed_global_handles >= kFreedGlobalHandlesThreshold || 5607 if (freed_global_handles >= kFreedGlobalHandlesThreshold ||
5604 memory_reducer_.ShouldGrowHeapSlowly()) { 5608 memory_reducer_.ShouldGrowHeapSlowly() || optimize_for_memory_usage_) {
5605 factor = Min(factor, kConservativeHeapGrowingFactor); 5609 factor = Min(factor, kConservativeHeapGrowingFactor);
5606 } 5610 }
5607 5611
5608 if (FLAG_stress_compaction || 5612 if (FLAG_stress_compaction ||
5609 mark_compact_collector()->reduce_memory_footprint_) { 5613 mark_compact_collector()->reduce_memory_footprint_) {
5610 factor = kMinHeapGrowingFactor; 5614 factor = kMinHeapGrowingFactor;
5611 } 5615 }
5612 5616
5613 old_generation_allocation_limit_ = 5617 old_generation_allocation_limit_ =
5614 CalculateOldGenerationAllocationLimit(factor, old_gen_size); 5618 CalculateOldGenerationAllocationLimit(factor, old_gen_size);
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
6858 *object_type = "CODE_TYPE"; \ 6862 *object_type = "CODE_TYPE"; \
6859 *object_sub_type = "CODE_AGE/" #name; \ 6863 *object_sub_type = "CODE_AGE/" #name; \
6860 return true; 6864 return true;
6861 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6865 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6862 #undef COMPARE_AND_RETURN_NAME 6866 #undef COMPARE_AND_RETURN_NAME
6863 } 6867 }
6864 return false; 6868 return false;
6865 } 6869 }
6866 } // namespace internal 6870 } // namespace internal
6867 } // namespace v8 6871 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698