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 5778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5789 explicit UnreachableObjectsFilter(Heap* heap) : heap_(heap) { | 5789 explicit UnreachableObjectsFilter(Heap* heap) : heap_(heap) { |
5790 MarkReachableObjects(); | 5790 MarkReachableObjects(); |
5791 } | 5791 } |
5792 | 5792 |
5793 ~UnreachableObjectsFilter() { | 5793 ~UnreachableObjectsFilter() { |
5794 heap_->mark_compact_collector()->ClearMarkbits(); | 5794 heap_->mark_compact_collector()->ClearMarkbits(); |
5795 } | 5795 } |
5796 | 5796 |
5797 bool SkipObject(HeapObject* object) { | 5797 bool SkipObject(HeapObject* object) { |
5798 MarkBit mark_bit = Marking::MarkBitFrom(object); | 5798 MarkBit mark_bit = Marking::MarkBitFrom(object); |
5799 return !mark_bit.Get(); | 5799 return Marking::IsWhite(mark_bit); |
5800 } | 5800 } |
5801 | 5801 |
5802 private: | 5802 private: |
5803 class MarkingVisitor : public ObjectVisitor { | 5803 class MarkingVisitor : public ObjectVisitor { |
5804 public: | 5804 public: |
5805 MarkingVisitor() : marking_stack_(10) {} | 5805 MarkingVisitor() : marking_stack_(10) {} |
5806 | 5806 |
5807 void VisitPointers(Object** start, Object** end) { | 5807 void VisitPointers(Object** start, Object** end) { |
5808 for (Object** p = start; p < end; p++) { | 5808 for (Object** p = start; p < end; p++) { |
5809 if (!(*p)->IsHeapObject()) continue; | 5809 if (!(*p)->IsHeapObject()) continue; |
5810 HeapObject* obj = HeapObject::cast(*p); | 5810 HeapObject* obj = HeapObject::cast(*p); |
5811 MarkBit mark_bit = Marking::MarkBitFrom(obj); | 5811 MarkBit mark_bit = Marking::MarkBitFrom(obj); |
5812 if (!mark_bit.Get()) { | 5812 if (Marking::IsWhite(mark_bit)) { |
5813 mark_bit.Set(); | 5813 Marking::WhiteToBlack(mark_bit); |
5814 marking_stack_.Add(obj); | 5814 marking_stack_.Add(obj); |
5815 } | 5815 } |
5816 } | 5816 } |
5817 } | 5817 } |
5818 | 5818 |
5819 void TransitiveClosure() { | 5819 void TransitiveClosure() { |
5820 while (!marking_stack_.is_empty()) { | 5820 while (!marking_stack_.is_empty()) { |
5821 HeapObject* obj = marking_stack_.RemoveLast(); | 5821 HeapObject* obj = marking_stack_.RemoveLast(); |
5822 obj->Iterate(this); | 5822 obj->Iterate(this); |
5823 } | 5823 } |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6390 static_cast<int>(object_sizes_last_time_[index])); | 6390 static_cast<int>(object_sizes_last_time_[index])); |
6391 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6391 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6392 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6392 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6393 | 6393 |
6394 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6394 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6395 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6395 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6396 ClearObjectStats(); | 6396 ClearObjectStats(); |
6397 } | 6397 } |
6398 } | 6398 } |
6399 } // namespace v8::internal | 6399 } // namespace v8::internal |
OLD | NEW |