| OLD | NEW |
| 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/context-slot-cache.h" | 9 #include "src/ast/context-slot-cache.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 high_survival_rate_period_length_(0), | 118 high_survival_rate_period_length_(0), |
| 119 promoted_objects_size_(0), | 119 promoted_objects_size_(0), |
| 120 promotion_ratio_(0), | 120 promotion_ratio_(0), |
| 121 semi_space_copied_object_size_(0), | 121 semi_space_copied_object_size_(0), |
| 122 previous_semi_space_copied_object_size_(0), | 122 previous_semi_space_copied_object_size_(0), |
| 123 semi_space_copied_rate_(0), | 123 semi_space_copied_rate_(0), |
| 124 nodes_died_in_new_space_(0), | 124 nodes_died_in_new_space_(0), |
| 125 nodes_copied_in_new_space_(0), | 125 nodes_copied_in_new_space_(0), |
| 126 nodes_promoted_(0), | 126 nodes_promoted_(0), |
| 127 maximum_size_scavenges_(0), | 127 maximum_size_scavenges_(0), |
| 128 max_gc_pause_(0.0), | |
| 129 total_gc_time_ms_(0.0), | |
| 130 max_alive_after_gc_(0), | |
| 131 min_in_mutator_(kMaxInt), | |
| 132 marking_time_(0.0), | |
| 133 sweeping_time_(0.0), | |
| 134 last_idle_notification_time_(0.0), | 128 last_idle_notification_time_(0.0), |
| 135 last_gc_time_(0.0), | 129 last_gc_time_(0.0), |
| 136 scavenge_collector_(nullptr), | 130 scavenge_collector_(nullptr), |
| 137 mark_compact_collector_(nullptr), | 131 mark_compact_collector_(nullptr), |
| 138 memory_allocator_(nullptr), | 132 memory_allocator_(nullptr), |
| 139 store_buffer_(nullptr), | 133 store_buffer_(nullptr), |
| 140 incremental_marking_(nullptr), | 134 incremental_marking_(nullptr), |
| 141 gc_idle_time_handler_(nullptr), | 135 gc_idle_time_handler_(nullptr), |
| 142 memory_reducer_(nullptr), | 136 memory_reducer_(nullptr), |
| 143 live_object_stats_(nullptr), | 137 live_object_stats_(nullptr), |
| (...skipping 5442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5586 | 5580 |
| 5587 void Heap::TearDown() { | 5581 void Heap::TearDown() { |
| 5588 #ifdef VERIFY_HEAP | 5582 #ifdef VERIFY_HEAP |
| 5589 if (FLAG_verify_heap) { | 5583 if (FLAG_verify_heap) { |
| 5590 Verify(); | 5584 Verify(); |
| 5591 } | 5585 } |
| 5592 #endif | 5586 #endif |
| 5593 | 5587 |
| 5594 UpdateMaximumCommitted(); | 5588 UpdateMaximumCommitted(); |
| 5595 | 5589 |
| 5596 if (FLAG_print_cumulative_gc_stat) { | |
| 5597 PrintF("\n"); | |
| 5598 PrintF("gc_count=%d ", gc_count_); | |
| 5599 PrintF("mark_sweep_count=%d ", ms_count_); | |
| 5600 PrintF("max_gc_pause=%.1f ", get_max_gc_pause()); | |
| 5601 PrintF("total_gc_time=%.1f ", total_gc_time_ms_); | |
| 5602 PrintF("min_in_mutator=%.1f ", get_min_in_mutator()); | |
| 5603 PrintF("max_alive_after_gc=%" V8PRIdPTR " ", get_max_alive_after_gc()); | |
| 5604 PrintF("total_marking_time=%.1f ", tracer()->cumulative_marking_duration()); | |
| 5605 PrintF("total_sweeping_time=%.1f ", | |
| 5606 tracer()->cumulative_sweeping_duration()); | |
| 5607 PrintF("\n\n"); | |
| 5608 } | |
| 5609 | |
| 5610 if (FLAG_print_max_heap_committed) { | 5590 if (FLAG_print_max_heap_committed) { |
| 5611 PrintF("\n"); | 5591 PrintF("\n"); |
| 5612 PrintF("maximum_committed_by_heap=%" V8PRIdPTR " ", | 5592 PrintF("maximum_committed_by_heap=%" V8PRIdPTR " ", |
| 5613 MaximumCommittedMemory()); | 5593 MaximumCommittedMemory()); |
| 5614 PrintF("maximum_committed_by_new_space=%" V8PRIdPTR " ", | 5594 PrintF("maximum_committed_by_new_space=%" V8PRIdPTR " ", |
| 5615 new_space_->MaximumCommittedMemory()); | 5595 new_space_->MaximumCommittedMemory()); |
| 5616 PrintF("maximum_committed_by_old_space=%" V8PRIdPTR " ", | 5596 PrintF("maximum_committed_by_old_space=%" V8PRIdPTR " ", |
| 5617 old_space_->MaximumCommittedMemory()); | 5597 old_space_->MaximumCommittedMemory()); |
| 5618 PrintF("maximum_committed_by_code_space=%" V8PRIdPTR " ", | 5598 PrintF("maximum_committed_by_code_space=%" V8PRIdPTR " ", |
| 5619 code_space_->MaximumCommittedMemory()); | 5599 code_space_->MaximumCommittedMemory()); |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6368 // Triggers a depth-first traversal of reachable objects from roots | 6348 // Triggers a depth-first traversal of reachable objects from roots |
| 6369 // and finds a path to any global object and prints it. Useful for | 6349 // and finds a path to any global object and prints it. Useful for |
| 6370 // determining the source for leaks of global objects. | 6350 // determining the source for leaks of global objects. |
| 6371 void Heap::TracePathToGlobal() { | 6351 void Heap::TracePathToGlobal() { |
| 6372 PathTracer tracer(PathTracer::kAnyGlobalObject, PathTracer::FIND_ALL, | 6352 PathTracer tracer(PathTracer::kAnyGlobalObject, PathTracer::FIND_ALL, |
| 6373 VISIT_ALL); | 6353 VISIT_ALL); |
| 6374 IterateRoots(&tracer, VISIT_ONLY_STRONG); | 6354 IterateRoots(&tracer, VISIT_ONLY_STRONG); |
| 6375 } | 6355 } |
| 6376 #endif | 6356 #endif |
| 6377 | 6357 |
| 6378 | 6358 void Heap::UpdateTotalGCTime(double duration) { |
| 6379 void Heap::UpdateCumulativeGCStatistics(double duration, | 6359 if (FLAG_trace_gc_verbose) { |
| 6380 double spent_in_mutator, | |
| 6381 double marking_time) { | |
| 6382 if (FLAG_print_cumulative_gc_stat) { | |
| 6383 total_gc_time_ms_ += duration; | |
| 6384 max_gc_pause_ = Max(max_gc_pause_, duration); | |
| 6385 max_alive_after_gc_ = Max(max_alive_after_gc_, SizeOfObjects()); | |
| 6386 min_in_mutator_ = Min(min_in_mutator_, spent_in_mutator); | |
| 6387 } else if (FLAG_trace_gc_verbose) { | |
| 6388 total_gc_time_ms_ += duration; | 6360 total_gc_time_ms_ += duration; |
| 6389 } | 6361 } |
| 6390 | |
| 6391 marking_time_ += marking_time; | |
| 6392 } | 6362 } |
| 6393 | 6363 |
| 6394 void Heap::ExternalStringTable::CleanUp() { | 6364 void Heap::ExternalStringTable::CleanUp() { |
| 6395 int last = 0; | 6365 int last = 0; |
| 6396 Isolate* isolate = heap_->isolate(); | 6366 Isolate* isolate = heap_->isolate(); |
| 6397 for (int i = 0; i < new_space_strings_.length(); ++i) { | 6367 for (int i = 0; i < new_space_strings_.length(); ++i) { |
| 6398 if (new_space_strings_[i]->IsTheHole(isolate)) { | 6368 if (new_space_strings_[i]->IsTheHole(isolate)) { |
| 6399 continue; | 6369 continue; |
| 6400 } | 6370 } |
| 6401 DCHECK(new_space_strings_[i]->IsExternalString()); | 6371 DCHECK(new_space_strings_[i]->IsExternalString()); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6540 } | 6510 } |
| 6541 | 6511 |
| 6542 | 6512 |
| 6543 // static | 6513 // static |
| 6544 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6514 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6545 return StaticVisitorBase::GetVisitorId(map); | 6515 return StaticVisitorBase::GetVisitorId(map); |
| 6546 } | 6516 } |
| 6547 | 6517 |
| 6548 } // namespace internal | 6518 } // namespace internal |
| 6549 } // namespace v8 | 6519 } // namespace v8 |
| OLD | NEW |