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 #ifndef V8_HEAP_MARK_COMPACT_H_ | 5 #ifndef V8_HEAP_MARK_COMPACT_H_ |
6 #define V8_HEAP_MARK_COMPACT_H_ | 6 #define V8_HEAP_MARK_COMPACT_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 public: | 33 public: |
34 INLINE(static MarkBit MarkBitFrom(Address addr)) { | 34 INLINE(static MarkBit MarkBitFrom(Address addr)) { |
35 MemoryChunk* p = MemoryChunk::FromAddress(addr); | 35 MemoryChunk* p = MemoryChunk::FromAddress(addr); |
36 return p->markbits()->MarkBitFromIndex(p->AddressToMarkbitIndex(addr)); | 36 return p->markbits()->MarkBitFromIndex(p->AddressToMarkbitIndex(addr)); |
37 } | 37 } |
38 | 38 |
39 INLINE(static MarkBit MarkBitFrom(HeapObject* obj)) { | 39 INLINE(static MarkBit MarkBitFrom(HeapObject* obj)) { |
40 return MarkBitFrom(reinterpret_cast<Address>(obj)); | 40 return MarkBitFrom(reinterpret_cast<Address>(obj)); |
41 } | 41 } |
42 | 42 |
43 #ifdef DEBUG | |
44 static Marking::ObjectColor Color(HeapObject* obj) { | 43 static Marking::ObjectColor Color(HeapObject* obj) { |
45 return Marking::Color(ObjectMarking::MarkBitFrom(obj)); | 44 return Marking::Color(ObjectMarking::MarkBitFrom(obj)); |
46 } | 45 } |
47 #endif | |
48 | 46 |
49 private: | 47 private: |
50 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectMarking); | 48 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectMarking); |
51 }; | 49 }; |
52 | 50 |
53 // ---------------------------------------------------------------------------- | 51 // ---------------------------------------------------------------------------- |
54 // Marking deque for tracing live objects. | 52 // Marking deque for tracing live objects. |
55 class MarkingDeque { | 53 class MarkingDeque { |
56 public: | 54 public: |
57 MarkingDeque() | 55 MarkingDeque() |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 | 505 |
508 bool WillBeDeoptimized(Code* code); | 506 bool WillBeDeoptimized(Code* code); |
509 void ClearInvalidRememberedSetSlots(); | 507 void ClearInvalidRememberedSetSlots(); |
510 | 508 |
511 void ComputeEvacuationHeuristics(int area_size, | 509 void ComputeEvacuationHeuristics(int area_size, |
512 int* target_fragmentation_percent, | 510 int* target_fragmentation_percent, |
513 int* max_evacuated_bytes); | 511 int* max_evacuated_bytes); |
514 | 512 |
515 void VisitAllObjects(HeapObjectVisitor* visitor); | 513 void VisitAllObjects(HeapObjectVisitor* visitor); |
516 | 514 |
| 515 void RecordObjectStats(); |
| 516 |
517 // Finishes GC, performs heap verification if enabled. | 517 // Finishes GC, performs heap verification if enabled. |
518 void Finish(); | 518 void Finish(); |
519 | 519 |
520 // ----------------------------------------------------------------------- | 520 // ----------------------------------------------------------------------- |
521 // Phase 1: Marking live objects. | 521 // Phase 1: Marking live objects. |
522 // | 522 // |
523 // Before: The heap has been prepared for garbage collection by | 523 // Before: The heap has been prepared for garbage collection by |
524 // MarkCompactCollector::Prepare() and is otherwise in its | 524 // MarkCompactCollector::Prepare() and is otherwise in its |
525 // normal state. | 525 // normal state. |
526 // | 526 // |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 private: | 761 private: |
762 MarkCompactCollector* collector_; | 762 MarkCompactCollector* collector_; |
763 }; | 763 }; |
764 | 764 |
765 | 765 |
766 const char* AllocationSpaceName(AllocationSpace space); | 766 const char* AllocationSpaceName(AllocationSpace space); |
767 } // namespace internal | 767 } // namespace internal |
768 } // namespace v8 | 768 } // namespace v8 |
769 | 769 |
770 #endif // V8_HEAP_MARK_COMPACT_H_ | 770 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |