V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
slots-inl.h
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_OBJECTS_SLOTS_INL_H_
6 #define V8_OBJECTS_SLOTS_INL_H_
7 
8 #include "src/objects/slots.h"
9 
10 #include "src/base/atomic-utils.h"
11 #include "src/objects.h"
12 #include "src/objects/heap-object.h"
13 #include "src/objects/maybe-object.h"
14 
15 namespace v8 {
16 namespace internal {
17 
18 ObjectSlot::ObjectSlot(ObjectPtr* object)
19  : SlotBase(reinterpret_cast<Address>(&object->ptr_)) {}
20 
21 void ObjectSlot::store(Object* value) const { *location() = value->ptr(); }
22 
23 ObjectPtr ObjectSlot::Acquire_Load() const {
24  return ObjectPtr(AsAtomicTagged::Acquire_Load(location()));
25 }
26 
27 Object* ObjectSlot::Acquire_Load1() const {
28  return reinterpret_cast<Object*>(AsAtomicTagged::Acquire_Load(location()));
29 }
30 
31 ObjectPtr ObjectSlot::Relaxed_Load() const {
32  return ObjectPtr(AsAtomicTagged::Relaxed_Load(location()));
33 }
34 
35 void ObjectSlot::Relaxed_Store(ObjectPtr value) const {
36  AsAtomicTagged::Relaxed_Store(location(), value->ptr());
37 }
38 
39 void ObjectSlot::Relaxed_Store1(Object* value) const {
40  AsAtomicTagged::Relaxed_Store(location(), value->ptr());
41 }
42 
43 void ObjectSlot::Release_Store1(Object* value) const {
44  AsAtomicTagged::Release_Store(location(), value->ptr());
45 }
46 
47 void ObjectSlot::Release_Store(ObjectPtr value) const {
48  AsAtomicTagged::Release_Store(location(), value->ptr());
49 }
50 
51 ObjectPtr ObjectSlot::Release_CompareAndSwap(ObjectPtr old,
52  ObjectPtr target) const {
53  Address result = AsAtomicTagged::Release_CompareAndSwap(
54  location(), old->ptr(), target->ptr());
55  return ObjectPtr(result);
56 }
57 
58 MaybeObject MaybeObjectSlot::operator*() const {
59  return MaybeObject(*location());
60 }
61 
62 void MaybeObjectSlot::store(MaybeObject value) const {
63  *location() = value.ptr();
64 }
65 
66 MaybeObject MaybeObjectSlot::Relaxed_Load() const {
67  return MaybeObject(AsAtomicTagged::Relaxed_Load(location()));
68 }
69 
70 void MaybeObjectSlot::Relaxed_Store(MaybeObject value) const {
71  AsAtomicTagged::Relaxed_Store(location(), value->ptr());
72 }
73 
74 void MaybeObjectSlot::Release_CompareAndSwap(MaybeObject old,
75  MaybeObject target) const {
76  AsAtomicTagged::Release_CompareAndSwap(location(), old.ptr(), target.ptr());
77 }
78 
79 HeapObjectReference HeapObjectSlot::operator*() const {
80  return HeapObjectReference(*location());
81 }
82 
83 void HeapObjectSlot::store(HeapObjectReference value) const {
84  *location() = value.ptr();
85 }
86 
87 } // namespace internal
88 } // namespace v8
89 
90 #endif // V8_OBJECTS_SLOTS_INL_H_
Definition: libplatform.h:13