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

Side by Side Diff: src/heap.cc

Issue 7104048: Revert 8133: Lower heap size limits on systems that are short of virtual memory. (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 6 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 | « ChangeLog ('k') | src/platform.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 last_idle_notification_gc_count_init_(false), 146 last_idle_notification_gc_count_init_(false),
147 configured_(false), 147 configured_(false),
148 is_safe_to_read_maps_(true) { 148 is_safe_to_read_maps_(true) {
149 // Allow build-time customization of the max semispace size. Building 149 // Allow build-time customization of the max semispace size. Building
150 // V8 with snapshots and a non-default max semispace size is much 150 // V8 with snapshots and a non-default max semispace size is much
151 // easier if you can define it as part of the build environment. 151 // easier if you can define it as part of the build environment.
152 #if defined(V8_MAX_SEMISPACE_SIZE) 152 #if defined(V8_MAX_SEMISPACE_SIZE)
153 max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE; 153 max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE;
154 #endif 154 #endif
155 155
156 intptr_t max_virtual = OS::MaxVirtualMemory();
157
158 if (max_virtual > 0) {
159 intptr_t half = max_virtual >> 1;
160 intptr_t quarter = max_virtual >> 2;
161 // If we have limits on the amount of virtual memory we can use then we may
162 // be forced to lower the allocation limits. We reserve one quarter of the
163 // memory for young space and off-heap data. The rest is distributed as
164 // described below.
165 if (code_range_size_ > 0) {
166 // Reserve a quarter of the memory for the code range. The old space
167 // heap gets the remaining half. There is some unavoidable double
168 // counting going on here since the heap size is measured in committed
169 // virtual memory and the code range is only reserved virtual memory.
170 code_range_size_ = Min(code_range_size_, quarter);
171 max_old_generation_size_ = Min(max_old_generation_size_, half);
172 } else {
173 // Reserve three quarters of the memory for the old space heap including
174 // the executable code.
175 max_old_generation_size_ = Min(max_old_generation_size_, half + quarter);
176 }
177 }
178
179 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength); 156 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength);
180 global_contexts_list_ = NULL; 157 global_contexts_list_ = NULL;
181 mark_compact_collector_.heap_ = this; 158 mark_compact_collector_.heap_ = this;
182 external_string_table_.heap_ = this; 159 external_string_table_.heap_ = this;
183 } 160 }
184 161
185 162
186 intptr_t Heap::Capacity() { 163 intptr_t Heap::Capacity() {
187 if (!HasBeenSetup()) return 0; 164 if (!HasBeenSetup()) return 0;
188 165
(...skipping 5761 matching lines...) Expand 10 before | Expand all | Expand 10 after
5950 } 5927 }
5951 5928
5952 5929
5953 void ExternalStringTable::TearDown() { 5930 void ExternalStringTable::TearDown() {
5954 new_space_strings_.Free(); 5931 new_space_strings_.Free();
5955 old_space_strings_.Free(); 5932 old_space_strings_.Free();
5956 } 5933 }
5957 5934
5958 5935
5959 } } // namespace v8::internal 5936 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « ChangeLog ('k') | src/platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698