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

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

Issue 1867383002: Revert of Fix printf formats (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 | « src/heap/gc-tracer.cc ('k') | src/heap/mark-compact.cc » ('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/heap/heap.h" 5 #include "src/heap/heap.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/ast/scopeinfo.h" 9 #include "src/ast/scopeinfo.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 new_space_.CollectStatistics(); 336 new_space_.CollectStatistics();
337 new_space_.ReportStatistics(); 337 new_space_.ReportStatistics();
338 new_space_.ClearHistograms(); 338 new_space_.ClearHistograms();
339 } 339 }
340 #endif // DEBUG 340 #endif // DEBUG
341 } 341 }
342 342
343 343
344 void Heap::PrintShortHeapStatistics() { 344 void Heap::PrintShortHeapStatistics() {
345 if (!FLAG_trace_gc_verbose) return; 345 if (!FLAG_trace_gc_verbose) return;
346 PrintIsolate(isolate_, "Memory allocator, used: %6" V8PRIdPTR 346 PrintIsolate(isolate_, "Memory allocator, used: %6" V8_PTR_PREFIX
347 " KB, available: %6" V8PRIdPTR " KB\n", 347 "d KB"
348 ", available: %6" V8_PTR_PREFIX "d KB\n",
348 memory_allocator()->Size() / KB, 349 memory_allocator()->Size() / KB,
349 memory_allocator()->Available() / KB); 350 memory_allocator()->Available() / KB);
350 PrintIsolate(isolate_, "New space, used: %6" V8PRIdPTR 351 PrintIsolate(isolate_, "New space, used: %6" V8_PTR_PREFIX
351 " KB" 352 "d KB"
352 ", available: %6" V8PRIdPTR 353 ", available: %6" V8_PTR_PREFIX
353 " KB" 354 "d KB"
354 ", committed: %6" V8PRIdPTR " KB\n", 355 ", committed: %6" V8_PTR_PREFIX "d KB\n",
355 new_space_.Size() / KB, new_space_.Available() / KB, 356 new_space_.Size() / KB, new_space_.Available() / KB,
356 new_space_.CommittedMemory() / KB); 357 new_space_.CommittedMemory() / KB);
357 PrintIsolate(isolate_, "Old space, used: %6" V8PRIdPTR 358 PrintIsolate(isolate_, "Old space, used: %6" V8_PTR_PREFIX
358 " KB" 359 "d KB"
359 ", available: %6" V8PRIdPTR 360 ", available: %6" V8_PTR_PREFIX
360 " KB" 361 "d KB"
361 ", committed: %6" V8PRIdPTR " KB\n", 362 ", committed: %6" V8_PTR_PREFIX "d KB\n",
362 old_space_->SizeOfObjects() / KB, old_space_->Available() / KB, 363 old_space_->SizeOfObjects() / KB, old_space_->Available() / KB,
363 old_space_->CommittedMemory() / KB); 364 old_space_->CommittedMemory() / KB);
364 PrintIsolate(isolate_, "Code space, used: %6" V8PRIdPTR 365 PrintIsolate(isolate_, "Code space, used: %6" V8_PTR_PREFIX
365 " KB" 366 "d KB"
366 ", available: %6" V8PRIdPTR 367 ", available: %6" V8_PTR_PREFIX
367 " KB" 368 "d KB"
368 ", committed: %6" V8PRIdPTR " KB\n", 369 ", committed: %6" V8_PTR_PREFIX "d KB\n",
369 code_space_->SizeOfObjects() / KB, code_space_->Available() / KB, 370 code_space_->SizeOfObjects() / KB, code_space_->Available() / KB,
370 code_space_->CommittedMemory() / KB); 371 code_space_->CommittedMemory() / KB);
371 PrintIsolate(isolate_, "Map space, used: %6" V8PRIdPTR 372 PrintIsolate(isolate_, "Map space, used: %6" V8_PTR_PREFIX
372 " KB" 373 "d KB"
373 ", available: %6" V8PRIdPTR 374 ", available: %6" V8_PTR_PREFIX
374 " KB" 375 "d KB"
375 ", committed: %6" V8PRIdPTR " KB\n", 376 ", committed: %6" V8_PTR_PREFIX "d KB\n",
376 map_space_->SizeOfObjects() / KB, map_space_->Available() / KB, 377 map_space_->SizeOfObjects() / KB, map_space_->Available() / KB,
377 map_space_->CommittedMemory() / KB); 378 map_space_->CommittedMemory() / KB);
378 PrintIsolate(isolate_, "Large object space, used: %6" V8PRIdPTR 379 PrintIsolate(isolate_, "Large object space, used: %6" V8_PTR_PREFIX
379 " KB" 380 "d KB"
380 ", available: %6" V8PRIdPTR 381 ", available: %6" V8_PTR_PREFIX
381 " KB" 382 "d KB"
382 ", committed: %6" V8PRIdPTR " KB\n", 383 ", committed: %6" V8_PTR_PREFIX "d KB\n",
383 lo_space_->SizeOfObjects() / KB, lo_space_->Available() / KB, 384 lo_space_->SizeOfObjects() / KB, lo_space_->Available() / KB,
384 lo_space_->CommittedMemory() / KB); 385 lo_space_->CommittedMemory() / KB);
385 PrintIsolate(isolate_, "All spaces, used: %6" V8PRIdPTR 386 PrintIsolate(isolate_, "All spaces, used: %6" V8_PTR_PREFIX
386 " KB" 387 "d KB"
387 ", available: %6" V8PRIdPTR 388 ", available: %6" V8_PTR_PREFIX
388 " KB" 389 "d KB"
389 ", committed: %6" V8PRIdPTR " KB\n", 390 ", committed: %6" V8_PTR_PREFIX "d KB\n",
390 this->SizeOfObjects() / KB, this->Available() / KB, 391 this->SizeOfObjects() / KB, this->Available() / KB,
391 this->CommittedMemory() / KB); 392 this->CommittedMemory() / KB);
392 PrintIsolate( 393 PrintIsolate(
393 isolate_, "External memory reported: %6" V8PRIdPTR " KB\n", 394 isolate_, "External memory reported: %6" V8_PTR_PREFIX "d KB\n",
394 static_cast<intptr_t>(amount_of_external_allocated_memory_ / KB)); 395 static_cast<intptr_t>(amount_of_external_allocated_memory_ / KB));
395 PrintIsolate(isolate_, "Total time spent in GC : %.1f ms\n", 396 PrintIsolate(isolate_, "Total time spent in GC : %.1f ms\n",
396 total_gc_time_ms_); 397 total_gc_time_ms_);
397 } 398 }
398 399
400
399 // TODO(1238405): Combine the infrastructure for --heap-stats and 401 // TODO(1238405): Combine the infrastructure for --heap-stats and
400 // --log-gc to avoid the complicated preprocessor and flag testing. 402 // --log-gc to avoid the complicated preprocessor and flag testing.
401 void Heap::ReportStatisticsAfterGC() { 403 void Heap::ReportStatisticsAfterGC() {
402 // Similar to the before GC, we use some complicated logic to ensure that 404 // Similar to the before GC, we use some complicated logic to ensure that
403 // NewSpace statistics are logged exactly once when --log-gc is turned on. 405 // NewSpace statistics are logged exactly once when --log-gc is turned on.
404 #if defined(DEBUG) 406 #if defined(DEBUG)
405 if (FLAG_heap_stats) { 407 if (FLAG_heap_stats) {
406 new_space_.CollectStatistics(); 408 new_space_.CollectStatistics();
407 ReportHeapStatistics("After GC"); 409 ReportHeapStatistics("After GC");
408 } else if (FLAG_log_gc) { 410 } else if (FLAG_log_gc) {
(...skipping 4065 matching lines...) Expand 10 before | Expand all | Expand 10 after
4474 } 4476 }
4475 4477
4476 4478
4477 // This function expects that NewSpace's allocated objects histogram is 4479 // This function expects that NewSpace's allocated objects histogram is
4478 // populated (via a call to CollectStatistics or else as a side effect of a 4480 // populated (via a call to CollectStatistics or else as a side effect of a
4479 // just-completed scavenge collection). 4481 // just-completed scavenge collection).
4480 void Heap::ReportHeapStatistics(const char* title) { 4482 void Heap::ReportHeapStatistics(const char* title) {
4481 USE(title); 4483 USE(title);
4482 PrintF(">>>>>> =============== %s (%d) =============== >>>>>>\n", title, 4484 PrintF(">>>>>> =============== %s (%d) =============== >>>>>>\n", title,
4483 gc_count_); 4485 gc_count_);
4484 PrintF("old_generation_allocation_limit_ %" V8PRIdPTR "\n", 4486 PrintF("old_generation_allocation_limit_ %" V8_PTR_PREFIX "d\n",
4485 old_generation_allocation_limit_); 4487 old_generation_allocation_limit_);
4486 4488
4487 PrintF("\n"); 4489 PrintF("\n");
4488 PrintF("Number of handles : %d\n", HandleScope::NumberOfHandles(isolate_)); 4490 PrintF("Number of handles : %d\n", HandleScope::NumberOfHandles(isolate_));
4489 isolate_->global_handles()->PrintStats(); 4491 isolate_->global_handles()->PrintStats();
4490 PrintF("\n"); 4492 PrintF("\n");
4491 4493
4492 PrintF("Heap statistics : "); 4494 PrintF("Heap statistics : ");
4493 memory_allocator()->ReportStatistics(); 4495 memory_allocator()->ReportStatistics();
4494 PrintF("To space : "); 4496 PrintF("To space : ");
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
5141 } 5143 }
5142 5144
5143 if (FLAG_heap_growing_percent > 0) { 5145 if (FLAG_heap_growing_percent > 0) {
5144 factor = 1.0 + FLAG_heap_growing_percent / 100.0; 5146 factor = 1.0 + FLAG_heap_growing_percent / 100.0;
5145 } 5147 }
5146 5148
5147 old_generation_allocation_limit_ = 5149 old_generation_allocation_limit_ =
5148 CalculateOldGenerationAllocationLimit(factor, old_gen_size); 5150 CalculateOldGenerationAllocationLimit(factor, old_gen_size);
5149 5151
5150 if (FLAG_trace_gc_verbose) { 5152 if (FLAG_trace_gc_verbose) {
5151 PrintIsolate(isolate_, "Grow: old size: %" V8PRIdPTR 5153 PrintIsolate(isolate_, "Grow: old size: %" V8_PTR_PREFIX
5152 " KB, new limit: %" V8PRIdPTR " KB (%.1f)\n", 5154 "d KB, new limit: %" V8_PTR_PREFIX "d KB (%.1f)\n",
5153 old_gen_size / KB, old_generation_allocation_limit_ / KB, 5155 old_gen_size / KB, old_generation_allocation_limit_ / KB,
5154 factor); 5156 factor);
5155 } 5157 }
5156 } 5158 }
5157 5159
5158 5160
5159 void Heap::DampenOldGenerationAllocationLimit(intptr_t old_gen_size, 5161 void Heap::DampenOldGenerationAllocationLimit(intptr_t old_gen_size,
5160 double gc_speed, 5162 double gc_speed,
5161 double mutator_speed) { 5163 double mutator_speed) {
5162 double factor = HeapGrowingFactor(gc_speed, mutator_speed); 5164 double factor = HeapGrowingFactor(gc_speed, mutator_speed);
5163 intptr_t limit = CalculateOldGenerationAllocationLimit(factor, old_gen_size); 5165 intptr_t limit = CalculateOldGenerationAllocationLimit(factor, old_gen_size);
5164 if (limit < old_generation_allocation_limit_) { 5166 if (limit < old_generation_allocation_limit_) {
5165 if (FLAG_trace_gc_verbose) { 5167 if (FLAG_trace_gc_verbose) {
5166 PrintIsolate(isolate_, 5168 PrintIsolate(isolate_, "Dampen: old size: %" V8_PTR_PREFIX
5167 "Dampen: old size: %" V8PRIdPTR " KB, old limit: %" V8PRIdPTR 5169 "d KB, old limit: %" V8_PTR_PREFIX
5168 " KB, " 5170 "d KB, "
5169 "new limit: %" V8PRIdPTR " KB (%.1f)\n", 5171 "new limit: %" V8_PTR_PREFIX "d KB (%.1f)\n",
5170 old_gen_size / KB, old_generation_allocation_limit_ / KB, 5172 old_gen_size / KB, old_generation_allocation_limit_ / KB,
5171 limit / KB, factor); 5173 limit / KB, factor);
5172 } 5174 }
5173 old_generation_allocation_limit_ = limit; 5175 old_generation_allocation_limit_ = limit;
5174 } 5176 }
5175 } 5177 }
5176 5178
5177 5179
5178 void Heap::EnableInlineAllocation() { 5180 void Heap::EnableInlineAllocation() {
5179 if (!inline_allocation_disabled_) return; 5181 if (!inline_allocation_disabled_) return;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
5384 5386
5385 UpdateMaximumCommitted(); 5387 UpdateMaximumCommitted();
5386 5388
5387 if (FLAG_print_cumulative_gc_stat) { 5389 if (FLAG_print_cumulative_gc_stat) {
5388 PrintF("\n"); 5390 PrintF("\n");
5389 PrintF("gc_count=%d ", gc_count_); 5391 PrintF("gc_count=%d ", gc_count_);
5390 PrintF("mark_sweep_count=%d ", ms_count_); 5392 PrintF("mark_sweep_count=%d ", ms_count_);
5391 PrintF("max_gc_pause=%.1f ", get_max_gc_pause()); 5393 PrintF("max_gc_pause=%.1f ", get_max_gc_pause());
5392 PrintF("total_gc_time=%.1f ", total_gc_time_ms_); 5394 PrintF("total_gc_time=%.1f ", total_gc_time_ms_);
5393 PrintF("min_in_mutator=%.1f ", get_min_in_mutator()); 5395 PrintF("min_in_mutator=%.1f ", get_min_in_mutator());
5394 PrintF("max_alive_after_gc=%" V8PRIdPTR " ", get_max_alive_after_gc()); 5396 PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ", get_max_alive_after_gc());
5395 PrintF("total_marking_time=%.1f ", tracer()->cumulative_marking_duration()); 5397 PrintF("total_marking_time=%.1f ", tracer()->cumulative_marking_duration());
5396 PrintF("total_sweeping_time=%.1f ", 5398 PrintF("total_sweeping_time=%.1f ",
5397 tracer()->cumulative_sweeping_duration()); 5399 tracer()->cumulative_sweeping_duration());
5398 PrintF("\n\n"); 5400 PrintF("\n\n");
5399 } 5401 }
5400 5402
5401 if (FLAG_print_max_heap_committed) { 5403 if (FLAG_print_max_heap_committed) {
5402 PrintF("\n"); 5404 PrintF("\n");
5403 PrintF("maximum_committed_by_heap=%" V8PRIdPTR " ", 5405 PrintF("maximum_committed_by_heap=%" V8_PTR_PREFIX "d ",
5404 MaximumCommittedMemory()); 5406 MaximumCommittedMemory());
5405 PrintF("maximum_committed_by_new_space=%" V8PRIdPTR " ", 5407 PrintF("maximum_committed_by_new_space=%" V8_PTR_PREFIX "d ",
5406 new_space_.MaximumCommittedMemory()); 5408 new_space_.MaximumCommittedMemory());
5407 PrintF("maximum_committed_by_old_space=%" V8PRIdPTR " ", 5409 PrintF("maximum_committed_by_old_space=%" V8_PTR_PREFIX "d ",
5408 old_space_->MaximumCommittedMemory()); 5410 old_space_->MaximumCommittedMemory());
5409 PrintF("maximum_committed_by_code_space=%" V8PRIdPTR " ", 5411 PrintF("maximum_committed_by_code_space=%" V8_PTR_PREFIX "d ",
5410 code_space_->MaximumCommittedMemory()); 5412 code_space_->MaximumCommittedMemory());
5411 PrintF("maximum_committed_by_map_space=%" V8PRIdPTR " ", 5413 PrintF("maximum_committed_by_map_space=%" V8_PTR_PREFIX "d ",
5412 map_space_->MaximumCommittedMemory()); 5414 map_space_->MaximumCommittedMemory());
5413 PrintF("maximum_committed_by_lo_space=%" V8PRIdPTR " ", 5415 PrintF("maximum_committed_by_lo_space=%" V8_PTR_PREFIX "d ",
5414 lo_space_->MaximumCommittedMemory()); 5416 lo_space_->MaximumCommittedMemory());
5415 PrintF("\n\n"); 5417 PrintF("\n\n");
5416 } 5418 }
5417 5419
5418 if (FLAG_verify_predictable) { 5420 if (FLAG_verify_predictable) {
5419 PrintAlloctionsHash(); 5421 PrintAlloctionsHash();
5420 } 5422 }
5421 5423
5422 new_space()->RemoveAllocationObserver(idle_scavenge_observer_); 5424 new_space()->RemoveAllocationObserver(idle_scavenge_observer_);
5423 delete idle_scavenge_observer_; 5425 delete idle_scavenge_observer_;
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
6435 } 6437 }
6436 6438
6437 6439
6438 // static 6440 // static
6439 int Heap::GetStaticVisitorIdForMap(Map* map) { 6441 int Heap::GetStaticVisitorIdForMap(Map* map) {
6440 return StaticVisitorBase::GetVisitorId(map); 6442 return StaticVisitorBase::GetVisitorId(map);
6441 } 6443 }
6442 6444
6443 } // namespace internal 6445 } // namespace internal
6444 } // namespace v8 6446 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/gc-tracer.cc ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698