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

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

Issue 1128483003: Add heap growing strategy details to --trace-gc-verbose. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | 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 "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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 ", available: %6" V8_PTR_PREFIX "d KB\n", 322 ", available: %6" V8_PTR_PREFIX "d KB\n",
323 isolate_->memory_allocator()->Size() / KB, 323 isolate_->memory_allocator()->Size() / KB,
324 isolate_->memory_allocator()->Available() / KB); 324 isolate_->memory_allocator()->Available() / KB);
325 PrintIsolate(isolate_, "New space, used: %6" V8_PTR_PREFIX 325 PrintIsolate(isolate_, "New space, used: %6" V8_PTR_PREFIX
326 "d KB" 326 "d KB"
327 ", available: %6" V8_PTR_PREFIX 327 ", available: %6" V8_PTR_PREFIX
328 "d KB" 328 "d KB"
329 ", committed: %6" V8_PTR_PREFIX "d KB\n", 329 ", committed: %6" V8_PTR_PREFIX "d KB\n",
330 new_space_.Size() / KB, new_space_.Available() / KB, 330 new_space_.Size() / KB, new_space_.Available() / KB,
331 new_space_.CommittedMemory() / KB); 331 new_space_.CommittedMemory() / KB);
332 PrintIsolate(isolate_, "Old space, used: %6" V8_PTR_PREFIX 332 PrintIsolate(isolate_, "Old space, used: %6" V8_PTR_PREFIX
333 "d KB" 333 "d KB"
334 ", available: %6" V8_PTR_PREFIX 334 ", available: %6" V8_PTR_PREFIX
335 "d KB" 335 "d KB"
336 ", committed: %6" V8_PTR_PREFIX "d KB\n", 336 ", committed: %6" V8_PTR_PREFIX "d KB\n",
337 old_space_->SizeOfObjects() / KB, old_space_->Available() / KB, 337 old_space_->SizeOfObjects() / KB, old_space_->Available() / KB,
338 old_space_->CommittedMemory() / KB); 338 old_space_->CommittedMemory() / KB);
339 PrintIsolate(isolate_, "Code space, used: %6" V8_PTR_PREFIX 339 PrintIsolate(isolate_, "Code space, used: %6" V8_PTR_PREFIX
340 "d KB" 340 "d KB"
341 ", available: %6" V8_PTR_PREFIX 341 ", available: %6" V8_PTR_PREFIX
342 "d KB" 342 "d KB"
(...skipping 4916 matching lines...) Expand 10 before | Expand all | Expand 10 after
5259 max_factor = 2; 5259 max_factor = 2;
5260 } 5260 }
5261 5261
5262 // If there are many freed global handles, then the next full GC will 5262 // If there are many freed global handles, then the next full GC will
5263 // likely collect a lot of garbage. Choose the heap growing factor 5263 // likely collect a lot of garbage. Choose the heap growing factor
5264 // depending on freed global handles. 5264 // depending on freed global handles.
5265 // TODO(ulan, hpayer): Take into account mutator utilization. 5265 // TODO(ulan, hpayer): Take into account mutator utilization.
5266 // TODO(hpayer): The idle factor could make the handles heuristic obsolete. 5266 // TODO(hpayer): The idle factor could make the handles heuristic obsolete.
5267 // Look into that. 5267 // Look into that.
5268 double factor; 5268 double factor;
5269 double idle_factor;
5269 if (freed_global_handles <= kMinHandles) { 5270 if (freed_global_handles <= kMinHandles) {
5270 factor = max_factor; 5271 factor = max_factor;
5271 } else if (freed_global_handles >= kMaxHandles) { 5272 } else if (freed_global_handles >= kMaxHandles) {
5272 factor = min_factor; 5273 factor = min_factor;
5273 } else { 5274 } else {
5274 // Compute factor using linear interpolation between points 5275 // Compute factor using linear interpolation between points
5275 // (kMinHandles, max_factor) and (kMaxHandles, min_factor). 5276 // (kMinHandles, max_factor) and (kMaxHandles, min_factor).
5276 factor = max_factor - 5277 factor = max_factor -
5277 (freed_global_handles - kMinHandles) * (max_factor - min_factor) / 5278 (freed_global_handles - kMinHandles) * (max_factor - min_factor) /
5278 (kMaxHandles - kMinHandles); 5279 (kMaxHandles - kMinHandles);
5279 } 5280 }
5280 5281
5281 if (FLAG_stress_compaction || 5282 if (FLAG_stress_compaction ||
5282 mark_compact_collector()->reduce_memory_footprint_) { 5283 mark_compact_collector()->reduce_memory_footprint_) {
5283 factor = min_factor; 5284 factor = min_factor;
5284 } 5285 }
5285 5286
5287 idle_factor = Min(factor, idle_max_factor);
5288
5286 old_generation_allocation_limit_ = 5289 old_generation_allocation_limit_ =
5287 CalculateOldGenerationAllocationLimit(factor, old_gen_size); 5290 CalculateOldGenerationAllocationLimit(factor, old_gen_size);
5288 idle_old_generation_allocation_limit_ = CalculateOldGenerationAllocationLimit( 5291 idle_old_generation_allocation_limit_ =
5289 Min(factor, idle_max_factor), old_gen_size); 5292 CalculateOldGenerationAllocationLimit(idle_factor, old_gen_size);
5293
5294 if (FLAG_trace_gc_verbose) {
5295 PrintIsolate(
5296 isolate_,
5297 "Grow: old size: %" V8_PTR_PREFIX "d KB, new limit: %" V8_PTR_PREFIX
5298 "d KB (%.1f), new idle limit: %" V8_PTR_PREFIX "d KB (%.1f)\n",
5299 old_gen_size / KB, old_generation_allocation_limit_ / KB, factor,
5300 idle_old_generation_allocation_limit_ / KB, idle_factor);
5301 }
5290 } 5302 }
5291 5303
5292 5304
5293 void Heap::EnableInlineAllocation() { 5305 void Heap::EnableInlineAllocation() {
5294 if (!inline_allocation_disabled_) return; 5306 if (!inline_allocation_disabled_) return;
5295 inline_allocation_disabled_ = false; 5307 inline_allocation_disabled_ = false;
5296 5308
5297 // Update inline allocation limit for new space. 5309 // Update inline allocation limit for new space.
5298 new_space()->UpdateInlineAllocationLimit(0); 5310 new_space()->UpdateInlineAllocationLimit(0);
5299 } 5311 }
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
6422 static_cast<int>(object_sizes_last_time_[index])); 6434 static_cast<int>(object_sizes_last_time_[index]));
6423 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6435 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6424 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6436 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6425 6437
6426 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6438 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6427 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6439 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6428 ClearObjectStats(); 6440 ClearObjectStats();
6429 } 6441 }
6430 } 6442 }
6431 } // namespace v8::internal 6443 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698