v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8::internal::ConsString Class Reference

#include <string.h>

Inheritance diagram for v8::internal::ConsString:
Collaboration diagram for v8::internal::ConsString:

Public Member Functions

Tagged< Stringfirst () const
 
void set_first (Tagged< String > value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
 
Tagged< Stringsecond () const
 
void set_second (Tagged< String > value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
 
Tagged< Objectunchecked_first () const
 
Tagged< Objectunchecked_second () const
 
V8_INLINE bool IsFlat () const
 
V8_EXPORT_PRIVATE uint16_t Get (uint32_t index, const SharedStringAccessGuardIfNeeded &access_guard) const
 
- Public Member Functions inherited from v8::internal::String
template<typename IsolateT >
void MakeThin (IsolateT *isolate, Tagged< String > canonical)
 
template<typename Char >
V8_INLINE base::Vector< const Char > GetCharVector (const DisallowGarbageCollection &no_gc)
 
template<typename Char >
const Char * GetDirectStringChars (const DisallowGarbageCollection &no_gc) const
 
template<typename Char >
const Char * GetDirectStringChars (const DisallowGarbageCollection &no_gc, const SharedStringAccessGuardIfNeeded &access_guard) const
 
const uint8_t * AddressOfCharacterAt (uint32_t start_index, const DisallowGarbageCollection &no_gc)
 
uint32_t length () const
 
uint32_t length (AcquireLoadTag) const
 
void set_length (uint32_t hash)
 
void set_length (uint32_t hash, ReleaseStoreTag)
 
bool IsOneByteRepresentation () const
 
bool IsTwoByteRepresentation () const
 
void Set (uint32_t index, uint16_t value)
 
V8_INLINE uint16_t Get (uint32_t index) const
 
V8_INLINE uint16_t Get (uint32_t index, Isolate *isolate) const
 
V8_INLINE uint16_t Get (uint32_t index, LocalIsolate *local_isolate) const
 
V8_INLINE uint16_t Get (uint32_t index, const SharedStringAccessGuardIfNeeded &access_guard) const
 
V8_EXPORT_PRIVATE V8_INLINE FlatContent GetFlatContent (const DisallowGarbageCollection &no_gc)
 
V8_EXPORT_PRIVATE V8_INLINE FlatContent GetFlatContent (const DisallowGarbageCollection &no_gc, const SharedStringAccessGuardIfNeeded &)
 
Tagged< StringGetUnderlying () const
 
bool Equals (Tagged< String > other) const
 
template<EqualityType kEqType = EqualityType::kWholeString, typename Char >
bool IsEqualTo (base::Vector< const Char > str, Isolate *isolate) const
 
template<EqualityType kEqType = EqualityType::kWholeString, typename Char >
bool IsEqualTo (base::Vector< const Char > str) const
 
template<EqualityType kEqType = EqualityType::kWholeString, typename Char >
bool IsEqualTo (base::Vector< const Char > str, LocalIsolate *isolate) const
 
V8_EXPORT_PRIVATE bool HasOneBytePrefix (base::Vector< const char > str)
 
V8_EXPORT_PRIVATE bool IsOneByteEqualTo (base::Vector< const char > str)
 
std::unique_ptr< char[]> ToCString (uint32_t offset, uint32_t length, size_t *length_output=nullptr)
 
V8_EXPORT_PRIVATE std::unique_ptr< char[]> ToCString (size_t *length_output=nullptr)
 
template<typename T >
bool MarkForExternalizationDuringGC (Isolate *isolate, T *resource)
 
template<typename T >
void MakeExternalDuringGC (Isolate *isolate, T *resource)
 
V8_EXPORT_PRIVATE bool MakeExternal (Isolate *isolate, v8::String::ExternalStringResource *resource)
 
V8_EXPORT_PRIVATE bool MakeExternal (Isolate *isolate, v8::String::ExternalOneByteStringResource *resource)
 
bool SupportsExternalization (v8::String::Encoding)
 
bool AsArrayIndex (uint32_t *index)
 
bool AsIntegerIndex (size_t *index)
 
V8_EXPORT_PRIVATE void PrintOn (FILE *out)
 
V8_EXPORT_PRIVATE void PrintOn (std::ostream &out)
 
const char * PrefixForDebugPrint () const
 
const char * SuffixForDebugPrint () const
 
void StringShortPrint (StringStream *accumulator)
 
void PrintUC16 (std::ostream &os, int start=0, int end=-1)
 
void PrintUC16 (StringStream *accumulator, int start, int end)
 
bool IsFlat () const
 
bool IsShared () const
 
template<typename TDispatcher >
V8_INLINE auto DispatchToSpecificType (TDispatcher &&dispatcher) const -> std::common_type_t< decltype(dispatcher(Tagged< SeqOneByteString >{})), decltype(dispatcher(Tagged< SeqTwoByteString >{})), decltype(dispatcher(Tagged< ExternalOneByteString >{})), decltype(dispatcher(Tagged< ExternalTwoByteString >{})), decltype(dispatcher(Tagged< ThinString >{})), decltype(dispatcher(Tagged< ConsString >{})), decltype(dispatcher(Tagged< SlicedString >{}))>
 
template<String::EqualityType kEqType, typename Char >
bool IsEqualToImpl (base::Vector< const Char > str, const SharedStringAccessGuardIfNeeded &access_guard) const
 
template<typename Char >
bool IsConsStringEqualToImpl (Tagged< ConsString > string, base::Vector< const Char > str, const SharedStringAccessGuardIfNeeded &access_guard)
 
template<typename T , template< typename > typename HandleType>
requires (std::is_convertible_v<HandleType<T>, DirectHandle<String>>)
HandleType< StringFlatten (Isolate *isolate, HandleType< T > string, AllocationType allocation)
 
template<typename T , template< typename > typename HandleType>
requires (std::is_convertible_v<HandleType<T>, DirectHandle<String>>)
HandleType< StringFlatten (LocalIsolate *isolate, HandleType< T > string, AllocationType allocation)
 
template<>
base::Vector< const uint8_t > GetCharVector (const DisallowGarbageCollection &no_gc)
 
template<>
base::Vector< const base::uc16GetCharVector (const DisallowGarbageCollection &no_gc)
 
- Public Member Functions inherited from v8::internal::Name
bool HasHashCode () const
 
bool HasForwardingIndex (AcquireLoadTag) const
 
bool HasInternalizedForwardingIndex (AcquireLoadTag) const
 
bool HasExternalForwardingIndex (AcquireLoadTag) const
 
uint32_t raw_hash_field () const
 
uint32_t raw_hash_field (AcquireLoadTag) const
 
void set_raw_hash_field (uint32_t hash)
 
void set_raw_hash_field (uint32_t hash, ReleaseStoreTag)
 
void set_raw_hash_field_if_empty (uint32_t hash)
 
uint32_t hash () const
 
bool TryGetHash (uint32_t *hash) const
 
bool Equals (Tagged< Name > other)
 
bool IsArrayIndex ()
 
bool AsArrayIndex (uint32_t *index)
 
bool AsIntegerIndex (size_t *index)
 
bool IsInteresting (Isolate *isolate)
 
bool IsPrivate ()
 
bool IsPrivateName ()
 
bool IsPrivateBrand ()
 
void NameShortPrint ()
 
int NameShortPrint (base::Vector< char > str)
 
uint32_t EnsureHash ()
 
uint32_t EnsureHash (const SharedStringAccessGuardIfNeeded &)
 
uint32_t EnsureRawHash ()
 
uint32_t EnsureRawHash (const SharedStringAccessGuardIfNeeded &)
 
uint32_t RawHash ()
 
- Public Member Functions inherited from v8::internal::HeapObjectLayout
 HeapObjectLayout ()=delete
 
Tagged< Mapmap () const
 
Tagged< Mapmap (AcquireLoadTag) const
 
MapWord map_word (RelaxedLoadTag) const
 
void set_map (Isolate *isolate, Tagged< Map > value)
 
template<typename IsolateT >
void set_map (IsolateT *isolate, Tagged< Map > value, ReleaseStoreTag)
 
template<typename IsolateT >
void set_map_safe_transition (IsolateT *isolate, Tagged< Map > value, ReleaseStoreTag)
 
void set_map_safe_transition_no_write_barrier (Isolate *isolate, Tagged< Map > value, RelaxedStoreTag=kRelaxedStore)
 
template<typename IsolateT >
void set_map_after_allocation (IsolateT *isolate, Tagged< Map > value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
 
void set_map_no_write_barrier (Isolate *isolate, Tagged< Map > value, RelaxedStoreTag=kRelaxedStore)
 
void set_map_word_forwarded (Tagged< HeapObject > target_object, ReleaseStoreTag)
 
void set_map_word_forwarded (Tagged< HeapObject > target_object, RelaxedStoreTag)
 
Address ptr () const
 
Address address () const
 
ReadOnlyRoots EarlyGetReadOnlyRoots () const
 
int Size () const
 
V8_EXPORT_PRIVATE int SizeFromMap (Tagged< Map > map) const
 
WriteBarrierMode GetWriteBarrierMode (const DisallowGarbageCollection &promise)
 

Static Public Attributes

static const uint32_t kMinLength = 13
 
- Static Public Attributes inherited from v8::internal::String
static const int32_t kMaxOneByteCharCode = unibrow::Latin1::kMaxChar
 
static const uint32_t kMaxOneByteCharCodeU = unibrow::Latin1::kMaxChar
 
static const int kMaxUtf16CodeUnit = 0xffff
 
static const uint32_t kMaxUtf16CodeUnitU = kMaxUtf16CodeUnit
 
static const base::uc32 kMaxCodePoint = 0x10ffff
 
static const uint32_t kMaxLength = v8::String::kMaxLength
 
static const uint32_t kMaxHashCalcLength = 16383
 
static const uint32_t kMaxShortPrintLength = 1024
 
static uint32_t constexpr kInlineLineEndsSize = 32
 
- Static Public Attributes inherited from v8::internal::Name
static constexpr int kHashNotComputedMask = 1
 
static constexpr int kEmptyHashField
 
static const int kMaxCachedArrayIndexLength = 7
 
static const uint32_t kMaxArrayIndex = kMaxUInt32 - 1
 
static const int kMaxArrayIndexSize = 10
 
static const int kMaxIntegerIndexSize
 
static const int kArrayIndexValueBits = 24
 
static const int kArrayIndexLengthBits
 
static const unsigned int kDoesNotContainCachedArrayIndexMask
 
static const unsigned int kDoesNotContainIntegerOrForwardingIndexMask = 0b10
 

Private Attributes

TaggedMember< Stringfirst_
 
TaggedMember< Stringsecond_
 

Friends

struct ObjectTraits< ConsString >
 
struct OffsetsForDebug
 
class V8HeapExplorer
 
class CodeStubAssembler
 
class ToDirectStringAssembler
 
class StringBuiltinsAssembler
 
class SandboxTesting
 
class maglev::MaglevAssembler
 
class maglev::MaglevGraphBuilder
 
class compiler::AccessBuilder
 
class TorqueGeneratedConsStringAsserts
 
Tagged< StringString::GetUnderlying () const
 

Additional Inherited Members

- Public Types inherited from v8::internal::String
enum  Encoding { ONE_BYTE_ENCODING , TWO_BYTE_ENCODING }
 
enum class  EqualityType { kWholeString , kPrefix , kNoLengthCheck }
 
enum  TrimMode { kTrim , kTrimStart , kTrimEnd }
 
enum class  Utf8EncodingFlag { kNoFlags = 0 , kNullTerminate = 1u << 0 , kReplaceInvalid = 1u << 1 }
 
using Utf8EncodingFlags = base::Flags<Utf8EncodingFlag>
 
using LineEndsVector = base::SmallVector<int32_t, kInlineLineEndsSize>
 
- Public Types inherited from v8::internal::Name
enum class  HashFieldType : uint32_t { kHash = 0b10 , kIntegerIndex = 0b00 , kForwardingIndex = 0b01 , kEmpty = 0b11 }
 
using HashFieldTypeBits = base::BitField<HashFieldType, 0, 2>
 
using HashBits
 
using IsInternalizedForwardingIndexBit = HashFieldTypeBits::Next<bool, 1>
 
using IsExternalForwardingIndexBit
 
using ForwardingIndexValueBits
 
using ArrayIndexValueBits
 
using ArrayIndexLengthBits
 
- Static Public Member Functions inherited from v8::internal::String
static bool IsOneByteRepresentationUnderneath (Tagged< String > string)
 
template<template< typename > typename HandleType>
requires (std::is_convertible_v<HandleType<String>, DirectHandle<String>>)
static HandleType< NumberToNumber (Isolate *isolate, HandleType< String > subject)
 
template<typename T , template< typename > typename HandleType>
requires (std::is_convertible_v<HandleType<T>, DirectHandle<String>>)
static V8_INLINE HandleType< StringFlatten (Isolate *isolate, HandleType< T > string, AllocationType allocation=AllocationType::kYoung)
 
template<typename T , template< typename > typename HandleType>
requires (std::is_convertible_v<HandleType<T>, DirectHandle<String>>)
static V8_INLINE HandleType< StringFlatten (LocalIsolate *isolate, HandleType< T > string, AllocationType allocation=AllocationType::kYoung)
 
template<typename T , template< typename > typename HandleType>
requires (std::is_convertible_v<HandleType<T>, DirectHandle<String>>)
static HandleType< StringShare (Isolate *isolate, HandleType< T > string)
 
static V8_WARN_UNUSED_RESULT ComparisonResult Compare (Isolate *isolate, DirectHandle< String > x, DirectHandle< String > y)
 
static Tagged< ObjectIndexOf (Isolate *isolate, DirectHandle< Object > receiver, DirectHandle< Object > search, DirectHandle< Object > position)
 
static int IndexOf (Isolate *isolate, DirectHandle< String > receiver, DirectHandle< String > search, uint32_t start_index)
 
static Tagged< ObjectLastIndexOf (Isolate *isolate, DirectHandle< Object > receiver, DirectHandle< Object > search, DirectHandle< Object > position)
 
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< StringGetSubstitution (Isolate *isolate, Match *match, DirectHandle< String > replacement, uint32_t start_index=0)
 
static bool Equals (Isolate *isolate, DirectHandle< String > one, DirectHandle< String > two)
 
static bool IsIdentifier (Isolate *isolate, DirectHandle< String > str)
 
static int32_t ToArrayIndex (Address addr)
 
template<typename SinkCharT >
static void WriteToFlat (Tagged< String > source, SinkCharT *sink, uint32_t start, uint32_t length)
 
template<typename SinkCharT >
static void WriteToFlat (Tagged< String > source, SinkCharT *sink, uint32_t start, uint32_t length, const SharedStringAccessGuardIfNeeded &access_guard)
 
template<typename SinkCharT >
static void WriteToFlat2 (SinkCharT *dst, Tagged< ConsString > src, uint32_t src_index, uint32_t length, const SharedStringAccessGuardIfNeeded &aguard, const DisallowGarbageCollection &no_gc)
 
static size_t Utf8Length (Isolate *isolate, DirectHandle< String > string)
 
static size_t WriteUtf8 (Isolate *isolate, DirectHandle< String > string, char *buffer, size_t capacity, Utf8EncodingFlags flags, size_t *processed_characters_return=nullptr)
 
static bool IsWellFormedUnicode (Isolate *isolate, DirectHandle< String > string)
 
static bool IsAscii (const char *chars, uint32_t length)
 
static bool IsAscii (const uint8_t *chars, uint32_t length)
 
static uint32_t NonOneByteStart (const base::uc16 *chars, uint32_t length)
 
static bool IsOneByte (const base::uc16 *chars, uint32_t length)
 
template<class Visitor >
static Tagged< ConsStringVisitFlat (Visitor *visitor, Tagged< String > string, int offset=0)
 
template<class Visitor >
static Tagged< ConsStringVisitFlat (Visitor *visitor, Tagged< String > string, int offset, const SharedStringAccessGuardIfNeeded &access_guard)
 
template<typename IsolateT >
static LineEndsVector CalculateLineEndsVector (IsolateT *isolate, DirectHandle< String > string, bool include_ending_line)
 
template<typename IsolateT >
static Handle< FixedArrayCalculateLineEnds (IsolateT *isolate, DirectHandle< String > string, bool include_ending_line)
 
static bool IsInPlaceInternalizable (Tagged< String > string)
 
static bool IsInPlaceInternalizable (InstanceType instance_type)
 
static bool IsInPlaceInternalizableExcludingExternal (InstanceType instance_type)
 
template<typename TDispatcher , typename... TArgs>
static auto DispatchToSpecificTypeWithoutCast (InstanceType instance_type, TArgs &&... args)
 
- Static Public Member Functions inherited from v8::internal::Name
static bool Equals (Isolate *isolate, DirectHandle< Name > one, DirectHandle< Name > two)
 
static bool ContainsCachedArrayIndex (uint32_t hash)
 
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< StringToFunctionName (Isolate *isolate, DirectHandle< Name > name)
 
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< StringToFunctionName (Isolate *isolate, DirectHandle< Name > name, DirectHandle< String > prefix)
 
static bool IsHashFieldComputed (uint32_t raw_hash_field)
 
static bool IsHash (uint32_t raw_hash_field)
 
static bool IsIntegerIndex (uint32_t raw_hash_field)
 
static bool IsForwardingIndex (uint32_t raw_hash_field)
 
static bool IsInternalizedForwardingIndex (uint32_t raw_hash_field)
 
static bool IsExternalForwardingIndex (uint32_t raw_hash_field)
 
static uint32_t CreateHashFieldValue (uint32_t hash, HashFieldType type)
 
static uint32_t CreateInternalizedForwardingIndex (uint32_t index)
 
static uint32_t CreateExternalForwardingIndex (uint32_t index)
 
- Public Attributes inherited from v8::internal::String
V8_OBJECT_INNER_CLASS class v8::internal::String::FlatContent V8_OBJECT_INNER_CLASS_END
 

Detailed Description

Definition at line 1003 of file string.h.

Member Function Documentation

◆ first()

Tagged< String > v8::internal::ConsString::first ( ) const
inline

Definition at line 1280 of file string-inl.h.

◆ Get()

uint16_t v8::internal::ConsString::Get ( uint32_t index,
const SharedStringAccessGuardIfNeeded & access_guard ) const

Definition at line 2005 of file string.cc.

◆ IsFlat()

bool v8::internal::ConsString::IsFlat ( ) const

Definition at line 1297 of file string-inl.h.

◆ second()

Tagged< String > v8::internal::ConsString::second ( ) const
inline

Definition at line 1285 of file string-inl.h.

◆ set_first()

void v8::internal::ConsString::set_first ( Tagged< String > value,
WriteBarrierMode mode = UPDATE_WRITE_BARRIER )
inline

Definition at line 1281 of file string-inl.h.

◆ set_second()

void v8::internal::ConsString::set_second ( Tagged< String > value,
WriteBarrierMode mode = UPDATE_WRITE_BARRIER )
inline

Definition at line 1286 of file string-inl.h.

◆ unchecked_first()

Tagged< Object > v8::internal::ConsString::unchecked_first ( ) const
inline

Definition at line 1291 of file string-inl.h.

◆ unchecked_second()

Tagged< Object > v8::internal::ConsString::unchecked_second ( ) const
inline

Definition at line 1293 of file string-inl.h.

Friends And Related Symbol Documentation

◆ CodeStubAssembler

friend class CodeStubAssembler
friend

Definition at line 1037 of file string.h.

◆ compiler::AccessBuilder

friend class compiler::AccessBuilder
friend

Definition at line 1043 of file string.h.

◆ maglev::MaglevAssembler

friend class maglev::MaglevAssembler
friend

Definition at line 1041 of file string.h.

◆ maglev::MaglevGraphBuilder

friend class maglev::MaglevGraphBuilder
friend

Definition at line 1042 of file string.h.

◆ ObjectTraits< ConsString >

friend struct ObjectTraits< ConsString >
friend

Definition at line 1029 of file string.h.

◆ OffsetsForDebug

friend struct OffsetsForDebug
friend

Definition at line 1035 of file string.h.

◆ SandboxTesting

friend class SandboxTesting
friend

Definition at line 1040 of file string.h.

◆ String::GetUnderlying

Tagged< String > String::GetUnderlying ( ) const
friend

◆ StringBuiltinsAssembler

friend class StringBuiltinsAssembler
friend

Definition at line 1039 of file string.h.

◆ ToDirectStringAssembler

friend class ToDirectStringAssembler
friend

Definition at line 1038 of file string.h.

◆ TorqueGeneratedConsStringAsserts

friend class TorqueGeneratedConsStringAsserts
friend

Definition at line 1044 of file string.h.

◆ V8HeapExplorer

friend class V8HeapExplorer
friend

Definition at line 1036 of file string.h.

Member Data Documentation

◆ first_

TaggedMember<String> v8::internal::ConsString::first_
private

Definition at line 1048 of file string.h.

◆ kMinLength

const uint32_t v8::internal::ConsString::kMinLength = 13
static

Definition at line 1029 of file string.h.

◆ second_

TaggedMember<String> v8::internal::ConsString::second_
private

Definition at line 1049 of file string.h.


The documentation for this class was generated from the following files: