| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 void MarkCompactCollector::SetFlags(int flags) { | 46 void MarkCompactCollector::SetFlags(int flags) { |
| 47 sweep_precisely_ = ((flags & Heap::kMakeHeapIterableMask) != 0); | 47 sweep_precisely_ = ((flags & Heap::kMakeHeapIterableMask) != 0); |
| 48 } | 48 } |
| 49 | 49 |
| 50 | 50 |
| 51 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { | 51 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { |
| 52 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); | 52 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); |
| 53 if (!mark_bit.Get()) { | 53 if (!mark_bit.Get()) { |
| 54 mark_bit.Set(); | 54 mark_bit.Set(); |
| 55 MemoryChunk::IncrementLiveBytes(obj->address(), obj->Size()); |
| 55 #ifdef DEBUG | 56 #ifdef DEBUG |
| 56 UpdateLiveObjectCount(obj); | 57 UpdateLiveObjectCount(obj); |
| 57 #endif | 58 #endif |
| 58 ProcessNewlyMarkedObject(obj); | 59 ProcessNewlyMarkedObject(obj); |
| 59 } | 60 } |
| 60 } | 61 } |
| 61 | 62 |
| 62 | 63 |
| 63 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) { | 64 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) { |
| 65 ASSERT(!mark_bit.Get()); |
| 64 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); | 66 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); |
| 65 mark_bit.Set(); | 67 mark_bit.Set(); |
| 68 MemoryChunk::IncrementLiveBytes(obj->address(), obj->Size()); |
| 66 #ifdef DEBUG | 69 #ifdef DEBUG |
| 67 UpdateLiveObjectCount(obj); | 70 UpdateLiveObjectCount(obj); |
| 68 #endif | 71 #endif |
| 69 } | 72 } |
| 70 | 73 |
| 71 | 74 |
| 72 bool MarkCompactCollector::IsMarked(Object* obj) { | 75 bool MarkCompactCollector::IsMarked(Object* obj) { |
| 73 ASSERT(obj->IsHeapObject()); | 76 ASSERT(obj->IsHeapObject()); |
| 74 HeapObject* heap_object = HeapObject::cast(obj); | 77 HeapObject* heap_object = HeapObject::cast(obj); |
| 75 return Marking::MarkBitFrom(heap_object).Get(); | 78 return Marking::MarkBitFrom(heap_object).Get(); |
| 76 } | 79 } |
| 77 | 80 |
| 78 | 81 |
| 79 } } // namespace v8::internal | 82 } } // namespace v8::internal |
| 80 | 83 |
| 81 #endif // V8_MARK_COMPACT_INL_H_ | 84 #endif // V8_MARK_COMPACT_INL_H_ |
| OLD | NEW |