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 4190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4201 Struct* result; | 4201 Struct* result; |
4202 { AllocationResult allocation = Allocate(map, space); | 4202 { AllocationResult allocation = Allocate(map, space); |
4203 if (!allocation.To(&result)) return allocation; | 4203 if (!allocation.To(&result)) return allocation; |
4204 } | 4204 } |
4205 result->InitializeBody(size); | 4205 result->InitializeBody(size); |
4206 return result; | 4206 return result; |
4207 } | 4207 } |
4208 | 4208 |
4209 | 4209 |
4210 bool Heap::IsHeapIterable() { | 4210 bool Heap::IsHeapIterable() { |
| 4211 // TODO(hpayer): This function is not correct. Allocation folding in old |
| 4212 // space breaks the iterability. |
4211 return (old_pointer_space()->swept_precisely() && | 4213 return (old_pointer_space()->swept_precisely() && |
4212 old_data_space()->swept_precisely() && | 4214 old_data_space()->swept_precisely() && |
4213 new_space_top_after_last_gc_ == new_space()->top()); | 4215 new_space_top_after_last_gc_ == new_space()->top()); |
4214 } | 4216 } |
4215 | 4217 |
4216 | 4218 |
4217 void Heap::MakeHeapIterable() { | 4219 void Heap::MakeHeapIterable() { |
4218 ASSERT(AllowHeapAllocation::IsAllowed()); | 4220 ASSERT(AllowHeapAllocation::IsAllowed()); |
4219 if (!IsHeapIterable()) { | 4221 if (!IsHeapIterable()) { |
4220 CollectAllGarbage(kMakeHeapIterableMask, "Heap::MakeHeapIterable"); | 4222 CollectAllGarbage(kMakeHeapIterableMask, "Heap::MakeHeapIterable"); |
4221 } | 4223 } |
| 4224 if (mark_compact_collector()->sweeping_in_progress()) { |
| 4225 mark_compact_collector()->EnsureSweepingCompleted(); |
| 4226 } |
4222 ASSERT(IsHeapIterable()); | 4227 ASSERT(IsHeapIterable()); |
4223 } | 4228 } |
4224 | 4229 |
4225 | 4230 |
4226 void Heap::AdvanceIdleIncrementalMarking(intptr_t step_size) { | 4231 void Heap::AdvanceIdleIncrementalMarking(intptr_t step_size) { |
4227 HistogramTimerScope idle_notification_scope( | 4232 HistogramTimerScope idle_notification_scope( |
4228 isolate_->counters()->gc_incremental_marking()); | 4233 isolate_->counters()->gc_incremental_marking()); |
4229 | 4234 |
4230 incremental_marking()->Step(step_size, | 4235 incremental_marking()->Step(step_size, |
4231 IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 4236 IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
(...skipping 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6445 static_cast<int>(object_sizes_last_time_[index])); | 6450 static_cast<int>(object_sizes_last_time_[index])); |
6446 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6451 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6447 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6452 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6448 | 6453 |
6449 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6454 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6450 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6455 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6451 ClearObjectStats(); | 6456 ClearObjectStats(); |
6452 } | 6457 } |
6453 | 6458 |
6454 } } // namespace v8::internal | 6459 } } // namespace v8::internal |
OLD | NEW |