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/heap/mark-compact.h" | 5 #include "src/heap/mark-compact.h" |
6 | 6 |
7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/base/sys-info.h" | 9 #include "src/base/sys-info.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 3484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3495 #endif // VERIFY_HEAP | 3495 #endif // VERIFY_HEAP |
3496 | 3496 |
3497 bool MarkCompactCollector::VisitLiveObjects(MemoryChunk* page, | 3497 bool MarkCompactCollector::VisitLiveObjects(MemoryChunk* page, |
3498 HeapObjectVisitor* visitor, | 3498 HeapObjectVisitor* visitor, |
3499 IterationMode mode) { | 3499 IterationMode mode) { |
3500 #ifdef VERIFY_HEAP | 3500 #ifdef VERIFY_HEAP |
3501 VerifyAllBlackObjects(page); | 3501 VerifyAllBlackObjects(page); |
3502 #endif // VERIFY_HEAP | 3502 #endif // VERIFY_HEAP |
3503 | 3503 |
3504 LiveObjectIterator<kBlackObjects> it(page); | 3504 LiveObjectIterator<kBlackObjects> it(page); |
3505 HeapObject* object = NULL; | 3505 HeapObject* object = nullptr; |
3506 while ((object = it.Next()) != NULL) { | 3506 while ((object = it.Next()) != nullptr) { |
3507 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object))); | 3507 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object))); |
3508 if (!visitor->Visit(object)) { | 3508 if (!visitor->Visit(object)) { |
3509 if (mode == kClearMarkbits) { | 3509 if (mode == kClearMarkbits) { |
3510 page->markbits()->ClearRange( | 3510 page->markbits()->ClearRange( |
3511 page->AddressToMarkbitIndex(page->area_start()), | 3511 page->AddressToMarkbitIndex(page->area_start()), |
3512 page->AddressToMarkbitIndex(object->address())); | 3512 page->AddressToMarkbitIndex(object->address())); |
3513 LiveObjectIterator<kBlackObjects> it2(page); | |
ulan
2016/01/14 15:46:38
Let's move this code into a separate function name
Michael Lippautz
2016/01/14 16:01:46
RecomputeLiveBytes it is.
| |
3514 int new_live_size = 0; | |
3515 while ((object = it2.Next()) != nullptr) { | |
3516 new_live_size += object->Size(); | |
3517 } | |
3518 DCHECK_LT(new_live_size, page->LiveBytes()); | |
3519 page->IncrementLiveBytes(new_live_size - page->LiveBytes()); | |
ulan
2016/01/14 15:46:38
I think adding new page->SetLiveBytes(new_live_siz
Michael Lippautz
2016/01/14 16:01:45
SetLiveBytes() it is.
| |
3513 } | 3520 } |
3514 return false; | 3521 return false; |
3515 } | 3522 } |
3516 } | 3523 } |
3517 if (mode == kClearMarkbits) { | 3524 if (mode == kClearMarkbits) { |
3518 Bitmap::Clear(page); | 3525 Bitmap::Clear(page); |
3519 } | 3526 } |
3520 return true; | 3527 return true; |
3521 } | 3528 } |
3522 | 3529 |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4054 MarkBit mark_bit = Marking::MarkBitFrom(host); | 4061 MarkBit mark_bit = Marking::MarkBitFrom(host); |
4055 if (Marking::IsBlack(mark_bit)) { | 4062 if (Marking::IsBlack(mark_bit)) { |
4056 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 4063 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
4057 RecordRelocSlot(&rinfo, target); | 4064 RecordRelocSlot(&rinfo, target); |
4058 } | 4065 } |
4059 } | 4066 } |
4060 } | 4067 } |
4061 | 4068 |
4062 } // namespace internal | 4069 } // namespace internal |
4063 } // namespace v8 | 4070 } // namespace v8 |
OLD | NEW |