v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
heap-visitor-inl.h File Reference
Include dependency graph for heap-visitor-inl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  v8::internal::ConcurrentVisitorCastHelper< T >
 

Namespaces

namespace  v8
 
namespace  v8::internal
 

Macros

#define DEFINE_READ_ONLY_MAP_SPECIALIZATION(VisitorIdType)
 
#define CASE(TypeName)
 
#define CASE(TypeName)
 
#define VISIT(TypeName)
 
#define VISIT_WITH_SLACK(TypeName)
 
#define UNCHECKED_CAST(VisitorId, TypeName)
 
#define VISIT_AS_LOCKED_STRING(VisitorId, TypeName)
 
#define UNSAFE_STRING_TRANSITION_TARGET_CASE(VisitorIdType, TypeName)
 

Functions

template<VisitorId visitor_id>
constexpr bool v8::internal::SupportsRightTrim ()
 
template<VisitorId visitor_id>
bool v8::internal::ContainsReadOnlyMap (PtrComprCageBase, Tagged< HeapObject >)
 

Macro Definition Documentation

◆ CASE [1/2]

#define CASE ( TypeName)
Value:
case kVisit##TypeName: \
/* If this DCHECK fails, it means that the object type wasn't added \
* to the TRUSTED_VISITOR_ID_LIST. \
* Note: This would normally be just !IsTrustedObject(obj), however we \
* might see trusted objects here before they've been migrated to trusted \
* space, hence the second condition. */ \
DCHECK(!InstanceTypeChecker::IsTrustedObject(map) || \
!HeapLayout::InTrustedSpace(object)); \
return visitor->Visit##TypeName( \
map, ConcreteVisitor::template Cast<TypeName>(object, heap_), \
maybe_object_size);
Heap * heap_

◆ CASE [2/2]

#define CASE ( TypeName)
Value:
case kVisit##TypeName: \
DCHECK(InstanceTypeChecker::IsTrustedObject(map)); \
/* Trusted objects are protected from modifications by an attacker as \
* they are located outside of the sandbox. However, an attacker can \
* still craft their own fake trusted objects inside the sandbox. In \
* this case, bad things might happen if these objects are then \
* processed by e.g. an object visitor as they will typically assume \
* that these objects are trustworthy. The following check defends \
* against that by ensuring that the object is outside of the sandbox. \
* See also crbug.com/c/1505089. */ \
SBXCHECK(OutsideSandboxOrInReadonlySpace(object)); \
return visitor->Visit##TypeName( \
map, ConcreteVisitor::template Cast<TypeName>(object, heap_), \
maybe_object_size);

◆ DEFINE_READ_ONLY_MAP_SPECIALIZATION

#define DEFINE_READ_ONLY_MAP_SPECIALIZATION ( VisitorIdType)
Value:
template <> \
inline bool ContainsReadOnlyMap<VisitorId::kVisit##VisitorIdType>( \
PtrComprCageBase cage_base, Tagged<HeapObject> object) { \
/* If you see this DCHECK fail we encountered a Map with a VisitorId that \
* should have only ever appeared in read-only space. */ \
DCHECK(HeapLayout::InReadOnlySpace(object->map(cage_base))); \
return true; \
}

Definition at line 61 of file heap-visitor-inl.h.

◆ UNCHECKED_CAST

#define UNCHECKED_CAST ( VisitorId,
TypeName )
Value:
template <> \
V8_INLINE Tagged<TypeName> ConcurrentVisitorCastHelper<TypeName>::Cast( \
Tagged<HeapObject> object) { \
return UncheckedCast<TypeName>(object); \
}
#define V8_INLINE
Definition v8config.h:500

Definition at line 392 of file heap-visitor-inl.h.

◆ UNSAFE_STRING_TRANSITION_TARGET_CASE

#define UNSAFE_STRING_TRANSITION_TARGET_CASE ( VisitorIdType,
TypeName )
Value:
case kVisit##VisitorIdType: \
visitor \
->template VisitMapPointerIfNeeded<VisitorId::kVisit##VisitorIdType>( \
object); \
size = ObjectTraits<TypeName>::BodyDescriptor::SizeOf(map, object); \
ObjectTraits<TypeName>::BodyDescriptor::IterateBody( \
map, UncheckedCast<TypeName>(object), size, visitor); \
break;

◆ VISIT

#define VISIT ( TypeName)
Value:
template <typename ConcreteVisitor> \
size_t HeapVisitor<ConcreteVisitor>::Visit##TypeName( \
Tagged<Map> map, Tagged<TypeName> object, \
MaybeObjectSize maybe_object_size) { \
return static_cast<ConcreteVisitor*>(this) \
->template VisitWithBodyDescriptor< \
VisitorId::kVisit##TypeName, TypeName, \
ObjectTraits<TypeName>::BodyDescriptor>(map, object, \
maybe_object_size); \
}

Definition at line 207 of file heap-visitor-inl.h.

◆ VISIT_AS_LOCKED_STRING

#define VISIT_AS_LOCKED_STRING ( VisitorId,
TypeName )
Value:
template <typename ConcreteVisitor> \
size_t ConcurrentHeapVisitor<ConcreteVisitor>::Visit##TypeName( \
Tagged<Map> map, Tagged<TypeName> object, \
MaybeObjectSize maybe_object_size) { \
if constexpr (ConcreteVisitor::EnableConcurrentVisitation()) { \
return VisitStringLocked(object); \
} \
return HeapVisitor<ConcreteVisitor>::Visit##TypeName(map, object, \
maybe_object_size); \
}

Definition at line 414 of file heap-visitor-inl.h.

◆ VISIT_WITH_SLACK

#define VISIT_WITH_SLACK ( TypeName)
Value:
template <typename ConcreteVisitor> \
size_t HeapVisitor<ConcreteVisitor>::Visit##TypeName( \
Tagged<Map> map, Tagged<TypeName> object, \
MaybeObjectSize maybe_object_size) { \
return static_cast<ConcreteVisitor*>(this) \
->template VisitJSObjectSubclass<TypeName, TypeName::BodyDescriptor>( \
map, object, maybe_object_size); \
}

Definition at line 224 of file heap-visitor-inl.h.