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

Side by Side Diff: src/heap/incremental-marking-inl.h

Issue 1380523002: [heap] Less aggressive inlining of IncrementalMarking code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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/incremental-marking.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_INCREMENTAL_MARKING_INL_H_ 5 #ifndef V8_HEAP_INCREMENTAL_MARKING_INL_H_
6 #define V8_HEAP_INCREMENTAL_MARKING_INL_H_ 6 #define V8_HEAP_INCREMENTAL_MARKING_INL_H_
7 7
8 #include "src/heap/incremental-marking.h" 8 #include "src/heap/incremental-marking.h"
9 #include "src/heap/mark-compact.h"
10 9
11 namespace v8 { 10 namespace v8 {
12 namespace internal { 11 namespace internal {
13 12
14 13
15 bool IncrementalMarking::BaseRecordWrite(HeapObject* obj, Object** slot,
16 Object* value) {
17 HeapObject* value_heap_obj = HeapObject::cast(value);
18 MarkBit value_bit = Marking::MarkBitFrom(value_heap_obj);
19 if (Marking::IsWhite(value_bit)) {
20 MarkBit obj_bit = Marking::MarkBitFrom(obj);
21 if (Marking::IsBlack(obj_bit)) {
22 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address());
23 if (chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR)) {
24 if (chunk->IsLeftOfProgressBar(slot)) {
25 WhiteToGreyAndPush(value_heap_obj, value_bit);
26 RestartIfNotMarking();
27 } else {
28 return false;
29 }
30 } else {
31 BlackToGreyAndUnshift(obj, obj_bit);
32 RestartIfNotMarking();
33 return false;
34 }
35 } else {
36 return false;
37 }
38 }
39 if (!is_compacting_) return false;
40 MarkBit obj_bit = Marking::MarkBitFrom(obj);
41 return Marking::IsBlack(obj_bit);
42 }
43
44
45 void IncrementalMarking::RecordWrite(HeapObject* obj, Object** slot, 14 void IncrementalMarking::RecordWrite(HeapObject* obj, Object** slot,
46 Object* value) { 15 Object* value) {
47 if (IsMarking() && value->IsHeapObject()) { 16 if (IsMarking() && value->IsHeapObject()) {
48 RecordWriteSlow(obj, slot, value); 17 RecordWriteSlow(obj, slot, value);
49 } 18 }
50 } 19 }
51 20
52 21
53 void IncrementalMarking::RecordWriteOfCodeEntry(JSFunction* host, Object** slot, 22 void IncrementalMarking::RecordWriteOfCodeEntry(JSFunction* host, Object** slot,
54 Code* value) { 23 Code* value) {
55 if (IsMarking()) RecordWriteOfCodeEntrySlow(host, slot, value); 24 if (IsMarking()) {
25 RecordWriteOfCodeEntrySlow(host, slot, value);
26 }
56 } 27 }
57 28
58 29
59 void IncrementalMarking::RecordWriteIntoCode(HeapObject* obj, RelocInfo* rinfo, 30 void IncrementalMarking::RecordWriteIntoCode(HeapObject* obj, RelocInfo* rinfo,
60 Object* value) { 31 Object* value) {
61 if (IsMarking() && value->IsHeapObject()) { 32 if (IsMarking() && value->IsHeapObject()) {
62 RecordWriteIntoCodeSlow(obj, rinfo, value); 33 RecordWriteIntoCodeSlow(obj, rinfo, value);
63 } 34 }
64 } 35 }
65 36
66 37
67 void IncrementalMarking::RecordWrites(HeapObject* obj) { 38 } // namespace internal
68 if (IsMarking()) { 39 } // namespace v8
69 MarkBit obj_bit = Marking::MarkBitFrom(obj);
70 if (Marking::IsBlack(obj_bit)) {
71 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address());
72 if (chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR)) {
73 chunk->set_progress_bar(0);
74 }
75 BlackToGreyAndUnshift(obj, obj_bit);
76 RestartIfNotMarking();
77 }
78 }
79 }
80
81
82 void IncrementalMarking::BlackToGreyAndUnshift(HeapObject* obj,
83 MarkBit mark_bit) {
84 DCHECK(Marking::MarkBitFrom(obj) == mark_bit);
85 DCHECK(obj->Size() >= 2 * kPointerSize);
86 DCHECK(IsMarking());
87 Marking::BlackToGrey(mark_bit);
88 int obj_size = obj->Size();
89 MemoryChunk::IncrementLiveBytesFromGC(obj, -obj_size);
90 bytes_scanned_ -= obj_size;
91 int64_t old_bytes_rescanned = bytes_rescanned_;
92 bytes_rescanned_ = old_bytes_rescanned + obj_size;
93 if ((bytes_rescanned_ >> 20) != (old_bytes_rescanned >> 20)) {
94 if (bytes_rescanned_ > 2 * heap_->PromotedSpaceSizeOfObjects()) {
95 // If we have queued twice the heap size for rescanning then we are
96 // going around in circles, scanning the same objects again and again
97 // as the program mutates the heap faster than we can incrementally
98 // trace it. In this case we switch to non-incremental marking in
99 // order to finish off this marking phase.
100 if (FLAG_trace_incremental_marking) {
101 PrintIsolate(
102 heap()->isolate(),
103 "Hurrying incremental marking because of lack of progress\n");
104 }
105 marking_speed_ = kMaxMarkingSpeed;
106 }
107 }
108
109 heap_->mark_compact_collector()->marking_deque()->Unshift(obj);
110 }
111
112
113 void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj, MarkBit mark_bit) {
114 Marking::WhiteToGrey(mark_bit);
115 heap_->mark_compact_collector()->marking_deque()->Push(obj);
116 }
117 }
118 } // namespace v8::internal
119 40
120 #endif // V8_HEAP_INCREMENTAL_MARKING_INL_H_ 41 #endif // V8_HEAP_INCREMENTAL_MARKING_INL_H_
OLDNEW
« no previous file with comments | « src/heap/incremental-marking.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698