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

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

Issue 1125193005: Make new space allocation throughput estimation more accurate. (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
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 marking_time_(0.0), 133 marking_time_(0.0),
134 sweeping_time_(0.0), 134 sweeping_time_(0.0),
135 last_idle_notification_time_(0.0), 135 last_idle_notification_time_(0.0),
136 mark_compact_collector_(this), 136 mark_compact_collector_(this),
137 store_buffer_(this), 137 store_buffer_(this),
138 marking_(this), 138 marking_(this),
139 incremental_marking_(this), 139 incremental_marking_(this),
140 gc_count_at_last_idle_gc_(0), 140 gc_count_at_last_idle_gc_(0),
141 full_codegen_bytes_generated_(0), 141 full_codegen_bytes_generated_(0),
142 crankshaft_codegen_bytes_generated_(0), 142 crankshaft_codegen_bytes_generated_(0),
143 new_space_allocation_counter_(0),
143 gcs_since_last_deopt_(0), 144 gcs_since_last_deopt_(0),
144 allocation_sites_scratchpad_length_(0), 145 allocation_sites_scratchpad_length_(0),
145 promotion_queue_(this), 146 promotion_queue_(this),
146 configured_(false), 147 configured_(false),
147 external_string_table_(this), 148 external_string_table_(this),
148 chunks_queued_for_free_(NULL), 149 chunks_queued_for_free_(NULL),
149 gc_callbacks_depth_(0), 150 gc_callbacks_depth_(0),
150 deserialization_complete_(false), 151 deserialization_complete_(false),
151 concurrent_sweeping_enabled_(false), 152 concurrent_sweeping_enabled_(false),
152 strong_roots_list_(NULL) { 153 strong_roots_list_(NULL) {
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 if (isolate()->concurrent_osr_enabled()) { 454 if (isolate()->concurrent_osr_enabled()) {
454 isolate()->optimizing_compile_dispatcher()->AgeBufferedOsrJobs(); 455 isolate()->optimizing_compile_dispatcher()->AgeBufferedOsrJobs();
455 } 456 }
456 457
457 if (new_space_.IsAtMaximumCapacity()) { 458 if (new_space_.IsAtMaximumCapacity()) {
458 maximum_size_scavenges_++; 459 maximum_size_scavenges_++;
459 } else { 460 } else {
460 maximum_size_scavenges_ = 0; 461 maximum_size_scavenges_ = 0;
461 } 462 }
462 CheckNewSpaceExpansionCriteria(); 463 CheckNewSpaceExpansionCriteria();
464 UpdateNewSpaceAllocationCounter();
463 } 465 }
464 466
465 467
466 intptr_t Heap::SizeOfObjects() { 468 intptr_t Heap::SizeOfObjects() {
467 intptr_t total = 0; 469 intptr_t total = 0;
468 AllSpaces spaces(this); 470 AllSpaces spaces(this);
469 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) { 471 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) {
470 total += space->SizeOfObjects(); 472 total += space->SizeOfObjects();
471 } 473 }
472 return total; 474 return total;
(...skipping 4151 matching lines...) Expand 10 before | Expand all | Expand 10 after
4624 GCIdleTimeHandler::HeapState heap_state; 4626 GCIdleTimeHandler::HeapState heap_state;
4625 heap_state.contexts_disposed = contexts_disposed_; 4627 heap_state.contexts_disposed = contexts_disposed_;
4626 heap_state.contexts_disposal_rate = 4628 heap_state.contexts_disposal_rate =
4627 tracer()->ContextDisposalRateInMilliseconds(); 4629 tracer()->ContextDisposalRateInMilliseconds();
4628 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects()); 4630 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects());
4629 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); 4631 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped();
4630 // TODO(ulan): Start incremental marking only for large heaps. 4632 // TODO(ulan): Start incremental marking only for large heaps.
4631 intptr_t limit = old_generation_allocation_limit_; 4633 intptr_t limit = old_generation_allocation_limit_;
4632 if (is_long_idle_notification) { 4634 if (is_long_idle_notification) {
4633 limit = idle_old_generation_allocation_limit_; 4635 limit = idle_old_generation_allocation_limit_;
4636 tracer()->SampleNewSpaceAllocation(start_ms, NewSpaceAllocationCounter());
4634 } 4637 }
4635 4638
4636 heap_state.can_start_incremental_marking = 4639 heap_state.can_start_incremental_marking =
4637 incremental_marking()->CanBeActivated() && 4640 incremental_marking()->CanBeActivated() &&
4638 HeapIsFullEnoughToStartIncrementalMarking(limit) && 4641 HeapIsFullEnoughToStartIncrementalMarking(limit) &&
4639 !mark_compact_collector()->sweeping_in_progress(); 4642 !mark_compact_collector()->sweeping_in_progress();
4640 heap_state.sweeping_in_progress = 4643 heap_state.sweeping_in_progress =
4641 mark_compact_collector()->sweeping_in_progress(); 4644 mark_compact_collector()->sweeping_in_progress();
4642 heap_state.sweeping_completed = 4645 heap_state.sweeping_completed =
4643 mark_compact_collector()->IsSweepingCompleted(); 4646 mark_compact_collector()->IsSweepingCompleted();
4644 heap_state.mark_compact_speed_in_bytes_per_ms = 4647 heap_state.mark_compact_speed_in_bytes_per_ms =
4645 static_cast<size_t>(tracer()->MarkCompactSpeedInBytesPerMillisecond()); 4648 static_cast<size_t>(tracer()->MarkCompactSpeedInBytesPerMillisecond());
4646 heap_state.incremental_marking_speed_in_bytes_per_ms = static_cast<size_t>( 4649 heap_state.incremental_marking_speed_in_bytes_per_ms = static_cast<size_t>(
4647 tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); 4650 tracer()->IncrementalMarkingSpeedInBytesPerMillisecond());
4648 heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms = 4651 heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms =
4649 static_cast<size_t>( 4652 static_cast<size_t>(
4650 tracer()->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()); 4653 tracer()->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond());
4651 heap_state.scavenge_speed_in_bytes_per_ms = 4654 heap_state.scavenge_speed_in_bytes_per_ms =
4652 static_cast<size_t>(tracer()->ScavengeSpeedInBytesPerMillisecond()); 4655 static_cast<size_t>(tracer()->ScavengeSpeedInBytesPerMillisecond());
4653 heap_state.used_new_space_size = new_space_.Size(); 4656 heap_state.used_new_space_size = new_space_.Size();
4654 heap_state.new_space_capacity = new_space_.Capacity(); 4657 heap_state.new_space_capacity = new_space_.Capacity();
4655 heap_state.new_space_allocation_throughput_in_bytes_per_ms = 4658 heap_state.new_space_allocation_throughput_in_bytes_per_ms =
4656 static_cast<size_t>( 4659 tracer()->NewSpaceAllocationThroughputInBytesPerMillisecond();
4657 tracer()->NewSpaceAllocationThroughputInBytesPerMillisecond());
4658 4660
4659 GCIdleTimeAction action = 4661 GCIdleTimeAction action =
4660 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state); 4662 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state);
4661 4663
4662 isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample( 4664 isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample(
4663 static_cast<int>(idle_time_in_ms)); 4665 static_cast<int>(idle_time_in_ms));
4664 if (is_long_idle_notification) { 4666 if (is_long_idle_notification) {
4665 int committed_memory = static_cast<int>(CommittedMemory() / KB); 4667 int committed_memory = static_cast<int>(CommittedMemory() / KB);
4666 int used_memory = static_cast<int>(heap_state.size_of_objects / KB); 4668 int used_memory = static_cast<int>(heap_state.size_of_objects / KB);
4667 isolate()->counters()->aggregated_memory_heap_committed()->AddSample( 4669 isolate()->counters()->aggregated_memory_heap_committed()->AddSample(
(...skipping 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after
6510 } 6512 }
6511 delete list; 6513 delete list;
6512 } else { 6514 } else {
6513 prev = list; 6515 prev = list;
6514 } 6516 }
6515 list = next; 6517 list = next;
6516 } 6518 }
6517 } 6519 }
6518 } 6520 }
6519 } // namespace v8::internal 6521 } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698