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 4588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4599 if (!FLAG_incremental_marking || Serializer::enabled()) { | 4599 if (!FLAG_incremental_marking || Serializer::enabled()) { |
4600 return IdleGlobalGC(); | 4600 return IdleGlobalGC(); |
4601 } | 4601 } |
4602 | 4602 |
4603 // By doing small chunks of GC work in each IdleNotification, | 4603 // By doing small chunks of GC work in each IdleNotification, |
4604 // perform a round of incremental GCs and after that wait until | 4604 // perform a round of incremental GCs and after that wait until |
4605 // the mutator creates enough garbage to justify a new round. | 4605 // the mutator creates enough garbage to justify a new round. |
4606 // An incremental GC progresses as follows: | 4606 // An incremental GC progresses as follows: |
4607 // 1. many incremental marking steps, | 4607 // 1. many incremental marking steps, |
4608 // 2. one old space mark-sweep-compact, | 4608 // 2. one old space mark-sweep-compact, |
4609 // 3. many lazy sweep steps. | |
4610 // Use mark-sweep-compact events to count incremental GCs in a round. | 4609 // Use mark-sweep-compact events to count incremental GCs in a round. |
4611 | 4610 |
4612 if (incremental_marking()->IsStopped()) { | |
4613 if (!mark_compact_collector()->AreSweeperThreadsActivated() && | |
4614 !IsSweepingComplete() && | |
4615 !AdvanceSweepers(static_cast<int>(step_size))) { | |
4616 return false; | |
4617 } | |
4618 } | |
4619 | |
4620 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { | 4611 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { |
4621 if (EnoughGarbageSinceLastIdleRound()) { | 4612 if (EnoughGarbageSinceLastIdleRound()) { |
4622 StartIdleRound(); | 4613 StartIdleRound(); |
4623 } else { | 4614 } else { |
4624 return true; | 4615 return true; |
4625 } | 4616 } |
4626 } | 4617 } |
4627 | 4618 |
4628 int remaining_mark_sweeps = kMaxMarkSweepsInIdleRound - | 4619 int remaining_mark_sweeps = kMaxMarkSweepsInIdleRound - |
4629 mark_sweeps_since_idle_round_started_; | 4620 mark_sweeps_since_idle_round_started_; |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5333 return old_pointer_space_->SizeOfObjects() | 5324 return old_pointer_space_->SizeOfObjects() |
5334 + old_data_space_->SizeOfObjects() | 5325 + old_data_space_->SizeOfObjects() |
5335 + code_space_->SizeOfObjects() | 5326 + code_space_->SizeOfObjects() |
5336 + map_space_->SizeOfObjects() | 5327 + map_space_->SizeOfObjects() |
5337 + cell_space_->SizeOfObjects() | 5328 + cell_space_->SizeOfObjects() |
5338 + property_cell_space_->SizeOfObjects() | 5329 + property_cell_space_->SizeOfObjects() |
5339 + lo_space_->SizeOfObjects(); | 5330 + lo_space_->SizeOfObjects(); |
5340 } | 5331 } |
5341 | 5332 |
5342 | 5333 |
5343 bool Heap::AdvanceSweepers(int step_size) { | |
5344 ASSERT(!mark_compact_collector()->AreSweeperThreadsActivated()); | |
5345 bool sweeping_complete = old_data_space()->AdvanceSweeper(step_size); | |
5346 sweeping_complete &= old_pointer_space()->AdvanceSweeper(step_size); | |
5347 return sweeping_complete; | |
5348 } | |
5349 | |
5350 | |
5351 int64_t Heap::PromotedExternalMemorySize() { | 5334 int64_t Heap::PromotedExternalMemorySize() { |
5352 if (amount_of_external_allocated_memory_ | 5335 if (amount_of_external_allocated_memory_ |
5353 <= amount_of_external_allocated_memory_at_last_global_gc_) return 0; | 5336 <= amount_of_external_allocated_memory_at_last_global_gc_) return 0; |
5354 return amount_of_external_allocated_memory_ | 5337 return amount_of_external_allocated_memory_ |
5355 - amount_of_external_allocated_memory_at_last_global_gc_; | 5338 - amount_of_external_allocated_memory_at_last_global_gc_; |
5356 } | 5339 } |
5357 | 5340 |
5358 | 5341 |
5359 void Heap::EnableInlineAllocation() { | 5342 void Heap::EnableInlineAllocation() { |
5360 if (!inline_allocation_disabled_) return; | 5343 if (!inline_allocation_disabled_) return; |
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6682 static_cast<int>(object_sizes_last_time_[index])); | 6665 static_cast<int>(object_sizes_last_time_[index])); |
6683 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6666 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6684 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6667 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6685 | 6668 |
6686 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6669 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6687 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6670 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6688 ClearObjectStats(); | 6671 ClearObjectStats(); |
6689 } | 6672 } |
6690 | 6673 |
6691 } } // namespace v8::internal | 6674 } } // namespace v8::internal |
OLD | NEW |