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/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 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 freed_global_handles = | 1276 freed_global_handles = |
1277 isolate_->global_handles()->PostGarbageCollectionProcessing(collector); | 1277 isolate_->global_handles()->PostGarbageCollectionProcessing(collector); |
1278 } | 1278 } |
1279 gc_post_processing_depth_--; | 1279 gc_post_processing_depth_--; |
1280 | 1280 |
1281 isolate_->eternal_handles()->PostGarbageCollectionProcessing(this); | 1281 isolate_->eternal_handles()->PostGarbageCollectionProcessing(this); |
1282 | 1282 |
1283 // Update relocatables. | 1283 // Update relocatables. |
1284 Relocatable::PostGarbageCollectionProcessing(isolate_); | 1284 Relocatable::PostGarbageCollectionProcessing(isolate_); |
1285 | 1285 |
| 1286 double gc_speed = tracer()->CombinedMarkCompactSpeedInBytesPerMillisecond(); |
| 1287 double mutator_speed = static_cast<double>( |
| 1288 tracer() |
| 1289 ->CurrentOldGenerationAllocationThroughputInBytesPerMillisecond()); |
| 1290 intptr_t old_gen_size = PromotedSpaceSizeOfObjects(); |
1286 if (collector == MARK_COMPACTOR) { | 1291 if (collector == MARK_COMPACTOR) { |
1287 // Register the amount of external allocated memory. | 1292 // Register the amount of external allocated memory. |
1288 amount_of_external_allocated_memory_at_last_global_gc_ = | 1293 amount_of_external_allocated_memory_at_last_global_gc_ = |
1289 amount_of_external_allocated_memory_; | 1294 amount_of_external_allocated_memory_; |
1290 double gc_speed = tracer()->CombinedMarkCompactSpeedInBytesPerMillisecond(); | |
1291 double mutator_speed = static_cast<double>( | |
1292 tracer() | |
1293 ->CurrentOldGenerationAllocationThroughputInBytesPerMillisecond()); | |
1294 intptr_t old_gen_size = PromotedSpaceSizeOfObjects(); | |
1295 SetOldGenerationAllocationLimit(old_gen_size, gc_speed, mutator_speed); | 1295 SetOldGenerationAllocationLimit(old_gen_size, gc_speed, mutator_speed); |
| 1296 } else if (HasLowYoungGenerationAllocationRate()) { |
| 1297 DampenOldGenerationAllocationLimit(old_gen_size, gc_speed, mutator_speed); |
1296 } | 1298 } |
1297 | 1299 |
1298 { | 1300 { |
1299 GCCallbacksScope scope(this); | 1301 GCCallbacksScope scope(this); |
1300 if (scope.CheckReenter()) { | 1302 if (scope.CheckReenter()) { |
1301 AllowHeapAllocation allow_allocation; | 1303 AllowHeapAllocation allow_allocation; |
1302 GCTracer::Scope scope(tracer(), GCTracer::Scope::EXTERNAL); | 1304 GCTracer::Scope scope(tracer(), GCTracer::Scope::EXTERNAL); |
1303 VMState<EXTERNAL> state(isolate_); | 1305 VMState<EXTERNAL> state(isolate_); |
1304 HandleScope handle_scope(isolate_); | 1306 HandleScope handle_scope(isolate_); |
1305 CallGCEpilogueCallbacks(gc_type, gc_callback_flags); | 1307 CallGCEpilogueCallbacks(gc_type, gc_callback_flags); |
(...skipping 4262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5568 PrintIsolate( | 5570 PrintIsolate( |
5569 isolate_, | 5571 isolate_, |
5570 "Grow: old size: %" V8_PTR_PREFIX "d KB, new limit: %" V8_PTR_PREFIX | 5572 "Grow: old size: %" V8_PTR_PREFIX "d KB, new limit: %" V8_PTR_PREFIX |
5571 "d KB (%.1f), new idle limit: %" V8_PTR_PREFIX "d KB (%.1f)\n", | 5573 "d KB (%.1f), new idle limit: %" V8_PTR_PREFIX "d KB (%.1f)\n", |
5572 old_gen_size / KB, old_generation_allocation_limit_ / KB, factor, | 5574 old_gen_size / KB, old_generation_allocation_limit_ / KB, factor, |
5573 idle_old_generation_allocation_limit_ / KB, idle_factor); | 5575 idle_old_generation_allocation_limit_ / KB, idle_factor); |
5574 } | 5576 } |
5575 } | 5577 } |
5576 | 5578 |
5577 | 5579 |
| 5580 void Heap::DampenOldGenerationAllocationLimit(intptr_t old_gen_size, |
| 5581 double gc_speed, |
| 5582 double mutator_speed) { |
| 5583 double factor = HeapGrowingFactor(gc_speed, mutator_speed); |
| 5584 intptr_t limit = CalculateOldGenerationAllocationLimit(factor, old_gen_size); |
| 5585 if (limit < old_generation_allocation_limit_) { |
| 5586 if (FLAG_trace_gc_verbose) { |
| 5587 PrintIsolate(isolate_, "Dampen: old size: %" V8_PTR_PREFIX |
| 5588 "d KB, old limit: %" V8_PTR_PREFIX "d KB, \n", |
| 5589 "new limit: %" V8_PTR_PREFIX "d KB (%.1f)\n", |
| 5590 old_gen_size / KB, old_generation_allocation_limit_ / KB, |
| 5591 limit / KB, factor); |
| 5592 } |
| 5593 old_generation_allocation_limit_ = limit; |
| 5594 } |
| 5595 } |
| 5596 |
| 5597 |
5578 void Heap::EnableInlineAllocation() { | 5598 void Heap::EnableInlineAllocation() { |
5579 if (!inline_allocation_disabled_) return; | 5599 if (!inline_allocation_disabled_) return; |
5580 inline_allocation_disabled_ = false; | 5600 inline_allocation_disabled_ = false; |
5581 | 5601 |
5582 // Update inline allocation limit for new space. | 5602 // Update inline allocation limit for new space. |
5583 new_space()->UpdateInlineAllocationLimit(0); | 5603 new_space()->UpdateInlineAllocationLimit(0); |
5584 } | 5604 } |
5585 | 5605 |
5586 | 5606 |
5587 void Heap::DisableInlineAllocation() { | 5607 void Heap::DisableInlineAllocation() { |
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6787 *object_type = "CODE_TYPE"; \ | 6807 *object_type = "CODE_TYPE"; \ |
6788 *object_sub_type = "CODE_AGE/" #name; \ | 6808 *object_sub_type = "CODE_AGE/" #name; \ |
6789 return true; | 6809 return true; |
6790 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6810 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
6791 #undef COMPARE_AND_RETURN_NAME | 6811 #undef COMPARE_AND_RETURN_NAME |
6792 } | 6812 } |
6793 return false; | 6813 return false; |
6794 } | 6814 } |
6795 } // namespace internal | 6815 } // namespace internal |
6796 } // namespace v8 | 6816 } // namespace v8 |
OLD | NEW |