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

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

Issue 652543007: Add support for a target new space size (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 2 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/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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 Heap::Heap() 54 Heap::Heap()
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 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), 65 max_old_generation_size_(700ul * (kPointerSize / 4) * MB),
65 max_executable_size_(256ul * (kPointerSize / 4) * MB), 66 max_executable_size_(256ul * (kPointerSize / 4) * MB),
66 // Variables set based on semispace_size_ and old_generation_size_ in 67 // Variables set based on semispace_size_ and old_generation_size_ in
67 // ConfigureHeap. 68 // ConfigureHeap.
68 // Will be 4 * reserved_semispace_size_ to ensure that young 69 // Will be 4 * reserved_semispace_size_ to ensure that young
69 // generation can be aligned to its size. 70 // generation can be aligned to its size.
70 maximum_committed_(0), 71 maximum_committed_(0),
71 survived_since_last_expansion_(0), 72 survived_since_last_expansion_(0),
72 sweep_generation_(0), 73 sweep_generation_(0),
73 always_allocate_scope_depth_(0), 74 always_allocate_scope_depth_(0),
(...skipping 4863 matching lines...) Expand 10 before | Expand all | Expand 10 after
4937 base::bits::RoundUpToPowerOfTwo32(max_semi_space_size_); 4938 base::bits::RoundUpToPowerOfTwo32(max_semi_space_size_);
4938 reserved_semispace_size_ = 4939 reserved_semispace_size_ =
4939 base::bits::RoundUpToPowerOfTwo32(reserved_semispace_size_); 4940 base::bits::RoundUpToPowerOfTwo32(reserved_semispace_size_);
4940 4941
4941 if (FLAG_min_semi_space_size > 0) { 4942 if (FLAG_min_semi_space_size > 0) {
4942 int initial_semispace_size = FLAG_min_semi_space_size * MB; 4943 int initial_semispace_size = FLAG_min_semi_space_size * MB;
4943 if (initial_semispace_size > max_semi_space_size_) { 4944 if (initial_semispace_size > max_semi_space_size_) {
4944 initial_semispace_size_ = max_semi_space_size_; 4945 initial_semispace_size_ = max_semi_space_size_;
4945 if (FLAG_trace_gc) { 4946 if (FLAG_trace_gc) {
4946 PrintPID( 4947 PrintPID(
4947 "Min semi-space size cannot be more than the maximum" 4948 "Min semi-space size cannot be more than the maximum "
4948 "semi-space size of %d MB\n", 4949 "semi-space size of %d MB\n",
4949 max_semi_space_size_); 4950 max_semi_space_size_ / MB);
4950 } 4951 }
4951 } else { 4952 } else {
4952 initial_semispace_size_ = initial_semispace_size; 4953 initial_semispace_size_ = initial_semispace_size;
4953 } 4954 }
4954 } 4955 }
4955 4956
4956 initial_semispace_size_ = Min(initial_semispace_size_, max_semi_space_size_); 4957 initial_semispace_size_ = Min(initial_semispace_size_, max_semi_space_size_);
4957 4958
4959 if (FLAG_target_semi_space_size > 0) {
4960 int target_semispace_size = FLAG_target_semi_space_size * MB;
4961 if (target_semispace_size < initial_semispace_size_) {
4962 target_semispace_size_ = initial_semispace_size_;
4963 if (FLAG_trace_gc) {
4964 PrintPID(
4965 "Target semi-space size cannot be less than the minimum "
4966 "semi-space size of %d MB\n",
4967 initial_semispace_size_ / MB);
4968 }
4969 } else if (target_semispace_size > max_semi_space_size_) {
4970 target_semispace_size_ = max_semi_space_size_;
4971 if (FLAG_trace_gc) {
4972 PrintPID(
4973 "Target semi-space size cannot be less than the maximum "
4974 "semi-space size of %d MB\n",
4975 max_semi_space_size_ / MB);
4976 }
4977 } else {
4978 target_semispace_size_ = target_semispace_size;
4979 }
4980 }
4981
4982 target_semispace_size_ = Max(initial_semispace_size_, target_semispace_size_);
4983
4958 // The old generation is paged and needs at least one page for each space. 4984 // The old generation is paged and needs at least one page for each space.
4959 int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1; 4985 int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1;
4960 max_old_generation_size_ = 4986 max_old_generation_size_ =
4961 Max(static_cast<intptr_t>(paged_space_count * Page::kPageSize), 4987 Max(static_cast<intptr_t>(paged_space_count * Page::kPageSize),
4962 max_old_generation_size_); 4988 max_old_generation_size_);
4963 4989
4964 // We rely on being able to allocate new arrays in paged spaces. 4990 // We rely on being able to allocate new arrays in paged spaces.
4965 DCHECK(Page::kMaxRegularHeapObjectSize >= 4991 DCHECK(Page::kMaxRegularHeapObjectSize >=
4966 (JSArray::kSize + 4992 (JSArray::kSize +
4967 FixedArray::SizeFor(JSObject::kInitialMaxFastElementArray) + 4993 FixedArray::SizeFor(JSObject::kInitialMaxFastElementArray) +
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
6204 static_cast<int>(object_sizes_last_time_[index])); 6230 static_cast<int>(object_sizes_last_time_[index]));
6205 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6231 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6206 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6232 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6207 6233
6208 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6234 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6209 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6235 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6210 ClearObjectStats(); 6236 ClearObjectStats();
6211 } 6237 }
6212 } 6238 }
6213 } // namespace v8::internal 6239 } // 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