• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 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_HEAP_WRITE_BARRIER_H_
6 #define V8_HEAP_HEAP_WRITE_BARRIER_H_
7 
8 namespace v8 {
9 namespace internal {
10 
11 class Code;
12 class FixedArray;
13 class Heap;
14 class HeapObject;
15 class MaybeObject;
16 class Object;
17 class RelocInfo;
18 
19 // Note: In general it is preferred to use the macros defined in
20 // object-macros.h.
21 
22 // Write barrier for FixedArray elements.
23 #define FIXED_ARRAY_ELEMENTS_WRITE_BARRIER(heap, array, start, length) \
24   do {                                                                 \
25     GenerationalBarrierForElements(heap, array, start, length);        \
26     MarkingBarrierForElements(heap, array);                            \
27   } while (false)
28 
29 // Combined write barriers.
30 void WriteBarrierForCode(Code* host, RelocInfo* rinfo, Object* value);
31 void WriteBarrierForCode(Code* host);
32 
33 // Generational write barrier.
34 void GenerationalBarrier(HeapObject* object, Object** slot, Object* value);
35 void GenerationalBarrier(HeapObject* object, MaybeObject** slot,
36                          MaybeObject* value);
37 void GenerationalBarrierForElements(Heap* heap, FixedArray* array, int offset,
38                                     int length);
39 void GenerationalBarrierForCode(Code* host, RelocInfo* rinfo,
40                                 HeapObject* object);
41 
42 // Marking write barrier.
43 void MarkingBarrier(HeapObject* object, Object** slot, Object* value);
44 void MarkingBarrier(HeapObject* object, MaybeObject** slot, MaybeObject* value);
45 void MarkingBarrierForElements(Heap* heap, HeapObject* object);
46 void MarkingBarrierForCode(Code* host, RelocInfo* rinfo, HeapObject* object);
47 
48 }  // namespace internal
49 }  // namespace v8
50 
51 #endif  // V8_HEAP_HEAP_WRITE_BARRIER_H_
52