| 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 "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/heap/spaces.h" | 9 #include "src/heap/spaces.h" |
| 10 | 10 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 void ClearOverflowed() { overflowed_ = false; } | 162 void ClearOverflowed() { overflowed_ = false; } |
| 163 | 163 |
| 164 void SetOverflowed() { overflowed_ = true; } | 164 void SetOverflowed() { overflowed_ = true; } |
| 165 | 165 |
| 166 // Push the (marked) object on the marking stack if there is room, | 166 // Push the (marked) object on the marking stack if there is room, |
| 167 // otherwise mark the object as overflowed and wait for a rescan of the | 167 // otherwise mark the object as overflowed and wait for a rescan of the |
| 168 // heap. | 168 // heap. |
| 169 INLINE(void PushBlack(HeapObject* object)) { | 169 INLINE(void PushBlack(HeapObject* object)) { |
| 170 DCHECK(object->IsHeapObject()); | 170 DCHECK(object->IsHeapObject()); |
| 171 // TODO(jochen): Remove again before we branch for 4.2. |
| 172 CHECK(object->IsHeapObject() && object->map()->IsMap()); |
| 171 if (IsFull()) { | 173 if (IsFull()) { |
| 172 Marking::BlackToGrey(object); | 174 Marking::BlackToGrey(object); |
| 173 MemoryChunk::IncrementLiveBytesFromGC(object->address(), -object->Size()); | 175 MemoryChunk::IncrementLiveBytesFromGC(object->address(), -object->Size()); |
| 174 SetOverflowed(); | 176 SetOverflowed(); |
| 175 } else { | 177 } else { |
| 176 array_[top_] = object; | 178 array_[top_] = object; |
| 177 top_ = ((top_ + 1) & mask_); | 179 top_ = ((top_ + 1) & mask_); |
| 178 } | 180 } |
| 179 } | 181 } |
| 180 | 182 |
| 181 INLINE(void PushGrey(HeapObject* object)) { | 183 INLINE(void PushGrey(HeapObject* object)) { |
| 182 DCHECK(object->IsHeapObject()); | 184 DCHECK(object->IsHeapObject()); |
| 185 // TODO(jochen): Remove again before we branch for 4.2. |
| 186 CHECK(object->IsHeapObject() && object->map()->IsMap()); |
| 183 if (IsFull()) { | 187 if (IsFull()) { |
| 184 SetOverflowed(); | 188 SetOverflowed(); |
| 185 } else { | 189 } else { |
| 186 array_[top_] = object; | 190 array_[top_] = object; |
| 187 top_ = ((top_ + 1) & mask_); | 191 top_ = ((top_ + 1) & mask_); |
| 188 } | 192 } |
| 189 } | 193 } |
| 190 | 194 |
| 191 INLINE(HeapObject* Pop()) { | 195 INLINE(HeapObject* Pop()) { |
| 192 DCHECK(!IsEmpty()); | 196 DCHECK(!IsEmpty()); |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 private: | 956 private: |
| 953 MarkCompactCollector* collector_; | 957 MarkCompactCollector* collector_; |
| 954 }; | 958 }; |
| 955 | 959 |
| 956 | 960 |
| 957 const char* AllocationSpaceName(AllocationSpace space); | 961 const char* AllocationSpaceName(AllocationSpace space); |
| 958 } | 962 } |
| 959 } // namespace v8::internal | 963 } // namespace v8::internal |
| 960 | 964 |
| 961 #endif // V8_HEAP_MARK_COMPACT_H_ | 965 #endif // V8_HEAP_MARK_COMPACT_H_ |
| OLD | NEW |