| 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 "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #include "accessors.h" | 7 #include "accessors.h" |
| 8 #include "api.h" | 8 #include "api.h" |
| 9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
| 10 #include "codegen.h" | 10 #include "codegen.h" |
| (...skipping 4303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4314 { AllocationResult allocation = Allocate(map, space); | 4314 { AllocationResult allocation = Allocate(map, space); |
| 4315 if (!allocation.To(&result)) return allocation; | 4315 if (!allocation.To(&result)) return allocation; |
| 4316 } | 4316 } |
| 4317 result->InitializeBody(size); | 4317 result->InitializeBody(size); |
| 4318 return result; | 4318 return result; |
| 4319 } | 4319 } |
| 4320 | 4320 |
| 4321 | 4321 |
| 4322 bool Heap::IsHeapIterable() { | 4322 bool Heap::IsHeapIterable() { |
| 4323 return (!old_pointer_space()->was_swept_conservatively() && | 4323 return (!old_pointer_space()->was_swept_conservatively() && |
| 4324 !old_data_space()->was_swept_conservatively() && | 4324 !old_data_space()->was_swept_conservatively()); |
| 4325 new_space()->bottom() == new_space()->top()); | |
| 4326 } | 4325 } |
| 4327 | 4326 |
| 4328 | 4327 |
| 4329 void Heap::MakeHeapIterable() { | 4328 void Heap::EnsureHeapIsIterable() { |
| 4330 ASSERT(AllowHeapAllocation::IsAllowed()); | 4329 ASSERT(AllowHeapAllocation::IsAllowed()); |
| 4331 if (!IsHeapIterable()) { | 4330 if (!IsHeapIterable()) { |
| 4332 CollectAllGarbage(kMakeHeapIterableMask, "Heap::MakeHeapIterable"); | 4331 CollectAllGarbage(kMakeHeapIterableMask, "Heap::EnsureHeapIsIterable"); |
| 4333 } | 4332 } |
| 4334 ASSERT(IsHeapIterable()); | 4333 ASSERT(IsHeapIterable()); |
| 4335 } | 4334 } |
| 4336 | 4335 |
| 4337 | 4336 |
| 4338 void Heap::AdvanceIdleIncrementalMarking(intptr_t step_size) { | 4337 void Heap::AdvanceIdleIncrementalMarking(intptr_t step_size) { |
| 4339 incremental_marking()->Step(step_size, | 4338 incremental_marking()->Step(step_size, |
| 4340 IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 4339 IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
| 4341 | 4340 |
| 4342 if (incremental_marking()->IsComplete()) { | 4341 if (incremental_marking()->IsComplete()) { |
| (...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5726 heap_->IterateRoots(&visitor, VISIT_ALL); | 5725 heap_->IterateRoots(&visitor, VISIT_ALL); |
| 5727 visitor.TransitiveClosure(); | 5726 visitor.TransitiveClosure(); |
| 5728 } | 5727 } |
| 5729 | 5728 |
| 5730 Heap* heap_; | 5729 Heap* heap_; |
| 5731 DisallowHeapAllocation no_allocation_; | 5730 DisallowHeapAllocation no_allocation_; |
| 5732 }; | 5731 }; |
| 5733 | 5732 |
| 5734 | 5733 |
| 5735 HeapIterator::HeapIterator(Heap* heap) | 5734 HeapIterator::HeapIterator(Heap* heap) |
| 5736 : make_heap_iterable_helper_(heap), | 5735 : heap_(heap), |
| 5737 no_heap_allocation_(), | |
| 5738 heap_(heap), | |
| 5739 filtering_(HeapIterator::kNoFiltering), | 5736 filtering_(HeapIterator::kNoFiltering), |
| 5740 filter_(NULL) { | 5737 filter_(NULL) { |
| 5741 Init(); | 5738 Init(); |
| 5742 } | 5739 } |
| 5743 | 5740 |
| 5744 | 5741 |
| 5745 HeapIterator::HeapIterator(Heap* heap, | 5742 HeapIterator::HeapIterator(Heap* heap, |
| 5746 HeapIterator::HeapObjectsFiltering filtering) | 5743 HeapIterator::HeapObjectsFiltering filtering) |
| 5747 : make_heap_iterable_helper_(heap), | 5744 : heap_(heap), |
| 5748 no_heap_allocation_(), | |
| 5749 heap_(heap), | |
| 5750 filtering_(filtering), | 5745 filtering_(filtering), |
| 5751 filter_(NULL) { | 5746 filter_(NULL) { |
| 5752 Init(); | 5747 Init(); |
| 5753 } | 5748 } |
| 5754 | 5749 |
| 5755 | 5750 |
| 5756 HeapIterator::~HeapIterator() { | 5751 HeapIterator::~HeapIterator() { |
| 5757 Shutdown(); | 5752 Shutdown(); |
| 5758 } | 5753 } |
| 5759 | 5754 |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6488 static_cast<int>(object_sizes_last_time_[index])); | 6483 static_cast<int>(object_sizes_last_time_[index])); |
| 6489 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6484 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6490 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6485 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6491 | 6486 |
| 6492 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6487 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6493 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6488 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6494 ClearObjectStats(); | 6489 ClearObjectStats(); |
| 6495 } | 6490 } |
| 6496 | 6491 |
| 6497 } } // namespace v8::internal | 6492 } } // namespace v8::internal |
| OLD | NEW |