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

Side by Side Diff: src/heap/mark-compact-inl.h

Issue 2647873002: Revert of [heap] Provide ObjectMarking with marking transitions (Closed)
Patch Set: Created 3 years, 11 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/mark-compact.cc ('k') | src/heap/objects-visiting-inl.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 #ifndef V8_HEAP_MARK_COMPACT_INL_H_ 5 #ifndef V8_HEAP_MARK_COMPACT_INL_H_
6 #define V8_HEAP_MARK_COMPACT_INL_H_ 6 #define V8_HEAP_MARK_COMPACT_INL_H_
7 7
8 #include "src/heap/mark-compact.h" 8 #include "src/heap/mark-compact.h"
9 #include "src/heap/remembered-set.h" 9 #include "src/heap/remembered-set.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 void MarkCompactCollector::PushBlack(HeapObject* obj) { 15 void MarkCompactCollector::PushBlack(HeapObject* obj) {
16 DCHECK(ObjectMarking::IsBlack(obj)); 16 DCHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(obj)));
17 if (!marking_deque()->Push(obj)) { 17 if (marking_deque()->Push(obj)) {
18 ObjectMarking::BlackToGrey(obj); 18 MemoryChunk::IncrementLiveBytes(obj, obj->Size());
19 } else {
20 MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj);
21 Marking::BlackToGrey(mark_bit);
19 } 22 }
20 } 23 }
21 24
22 25
23 void MarkCompactCollector::UnshiftBlack(HeapObject* obj) { 26 void MarkCompactCollector::UnshiftBlack(HeapObject* obj) {
24 DCHECK(ObjectMarking::IsBlack(obj)); 27 DCHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(obj)));
25 if (!marking_deque()->Unshift(obj)) { 28 if (!marking_deque()->Unshift(obj)) {
26 ObjectMarking::BlackToGrey(obj); 29 MemoryChunk::IncrementLiveBytes(obj, -obj->Size());
30 MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj);
31 Marking::BlackToGrey(mark_bit);
27 } 32 }
28 } 33 }
29 34
30 35
31 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { 36 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) {
32 DCHECK(ObjectMarking::MarkBitFrom(obj) == mark_bit); 37 DCHECK(ObjectMarking::MarkBitFrom(obj) == mark_bit);
33 if (ObjectMarking::IsWhite(obj)) { 38 if (Marking::IsWhite(mark_bit)) {
34 ObjectMarking::WhiteToBlack(obj); 39 Marking::WhiteToBlack(mark_bit);
40 DCHECK(obj->GetIsolate()->heap()->Contains(obj));
35 PushBlack(obj); 41 PushBlack(obj);
36 } 42 }
37 } 43 }
38 44
39 void MarkCompactCollector::SetMark(HeapObject* obj) { 45
40 DCHECK(ObjectMarking::IsWhite(obj)); 46 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) {
41 ObjectMarking::WhiteToBlack(obj); 47 DCHECK(Marking::IsWhite(mark_bit));
48 DCHECK(ObjectMarking::MarkBitFrom(obj) == mark_bit);
49 Marking::WhiteToBlack(mark_bit);
50 MemoryChunk::IncrementLiveBytes(obj, obj->Size());
42 } 51 }
43 52
44 53
45 bool MarkCompactCollector::IsMarked(Object* obj) { 54 bool MarkCompactCollector::IsMarked(Object* obj) {
46 DCHECK(obj->IsHeapObject()); 55 DCHECK(obj->IsHeapObject());
47 return ObjectMarking::IsBlackOrGrey(HeapObject::cast(obj)); 56 HeapObject* heap_object = HeapObject::cast(obj);
57 return Marking::IsBlackOrGrey(ObjectMarking::MarkBitFrom(heap_object));
48 } 58 }
49 59
50 60
51 void MarkCompactCollector::RecordSlot(HeapObject* object, Object** slot, 61 void MarkCompactCollector::RecordSlot(HeapObject* object, Object** slot,
52 Object* target) { 62 Object* target) {
53 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); 63 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target));
54 Page* source_page = Page::FromAddress(reinterpret_cast<Address>(object)); 64 Page* source_page = Page::FromAddress(reinterpret_cast<Address>(object));
55 if (target_page->IsEvacuationCandidate() && 65 if (target_page->IsEvacuationCandidate() &&
56 !ShouldSkipEvacuationSlotRecording(object)) { 66 !ShouldSkipEvacuationSlotRecording(object)) {
57 DCHECK(IsMarked(object)); 67 DCHECK(Marking::IsBlackOrGrey(ObjectMarking::MarkBitFrom(object)));
58 RememberedSet<OLD_TO_OLD>::Insert(source_page, 68 RememberedSet<OLD_TO_OLD>::Insert(source_page,
59 reinterpret_cast<Address>(slot)); 69 reinterpret_cast<Address>(slot));
60 } 70 }
61 } 71 }
62 72
63 73
64 void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) { 74 void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) {
65 if (GetNextCandidate(shared_info) == nullptr) { 75 if (GetNextCandidate(shared_info) == nullptr) {
66 SetNextCandidate(shared_info, shared_function_info_candidates_head_); 76 SetNextCandidate(shared_info, shared_function_info_candidates_head_);
67 shared_function_info_candidates_head_ = shared_info; 77 shared_function_info_candidates_head_ = shared_info;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 220 }
211 if (object != nullptr) return object; 221 if (object != nullptr) return object;
212 } 222 }
213 return nullptr; 223 return nullptr;
214 } 224 }
215 225
216 } // namespace internal 226 } // namespace internal
217 } // namespace v8 227 } // namespace v8
218 228
219 #endif // V8_HEAP_MARK_COMPACT_INL_H_ 229 #endif // V8_HEAP_MARK_COMPACT_INL_H_
OLDNEW
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698