v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
foreign-inl.h
Go to the documentation of this file.
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_FOREIGN_INL_H_
6#define V8_OBJECTS_FOREIGN_INL_H_
7
9// Include the non-inl header before the rest of the headers.
10
11#include "src/common/globals.h"
17
18// Has to be the last include (doesn't have include guards):
20
21namespace v8::internal {
22
23#include "torque-generated/src/objects/foreign-tq-inl.inc"
24
26
27template <ExternalPointerTag tag>
29 return HeapObject::ReadExternalPointerField<tag>(kForeignAddressOffset,
30 isolate);
31}
32
33template <ExternalPointerTag tag>
36 return ReadExternalPointerField<tag>(kForeignAddressOffset, isolate);
37}
38
39template <ExternalPointerTag tag>
41 const Address value) {
42 WriteExternalPointerField<tag>(kForeignAddressOffset, isolate, value);
43}
44
45template <ExternalPointerTag tag>
47 const Address initial_value) {
48 InitExternalPointerField<tag>(kForeignAddressOffset, isolate, initial_value);
49}
50
56
58#ifdef V8_ENABLE_SANDBOX
60 RawExternalPointerField(kForeignAddressOffset,
62 .Relaxed_LoadHandle();
64 return isolate.GetExternalPointerTableTagFor(*this, handle);
65#endif // V8_ENABLE_SANDBOX
66 // Without the sandbox the address is stored untagged.
68}
69
70} // namespace v8::internal
71
73
74#endif // V8_OBJECTS_FOREIGN_INL_H_
Address foreign_address_unchecked() const
Definition foreign-inl.h:51
void init_foreign_address(IsolateForSandbox isolate, const Address initial_value)
Definition foreign-inl.h:46
ExternalPointerTag GetTag() const
Definition foreign-inl.h:57
Address foreign_address() const
Definition foreign-inl.h:34
void set_foreign_address(IsolateForSandbox isolate, const Address value)
Definition foreign-inl.h:40
Address ReadExternalPointerField(size_t offset, IsolateForSandbox isolate) const
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
Definition handles-inl.h:72
V8_INLINE void WriteExternalPointerField(Address field_address, IsolateForSandbox isolate, Address value)
V8_INLINE Address ReadExternalPointerField(Address field_address, IsolateForSandbox isolate)
V8_INLINE IsolateForSandbox GetIsolateForSandbox(Tagged< HeapObject >)
Definition isolate.h:75
@ kExternalPointerNullTag
constexpr ExternalPointerTagRange kAnyForeignExternalPointerTagRange(kFirstForeignExternalPointerTag, kLastForeignExternalPointerTag)
V8_INLINE void InitExternalPointerField(Address host_address, Address field_address, IsolateForSandbox isolate, Address value)
uint32_t ExternalPointerHandle
#define TQ_OBJECT_CONSTRUCTORS_IMPL(Type)