v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
reloc-info-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_CODEGEN_RELOC_INFO_INL_H_
6#define V8_CODEGEN_RELOC_INFO_INL_H_
7
9// Include the non-inl header before the rest of the headers.
10
13
14namespace v8 {
15namespace internal {
16
17template <typename ObjectVisitor>
19 Mode mode = rmode();
20 if (IsEmbeddedObjectMode(mode)) {
21 visitor->VisitEmbeddedPointer(host, this);
22 } else if (IsCodeTargetMode(mode)) {
23 visitor->VisitCodeTarget(host, this);
24 } else if (IsExternalReference(mode)) {
25 visitor->VisitExternalReference(host, this);
26 } else if (IsInternalReference(mode) || IsInternalReferenceEncoded(mode)) {
27 visitor->VisitInternalReference(host, this);
28 } else if (IsBuiltinEntryMode(mode)) {
29 visitor->VisitOffHeapTarget(host, this);
30 } else if (IsJSDispatchHandle(mode)) {
31#ifdef V8_ENABLE_LEAPTIERING
32 // This would need to pass the RelocInfo if dispatch entries were allowed
33 // to move and we needed to update this slot.
34 static_assert(!JSDispatchTable::kSupportsCompaction);
36#else
38#endif
39 }
40}
41
43 Tagged<HeapObject> target,
44 WriteBarrierMode write_barrier_mode,
45 ICacheFlushMode icache_flush_mode) {
46 set_target_object(target, icache_flush_mode);
47 if (!v8_flags.disable_write_barriers) {
48 WriteBarrier::ForRelocInfo(host, this, target, write_barrier_mode);
49 }
50}
51
52template <typename RelocInfoT>
54 const uint8_t* pos,
55 const uint8_t* end,
56 int mode_mask)
57 : pos_(pos), end_(end), rinfo_(reloc_info), mode_mask_(mode_mask) {
58 DCHECK_EQ(reloc_info.rmode(), RelocInfo::NO_INFO);
59 DCHECK_EQ(reloc_info.data(), 0);
60 // Relocation info is read backwards.
62 if (mode_mask_ == 0) pos_ = end_;
63 next();
64}
65
66} // namespace internal
67} // namespace v8
68
69#endif // V8_CODEGEN_RELOC_INFO_INL_H_
int pos_
SourcePosition pos
virtual void VisitEmbeddedPointer(Tagged< InstructionStream > host, RelocInfo *rinfo)
Definition visitors.h:178
virtual void VisitExternalReference(Tagged< InstructionStream > host, RelocInfo *rinfo)
Definition visitors.h:180
virtual void VisitCodeTarget(Tagged< InstructionStream > host, RelocInfo *rinfo)
Definition visitors.h:176
virtual void VisitOffHeapTarget(Tagged< InstructionStream > host, RelocInfo *rinfo)
Definition visitors.h:185
virtual void VisitJSDispatchTableEntry(Tagged< HeapObject > host, JSDispatchHandle handle)
Definition visitors.h:208
virtual void VisitInternalReference(Tagged< InstructionStream > host, RelocInfo *rinfo)
Definition visitors.h:182
static constexpr bool IsInternalReference(Mode mode)
Definition reloc-info.h:238
static constexpr bool IsCodeTargetMode(Mode mode)
Definition reloc-info.h:197
void Visit(Tagged< InstructionStream > host, ObjectVisitor *visitor)
static constexpr bool IsInternalReferenceEncoded(Mode mode)
Definition reloc-info.h:241
static constexpr bool IsJSDispatchHandle(Mode mode)
Definition reloc-info.h:254
static constexpr bool IsEmbeddedObjectMode(Mode mode)
Definition reloc-info.h:209
static constexpr bool IsExternalReference(Mode mode)
Definition reloc-info.h:235
V8_INLINE JSDispatchHandle js_dispatch_handle()
static constexpr bool IsBuiltinEntryMode(Mode mode)
Definition reloc-info.h:250
const uint8_t *const end_
Definition reloc-info.h:556
RelocIteratorBase(RelocIteratorBase &&) V8_NOEXCEPT=default
V8_INLINE void set_target_object(Tagged< InstructionStream > host, Tagged< HeapObject > target, WriteBarrierMode write_barrier_mode=UPDATE_WRITE_BARRIER, ICacheFlushMode icache_flush_mode=FLUSH_ICACHE_IF_NEEDED)
static void ForRelocInfo(Tagged< InstructionStream > host, RelocInfo *rinfo, Tagged< HeapObject > value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
const v8::base::TimeTicks end_
Definition sweeper.cc:54
int end
V8_EXPORT_PRIVATE FlagValues v8_flags
#define DCHECK_GE(v1, v2)
Definition logging.h:488
#define DCHECK_EQ(v1, v2)
Definition logging.h:485