Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Side by Side Diff: src/heap/mark-compact.cc

Issue 1994933002: [heap] Get rid of the wrapper in remembered-set.h (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/remembered-set.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3648 matching lines...) Expand 10 before | Expand all | Expand 10 after
3659 UpdateTypedPointers(heap, chunk); 3659 UpdateTypedPointers(heap, chunk);
3660 return true; 3660 return true;
3661 } 3661 }
3662 static const bool NeedSequentialFinalization = false; 3662 static const bool NeedSequentialFinalization = false;
3663 static void FinalizePageSequentially(Heap*, MemoryChunk*, bool, PerPageData) { 3663 static void FinalizePageSequentially(Heap*, MemoryChunk*, bool, PerPageData) {
3664 } 3664 }
3665 3665
3666 private: 3666 private:
3667 static void UpdateUntypedPointers(Heap* heap, MemoryChunk* chunk) { 3667 static void UpdateUntypedPointers(Heap* heap, MemoryChunk* chunk) {
3668 if (direction == OLD_TO_NEW) { 3668 if (direction == OLD_TO_NEW) {
3669 RememberedSet<OLD_TO_NEW>::IterateWithWrapper(heap, chunk, 3669 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [heap, chunk](Address slot) {
3670 UpdateOldToNewSlot); 3670 return CheckAndUpdateOldToNewSlot(heap, slot);
3671 });
3671 } else { 3672 } else {
3672 RememberedSet<OLD_TO_OLD>::Iterate(chunk, [](Address slot) { 3673 RememberedSet<OLD_TO_OLD>::Iterate(chunk, [](Address slot) {
3673 return UpdateSlot(reinterpret_cast<Object**>(slot)); 3674 return UpdateSlot(reinterpret_cast<Object**>(slot));
3674 }); 3675 });
3675 } 3676 }
3676 } 3677 }
3677 3678
3678 static void UpdateTypedPointers(Heap* heap, MemoryChunk* chunk) { 3679 static void UpdateTypedPointers(Heap* heap, MemoryChunk* chunk) {
3679 if (direction == OLD_TO_OLD) { 3680 if (direction == OLD_TO_OLD) {
3680 Isolate* isolate = heap->isolate(); 3681 Isolate* isolate = heap->isolate();
3681 RememberedSet<OLD_TO_OLD>::IterateTyped( 3682 RememberedSet<OLD_TO_OLD>::IterateTyped(
3682 chunk, [isolate](SlotType type, Address slot) { 3683 chunk, [isolate](SlotType type, Address slot) {
3683 return UpdateTypedSlot(isolate, type, slot, UpdateSlot); 3684 return UpdateTypedSlot(isolate, type, slot, UpdateSlot);
3684 }); 3685 });
3685 } 3686 }
3686 } 3687 }
3687 3688
3688 static void UpdateOldToNewSlot(HeapObject** address, HeapObject* object) { 3689 static SlotCallbackResult CheckAndUpdateOldToNewSlot(Heap* heap,
3689 MapWord map_word = object->map_word(); 3690 Address slot_address) {
3690 // There could still be stale pointers in large object space, map space, 3691 Object** slot = reinterpret_cast<Object**>(slot_address);
3691 // and old space for pages that have been promoted. 3692 if (heap->InFromSpace(*slot)) {
3692 if (map_word.IsForwardingAddress()) { 3693 HeapObject* heap_object = reinterpret_cast<HeapObject*>(*slot);
3693 // Update the corresponding slot. 3694 DCHECK(heap_object->IsHeapObject());
3694 *address = map_word.ToForwardingAddress(); 3695 MapWord map_word = heap_object->map_word();
3696 // There could still be stale pointers in large object space, map space,
3697 // and old space for pages that have been promoted.
3698 if (map_word.IsForwardingAddress()) {
3699 // Update the corresponding slot.
3700 *slot = map_word.ToForwardingAddress();
3701 }
3702 // If the object was in from space before and is after executing the
3703 // callback in to space, the object is still live.
3704 // Unfortunately, we do not know about the slot. It could be in a
3705 // just freed free space object.
3706 if (heap->InToSpace(*slot)) {
3707 return KEEP_SLOT;
3708 }
3709 } else {
3710 DCHECK(!heap->InNewSpace(*slot));
3695 } 3711 }
3712 return REMOVE_SLOT;
3696 } 3713 }
3697 }; 3714 };
3698 3715
3699 int NumberOfPointerUpdateTasks(int pages) { 3716 int NumberOfPointerUpdateTasks(int pages) {
3700 if (!FLAG_parallel_pointer_update) return 1; 3717 if (!FLAG_parallel_pointer_update) return 1;
3701 const int kMaxTasks = 4; 3718 const int kMaxTasks = 4;
3702 const int kPagesPerTask = 4; 3719 const int kPagesPerTask = 4;
3703 return Min(kMaxTasks, (pages + kPagesPerTask - 1) / kPagesPerTask); 3720 return Min(kMaxTasks, (pages + kPagesPerTask - 1) / kPagesPerTask);
3704 } 3721 }
3705 3722
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
4016 MarkBit mark_bit = Marking::MarkBitFrom(host); 4033 MarkBit mark_bit = Marking::MarkBitFrom(host);
4017 if (Marking::IsBlack(mark_bit)) { 4034 if (Marking::IsBlack(mark_bit)) {
4018 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); 4035 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host);
4019 RecordRelocSlot(host, &rinfo, target); 4036 RecordRelocSlot(host, &rinfo, target);
4020 } 4037 }
4021 } 4038 }
4022 } 4039 }
4023 4040
4024 } // namespace internal 4041 } // namespace internal
4025 } // namespace v8 4042 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/remembered-set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698