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

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

Issue 657583004: Start with a maximally large new space reservation (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | « no previous file | test/cctest/cctest.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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 Heap::Heap() 53 Heap::Heap()
54 : amount_of_external_allocated_memory_(0), 54 : amount_of_external_allocated_memory_(0),
55 amount_of_external_allocated_memory_at_last_global_gc_(0), 55 amount_of_external_allocated_memory_at_last_global_gc_(0),
56 isolate_(NULL), 56 isolate_(NULL),
57 code_range_size_(0), 57 code_range_size_(0),
58 // semispace_size_ should be a power of 2 and old_generation_size_ should 58 // semispace_size_ should be a power of 2 and old_generation_size_ should
59 // be a multiple of Page::kPageSize. 59 // be a multiple of Page::kPageSize.
60 reserved_semispace_size_(8 * (kPointerSize / 4) * MB), 60 reserved_semispace_size_(8 * (kPointerSize / 4) * MB),
61 max_semi_space_size_(8 * (kPointerSize / 4) * MB), 61 max_semi_space_size_(8 * (kPointerSize / 4) * MB),
62 initial_semispace_size_(Page::kPageSize), 62 initial_semispace_size_(8 * (kPointerSize / 4) * MB),
63 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), 63 max_old_generation_size_(700ul * (kPointerSize / 4) * MB),
64 max_executable_size_(256ul * (kPointerSize / 4) * MB), 64 max_executable_size_(256ul * (kPointerSize / 4) * MB),
65 // Variables set based on semispace_size_ and old_generation_size_ in 65 // Variables set based on semispace_size_ and old_generation_size_ in
66 // ConfigureHeap. 66 // ConfigureHeap.
67 // Will be 4 * reserved_semispace_size_ to ensure that young 67 // Will be 4 * reserved_semispace_size_ to ensure that young
68 // generation can be aligned to its size. 68 // generation can be aligned to its size.
69 maximum_committed_(0), 69 maximum_committed_(0),
70 survived_since_last_expansion_(0), 70 survived_since_last_expansion_(0),
71 sweep_generation_(0), 71 sweep_generation_(0),
72 always_allocate_scope_depth_(0), 72 always_allocate_scope_depth_(0),
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 promotion_queue_(this), 132 promotion_queue_(this),
133 configured_(false), 133 configured_(false),
134 external_string_table_(this), 134 external_string_table_(this),
135 chunks_queued_for_free_(NULL), 135 chunks_queued_for_free_(NULL),
136 gc_callbacks_depth_(0), 136 gc_callbacks_depth_(0),
137 deserialization_complete_(false) { 137 deserialization_complete_(false) {
138 // Allow build-time customization of the max semispace size. Building 138 // Allow build-time customization of the max semispace size. Building
139 // V8 with snapshots and a non-default max semispace size is much 139 // V8 with snapshots and a non-default max semispace size is much
140 // easier if you can define it as part of the build environment. 140 // easier if you can define it as part of the build environment.
141 #if defined(V8_MAX_SEMISPACE_SIZE) 141 #if defined(V8_MAX_SEMISPACE_SIZE)
142 max_semi_space_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE; 142 initial_semispace_size_ = max_semi_space_size_ = reserved_semispace_size_ =
143 V8_MAX_SEMISPACE_SIZE;
143 #endif 144 #endif
144 145
145 // Ensure old_generation_size_ is a multiple of kPageSize. 146 // Ensure old_generation_size_ is a multiple of kPageSize.
146 DCHECK(MB >= Page::kPageSize); 147 DCHECK(MB >= Page::kPageSize);
147 148
148 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength); 149 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength);
149 set_native_contexts_list(NULL); 150 set_native_contexts_list(NULL);
150 set_array_buffers_list(Smi::FromInt(0)); 151 set_array_buffers_list(Smi::FromInt(0));
151 set_allocation_sites_list(Smi::FromInt(0)); 152 set_allocation_sites_list(Smi::FromInt(0));
152 set_encountered_weak_collections(Smi::FromInt(0)); 153 set_encountered_weak_collections(Smi::FromInt(0));
(...skipping 4779 matching lines...) Expand 10 before | Expand all | Expand 10 after
4932 initial_semispace_size_ = max_semi_space_size_; 4933 initial_semispace_size_ = max_semi_space_size_;
4933 if (FLAG_trace_gc) { 4934 if (FLAG_trace_gc) {
4934 PrintPID( 4935 PrintPID(
4935 "Min semi-space size cannot be more than the maximum" 4936 "Min semi-space size cannot be more than the maximum"
4936 "semi-space size of %d MB\n", 4937 "semi-space size of %d MB\n",
4937 max_semi_space_size_); 4938 max_semi_space_size_);
4938 } 4939 }
4939 } else { 4940 } else {
4940 initial_semispace_size_ = initial_semispace_size; 4941 initial_semispace_size_ = initial_semispace_size;
4941 } 4942 }
4943 initial_semispace_size_ =
4944 Min(initial_semispace_size_, max_semi_space_size_);
4945 } else {
4946 initial_semispace_size_ = max_semi_space_size_;
4942 } 4947 }
4943 4948
4944 initial_semispace_size_ = Min(initial_semispace_size_, max_semi_space_size_);
4945 4949
4946 // The old generation is paged and needs at least one page for each space. 4950 // The old generation is paged and needs at least one page for each space.
4947 int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1; 4951 int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1;
4948 max_old_generation_size_ = 4952 max_old_generation_size_ =
4949 Max(static_cast<intptr_t>(paged_space_count * Page::kPageSize), 4953 Max(static_cast<intptr_t>(paged_space_count * Page::kPageSize),
4950 max_old_generation_size_); 4954 max_old_generation_size_);
4951 4955
4952 // We rely on being able to allocate new arrays in paged spaces. 4956 // We rely on being able to allocate new arrays in paged spaces.
4953 DCHECK(Page::kMaxRegularHeapObjectSize >= 4957 DCHECK(Page::kMaxRegularHeapObjectSize >=
4954 (JSArray::kSize + 4958 (JSArray::kSize +
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after
6192 static_cast<int>(object_sizes_last_time_[index])); 6196 static_cast<int>(object_sizes_last_time_[index]));
6193 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6197 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6194 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6198 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6195 6199
6196 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6200 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6197 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6201 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6198 ClearObjectStats(); 6202 ClearObjectStats();
6199 } 6203 }
6200 } 6204 }
6201 } // namespace v8::internal 6205 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/cctest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698