summaryrefslogtreecommitdiffstats
path: root/chromium/v8/src/sandbox/code-pointer.h
blob: 5eff0f3981a2db19e837ecc5f66328f5b5341791 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2023 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_SANDBOX_CODE_POINTER_H_
#define V8_SANDBOX_CODE_POINTER_H_

#include "src/common/globals.h"

namespace v8 {
namespace internal {

// Creates and initializes an entry in the CodePointerTable and writes a handle
// for that entry into the field. The entry will contain a pointer to the
// owning code object as well as to the entrypoint.
V8_INLINE void InitCodePointerTableEntryField(Address field_address,
                                              Isolate* isolate,
                                              Tagged<HeapObject> owning_code,
                                              Address entrypoint);

// If the sandbox is enabled: reads the CodePointerHandle from the field and
// reads the entrypoint pointer from the corresponding CodePointerTable entry.
// If the sandbox is disabled: load the external pointer from the field.
V8_INLINE Address ReadCodeEntrypointField(Address field_address);

// If the sandbox is enabled: reads the CodePointerHandle from the field and
// writes the entrypoint pointer to the corresponding CodePointerTable entry.
// If the sandbox is disabled: writes the entrypoint pointer to the field.
V8_INLINE void WriteCodeEntrypointField(Address field_address, Address value);

}  // namespace internal
}  // namespace v8

#endif  // V8_SANDBOX_CODE_POINTER_H_