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

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

Issue 1853783002: [heap] Non-contiguous young generation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Hannes comment Created 4 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 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/heap/heap.h" 5 #include "src/heap/heap.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/ast/scopeinfo.h" 9 #include "src/ast/scopeinfo.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 Heap& heap_; 68 Heap& heap_;
69 }; 69 };
70 70
71 Heap::Heap() 71 Heap::Heap()
72 : amount_of_external_allocated_memory_(0), 72 : amount_of_external_allocated_memory_(0),
73 amount_of_external_allocated_memory_at_last_global_gc_(0), 73 amount_of_external_allocated_memory_at_last_global_gc_(0),
74 isolate_(NULL), 74 isolate_(NULL),
75 code_range_size_(0), 75 code_range_size_(0),
76 // semispace_size_ should be a power of 2 and old_generation_size_ should 76 // semispace_size_ should be a power of 2 and old_generation_size_ should
77 // be a multiple of Page::kPageSize. 77 // be a multiple of Page::kPageSize.
78 reserved_semispace_size_(8 * (kPointerSize / 4) * MB),
79 max_semi_space_size_(8 * (kPointerSize / 4) * MB), 78 max_semi_space_size_(8 * (kPointerSize / 4) * MB),
80 initial_semispace_size_(Page::kPageSize), 79 initial_semispace_size_(Page::kPageSize),
81 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), 80 max_old_generation_size_(700ul * (kPointerSize / 4) * MB),
82 initial_old_generation_size_(max_old_generation_size_ / 81 initial_old_generation_size_(max_old_generation_size_ /
83 kInitalOldGenerationLimitFactor), 82 kInitalOldGenerationLimitFactor),
84 old_generation_size_configured_(false), 83 old_generation_size_configured_(false),
85 max_executable_size_(256ul * (kPointerSize / 4) * MB), 84 max_executable_size_(256ul * (kPointerSize / 4) * MB),
86 // Variables set based on semispace_size_ and old_generation_size_ in 85 // Variables set based on semispace_size_ and old_generation_size_ in
87 // ConfigureHeap. 86 // ConfigureHeap.
88 // Will be 4 * reserved_semispace_size_ to ensure that young 87 // Will be 4 * reserved_semispace_size_ to ensure that young
(...skipping 4827 matching lines...) Expand 10 before | Expand all | Expand 10 after
4916 max_old_generation_size_ = 4915 max_old_generation_size_ =
4917 ROUND_UP(max_old_generation_size_, Page::kPageSize); 4916 ROUND_UP(max_old_generation_size_, Page::kPageSize);
4918 max_executable_size_ = ROUND_UP(max_executable_size_, Page::kPageSize); 4917 max_executable_size_ = ROUND_UP(max_executable_size_, Page::kPageSize);
4919 } 4918 }
4920 4919
4921 if (FLAG_stress_compaction) { 4920 if (FLAG_stress_compaction) {
4922 // This will cause more frequent GCs when stressing. 4921 // This will cause more frequent GCs when stressing.
4923 max_semi_space_size_ = Page::kPageSize; 4922 max_semi_space_size_ = Page::kPageSize;
4924 } 4923 }
4925 4924
4926 if (isolate()->snapshot_available()) {
4927 // If we are using a snapshot we always reserve the default amount
4928 // of memory for each semispace because code in the snapshot has
4929 // write-barrier code that relies on the size and alignment of new
4930 // space. We therefore cannot use a larger max semispace size
4931 // than the default reserved semispace size.
4932 if (max_semi_space_size_ > reserved_semispace_size_) {
4933 max_semi_space_size_ = reserved_semispace_size_;
4934 if (FLAG_trace_gc) {
4935 PrintIsolate(isolate_,
4936 "Max semi-space size cannot be more than %d kbytes\n",
4937 reserved_semispace_size_ >> 10);
4938 }
4939 }
4940 } else {
4941 // If we are not using snapshots we reserve space for the actual
4942 // max semispace size.
4943 reserved_semispace_size_ = max_semi_space_size_;
4944 }
4945
4946 // The new space size must be a power of two to support single-bit testing 4925 // The new space size must be a power of two to support single-bit testing
4947 // for containment. 4926 // for containment.
4948 max_semi_space_size_ = 4927 max_semi_space_size_ =
4949 base::bits::RoundUpToPowerOfTwo32(max_semi_space_size_); 4928 base::bits::RoundUpToPowerOfTwo32(max_semi_space_size_);
4950 reserved_semispace_size_ =
4951 base::bits::RoundUpToPowerOfTwo32(reserved_semispace_size_);
4952 4929
4953 if (FLAG_min_semi_space_size > 0) { 4930 if (FLAG_min_semi_space_size > 0) {
4954 int initial_semispace_size = FLAG_min_semi_space_size * MB; 4931 int initial_semispace_size = FLAG_min_semi_space_size * MB;
4955 if (initial_semispace_size > max_semi_space_size_) { 4932 if (initial_semispace_size > max_semi_space_size_) {
4956 initial_semispace_size_ = max_semi_space_size_; 4933 initial_semispace_size_ = max_semi_space_size_;
4957 if (FLAG_trace_gc) { 4934 if (FLAG_trace_gc) {
4958 PrintIsolate(isolate_, 4935 PrintIsolate(isolate_,
4959 "Min semi-space size cannot be more than the maximum " 4936 "Min semi-space size cannot be more than the maximum "
4960 "semi-space size of %d MB\n", 4937 "semi-space size of %d MB\n",
4961 max_semi_space_size_ / MB); 4938 max_semi_space_size_ / MB);
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
5285 base::CallOnce(&initialize_gc_once, &InitializeGCOnce); 5262 base::CallOnce(&initialize_gc_once, &InitializeGCOnce);
5286 5263
5287 // Set up memory allocator. 5264 // Set up memory allocator.
5288 if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize())) 5265 if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize()))
5289 return false; 5266 return false;
5290 5267
5291 // Initialize incremental marking. 5268 // Initialize incremental marking.
5292 incremental_marking_ = new IncrementalMarking(this); 5269 incremental_marking_ = new IncrementalMarking(this);
5293 5270
5294 // Set up new space. 5271 // Set up new space.
5295 if (!new_space_.SetUp(reserved_semispace_size_, max_semi_space_size_)) { 5272 if (!new_space_.SetUp(initial_semispace_size_, max_semi_space_size_)) {
5296 return false; 5273 return false;
5297 } 5274 }
5298 new_space_top_after_last_gc_ = new_space()->top(); 5275 new_space_top_after_last_gc_ = new_space()->top();
5299 5276
5300 // Initialize old space. 5277 // Initialize old space.
5301 old_space_ = new OldSpace(this, OLD_SPACE, NOT_EXECUTABLE); 5278 old_space_ = new OldSpace(this, OLD_SPACE, NOT_EXECUTABLE);
5302 if (old_space_ == NULL) return false; 5279 if (old_space_ == NULL) return false;
5303 if (!old_space_->SetUp()) return false; 5280 if (!old_space_->SetUp()) return false;
5304 5281
5305 if (!isolate_->code_range()->SetUp(code_range_size_)) return false; 5282 if (!isolate_->code_range()->SetUp(code_range_size_)) return false;
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
6484 } 6461 }
6485 6462
6486 6463
6487 // static 6464 // static
6488 int Heap::GetStaticVisitorIdForMap(Map* map) { 6465 int Heap::GetStaticVisitorIdForMap(Map* map) {
6489 return StaticVisitorBase::GetVisitorId(map); 6466 return StaticVisitorBase::GetVisitorId(map);
6490 } 6467 }
6491 6468
6492 } // namespace internal 6469 } // namespace internal
6493 } // namespace v8 6470 } // namespace v8
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