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

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

Issue 1294093003: [heap] Unify MarkingDeque push and unshift operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-includes-heap-2
Patch Set: Fix test case. Created 5 years, 4 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.h ('k') | test/cctest/test-mark-compact.cc » ('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/isolate.h" 9 #include "src/isolate.h"
10 10
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 15
16 void MarkCompactCollector::SetFlags(int flags) { 16 void MarkCompactCollector::SetFlags(int flags) {
17 reduce_memory_footprint_ = ((flags & Heap::kReduceMemoryFootprintMask) != 0); 17 reduce_memory_footprint_ = ((flags & Heap::kReduceMemoryFootprintMask) != 0);
18 abort_incremental_marking_ = 18 abort_incremental_marking_ =
19 ((flags & Heap::kAbortIncrementalMarkingMask) != 0); 19 ((flags & Heap::kAbortIncrementalMarkingMask) != 0);
20 finalize_incremental_marking_ = 20 finalize_incremental_marking_ =
21 ((flags & Heap::kFinalizeIncrementalMarkingMask) != 0); 21 ((flags & Heap::kFinalizeIncrementalMarkingMask) != 0);
22 DCHECK(!finalize_incremental_marking_ || !abort_incremental_marking_); 22 DCHECK(!finalize_incremental_marking_ || !abort_incremental_marking_);
23 } 23 }
24 24
25 25
26 void MarkCompactCollector::PushBlack(HeapObject* obj) { 26 void MarkCompactCollector::PushBlack(HeapObject* obj) {
27 if (marking_deque_.PushBlack(obj)) { 27 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(obj)));
28 if (marking_deque_.Push(obj)) {
28 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); 29 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size());
29 } else { 30 } else {
30 Marking::BlackToGrey(obj); 31 Marking::BlackToGrey(obj);
31 } 32 }
32 } 33 }
33 34
34 35
35 void MarkCompactCollector::UnshiftBlack(HeapObject* obj) { 36 void MarkCompactCollector::UnshiftBlack(HeapObject* obj) {
36 if (!marking_deque_.UnshiftBlack(obj)) { 37 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(obj)));
38 if (!marking_deque_.Unshift(obj)) {
37 MemoryChunk::IncrementLiveBytesFromGC(obj, -obj->Size()); 39 MemoryChunk::IncrementLiveBytesFromGC(obj, -obj->Size());
38 Marking::BlackToGrey(obj); 40 Marking::BlackToGrey(obj);
39 } 41 }
40 } 42 }
41 43
42 44
43 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { 45 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) {
44 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); 46 DCHECK(Marking::MarkBitFrom(obj) == mark_bit);
45 if (Marking::IsWhite(mark_bit)) { 47 if (Marking::IsWhite(mark_bit)) {
46 Marking::WhiteToBlack(mark_bit); 48 Marking::WhiteToBlack(mark_bit);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 164
163 void CodeFlusher::ClearNextCodeMap(SharedFunctionInfo* holder) { 165 void CodeFlusher::ClearNextCodeMap(SharedFunctionInfo* holder) {
164 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); 166 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map());
165 code_map->set_undefined(SharedFunctionInfo::kNextMapIndex); 167 code_map->set_undefined(SharedFunctionInfo::kNextMapIndex);
166 } 168 }
167 169
168 } // namespace internal 170 } // namespace internal
169 } // namespace v8 171 } // namespace v8
170 172
171 #endif // V8_HEAP_MARK_COMPACT_INL_H_ 173 #endif // V8_HEAP_MARK_COMPACT_INL_H_
OLDNEW
« no previous file with comments | « src/heap/mark-compact.h ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698