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/once.h" | 9 #include "src/base/once.h" |
10 #include "src/base/utils/random-number-generator.h" | 10 #include "src/base/utils/random-number-generator.h" |
(...skipping 3294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3305 | 3305 |
3306 Page* page = Page::FromAddress(address); | 3306 Page* page = Page::FromAddress(address); |
3307 // We can move the object start if: | 3307 // We can move the object start if: |
3308 // (1) the object is not in old pointer or old data space, | 3308 // (1) the object is not in old pointer or old data space, |
3309 // (2) the page of the object was already swept, | 3309 // (2) the page of the object was already swept, |
3310 // (3) the page was already concurrently swept. This case is an optimization | 3310 // (3) the page was already concurrently swept. This case is an optimization |
3311 // for concurrent sweeping. The WasSwept predicate for concurrently swept | 3311 // for concurrent sweeping. The WasSwept predicate for concurrently swept |
3312 // pages is set after sweeping all pages. | 3312 // pages is set after sweeping all pages. |
3313 return (!is_in_old_pointer_space && !is_in_old_data_space) || | 3313 return (!is_in_old_pointer_space && !is_in_old_data_space) || |
3314 page->WasSwept() || | 3314 page->WasSwept() || |
3315 (mark_compact_collector()->AreSweeperThreadsActivated() && | 3315 (page->parallel_sweeping() <= |
3316 page->parallel_sweeping() <= | 3316 MemoryChunk::PARALLEL_SWEEPING_FINALIZE); |
3317 MemoryChunk::PARALLEL_SWEEPING_FINALIZE); | |
3318 } | 3317 } |
3319 | 3318 |
3320 | 3319 |
3321 void Heap::AdjustLiveBytes(Address address, int by, InvocationMode mode) { | 3320 void Heap::AdjustLiveBytes(Address address, int by, InvocationMode mode) { |
3322 if (incremental_marking()->IsMarking() && | 3321 if (incremental_marking()->IsMarking() && |
3323 Marking::IsBlack(Marking::MarkBitFrom(address))) { | 3322 Marking::IsBlack(Marking::MarkBitFrom(address))) { |
3324 if (mode == FROM_GC) { | 3323 if (mode == FROM_GC) { |
3325 MemoryChunk::IncrementLiveBytesFromGC(address, by); | 3324 MemoryChunk::IncrementLiveBytesFromGC(address, by); |
3326 } else { | 3325 } else { |
3327 MemoryChunk::IncrementLiveBytesFromMutator(address, by); | 3326 MemoryChunk::IncrementLiveBytesFromMutator(address, by); |
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4332 } | 4331 } |
4333 | 4332 |
4334 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { | 4333 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { |
4335 FinishIdleRound(); | 4334 FinishIdleRound(); |
4336 return true; | 4335 return true; |
4337 } | 4336 } |
4338 | 4337 |
4339 // If the IdleNotifcation is called with a large hint we will wait for | 4338 // If the IdleNotifcation is called with a large hint we will wait for |
4340 // the sweepter threads here. | 4339 // the sweepter threads here. |
4341 if (hint >= kMinHintForFullGC && | 4340 if (hint >= kMinHintForFullGC && |
4342 mark_compact_collector()->IsConcurrentSweepingInProgress()) { | 4341 mark_compact_collector()->sweeping_in_progress()) { |
4343 mark_compact_collector()->WaitUntilSweepingCompleted(); | 4342 mark_compact_collector()->EnsureSweepingCompleted(); |
4344 } | 4343 } |
4345 | 4344 |
4346 return false; | 4345 return false; |
4347 } | 4346 } |
4348 | 4347 |
4349 | 4348 |
4350 bool Heap::IdleGlobalGC() { | 4349 bool Heap::IdleGlobalGC() { |
4351 static const int kIdlesBeforeScavenge = 4; | 4350 static const int kIdlesBeforeScavenge = 4; |
4352 static const int kIdlesBeforeMarkSweep = 7; | 4351 static const int kIdlesBeforeMarkSweep = 7; |
4353 static const int kIdlesBeforeMarkCompact = 8; | 4352 static const int kIdlesBeforeMarkCompact = 8; |
(...skipping 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6415 static_cast<int>(object_sizes_last_time_[index])); | 6414 static_cast<int>(object_sizes_last_time_[index])); |
6416 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6415 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6417 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6416 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6418 | 6417 |
6419 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6418 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6420 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6419 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6421 ClearObjectStats(); | 6420 ClearObjectStats(); |
6422 } | 6421 } |
6423 | 6422 |
6424 } } // namespace v8::internal | 6423 } } // namespace v8::internal |
OLD | NEW |