v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
code-pointer-inl.h
Go to the documentation of this file.
1// Copyright 2023 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_SANDBOX_CODE_POINTER_INL_H_
6#define V8_SANDBOX_CODE_POINTER_INL_H_
7
9// Include the non-inl header before the rest of the headers.
10
11#include "include/v8-internal.h"
15
16namespace v8 {
17namespace internal {
18
21#ifdef V8_ENABLE_SANDBOX
22 // Handles may be written to objects from other threads so the handle needs
23 // to be loaded atomically. We assume that the load from the table cannot
24 // be reordered before the load of the handle due to the data dependency
25 // between the two loads and therefore use relaxed memory ordering, but
26 // technically we should use memory_order_consume here.
27 auto location = reinterpret_cast<CodePointerHandle*>(field_address);
29 return IsolateGroup::current()->code_pointer_table()->GetEntrypoint(handle,
30 tag);
31#else
33#endif // V8_ENABLE_SANDBOX
34}
35
37 Address value,
39#ifdef V8_ENABLE_SANDBOX
40 // See comment above for why this is a Relaxed_Load.
41 auto location = reinterpret_cast<CodePointerHandle*>(field_address);
43 IsolateGroup::current()->code_pointer_table()->SetEntrypoint(handle, value,
44 tag);
45#else
47#endif // V8_ENABLE_SANDBOX
48}
49
50} // namespace internal
51} // namespace v8
52
53#endif // V8_SANDBOX_CODE_POINTER_INL_H_
static T Relaxed_Load(T *addr)
static IsolateGroup * current()
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
Definition handles-inl.h:72
V8_INLINE Address ReadCodeEntrypointViaCodePointerField(Address field_address, CodeEntrypointTag tag)
IndirectPointerHandle CodePointerHandle
V8_INLINE void WriteCodeEntrypointViaCodePointerField(Address field_address, Address value, CodeEntrypointTag tag)
#define V8_INLINE
Definition v8config.h:500