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

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

Issue 1877823003: 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 4075 matching lines...) Expand 10 before | Expand all | Expand 10 after
4484 } 4486 }
4485 4487
4486 4488
4487 // This function expects that NewSpace's allocated objects histogram is 4489 // This function expects that NewSpace's allocated objects histogram is
4488 // populated (via a call to CollectStatistics or else as a side effect of a 4490 // populated (via a call to CollectStatistics or else as a side effect of a
4489 // just-completed scavenge collection). 4491 // just-completed scavenge collection).
4490 void Heap::ReportHeapStatistics(const char* title) { 4492 void Heap::ReportHeapStatistics(const char* title) {
4491 USE(title); 4493 USE(title);
4492 PrintF(">>>>>> =============== %s (%d) =============== >>>>>>\n", title, 4494 PrintF(">>>>>> =============== %s (%d) =============== >>>>>>\n", title,
4493 gc_count_); 4495 gc_count_);
4494 PrintF("old_generation_allocation_limit_ %" V8PRIdPTR "\n", 4496 PrintF("old_generation_allocation_limit_ %" V8_PTR_PREFIX "d\n",
4495 old_generation_allocation_limit_); 4497 old_generation_allocation_limit_);
4496 4498
4497 PrintF("\n"); 4499 PrintF("\n");
4498 PrintF("Number of handles : %d\n", HandleScope::NumberOfHandles(isolate_)); 4500 PrintF("Number of handles : %d\n", HandleScope::NumberOfHandles(isolate_));
4499 isolate_->global_handles()->PrintStats(); 4501 isolate_->global_handles()->PrintStats();
4500 PrintF("\n"); 4502 PrintF("\n");
4501 4503
4502 PrintF("Heap statistics : "); 4504 PrintF("Heap statistics : ");
4503 memory_allocator()->ReportStatistics(); 4505 memory_allocator()->ReportStatistics();
4504 PrintF("To space : "); 4506 PrintF("To space : ");
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
5151 } 5153 }
5152 5154
5153 if (FLAG_heap_growing_percent > 0) { 5155 if (FLAG_heap_growing_percent > 0) {
5154 factor = 1.0 + FLAG_heap_growing_percent / 100.0; 5156 factor = 1.0 + FLAG_heap_growing_percent / 100.0;
5155 } 5157 }
5156 5158
5157 old_generation_allocation_limit_ = 5159 old_generation_allocation_limit_ =
5158 CalculateOldGenerationAllocationLimit(factor, old_gen_size); 5160 CalculateOldGenerationAllocationLimit(factor, old_gen_size);
5159 5161
5160 if (FLAG_trace_gc_verbose) { 5162 if (FLAG_trace_gc_verbose) {
5161 PrintIsolate(isolate_, "Grow: old size: %" V8PRIdPTR 5163 PrintIsolate(isolate_, "Grow: old size: %" V8_PTR_PREFIX
5162 " KB, new limit: %" V8PRIdPTR " KB (%.1f)\n", 5164 "d KB, new limit: %" V8_PTR_PREFIX "d KB (%.1f)\n",
5163 old_gen_size / KB, old_generation_allocation_limit_ / KB, 5165 old_gen_size / KB, old_generation_allocation_limit_ / KB,
5164 factor); 5166 factor);
5165 } 5167 }
5166 } 5168 }
5167 5169
5168 5170
5169 void Heap::DampenOldGenerationAllocationLimit(intptr_t old_gen_size, 5171 void Heap::DampenOldGenerationAllocationLimit(intptr_t old_gen_size,
5170 double gc_speed, 5172 double gc_speed,
5171 double mutator_speed) { 5173 double mutator_speed) {
5172 double factor = HeapGrowingFactor(gc_speed, mutator_speed); 5174 double factor = HeapGrowingFactor(gc_speed, mutator_speed);
5173 intptr_t limit = CalculateOldGenerationAllocationLimit(factor, old_gen_size); 5175 intptr_t limit = CalculateOldGenerationAllocationLimit(factor, old_gen_size);
5174 if (limit < old_generation_allocation_limit_) { 5176 if (limit < old_generation_allocation_limit_) {
5175 if (FLAG_trace_gc_verbose) { 5177 if (FLAG_trace_gc_verbose) {
5176 PrintIsolate(isolate_, 5178 PrintIsolate(isolate_, "Dampen: old size: %" V8_PTR_PREFIX
5177 "Dampen: old size: %" V8PRIdPTR " KB, old limit: %" V8PRIdPTR 5179 "d KB, old limit: %" V8_PTR_PREFIX
5178 " KB, " 5180 "d KB, "
5179 "new limit: %" V8PRIdPTR " KB (%.1f)\n", 5181 "new limit: %" V8_PTR_PREFIX "d KB (%.1f)\n",
5180 old_gen_size / KB, old_generation_allocation_limit_ / KB, 5182 old_gen_size / KB, old_generation_allocation_limit_ / KB,
5181 limit / KB, factor); 5183 limit / KB, factor);
5182 } 5184 }
5183 old_generation_allocation_limit_ = limit; 5185 old_generation_allocation_limit_ = limit;
5184 } 5186 }
5185 } 5187 }
5186 5188
5187 5189
5188 void Heap::EnableInlineAllocation() { 5190 void Heap::EnableInlineAllocation() {
5189 if (!inline_allocation_disabled_) return; 5191 if (!inline_allocation_disabled_) return;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
5394 5396
5395 UpdateMaximumCommitted(); 5397 UpdateMaximumCommitted();
5396 5398
5397 if (FLAG_print_cumulative_gc_stat) { 5399 if (FLAG_print_cumulative_gc_stat) {
5398 PrintF("\n"); 5400 PrintF("\n");
5399 PrintF("gc_count=%d ", gc_count_); 5401 PrintF("gc_count=%d ", gc_count_);
5400 PrintF("mark_sweep_count=%d ", ms_count_); 5402 PrintF("mark_sweep_count=%d ", ms_count_);
5401 PrintF("max_gc_pause=%.1f ", get_max_gc_pause()); 5403 PrintF("max_gc_pause=%.1f ", get_max_gc_pause());
5402 PrintF("total_gc_time=%.1f ", total_gc_time_ms_); 5404 PrintF("total_gc_time=%.1f ", total_gc_time_ms_);
5403 PrintF("min_in_mutator=%.1f ", get_min_in_mutator()); 5405 PrintF("min_in_mutator=%.1f ", get_min_in_mutator());
5404 PrintF("max_alive_after_gc=%" V8PRIdPTR " ", get_max_alive_after_gc()); 5406 PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ", get_max_alive_after_gc());
5405 PrintF("total_marking_time=%.1f ", tracer()->cumulative_marking_duration()); 5407 PrintF("total_marking_time=%.1f ", tracer()->cumulative_marking_duration());
5406 PrintF("total_sweeping_time=%.1f ", 5408 PrintF("total_sweeping_time=%.1f ",
5407 tracer()->cumulative_sweeping_duration()); 5409 tracer()->cumulative_sweeping_duration());
5408 PrintF("\n\n"); 5410 PrintF("\n\n");
5409 } 5411 }
5410 5412
5411 if (FLAG_print_max_heap_committed) { 5413 if (FLAG_print_max_heap_committed) {
5412 PrintF("\n"); 5414 PrintF("\n");
5413 PrintF("maximum_committed_by_heap=%" V8PRIdPTR " ", 5415 PrintF("maximum_committed_by_heap=%" V8_PTR_PREFIX "d ",
5414 MaximumCommittedMemory()); 5416 MaximumCommittedMemory());
5415 PrintF("maximum_committed_by_new_space=%" V8PRIdPTR " ", 5417 PrintF("maximum_committed_by_new_space=%" V8_PTR_PREFIX "d ",
5416 new_space_.MaximumCommittedMemory()); 5418 new_space_.MaximumCommittedMemory());
5417 PrintF("maximum_committed_by_old_space=%" V8PRIdPTR " ", 5419 PrintF("maximum_committed_by_old_space=%" V8_PTR_PREFIX "d ",
5418 old_space_->MaximumCommittedMemory()); 5420 old_space_->MaximumCommittedMemory());
5419 PrintF("maximum_committed_by_code_space=%" V8PRIdPTR " ", 5421 PrintF("maximum_committed_by_code_space=%" V8_PTR_PREFIX "d ",
5420 code_space_->MaximumCommittedMemory()); 5422 code_space_->MaximumCommittedMemory());
5421 PrintF("maximum_committed_by_map_space=%" V8PRIdPTR " ", 5423 PrintF("maximum_committed_by_map_space=%" V8_PTR_PREFIX "d ",
5422 map_space_->MaximumCommittedMemory()); 5424 map_space_->MaximumCommittedMemory());
5423 PrintF("maximum_committed_by_lo_space=%" V8PRIdPTR " ", 5425 PrintF("maximum_committed_by_lo_space=%" V8_PTR_PREFIX "d ",
5424 lo_space_->MaximumCommittedMemory()); 5426 lo_space_->MaximumCommittedMemory());
5425 PrintF("\n\n"); 5427 PrintF("\n\n");
5426 } 5428 }
5427 5429
5428 if (FLAG_verify_predictable) { 5430 if (FLAG_verify_predictable) {
5429 PrintAlloctionsHash(); 5431 PrintAlloctionsHash();
5430 } 5432 }
5431 5433
5432 new_space()->RemoveAllocationObserver(idle_scavenge_observer_); 5434 new_space()->RemoveAllocationObserver(idle_scavenge_observer_);
5433 delete idle_scavenge_observer_; 5435 delete idle_scavenge_observer_;
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
6445 } 6447 }
6446 6448
6447 6449
6448 // static 6450 // static
6449 int Heap::GetStaticVisitorIdForMap(Map* map) { 6451 int Heap::GetStaticVisitorIdForMap(Map* map) {
6450 return StaticVisitorBase::GetVisitorId(map); 6452 return StaticVisitorBase::GetVisitorId(map);
6451 } 6453 }
6452 6454
6453 } // namespace internal 6455 } // namespace internal
6454 } // namespace v8 6456 } // 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