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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 // Forward declarations. | 30 // Forward declarations. |
31 class CodeFlusher; | 31 class CodeFlusher; |
32 class MarkCompactCollector; | 32 class MarkCompactCollector; |
33 class MarkingVisitor; | 33 class MarkingVisitor; |
34 template <MarkCompactMode mode> | 34 template <MarkCompactMode mode> |
35 class RootMarkingVisitor; | 35 class RootMarkingVisitor; |
36 | 36 |
37 class ObjectMarking : public AllStatic { | 37 class ObjectMarking : public AllStatic { |
38 public: | 38 public: |
39 INLINE(static MarkBit MarkBitFrom(Address addr)) { | 39 V8_INLINE static MarkBit MarkBitFrom(HeapObject* obj) { |
40 MemoryChunk* p = MemoryChunk::FromAddress(addr); | 40 const Address address = obj->address(); |
41 return p->markbits()->MarkBitFromIndex(p->AddressToMarkbitIndex(addr)); | 41 MemoryChunk* p = MemoryChunk::FromAddress(address); |
42 } | 42 return p->markbits()->MarkBitFromIndex(p->AddressToMarkbitIndex(address)); |
43 | |
44 INLINE(static MarkBit MarkBitFrom(HeapObject* obj)) { | |
45 return MarkBitFrom(reinterpret_cast<Address>(obj)); | |
46 } | 43 } |
47 | 44 |
48 static Marking::ObjectColor Color(HeapObject* obj) { | 45 static Marking::ObjectColor Color(HeapObject* obj) { |
49 return Marking::Color(ObjectMarking::MarkBitFrom(obj)); | 46 return Marking::Color(ObjectMarking::MarkBitFrom(obj)); |
50 } | 47 } |
51 | 48 |
52 private: | 49 private: |
53 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectMarking); | 50 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectMarking); |
54 }; | 51 }; |
55 | 52 |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 | 778 |
782 private: | 779 private: |
783 MarkCompactCollector* collector_; | 780 MarkCompactCollector* collector_; |
784 }; | 781 }; |
785 | 782 |
786 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); | 783 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); |
787 } // namespace internal | 784 } // namespace internal |
788 } // namespace v8 | 785 } // namespace v8 |
789 | 786 |
790 #endif // V8_HEAP_MARK_COMPACT_H_ | 787 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |