v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
visitors-inl.h
Go to the documentation of this file.
1// Copyright 2021 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_VISITORS_INL_H_
6#define V8_OBJECTS_VISITORS_INL_H_
7
9// Include the non-inl header before the rest of the headers.
10
12#include "src/common/globals.h"
15#include "src/objects/map.h"
16
17namespace v8 {
18namespace internal {
19
21 PtrComprCageBase cage_base, PtrComprCageBase code_cage_base)
22#if V8_COMPRESS_POINTERS
23 : cage_base_(cage_base)
24#ifdef V8_EXTERNAL_CODE_SPACE
25 ,
26 code_cage_base_(code_cage_base)
27#endif // V8_EXTERNAL_CODE_SPACE
28#endif // V8_COMPRESS_POINTERS
29{
30}
31
33#if V8_COMPRESS_POINTERS
34 : ObjectVisitorWithCageBases(PtrComprCageBase(isolate->cage_base()),
35 PtrComprCageBase(isolate->code_cage_base()))
36#else
38#endif // V8_COMPRESS_POINTERS
39{
40}
41
44
45template <typename Visitor>
47 FullObjectSlot code_slot, FullObjectSlot maybe_istream_slot) {
48#if DEBUG
50 Tagged<Object> maybe_istream = *maybe_istream_slot;
51 DCHECK(maybe_istream == Smi::zero() ||
53#endif
54}
55
56// static
57template <typename Visitor>
62
63template <typename Visitor>
65 Tagged<HeapObject> host) {
66 if (!IsSharedHeapObject(host->map(cage_base()))) return;
67 actual_visitor_->VisitMapPointer(host);
68}
69
70template <typename Visitor>
73#if DEBUG
74 Tagged<Object> istream_object = slot.load(code_cage_base());
76 if (istream_object.GetHeapObject(&istream)) {
78 }
79#endif
80}
81
82template <typename Visitor>
91
92template <typename Visitor>
95 if (!IsSharedHeapObject(rinfo->target_object(cage_base()))) return;
96 actual_visitor_->VisitEmbeddedPointer(host, rinfo);
97}
98
99// static
100template <typename Visitor>
105
106} // namespace internal
107} // namespace v8
108
109#endif // V8_OBJECTS_VISITORS_INL_H_
void VisitInstructionStreamPointer(Tagged< Code > host, InstructionStreamSlot slot) final
void VisitMapPointer(Tagged< HeapObject > host) final
void VisitEmbeddedPointer(Tagged< InstructionStream > host, RelocInfo *rinfo) final
void VisitCodeTarget(Tagged< InstructionStream > host, RelocInfo *rinfo) final
static V8_INLINE bool IsSharedHeapObject(Tagged< Object > object)
static V8_INLINE bool IsSharedHeapObject(Tagged< Object > object)
void VisitRunningCode(FullObjectSlot code_slot, FullObjectSlot maybe_istream_slot) final
Tagged< Object > load() const
Definition slots-inl.h:48
static V8_INLINE bool InWritableSharedSpace(Tagged< HeapObject > object)
static Tagged< InstructionStream > FromTargetAddress(Address address)
ObjectVisitorWithCageBases(PtrComprCageBase cage_base, PtrComprCageBase code_cage_base)
V8_INLINE Address target_address()
V8_INLINE Tagged< HeapObject > target_object(PtrComprCageBase cage_base)
static constexpr Tagged< Smi > zero()
Definition smi.h:99
bool GetHeapObject(Tagged< HeapObject > *result) const
V8_INLINE constexpr bool IsHeapObject(TaggedImpl< kRefType, StorageType > obj)
Definition objects.h:669
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
Definition casting.h:150
#define DCHECK(condition)
Definition logging.h:482