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

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

Issue 734363002: Introduce an option to do regular new space growing for a while (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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') | src/heap/spaces.h » ('j') | 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 : amount_of_external_allocated_memory_(0), 55 : amount_of_external_allocated_memory_(0),
56 amount_of_external_allocated_memory_at_last_global_gc_(0), 56 amount_of_external_allocated_memory_at_last_global_gc_(0),
57 isolate_(NULL), 57 isolate_(NULL),
58 code_range_size_(0), 58 code_range_size_(0),
59 // semispace_size_ should be a power of 2 and old_generation_size_ should 59 // semispace_size_ should be a power of 2 and old_generation_size_ should
60 // be a multiple of Page::kPageSize. 60 // be a multiple of Page::kPageSize.
61 reserved_semispace_size_(8 * (kPointerSize / 4) * MB), 61 reserved_semispace_size_(8 * (kPointerSize / 4) * MB),
62 max_semi_space_size_(8 * (kPointerSize / 4) * MB), 62 max_semi_space_size_(8 * (kPointerSize / 4) * MB),
63 initial_semispace_size_(Page::kPageSize), 63 initial_semispace_size_(Page::kPageSize),
64 target_semispace_size_(Page::kPageSize), 64 target_semispace_size_(Page::kPageSize),
65 scavenges_before_grow_(0),
65 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), 66 max_old_generation_size_(700ul * (kPointerSize / 4) * MB),
66 max_executable_size_(256ul * (kPointerSize / 4) * MB), 67 max_executable_size_(256ul * (kPointerSize / 4) * MB),
67 // Variables set based on semispace_size_ and old_generation_size_ in 68 // Variables set based on semispace_size_ and old_generation_size_ in
68 // ConfigureHeap. 69 // ConfigureHeap.
69 // Will be 4 * reserved_semispace_size_ to ensure that young 70 // Will be 4 * reserved_semispace_size_ to ensure that young
70 // generation can be aligned to its size. 71 // generation can be aligned to its size.
71 maximum_committed_(0), 72 maximum_committed_(0),
72 survived_since_last_expansion_(0), 73 survived_since_last_expansion_(0),
73 sweep_generation_(0), 74 sweep_generation_(0),
74 always_allocate_scope_depth_(0), 75 always_allocate_scope_depth_(0),
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 // Set age mark. 1564 // Set age mark.
1564 new_space_.set_age_mark(new_space_.top()); 1565 new_space_.set_age_mark(new_space_.top());
1565 1566
1566 new_space_.LowerInlineAllocationLimit( 1567 new_space_.LowerInlineAllocationLimit(
1567 new_space_.inline_allocation_limit_step()); 1568 new_space_.inline_allocation_limit_step());
1568 1569
1569 // Update how much has survived scavenge. 1570 // Update how much has survived scavenge.
1570 IncrementYoungSurvivorsCounter(static_cast<int>( 1571 IncrementYoungSurvivorsCounter(static_cast<int>(
1571 (PromotedSpaceSizeOfObjects() - survived_watermark) + new_space_.Size())); 1572 (PromotedSpaceSizeOfObjects() - survived_watermark) + new_space_.Size()));
1572 1573
1574 if (scavenges_before_grow_ > 0) {
1575 if (--scavenges_before_grow_ == 0) {
1576 new_space()->set_grow_to_target_capacity(true);
1577 }
1578 }
1579
1573 LOG(isolate_, ResourceEvent("scavenge", "end")); 1580 LOG(isolate_, ResourceEvent("scavenge", "end"));
1574 1581
1575 gc_state_ = NOT_IN_GC; 1582 gc_state_ = NOT_IN_GC;
1576 1583
1577 gc_idle_time_handler_.NotifyScavenge(); 1584 gc_idle_time_handler_.NotifyScavenge();
1578 } 1585 }
1579 1586
1580 1587
1581 String* Heap::UpdateNewSpaceReferenceInExternalStringTableEntry(Heap* heap, 1588 String* Heap::UpdateNewSpaceReferenceInExternalStringTableEntry(Heap* heap,
1582 Object** p) { 1589 Object** p) {
(...skipping 3469 matching lines...) Expand 10 before | Expand all | Expand 10 after
5052 "semi-space size of %d MB\n", 5059 "semi-space size of %d MB\n",
5053 max_semi_space_size_ / MB); 5060 max_semi_space_size_ / MB);
5054 } 5061 }
5055 } else { 5062 } else {
5056 target_semispace_size_ = target_semispace_size; 5063 target_semispace_size_ = target_semispace_size;
5057 } 5064 }
5058 } 5065 }
5059 5066
5060 target_semispace_size_ = Max(initial_semispace_size_, target_semispace_size_); 5067 target_semispace_size_ = Max(initial_semispace_size_, target_semispace_size_);
5061 5068
5069 scavenges_before_grow_ = Max(FLAG_scavenges_before_grow, 0);
5070
5062 // The old generation is paged and needs at least one page for each space. 5071 // The old generation is paged and needs at least one page for each space.
5063 int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1; 5072 int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1;
5064 max_old_generation_size_ = 5073 max_old_generation_size_ =
5065 Max(static_cast<intptr_t>(paged_space_count * Page::kPageSize), 5074 Max(static_cast<intptr_t>(paged_space_count * Page::kPageSize),
5066 max_old_generation_size_); 5075 max_old_generation_size_);
5067 5076
5068 // We rely on being able to allocate new arrays in paged spaces. 5077 // We rely on being able to allocate new arrays in paged spaces.
5069 DCHECK(Page::kMaxRegularHeapObjectSize >= 5078 DCHECK(Page::kMaxRegularHeapObjectSize >=
5070 (JSArray::kSize + 5079 (JSArray::kSize +
5071 FixedArray::SizeFor(JSObject::kInitialMaxFastElementArray) + 5080 FixedArray::SizeFor(JSObject::kInitialMaxFastElementArray) +
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
5234 5243
5235 // Set up memory allocator. 5244 // Set up memory allocator.
5236 if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize())) 5245 if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize()))
5237 return false; 5246 return false;
5238 5247
5239 // Set up new space. 5248 // Set up new space.
5240 if (!new_space_.SetUp(reserved_semispace_size_, max_semi_space_size_)) { 5249 if (!new_space_.SetUp(reserved_semispace_size_, max_semi_space_size_)) {
5241 return false; 5250 return false;
5242 } 5251 }
5243 new_space_top_after_last_gc_ = new_space()->top(); 5252 new_space_top_after_last_gc_ = new_space()->top();
5253 if (scavenges_before_grow_ <= 0) {
5254 new_space()->set_grow_to_target_capacity(true);
5255 }
5244 5256
5245 // Initialize old pointer space. 5257 // Initialize old pointer space.
5246 old_pointer_space_ = new OldSpace(this, max_old_generation_size_, 5258 old_pointer_space_ = new OldSpace(this, max_old_generation_size_,
5247 OLD_POINTER_SPACE, NOT_EXECUTABLE); 5259 OLD_POINTER_SPACE, NOT_EXECUTABLE);
5248 if (old_pointer_space_ == NULL) return false; 5260 if (old_pointer_space_ == NULL) return false;
5249 if (!old_pointer_space_->SetUp()) return false; 5261 if (!old_pointer_space_->SetUp()) return false;
5250 5262
5251 // Initialize old data space. 5263 // Initialize old data space.
5252 old_data_space_ = new OldSpace(this, max_old_generation_size_, OLD_DATA_SPACE, 5264 old_data_space_ = new OldSpace(this, max_old_generation_size_, OLD_DATA_SPACE,
5253 NOT_EXECUTABLE); 5265 NOT_EXECUTABLE);
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
6308 static_cast<int>(object_sizes_last_time_[index])); 6320 static_cast<int>(object_sizes_last_time_[index]));
6309 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6321 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6310 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6322 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6311 6323
6312 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6324 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6313 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6325 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6314 ClearObjectStats(); 6326 ClearObjectStats();
6315 } 6327 }
6316 } 6328 }
6317 } // namespace v8::internal 6329 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698