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

Side by Side Diff: src/heap.cc

Issue 279513003: Add flag to set minimum semi-space size. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/flag-definitions.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 "v8.h" 5 #include "v8.h"
6 6
7 #include "accessors.h" 7 #include "accessors.h"
8 #include "api.h" 8 #include "api.h"
9 #include "bootstrapper.h" 9 #include "bootstrapper.h"
10 #include "codegen.h" 10 #include "codegen.h"
(...skipping 5003 matching lines...) Expand 10 before | Expand all | Expand 10 after
5014 5014
5015 if (Snapshot::IsEnabled()) { 5015 if (Snapshot::IsEnabled()) {
5016 // If we are using a snapshot we always reserve the default amount 5016 // If we are using a snapshot we always reserve the default amount
5017 // of memory for each semispace because code in the snapshot has 5017 // of memory for each semispace because code in the snapshot has
5018 // write-barrier code that relies on the size and alignment of new 5018 // write-barrier code that relies on the size and alignment of new
5019 // space. We therefore cannot use a larger max semispace size 5019 // space. We therefore cannot use a larger max semispace size
5020 // than the default reserved semispace size. 5020 // than the default reserved semispace size.
5021 if (max_semi_space_size_ > reserved_semispace_size_) { 5021 if (max_semi_space_size_ > reserved_semispace_size_) {
5022 max_semi_space_size_ = reserved_semispace_size_; 5022 max_semi_space_size_ = reserved_semispace_size_;
5023 if (FLAG_trace_gc) { 5023 if (FLAG_trace_gc) {
5024 PrintPID("Max semispace size cannot be more than %dkbytes\n", 5024 PrintPID("Max semi-space size cannot be more than %d kbytes\n",
5025 reserved_semispace_size_ >> 10); 5025 reserved_semispace_size_ >> 10);
5026 } 5026 }
5027 } 5027 }
5028 } else { 5028 } else {
5029 // If we are not using snapshots we reserve space for the actual 5029 // If we are not using snapshots we reserve space for the actual
5030 // max semispace size. 5030 // max semispace size.
5031 reserved_semispace_size_ = max_semi_space_size_; 5031 reserved_semispace_size_ = max_semi_space_size_;
5032 } 5032 }
5033 5033
5034 // The max executable size must be less than or equal to the max old 5034 // The max executable size must be less than or equal to the max old
5035 // generation size. 5035 // generation size.
5036 if (max_executable_size_ > max_old_generation_size_) { 5036 if (max_executable_size_ > max_old_generation_size_) {
5037 max_executable_size_ = max_old_generation_size_; 5037 max_executable_size_ = max_old_generation_size_;
5038 } 5038 }
5039 5039
5040 // The new space size must be a power of two to support single-bit testing 5040 // The new space size must be a power of two to support single-bit testing
5041 // for containment. 5041 // for containment.
5042 max_semi_space_size_ = RoundUpToPowerOf2(max_semi_space_size_); 5042 max_semi_space_size_ = RoundUpToPowerOf2(max_semi_space_size_);
5043 reserved_semispace_size_ = RoundUpToPowerOf2(reserved_semispace_size_); 5043 reserved_semispace_size_ = RoundUpToPowerOf2(reserved_semispace_size_);
5044
5045 if (FLAG_min_semi_space_size > 0) {
5046 int initial_semispace_size = FLAG_min_semi_space_size * MB;
5047 if (initial_semispace_size > max_semi_space_size_) {
5048 initial_semispace_size_ = max_semi_space_size_;
5049 if (FLAG_trace_gc) {
5050 PrintPID("Min semi-space size cannot be more than the maximum"
5051 "semi-space size of %d MB\n", max_semi_space_size_);
5052 }
5053 } else {
5054 initial_semispace_size_ = initial_semispace_size;
5055 }
5056 }
5057
5044 initial_semispace_size_ = Min(initial_semispace_size_, max_semi_space_size_); 5058 initial_semispace_size_ = Min(initial_semispace_size_, max_semi_space_size_);
5045 5059
5046 // The external allocation limit should be below 256 MB on all architectures 5060 // The external allocation limit should be below 256 MB on all architectures
5047 // to avoid unnecessary low memory notifications, as that is the threshold 5061 // to avoid unnecessary low memory notifications, as that is the threshold
5048 // for some embedders. 5062 // for some embedders.
5049 external_allocation_limit_ = 12 * max_semi_space_size_; 5063 external_allocation_limit_ = 12 * max_semi_space_size_;
5050 ASSERT(external_allocation_limit_ <= 256 * MB); 5064 ASSERT(external_allocation_limit_ <= 256 * MB);
5051 5065
5052 // The old generation is paged and needs at least one page for each space. 5066 // The old generation is paged and needs at least one page for each space.
5053 int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1; 5067 int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1;
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after
6469 static_cast<int>(object_sizes_last_time_[index])); 6483 static_cast<int>(object_sizes_last_time_[index]));
6470 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6484 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6471 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6485 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6472 6486
6473 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6487 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6474 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6488 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6475 ClearObjectStats(); 6489 ClearObjectStats();
6476 } 6490 }
6477 6491
6478 } } // namespace v8::internal 6492 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698