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
3 // found in the LICENSE file.
4 
5 #ifndef V8_HEAP_INCREMENTAL_MARKING_INL_H_
6 #define V8_HEAP_INCREMENTAL_MARKING_INL_H_
7 
8 #include "src/heap/incremental-marking.h"
9 #include "src/isolate.h"
10 
11 namespace v8 {
12 namespace internal {
13 
14 
RecordWrite(HeapObject * obj,Object ** slot,Object * value)15 void IncrementalMarking::RecordWrite(HeapObject* obj, Object** slot,
16                                      Object* value) {
17   if (IsMarking() && value->IsHeapObject()) {
18     RecordWriteSlow(obj, slot, value);
19   }
20 }
21 
22 
RecordWriteOfCodeEntry(JSFunction * host,Object ** slot,Code * value)23 void IncrementalMarking::RecordWriteOfCodeEntry(JSFunction* host, Object** slot,
24                                                 Code* value) {
25   if (IsMarking()) {
26     RecordWriteOfCodeEntrySlow(host, slot, value);
27   }
28 }
29 
RecordWriteIntoCode(Code * host,RelocInfo * rinfo,Object * value)30 void IncrementalMarking::RecordWriteIntoCode(Code* host, RelocInfo* rinfo,
31                                              Object* value) {
32   if (IsMarking() && value->IsHeapObject()) {
33     RecordWriteIntoCodeSlow(host, rinfo, value);
34   }
35 }
36 
RestartIfNotMarking()37 void IncrementalMarking::RestartIfNotMarking() {
38   if (state_ == COMPLETE) {
39     state_ = MARKING;
40     if (FLAG_trace_incremental_marking) {
41       heap()->isolate()->PrintWithTimestamp(
42           "[IncrementalMarking] Restarting (new grey objects)\n");
43     }
44   }
45 }
46 
47 }  // namespace internal
48 }  // namespace v8
49 
50 #endif  // V8_HEAP_INCREMENTAL_MARKING_INL_H_
51