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

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

Issue 1347363002: [heap] Inline record slot methods. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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') | no next file » | 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/slots-buffer.h"
9 #include "src/isolate.h" 10 #include "src/isolate.h"
10 11
11 namespace v8 { 12 namespace v8 {
12 namespace internal { 13 namespace internal {
13 14
14 void MarkCompactCollector::PushBlack(HeapObject* obj) { 15 void MarkCompactCollector::PushBlack(HeapObject* obj) {
15 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(obj))); 16 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(obj)));
16 if (marking_deque_.Push(obj)) { 17 if (marking_deque_.Push(obj)) {
17 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); 18 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size());
18 } else { 19 } else {
(...skipping 29 matching lines...) Expand all
48 } 49 }
49 50
50 51
51 bool MarkCompactCollector::IsMarked(Object* obj) { 52 bool MarkCompactCollector::IsMarked(Object* obj) {
52 DCHECK(obj->IsHeapObject()); 53 DCHECK(obj->IsHeapObject());
53 HeapObject* heap_object = HeapObject::cast(obj); 54 HeapObject* heap_object = HeapObject::cast(obj);
54 return Marking::IsBlackOrGrey(Marking::MarkBitFrom(heap_object)); 55 return Marking::IsBlackOrGrey(Marking::MarkBitFrom(heap_object));
55 } 56 }
56 57
57 58
59 void MarkCompactCollector::RecordSlot(HeapObject* object, Object** slot,
60 Object* target) {
61 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target));
62 if (target_page->IsEvacuationCandidate() &&
63 !ShouldSkipEvacuationSlotRecording(object)) {
64 if (!SlotsBuffer::AddTo(slots_buffer_allocator_,
65 target_page->slots_buffer_address(), slot,
66 SlotsBuffer::FAIL_ON_OVERFLOW)) {
67 EvictPopularEvacuationCandidate(target_page);
68 }
69 }
70 }
71
72
73 void MarkCompactCollector::ForceRecordSlot(HeapObject* object, Object** slot,
74 Object* target) {
75 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target));
76 if (target_page->IsEvacuationCandidate() &&
77 !ShouldSkipEvacuationSlotRecording(object)) {
78 CHECK(SlotsBuffer::AddTo(slots_buffer_allocator_,
79 target_page->slots_buffer_address(), slot,
80 SlotsBuffer::IGNORE_OVERFLOW));
81 }
82 }
83
84
58 void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) { 85 void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) {
59 if (GetNextCandidate(shared_info) == NULL) { 86 if (GetNextCandidate(shared_info) == NULL) {
60 SetNextCandidate(shared_info, shared_function_info_candidates_head_); 87 SetNextCandidate(shared_info, shared_function_info_candidates_head_);
61 shared_function_info_candidates_head_ = shared_info; 88 shared_function_info_candidates_head_ = shared_info;
62 } 89 }
63 } 90 }
64 91
65 92
66 void CodeFlusher::AddCandidate(JSFunction* function) { 93 void CodeFlusher::AddCandidate(JSFunction* function) {
67 DCHECK(function->code() == function->shared()->code()); 94 DCHECK(function->code() == function->shared()->code());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 165
139 void CodeFlusher::ClearNextCodeMap(SharedFunctionInfo* holder) { 166 void CodeFlusher::ClearNextCodeMap(SharedFunctionInfo* holder) {
140 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); 167 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map());
141 code_map->set_undefined(SharedFunctionInfo::kNextMapIndex); 168 code_map->set_undefined(SharedFunctionInfo::kNextMapIndex);
142 } 169 }
143 170
144 } // namespace internal 171 } // namespace internal
145 } // namespace v8 172 } // namespace v8
146 173
147 #endif // V8_HEAP_MARK_COMPACT_INL_H_ 174 #endif // V8_HEAP_MARK_COMPACT_INL_H_
OLDNEW
« no previous file with comments | « src/heap/mark-compact.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698