OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // a multiple of Page::kPageSize. | 72 // a multiple of Page::kPageSize. |
73 reserved_semispace_size_(8 * (kPointerSize / 4) * MB), | 73 reserved_semispace_size_(8 * (kPointerSize / 4) * MB), |
74 max_semispace_size_(8 * (kPointerSize / 4) * MB), | 74 max_semispace_size_(8 * (kPointerSize / 4) * MB), |
75 initial_semispace_size_(Page::kPageSize), | 75 initial_semispace_size_(Page::kPageSize), |
76 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), | 76 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), |
77 max_executable_size_(256ul * (kPointerSize / 4) * MB), | 77 max_executable_size_(256ul * (kPointerSize / 4) * MB), |
78 // Variables set based on semispace_size_ and old_generation_size_ in | 78 // Variables set based on semispace_size_ and old_generation_size_ in |
79 // ConfigureHeap (survived_since_last_expansion_, external_allocation_limit_) | 79 // ConfigureHeap (survived_since_last_expansion_, external_allocation_limit_) |
80 // Will be 4 * reserved_semispace_size_ to ensure that young | 80 // Will be 4 * reserved_semispace_size_ to ensure that young |
81 // generation can be aligned to its size. | 81 // generation can be aligned to its size. |
| 82 maximum_committed_(0), |
82 survived_since_last_expansion_(0), | 83 survived_since_last_expansion_(0), |
83 sweep_generation_(0), | 84 sweep_generation_(0), |
84 always_allocate_scope_depth_(0), | 85 always_allocate_scope_depth_(0), |
85 linear_allocation_scope_depth_(0), | 86 linear_allocation_scope_depth_(0), |
86 contexts_disposed_(0), | 87 contexts_disposed_(0), |
87 global_ic_age_(0), | 88 global_ic_age_(0), |
88 flush_monomorphic_ics_(false), | 89 flush_monomorphic_ics_(false), |
89 allocation_mementos_found_(0), | 90 allocation_mementos_found_(0), |
90 scan_on_scavenge_pages_(0), | 91 scan_on_scavenge_pages_(0), |
91 new_space_(this), | 92 new_space_(this), |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 } | 226 } |
226 | 227 |
227 | 228 |
228 intptr_t Heap::CommittedMemoryExecutable() { | 229 intptr_t Heap::CommittedMemoryExecutable() { |
229 if (!HasBeenSetUp()) return 0; | 230 if (!HasBeenSetUp()) return 0; |
230 | 231 |
231 return isolate()->memory_allocator()->SizeExecutable(); | 232 return isolate()->memory_allocator()->SizeExecutable(); |
232 } | 233 } |
233 | 234 |
234 | 235 |
| 236 void Heap::UpdateMaximumCommitted() { |
| 237 if (!HasBeenSetUp()) return; |
| 238 |
| 239 intptr_t current_committed_memory = CommittedMemory(); |
| 240 if (current_committed_memory > maximum_committed_) { |
| 241 maximum_committed_ = current_committed_memory; |
| 242 } |
| 243 } |
| 244 |
| 245 |
235 intptr_t Heap::Available() { | 246 intptr_t Heap::Available() { |
236 if (!HasBeenSetUp()) return 0; | 247 if (!HasBeenSetUp()) return 0; |
237 | 248 |
238 return new_space_.Available() + | 249 return new_space_.Available() + |
239 old_pointer_space_->Available() + | 250 old_pointer_space_->Available() + |
240 old_data_space_->Available() + | 251 old_data_space_->Available() + |
241 code_space_->Available() + | 252 code_space_->Available() + |
242 map_space_->Available() + | 253 map_space_->Available() + |
243 cell_space_->Available() + | 254 cell_space_->Available() + |
244 property_cell_space_->Available(); | 255 property_cell_space_->Available(); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 mark_compact_collector()->EnableCodeFlushing(true); | 445 mark_compact_collector()->EnableCodeFlushing(true); |
435 } | 446 } |
436 | 447 |
437 #ifdef VERIFY_HEAP | 448 #ifdef VERIFY_HEAP |
438 if (FLAG_verify_heap) { | 449 if (FLAG_verify_heap) { |
439 Verify(); | 450 Verify(); |
440 } | 451 } |
441 #endif | 452 #endif |
442 } | 453 } |
443 | 454 |
| 455 UpdateMaximumCommitted(); |
| 456 |
444 #ifdef DEBUG | 457 #ifdef DEBUG |
445 ASSERT(!AllowHeapAllocation::IsAllowed() && gc_state_ == NOT_IN_GC); | 458 ASSERT(!AllowHeapAllocation::IsAllowed() && gc_state_ == NOT_IN_GC); |
446 | 459 |
447 if (FLAG_gc_verbose) Print(); | 460 if (FLAG_gc_verbose) Print(); |
448 | 461 |
449 ReportStatisticsBeforeGC(); | 462 ReportStatisticsBeforeGC(); |
450 #endif // DEBUG | 463 #endif // DEBUG |
451 | 464 |
452 store_buffer()->GCPrologue(); | 465 store_buffer()->GCPrologue(); |
453 | 466 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 if (FLAG_gc_verbose) Print(); | 512 if (FLAG_gc_verbose) Print(); |
500 if (FLAG_code_stats) ReportCodeStatistics("After GC"); | 513 if (FLAG_code_stats) ReportCodeStatistics("After GC"); |
501 #endif | 514 #endif |
502 if (FLAG_deopt_every_n_garbage_collections > 0) { | 515 if (FLAG_deopt_every_n_garbage_collections > 0) { |
503 if (++gcs_since_last_deopt_ == FLAG_deopt_every_n_garbage_collections) { | 516 if (++gcs_since_last_deopt_ == FLAG_deopt_every_n_garbage_collections) { |
504 Deoptimizer::DeoptimizeAll(isolate()); | 517 Deoptimizer::DeoptimizeAll(isolate()); |
505 gcs_since_last_deopt_ = 0; | 518 gcs_since_last_deopt_ = 0; |
506 } | 519 } |
507 } | 520 } |
508 | 521 |
| 522 UpdateMaximumCommitted(); |
| 523 |
509 isolate_->counters()->alive_after_last_gc()->Set( | 524 isolate_->counters()->alive_after_last_gc()->Set( |
510 static_cast<int>(SizeOfObjects())); | 525 static_cast<int>(SizeOfObjects())); |
511 | 526 |
512 isolate_->counters()->string_table_capacity()->Set( | 527 isolate_->counters()->string_table_capacity()->Set( |
513 string_table()->Capacity()); | 528 string_table()->Capacity()); |
514 isolate_->counters()->number_of_symbols()->Set( | 529 isolate_->counters()->number_of_symbols()->Set( |
515 string_table()->NumberOfElements()); | 530 string_table()->NumberOfElements()); |
516 | 531 |
517 if (full_codegen_bytes_generated_ + crankshaft_codegen_bytes_generated_ > 0) { | 532 if (full_codegen_bytes_generated_ + crankshaft_codegen_bytes_generated_ > 0) { |
518 isolate_->counters()->codegen_fraction_crankshaft()->AddSample( | 533 isolate_->counters()->codegen_fraction_crankshaft()->AddSample( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 isolate_->counters()->heap_sample_map_space_committed()->AddSample( | 575 isolate_->counters()->heap_sample_map_space_committed()->AddSample( |
561 static_cast<int>(map_space()->CommittedMemory() / KB)); | 576 static_cast<int>(map_space()->CommittedMemory() / KB)); |
562 isolate_->counters()->heap_sample_cell_space_committed()->AddSample( | 577 isolate_->counters()->heap_sample_cell_space_committed()->AddSample( |
563 static_cast<int>(cell_space()->CommittedMemory() / KB)); | 578 static_cast<int>(cell_space()->CommittedMemory() / KB)); |
564 isolate_->counters()-> | 579 isolate_->counters()-> |
565 heap_sample_property_cell_space_committed()-> | 580 heap_sample_property_cell_space_committed()-> |
566 AddSample(static_cast<int>( | 581 AddSample(static_cast<int>( |
567 property_cell_space()->CommittedMemory() / KB)); | 582 property_cell_space()->CommittedMemory() / KB)); |
568 isolate_->counters()->heap_sample_code_space_committed()->AddSample( | 583 isolate_->counters()->heap_sample_code_space_committed()->AddSample( |
569 static_cast<int>(code_space()->CommittedMemory() / KB)); | 584 static_cast<int>(code_space()->CommittedMemory() / KB)); |
| 585 |
| 586 isolate_->counters()->heap_sample_maximum_committed()->AddSample( |
| 587 static_cast<int>(MaximumCommittedMemory() / KB)); |
570 } | 588 } |
571 | 589 |
572 #define UPDATE_COUNTERS_FOR_SPACE(space) \ | 590 #define UPDATE_COUNTERS_FOR_SPACE(space) \ |
573 isolate_->counters()->space##_bytes_available()->Set( \ | 591 isolate_->counters()->space##_bytes_available()->Set( \ |
574 static_cast<int>(space()->Available())); \ | 592 static_cast<int>(space()->Available())); \ |
575 isolate_->counters()->space##_bytes_committed()->Set( \ | 593 isolate_->counters()->space##_bytes_committed()->Set( \ |
576 static_cast<int>(space()->CommittedMemory())); \ | 594 static_cast<int>(space()->CommittedMemory())); \ |
577 isolate_->counters()->space##_bytes_used()->Set( \ | 595 isolate_->counters()->space##_bytes_used()->Set( \ |
578 static_cast<int>(space()->SizeOfObjects())); | 596 static_cast<int>(space()->SizeOfObjects())); |
579 #define UPDATE_FRAGMENTATION_FOR_SPACE(space) \ | 597 #define UPDATE_FRAGMENTATION_FOR_SPACE(space) \ |
(...skipping 6225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6805 } | 6823 } |
6806 | 6824 |
6807 | 6825 |
6808 void Heap::TearDown() { | 6826 void Heap::TearDown() { |
6809 #ifdef VERIFY_HEAP | 6827 #ifdef VERIFY_HEAP |
6810 if (FLAG_verify_heap) { | 6828 if (FLAG_verify_heap) { |
6811 Verify(); | 6829 Verify(); |
6812 } | 6830 } |
6813 #endif | 6831 #endif |
6814 | 6832 |
| 6833 UpdateMaximumCommitted(); |
| 6834 |
6815 if (FLAG_print_cumulative_gc_stat) { | 6835 if (FLAG_print_cumulative_gc_stat) { |
6816 PrintF("\n"); | 6836 PrintF("\n"); |
6817 PrintF("gc_count=%d ", gc_count_); | 6837 PrintF("gc_count=%d ", gc_count_); |
6818 PrintF("mark_sweep_count=%d ", ms_count_); | 6838 PrintF("mark_sweep_count=%d ", ms_count_); |
6819 PrintF("max_gc_pause=%.1f ", get_max_gc_pause()); | 6839 PrintF("max_gc_pause=%.1f ", get_max_gc_pause()); |
6820 PrintF("total_gc_time=%.1f ", total_gc_time_ms_); | 6840 PrintF("total_gc_time=%.1f ", total_gc_time_ms_); |
6821 PrintF("min_in_mutator=%.1f ", get_min_in_mutator()); | 6841 PrintF("min_in_mutator=%.1f ", get_min_in_mutator()); |
6822 PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ", | 6842 PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ", |
6823 get_max_alive_after_gc()); | 6843 get_max_alive_after_gc()); |
6824 PrintF("total_marking_time=%.1f ", marking_time()); | 6844 PrintF("total_marking_time=%.1f ", marking_time()); |
6825 PrintF("total_sweeping_time=%.1f ", sweeping_time()); | 6845 PrintF("total_sweeping_time=%.1f ", sweeping_time()); |
6826 PrintF("\n\n"); | 6846 PrintF("\n\n"); |
6827 } | 6847 } |
6828 | 6848 |
| 6849 if (FLAG_print_max_heap_committed) { |
| 6850 PrintF("\n"); |
| 6851 PrintF("maximum_committed_by_heap=%" V8_PTR_PREFIX "d ", |
| 6852 MaximumCommittedMemory()); |
| 6853 PrintF("maximum_committed_by_new_space=%" V8_PTR_PREFIX "d ", |
| 6854 new_space_.MaximumCommittedMemory()); |
| 6855 PrintF("maximum_committed_by_old_pointer_space=%" V8_PTR_PREFIX "d ", |
| 6856 old_data_space_->MaximumCommittedMemory()); |
| 6857 PrintF("maximum_committed_by_old_data_space=%" V8_PTR_PREFIX "d ", |
| 6858 old_pointer_space_->MaximumCommittedMemory()); |
| 6859 PrintF("maximum_committed_by_old_data_space=%" V8_PTR_PREFIX "d ", |
| 6860 old_pointer_space_->MaximumCommittedMemory()); |
| 6861 PrintF("maximum_committed_by_code_space=%" V8_PTR_PREFIX "d ", |
| 6862 code_space_->MaximumCommittedMemory()); |
| 6863 PrintF("maximum_committed_by_map_space=%" V8_PTR_PREFIX "d ", |
| 6864 map_space_->MaximumCommittedMemory()); |
| 6865 PrintF("maximum_committed_by_cell_space=%" V8_PTR_PREFIX "d ", |
| 6866 cell_space_->MaximumCommittedMemory()); |
| 6867 PrintF("maximum_committed_by_property_space=%" V8_PTR_PREFIX "d ", |
| 6868 property_cell_space_->MaximumCommittedMemory()); |
| 6869 PrintF("maximum_committed_by_lo_space=%" V8_PTR_PREFIX "d ", |
| 6870 lo_space_->MaximumCommittedMemory()); |
| 6871 PrintF("\n\n"); |
| 6872 } |
| 6873 |
6829 TearDownArrayBuffers(); | 6874 TearDownArrayBuffers(); |
6830 | 6875 |
6831 isolate_->global_handles()->TearDown(); | 6876 isolate_->global_handles()->TearDown(); |
6832 | 6877 |
6833 external_string_table_.TearDown(); | 6878 external_string_table_.TearDown(); |
6834 | 6879 |
6835 mark_compact_collector()->TearDown(); | 6880 mark_compact_collector()->TearDown(); |
6836 | 6881 |
6837 new_space_.TearDown(); | 6882 new_space_.TearDown(); |
6838 | 6883 |
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7967 if (FLAG_concurrent_recompilation) { | 8012 if (FLAG_concurrent_recompilation) { |
7968 heap_->relocation_mutex_->Lock(); | 8013 heap_->relocation_mutex_->Lock(); |
7969 #ifdef DEBUG | 8014 #ifdef DEBUG |
7970 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 8015 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
7971 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 8016 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
7972 #endif // DEBUG | 8017 #endif // DEBUG |
7973 } | 8018 } |
7974 } | 8019 } |
7975 | 8020 |
7976 } } // namespace v8::internal | 8021 } } // namespace v8::internal |
OLD | NEW |