Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
dart::String Class Reference

#include <object.h>

Inheritance diagram for dart::String:
dart::Instance dart::Object

Classes

class  CodePointIterator
 

Public Member Functions

intptr_t Length () const
 
uword Hash () const
 
bool HasHash () const
 
virtual ObjectPtr HashCode () const
 
uint16_t CharAt (intptr_t index) const
 
intptr_t CharSize () const
 
bool Equals (const String &str) const
 
bool Equals (const String &str, intptr_t begin_index, intptr_t len) const
 
bool Equals (const char *cstr) const
 
bool EqualsLatin1 (const uint8_t *characters, intptr_t len) const
 
bool Equals (const uint16_t *characters, intptr_t len) const
 
bool Equals (const int32_t *characters, intptr_t len) const
 
bool EqualsConcat (const String &str1, const String &str2) const
 
virtual bool OperatorEquals (const Instance &other) const
 
virtual bool CanonicalizeEquals (const Instance &other) const
 
virtual uint32_t CanonicalizeHash () const
 
virtual bool Equals (const Instance &other) const
 
intptr_t CompareTo (const String &other) const
 
bool StartsWith (const String &other) const
 
bool EndsWith (const String &other) const
 
virtual InstancePtr CanonicalizeLocked (Thread *thread) const
 
bool IsSymbol () const
 
bool IsOneByteString () const
 
bool IsTwoByteString () const
 
char * ToMallocCString () const
 
void ToUTF8 (uint8_t *utf8_array, intptr_t array_len) const
 
- Public Member Functions inherited from dart::Instance
bool IsIdenticalTo (const Instance &other) const
 
intptr_t SizeFromClass () const
 
InstancePtr Canonicalize (Thread *thread) const
 
virtual void CanonicalizeFieldsLocked (Thread *thread) const
 
InstancePtr CopyShallowToOldSpace (Thread *thread) const
 
ObjectPtr GetField (const Field &field) const
 
void SetField (const Field &field, const Object &value) const
 
AbstractTypePtr GetType (Heap::Space space) const
 
virtual TypeArgumentsPtr GetTypeArguments () const
 
virtual void SetTypeArguments (const TypeArguments &value) const
 
bool IsInstanceOf (const AbstractType &other, const TypeArguments &other_instantiator_type_arguments, const TypeArguments &other_function_type_arguments) const
 
bool IsAssignableTo (const AbstractType &other, const TypeArguments &other_instantiator_type_arguments, const TypeArguments &other_function_type_arguments) const
 
bool IsValidNativeIndex (int index) const
 
intptr_t * NativeFieldsDataAddr () const
 
intptr_t GetNativeField (int index) const
 
void GetNativeFields (uint16_t num_fields, intptr_t *field_values) const
 
void SetNativeFields (uint16_t num_fields, const intptr_t *field_values) const
 
uint16_t NumNativeFields () const
 
void SetNativeField (int index, intptr_t value) const
 
bool IsCallable (Function *function) const
 
ObjectPtr Invoke (const String &selector, const Array &arguments, const Array &argument_names, bool respect_reflectable=true, bool check_is_entrypoint=false) const
 
ObjectPtr InvokeGetter (const String &selector, bool respect_reflectable=true, bool check_is_entrypoint=false) const
 
ObjectPtr InvokeSetter (const String &selector, const Instance &argument, bool respect_reflectable=true, bool check_is_entrypoint=false) const
 
ObjectPtr EvaluateCompiledExpression (const Class &klass, const ExternalTypedData &kernel_buffer, const Array &type_definitions, const Array &arguments, const TypeArguments &type_arguments) const
 
IntegerPtr IdentityHashCode (Thread *thread) const
 
virtual bool IsPointer () const
 
- Public Member Functions inherited from dart::Object
virtual ~Object ()
 
ObjectPtr ptr () const
 
void operator= (ObjectPtr value)
 
bool IsCanonical () const
 
void SetCanonical () const
 
void ClearCanonical () const
 
bool IsImmutable () const
 
void SetImmutable () const
 
void ClearImmutable () const
 
intptr_t GetClassId () const
 
ClassPtr clazz () const
 
 CLASS_LIST_FOR_HANDLES (DEFINE_CLASS_TESTER)
 
bool IsNull () const
 
virtual const char * ToCString () const
 
void PrintJSON (JSONStream *stream, bool ref=true) const
 
virtual void PrintJSONImpl (JSONStream *stream, bool ref) const
 
void PrintImplementationFields (JSONStream *stream) const
 
virtual void PrintImplementationFieldsImpl (const JSONArray &jsarr_fields) const
 
virtual const char * JSONType () const
 
virtual StringPtr DictionaryName () const
 
bool IsNew () const
 
bool IsOld () const
 
bool InVMIsolateHeap () const
 
void Print () const
 

Static Public Member Functions

static intptr_t HeaderSize ()
 
static intptr_t InstanceSize ()
 
static intptr_t LengthOf (StringPtr obj)
 
static intptr_t length_offset ()
 
static uword Hash (StringPtr raw)
 
static intptr_t hash_offset ()
 
static uword Hash (const String &str, intptr_t begin_index, intptr_t len)
 
static uword Hash (const char *characters, intptr_t len)
 
static uword Hash (const uint16_t *characters, intptr_t len)
 
static uword Hash (const int32_t *characters, intptr_t len)
 
static uword HashRawSymbol (const StringPtr symbol)
 
static uword HashConcat (const String &str1, const String &str2)
 
static uint16_t CharAt (StringPtr str, intptr_t index)
 
static bool StartsWith (StringPtr str, StringPtr prefix)
 
static const char * ToCString (Thread *thread, StringPtr ptr)
 
static StringPtr New (const char *cstr, Heap::Space space=Heap::kNew)
 
static StringPtr FromUTF8 (const uint8_t *utf8_array, intptr_t array_len, Heap::Space space=Heap::kNew)
 
static StringPtr FromLatin1 (const uint8_t *latin1_array, intptr_t array_len, Heap::Space space=Heap::kNew)
 
static StringPtr FromUTF16 (const uint16_t *utf16_array, intptr_t array_len, Heap::Space space=Heap::kNew)
 
static StringPtr FromUTF32 (const int32_t *utf32_array, intptr_t array_len, Heap::Space space=Heap::kNew)
 
static StringPtr New (const String &str, Heap::Space space=Heap::kNew)
 
static StringPtr NewExternal (const uint8_t *utf8_array, intptr_t array_len, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback, Heap::Space=Heap::kNew)
 
static StringPtr NewExternal (const uint16_t *utf16_array, intptr_t array_len, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback, Heap::Space=Heap::kNew)
 
static void Copy (const String &dst, intptr_t dst_offset, const uint8_t *characters, intptr_t len)
 
static void Copy (const String &dst, intptr_t dst_offset, const uint16_t *characters, intptr_t len)
 
static void Copy (const String &dst, intptr_t dst_offset, const String &src, intptr_t src_offset, intptr_t len)
 
static StringPtr EscapeSpecialCharacters (const String &str)
 
static const char * EncodeIRI (const String &str)
 
static StringPtr DecodeIRI (const String &str)
 
static StringPtr Concat (const String &str1, const String &str2, Heap::Space space=Heap::kNew)
 
static StringPtr ConcatAll (const Array &strings, Heap::Space space=Heap::kNew)
 
static StringPtr ConcatAllRange (const Array &strings, intptr_t start, intptr_t end, Heap::Space space=Heap::kNew)
 
static StringPtr SubString (const String &str, intptr_t begin_index, Heap::Space space=Heap::kNew)
 
static StringPtr SubString (const String &str, intptr_t begin_index, intptr_t length, Heap::Space space=Heap::kNew)
 
static StringPtr SubString (Thread *thread, const String &str, intptr_t begin_index, intptr_t length, Heap::Space space=Heap::kNew)
 
static StringPtr Transform (int32_t(*mapping)(int32_t ch), const String &str, Heap::Space space=Heap::kNew)
 
static StringPtr ToUpperCase (const String &str, Heap::Space space=Heap::kNew)
 
static StringPtr ToLowerCase (const String &str, Heap::Space space=Heap::kNew)
 
static StringPtr RemovePrivateKey (const String &name)
 
static const char * ScrubName (const String &name, bool is_extension=false)
 
static StringPtr ScrubNameRetainPrivate (const String &name, bool is_extension=false)
 
static bool EqualsIgnoringPrivateKey (const String &str1, const String &str2)
 
static StringPtr NewFormatted (const char *format,...) PRINTF_ATTRIBUTE(1
 
static StringPtr static StringPtr NewFormatted (Heap::Space space, const char *format,...) PRINTF_ATTRIBUTE(2
 
static StringPtr static StringPtr static StringPtr NewFormattedV (const char *format, va_list args, Heap::Space space=Heap::kNew)
 
static bool ParseDouble (const String &str, intptr_t start, intptr_t end, double *result)
 
static uint32_t GetCachedHash (const StringPtr obj)
 
static uint32_t SetCachedHashIfNotSet (StringPtr obj, uint32_t hash)
 
static uint32_t SetCachedHash (StringPtr obj, uint32_t hash)
 
- Static Public Member Functions inherited from dart::Instance
static bool NullIsAssignableTo (const AbstractType &other)
 
static bool NullIsAssignableTo (const AbstractType &other, const TypeArguments &other_instantiator_type_arguments, const TypeArguments &other_function_type_arguments)
 
static ObjectPtr EvaluateCompiledExpression (Thread *thread, const Object &receiver, const Library &library, const Class &klass, const ExternalTypedData &kernel_buffer, const Array &type_definitions, const Array &param_values, const TypeArguments &type_param_values)
 
static intptr_t UnroundedSize ()
 
static intptr_t InstanceSize ()
 
static InstancePtr New (const Class &cls, Heap::Space space=Heap::kNew)
 
static InstancePtr NewAlreadyFinalized (const Class &cls, Heap::Space space=Heap::kNew)
 
static intptr_t DataOffsetFor (intptr_t cid)
 
static intptr_t ElementSizeFor (intptr_t cid)
 
static intptr_t NextFieldOffset ()
 
static intptr_t NativeFieldsOffset ()
 
- Static Public Member Functions inherited from dart::Object
static ObjectPtr RawCast (ObjectPtr obj)
 
static constexpr bool ContainsCompressedPointers ()
 
static intptr_t tags_offset ()
 
static ObjectHandle ()
 
static ObjectHandle (Zone *zone)
 
static ObjectHandle (ObjectPtr ptr)
 
static ObjectHandle (Zone *zone, ObjectPtr ptr)
 
static ObjectZoneHandle ()
 
static ObjectZoneHandle (Zone *zone)
 
static ObjectZoneHandle (ObjectPtr ptr)
 
static ObjectZoneHandle (Zone *zone, ObjectPtr ptr)
 
static ObjectReadOnlyHandle ()
 
static ObjectPtr null ()
 
static void set_vm_isolate_snapshot_object_table (const Array &table)
 
static ClassPtr class_class ()
 
static ClassPtr dynamic_class ()
 
static ClassPtr void_class ()
 
static ClassPtr type_parameters_class ()
 
static ClassPtr type_arguments_class ()
 
static ClassPtr patch_class_class ()
 
static ClassPtr function_class ()
 
static ClassPtr closure_data_class ()
 
static ClassPtr ffi_trampoline_data_class ()
 
static ClassPtr field_class ()
 
static ClassPtr script_class ()
 
static ClassPtr library_class ()
 
static ClassPtr namespace_class ()
 
static ClassPtr kernel_program_info_class ()
 
static ClassPtr code_class ()
 
static ClassPtr instructions_class ()
 
static ClassPtr instructions_section_class ()
 
static ClassPtr instructions_table_class ()
 
static ClassPtr object_pool_class ()
 
static ClassPtr pc_descriptors_class ()
 
static ClassPtr code_source_map_class ()
 
static ClassPtr compressed_stackmaps_class ()
 
static ClassPtr var_descriptors_class ()
 
static ClassPtr exception_handlers_class ()
 
static ClassPtr context_class ()
 
static ClassPtr context_scope_class ()
 
static ClassPtr sentinel_class ()
 
static ClassPtr api_error_class ()
 
static ClassPtr language_error_class ()
 
static ClassPtr unhandled_exception_class ()
 
static ClassPtr unwind_error_class ()
 
static ClassPtr singletargetcache_class ()
 
static ClassPtr unlinkedcall_class ()
 
static ClassPtr monomorphicsmiablecall_class ()
 
static ClassPtr icdata_class ()
 
static ClassPtr megamorphic_cache_class ()
 
static ClassPtr subtypetestcache_class ()
 
static ClassPtr loadingunit_class ()
 
static ClassPtr weak_serialization_reference_class ()
 
static ClassPtr weak_array_class ()
 
static void InitNullAndBool (IsolateGroup *isolate_group)
 
static void Init (IsolateGroup *isolate_group)
 
static void InitVtables ()
 
static void FinishInit (IsolateGroup *isolate_group)
 
static void FinalizeVMIsolate (IsolateGroup *isolate_group)
 
static void FinalizeReadOnlyObject (ObjectPtr object)
 
static void Cleanup ()
 
static ErrorPtr Init (IsolateGroup *isolate_group, const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
 
static void MakeUnusedSpaceTraversable (const Object &obj, intptr_t original_size, intptr_t used_size)
 
static intptr_t InstanceSize ()
 
template<class FakeObject >
static void VerifyBuiltinVtable (intptr_t cid)
 
static void VerifyBuiltinVtables ()
 
static bool ShouldHaveImmutabilityBitSet (classid_t class_id)
 

Static Public Attributes

static constexpr intptr_t kOneByteChar = 1
 
static constexpr intptr_t kTwoByteChar = 2
 
static constexpr intptr_t kSizeofRawString
 
static constexpr intptr_t kMaxElements = kSmiMax / kTwoByteChar
 
- Static Public Attributes inherited from dart::Object
static constexpr intptr_t kHashBits = 30
 
static const ClassId kClassId = kObjectCid
 

Protected Member Functions

bool Equals (const uint8_t *characters, intptr_t len) const
 
void SetLength (intptr_t value) const
 
void SetHash (intptr_t value) const
 
 FINAL_HEAP_OBJECT_IMPLEMENTATION (String, Instance)
 
- Protected Member Functions inherited from dart::Instance
virtual void PrintSharedInstanceJSON (JSONObject *jsobj, bool ref, bool include_id=true) const
 
- Protected Member Functions inherited from dart::Object
 Object ()
 
uword raw_value () const
 
void setPtr (ObjectPtr value, intptr_t default_cid)
 
void CheckHandle () const
 
cpp_vtable vtable () const
 
void set_vtable (cpp_vtable value)
 
bool Contains (uword addr) const
 
template<typename type , std::memory_order order = std::memory_order_relaxed>
type LoadPointer (type const *addr) const
 
template<typename type , std::memory_order order = std::memory_order_relaxed>
void StorePointer (type const *addr, type value) const
 
template<typename type , typename compressed_type , std::memory_order order = std::memory_order_relaxed>
void StoreCompressedPointer (compressed_type const *addr, type value) const
 
template<typename type >
void StorePointerUnaligned (type const *addr, type value, Thread *thread) const
 
void StoreSmi (SmiPtr const *addr, SmiPtr value) const
 
template<typename FieldType >
void StoreSimd128 (const FieldType *addr, simd128_value_t value) const
 
template<typename FieldType >
FieldType LoadNonPointer (const FieldType *addr) const
 
template<typename FieldType , std::memory_order order>
FieldType LoadNonPointer (const FieldType *addr) const
 
template<typename FieldType , typename ValueType >
void StoreNonPointer (const FieldType *addr, ValueType value) const
 
template<typename FieldType , typename ValueType , std::memory_order order>
void StoreNonPointer (const FieldType *addr, ValueType value) const
 
template<typename FieldType >
FieldType * UnsafeMutableNonPointer (const FieldType *addr) const
 
 CLASS_LIST (STORE_NON_POINTER_ILLEGAL_TYPE)
 
void UnimplementedMethod () const
 
void AddCommonObjectProperties (JSONObject *jsobj, const char *protocol_type, bool ref) const
 

Static Protected Member Functions

static uword Hash (const uint8_t *characters, intptr_t len)
 
- Static Protected Member Functions inherited from dart::Object
static DART_NOINLINE ObjectHandleImpl (Zone *zone, ObjectPtr ptr, intptr_t default_cid)
 
static DART_NOINLINE ObjectZoneHandleImpl (Zone *zone, ObjectPtr ptr, intptr_t default_cid)
 
static DART_NOINLINE ObjectReadOnlyHandleImpl (intptr_t cid)
 
static ObjectPtr Allocate (intptr_t cls_id, intptr_t size, Heap::Space space, bool compressed, uword ptr_field_start_offset, uword ptr_field_end_offset)
 
template<typename T >
static DART_FORCE_INLINE T::ObjectPtrType Allocate (Heap::Space space)
 
template<typename T >
static DART_FORCE_INLINE T::ObjectPtrType Allocate (Heap::Space space, intptr_t elements)
 
template<typename T >
static DART_FORCE_INLINE T::ObjectPtrType AllocateVariant (intptr_t class_id, Heap::Space space)
 
template<typename T >
static DART_FORCE_INLINE T::ObjectPtrType AllocateVariant (intptr_t class_id, Heap::Space space, intptr_t elements)
 
static constexpr intptr_t RoundedAllocationSize (intptr_t size)
 
static ObjectPtr Clone (const Object &orig, Heap::Space space, bool load_with_relaxed_atomics=false)
 
template<typename T >
static DART_FORCE_INLINE uword from_offset ()
 
template<typename T >
static DART_FORCE_INLINE uword to_offset (intptr_t length=0)
 

Friends

class Class
 
class Symbols
 
class StringSlice
 
template<typename CharType >
class CharArray
 
class ConcatString
 
class OneByteString
 
class TwoByteString
 
class UntaggedOneByteString
 
class RODataSerializationCluster
 
class Pass2Visitor
 

Additional Inherited Members

- Public Types inherited from dart::Object
enum  NameVisibility { kInternalName = 0 , kScrubbedName , kUserVisibleName }
 
enum class  NameDisambiguation { kYes , kNo }
 
using UntaggedObjectType = UntaggedObject
 
using ObjectPtrType = ObjectPtr
 
- Protected Attributes inherited from dart::Object
ObjectPtr ptr_
 

Detailed Description

Definition at line 10137 of file object.h.

Member Function Documentation

◆ CanonicalizeEquals()

virtual bool dart::String::CanonicalizeEquals ( const Instance other) const
inlinevirtual

Reimplemented from dart::Instance.

Definition at line 10269 of file object.h.

10269 {
10270 return Equals(other);
10271 }
bool Equals(const String &str) const
Definition object.h:13311

◆ CanonicalizeHash()

virtual uint32_t dart::String::CanonicalizeHash ( ) const
inlinevirtual

Reimplemented from dart::Instance.

Definition at line 10272 of file object.h.

10272{ return Hash(); }
uword Hash() const
Definition object.h:10195

◆ CanonicalizeLocked()

InstancePtr dart::String::CanonicalizeLocked ( Thread thread) const
virtual

Reimplemented from dart::Instance.

Definition at line 23770 of file object.cc.

23770 {
23771 if (IsCanonical()) {
23772 return this->ptr();
23773 }
23774 return Symbols::New(Thread::Current(), *this);
23775}
ObjectPtr ptr() const
Definition object.h:332
bool IsCanonical() const
Definition object.h:335
static StringPtr New(Thread *thread, const char *cstr)
Definition symbols.h:722
static Thread * Current()
Definition thread.h:361

◆ CharAt() [1/2]

uint16_t dart::String::CharAt ( intptr_t  index) const
inline

Definition at line 10238 of file object.h.

10238{ return CharAt(ptr(), index); }
uint16_t CharAt(intptr_t index) const
Definition object.h:10238

◆ CharAt() [2/2]

uint16_t dart::String::CharAt ( StringPtr  str,
intptr_t  index 
)
inlinestatic

Definition at line 13385 of file object.h.

13385 {
13386 switch (str->GetClassId()) {
13387 case kOneByteStringCid:
13388 return OneByteString::CharAt(static_cast<OneByteStringPtr>(str), index);
13389 case kTwoByteStringCid:
13390 return TwoByteString::CharAt(static_cast<TwoByteStringPtr>(str), index);
13391 }
13392 UNREACHABLE();
13393 return 0;
13394}
#define UNREACHABLE()
Definition assert.h:248
static uint16_t CharAt(const String &str, intptr_t index)
Definition object.h:10504
static uint16_t CharAt(const String &str, intptr_t index)
Definition object.h:10643

◆ CharSize()

intptr_t dart::String::CharSize ( ) const

Definition at line 23601 of file object.cc.

23601 {
23602 intptr_t class_id = ptr()->GetClassId();
23603 if (class_id == kOneByteStringCid) {
23604 return kOneByteChar;
23605 }
23606 ASSERT(class_id == kTwoByteStringCid);
23607 return kTwoByteChar;
23608}
intptr_t GetClassId() const
Definition raw_object.h:864
static constexpr intptr_t kOneByteChar
Definition object.h:10139
static constexpr intptr_t kTwoByteChar
Definition object.h:10140
#define ASSERT(E)

◆ CompareTo()

intptr_t dart::String::CompareTo ( const String other) const

Definition at line 23717 of file object.cc.

23717 {
23718 const intptr_t this_len = this->Length();
23719 const intptr_t other_len = other.IsNull() ? 0 : other.Length();
23720 const intptr_t len = (this_len < other_len) ? this_len : other_len;
23721 for (intptr_t i = 0; i < len; i++) {
23722 uint16_t this_code_unit = this->CharAt(i);
23723 uint16_t other_code_unit = other.CharAt(i);
23724 if (this_code_unit < other_code_unit) {
23725 return -1;
23726 }
23727 if (this_code_unit > other_code_unit) {
23728 return 1;
23729 }
23730 }
23731 if (this_len < other_len) return -1;
23732 if (this_len > other_len) return 1;
23733 return 0;
23734}
intptr_t Length() const
Definition object.h:10189

◆ Concat()

StringPtr dart::String::Concat ( const String str1,
const String str2,
Heap::Space  space = Heap::kNew 
)
static

Definition at line 24116 of file object.cc.

24118 {
24119 ASSERT(!str1.IsNull() && !str2.IsNull());
24120 intptr_t char_size = Utils::Maximum(str1.CharSize(), str2.CharSize());
24121 if (char_size == kTwoByteChar) {
24122 return TwoByteString::Concat(str1, str2, space);
24123 }
24124 return OneByteString::Concat(str1, str2, space);
24125}
static OneByteStringPtr Concat(const String &str1, const String &str2, Heap::Space space)
Definition object.cc:24540
static TwoByteStringPtr Concat(const String &str1, const String &str2, Heap::Space space)
Definition object.cc:24719
static constexpr T Maximum(T x, T y)
Definition utils.h:26

◆ ConcatAll()

StringPtr dart::String::ConcatAll ( const Array strings,
Heap::Space  space = Heap::kNew 
)
static

Definition at line 24127 of file object.cc.

24127 {
24128 return ConcatAllRange(strings, 0, strings.Length(), space);
24129}
static StringPtr ConcatAllRange(const Array &strings, intptr_t start, intptr_t end, Heap::Space space=Heap::kNew)
Definition object.cc:24131

◆ ConcatAllRange()

StringPtr dart::String::ConcatAllRange ( const Array strings,
intptr_t  start,
intptr_t  end,
Heap::Space  space = Heap::kNew 
)
static

Definition at line 24131 of file object.cc.

24134 {
24135 ASSERT(!strings.IsNull());
24136 ASSERT(start >= 0);
24137 ASSERT(end <= strings.Length());
24138 intptr_t result_len = 0;
24139 String& str = String::Handle();
24140 intptr_t char_size = kOneByteChar;
24141 // Compute 'char_size' and 'result_len'.
24142 for (intptr_t i = start; i < end; i++) {
24143 str ^= strings.At(i);
24144 const intptr_t str_len = str.Length();
24145 if ((kMaxElements - result_len) < str_len) {
24147 UNREACHABLE();
24148 }
24149 result_len += str_len;
24150 char_size = Utils::Maximum(char_size, str.CharSize());
24151 }
24152 if (char_size == kOneByteChar) {
24153 return OneByteString::ConcatAll(strings, start, end, result_len, space);
24154 }
24155 ASSERT(char_size == kTwoByteChar);
24156 return TwoByteString::ConcatAll(strings, start, end, result_len, space);
24157}
static DART_NORETURN void ThrowOOM()
static Object & Handle()
Definition object.h:407
static OneByteStringPtr ConcatAll(const Array &strings, intptr_t start, intptr_t end, intptr_t len, Heap::Space space)
Definition object.cc:24552
static constexpr intptr_t kMaxElements
Definition object.h:10152
static TwoByteStringPtr ConcatAll(const Array &strings, intptr_t start, intptr_t end, intptr_t len, Heap::Space space)
Definition object.cc:24731
glong glong end

◆ Copy() [1/3]

void dart::String::Copy ( const String dst,
intptr_t  dst_offset,
const String src,
intptr_t  src_offset,
intptr_t  len 
)
static

Definition at line 23913 of file object.cc.

23917 {
23918 ASSERT(dst_offset >= 0);
23919 ASSERT(src_offset >= 0);
23920 ASSERT(len >= 0);
23921 ASSERT(len <= (dst.Length() - dst_offset));
23922 ASSERT(len <= (src.Length() - src_offset));
23923 if (len > 0) {
23924 intptr_t char_size = src.CharSize();
23925 if (char_size == kOneByteChar) {
23926 ASSERT(src.IsOneByteString());
23927 NoSafepointScope no_safepoint;
23928 String::Copy(dst, dst_offset, OneByteString::CharAddr(src, src_offset),
23929 len);
23930 } else {
23931 ASSERT(char_size == kTwoByteChar);
23932 ASSERT(src.IsTwoByteString());
23933 NoSafepointScope no_safepoint;
23934 String::Copy(dst, dst_offset, TwoByteString::CharAddr(src, src_offset),
23935 len);
23936 }
23937 }
23938}
static void Copy(const String &dst, intptr_t dst_offset, const uint8_t *characters, intptr_t len)
Definition object.cc:23871
dst
Definition cp.py:12

◆ Copy() [2/3]

void dart::String::Copy ( const String dst,
intptr_t  dst_offset,
const uint16_t *  characters,
intptr_t  len 
)
static

Definition at line 23890 of file object.cc.

23893 {
23894 ASSERT(dst_offset >= 0);
23895 ASSERT(array_len >= 0);
23896 ASSERT(array_len <= (dst.Length() - dst_offset));
23897 if (dst.IsOneByteString()) {
23898 NoSafepointScope no_safepoint;
23899 for (intptr_t i = 0; i < array_len; ++i) {
23900 ASSERT(Utf::IsLatin1(LoadUnaligned(&utf16_array[i])));
23901 *OneByteString::CharAddr(dst, i + dst_offset) = utf16_array[i];
23902 }
23903 } else {
23904 ASSERT(dst.IsTwoByteString());
23905 NoSafepointScope no_safepoint;
23906 if (array_len > 0) {
23907 memmove(TwoByteString::CharAddr(dst, dst_offset), utf16_array,
23908 array_len * 2);
23909 }
23910 }
23911}
static bool IsLatin1(int32_t code_point)
Definition unicode.h:23
static T LoadUnaligned(const T *ptr)
Definition unaligned.h:14

◆ Copy() [3/3]

void dart::String::Copy ( const String dst,
intptr_t  dst_offset,
const uint8_t *  characters,
intptr_t  len 
)
static

Definition at line 23871 of file object.cc.

23874 {
23875 ASSERT(dst_offset >= 0);
23876 ASSERT(len >= 0);
23877 ASSERT(len <= (dst.Length() - dst_offset));
23878 if (dst.IsOneByteString()) {
23879 NoSafepointScope no_safepoint;
23880 if (len > 0) {
23881 memmove(OneByteString::CharAddr(dst, dst_offset), characters, len);
23882 }
23883 } else if (dst.IsTwoByteString()) {
23884 for (intptr_t i = 0; i < len; ++i) {
23885 *TwoByteString::CharAddr(dst, i + dst_offset) = characters[i];
23886 }
23887 }
23888}

◆ DecodeIRI()

StringPtr dart::String::DecodeIRI ( const String str)
static

Definition at line 24027 of file object.cc.

24027 {
24028 CodePointIterator cpi(str);
24029 intptr_t num_escapes = 0;
24030 intptr_t len = str.Length();
24031 {
24032 CodePointIterator cpi(str);
24033 while (cpi.Next()) {
24034 int32_t code_point = cpi.Current();
24035 if (IsPercent(code_point)) {
24036 // Verify that the two characters following the % are hex digits.
24037 if (!cpi.Next()) {
24038 return String::null();
24039 }
24040 int32_t code_point = cpi.Current();
24041 if (!IsHexCharacter(code_point)) {
24042 return String::null();
24043 }
24044 if (!cpi.Next()) {
24045 return String::null();
24046 }
24047 code_point = cpi.Current();
24048 if (!IsHexCharacter(code_point)) {
24049 return String::null();
24050 }
24051 num_escapes += 2;
24052 }
24053 }
24054 }
24055 intptr_t utf8_len = len - num_escapes;
24056 ASSERT(utf8_len >= 0);
24057 Zone* zone = Thread::Current()->zone();
24058 uint8_t* utf8 = zone->Alloc<uint8_t>(utf8_len);
24059 {
24060 intptr_t index = 0;
24061 CodePointIterator cpi(str);
24062 while (cpi.Next()) {
24063 ASSERT(index < utf8_len);
24064 int32_t code_point = cpi.Current();
24065 if (IsPercent(code_point)) {
24066 cpi.Next();
24067 int32_t ch1 = cpi.Current();
24068 cpi.Next();
24069 int32_t ch2 = cpi.Current();
24070 int32_t merged = MergeHexCharacters(ch1, ch2);
24071 ASSERT(merged >= 0 && merged < 256);
24072 utf8[index] = static_cast<uint8_t>(merged);
24073 } else {
24074 ASSERT(code_point >= 0 && code_point < 256);
24075 utf8[index] = static_cast<uint8_t>(code_point);
24076 }
24077 index++;
24078 }
24079 }
24080 return FromUTF8(utf8, utf8_len);
24081}
static ObjectPtr null()
Definition object.h:433
static StringPtr FromUTF8(const uint8_t *utf8_array, intptr_t array_len, Heap::Space space=Heap::kNew)
Definition object.cc:23784
Zone * zone() const
static bool IsPercent(int32_t c)
Definition object.cc:23948
static bool IsHexCharacter(int32_t c)
Definition object.cc:23952
static int32_t MergeHexCharacters(int32_t c1, int32_t c2)
Definition object.cc:23993

◆ EncodeIRI()

const char * dart::String::EncodeIRI ( const String str)
static

Definition at line 23997 of file object.cc.

23997 {
23998 const intptr_t len = Utf8::Length(str);
23999 Zone* zone = Thread::Current()->zone();
24000 uint8_t* utf8 = zone->Alloc<uint8_t>(len);
24001 str.ToUTF8(utf8, len);
24002 intptr_t num_escapes = 0;
24003 for (int i = 0; i < len; ++i) {
24004 uint8_t byte = utf8[i];
24005 if (!IsURISafeCharacter(byte)) {
24006 num_escapes += 2;
24007 }
24008 }
24009 intptr_t cstr_len = len + num_escapes + 1;
24010 char* cstr = zone->Alloc<char>(cstr_len);
24011 intptr_t index = 0;
24012 for (int i = 0; i < len; ++i) {
24013 uint8_t byte = utf8[i];
24014 if (!IsURISafeCharacter(byte)) {
24015 cstr[index++] = '%';
24016 cstr[index++] = GetHexCharacter(byte >> 4);
24017 cstr[index++] = GetHexCharacter(byte & 0xF);
24018 } else {
24019 ASSERT(byte <= 127);
24020 cstr[index++] = byte;
24021 }
24022 }
24023 cstr[index] = '\0';
24024 return cstr;
24025}
static intptr_t Length(int32_t ch)
Definition unicode.cc:98
static int32_t GetHexCharacter(int32_t c)
Definition object.cc:23975
static bool IsURISafeCharacter(int32_t c)
Definition object.cc:23962

◆ EndsWith()

bool dart::String::EndsWith ( const String other) const

Definition at line 23751 of file object.cc.

23751 {
23752 if (other.IsNull()) {
23753 return false;
23754 }
23755 const intptr_t len = this->Length();
23756 const intptr_t other_len = other.Length();
23757 const intptr_t offset = len - other_len;
23758
23759 if ((other_len == 0) || (other_len > len)) {
23760 return false;
23761 }
23762 for (int i = offset; i < len; i++) {
23763 if (this->CharAt(i) != other.CharAt(i - offset)) {
23764 return false;
23765 }
23766 }
23767 return true;
23768}
Point offset

◆ Equals() [1/7]

bool dart::String::Equals ( const char *  cstr) const

Definition at line 23644 of file object.cc.

23644 {
23645 ASSERT(cstr != nullptr);
23646 CodePointIterator it(*this);
23647 intptr_t len = strlen(cstr);
23648 while (it.Next()) {
23649 if (*cstr == '\0') {
23650 // Lengths don't match.
23651 return false;
23652 }
23653 int32_t ch;
23654 intptr_t consumed =
23655 Utf8::Decode(reinterpret_cast<const uint8_t*>(cstr), len, &ch);
23656 if (consumed == 0 || it.Current() != ch) {
23657 return false;
23658 }
23659 cstr += consumed;
23660 len -= consumed;
23661 }
23662 return *cstr == '\0';
23663}
static intptr_t Decode(const uint8_t *utf8_array, intptr_t array_len, int32_t *ch)
Definition unicode.cc:135

◆ Equals() [2/7]

bool dart::String::Equals ( const Instance other) const
virtual

Definition at line 23610 of file object.cc.

23610 {
23611 if (this->ptr() == other.ptr()) {
23612 // Both handles point to the same raw instance.
23613 return true;
23614 }
23615
23616 if (!other.IsString()) {
23617 return false;
23618 }
23619
23620 const String& other_string = String::Cast(other);
23621 return Equals(other_string);
23622}

◆ Equals() [3/7]

bool dart::String::Equals ( const int32_t *  characters,
intptr_t  len 
) const

Definition at line 23693 of file object.cc.

23693 {
23694 if (len < 0) return false;
23695 intptr_t j = 0;
23696 for (intptr_t i = 0; i < len; ++i) {
23697 if (Utf::IsSupplementary(utf32_array[i])) {
23698 uint16_t encoded[2];
23699 Utf16::Encode(utf32_array[i], &encoded[0]);
23700 if (j + 1 >= Length()) return false;
23701 if (CharAt(j++) != encoded[0]) return false;
23702 if (CharAt(j++) != encoded[1]) return false;
23703 } else {
23704 if (j >= Length()) return false;
23705 if (CharAt(j++) != utf32_array[i]) return false;
23706 }
23707 }
23708 return j == Length();
23709}
static void Encode(int32_t codepoint, uint16_t *dst)
Definition unicode.cc:273
static bool IsSupplementary(int32_t code_point)
Definition unicode.h:31

◆ Equals() [4/7]

bool dart::String::Equals ( const String str) const
inline

Definition at line 13311 of file object.h.

13311 {
13312 if (ptr() == str.ptr()) {
13313 return true; // Both handles point to the same raw instance.
13314 }
13315 if (str.IsNull()) {
13316 return false;
13317 }
13318 if (IsCanonical() && str.IsCanonical()) {
13319 return false; // Two symbols that aren't identical aren't equal.
13320 }
13321 if (HasHash() && str.HasHash() && (Hash() != str.Hash())) {
13322 return false; // Both sides have hash codes and they do not match.
13323 }
13324 return Equals(str, 0, str.Length());
13325}
bool HasHash() const
Definition object.h:10208

◆ Equals() [5/7]

bool dart::String::Equals ( const String str,
intptr_t  begin_index,
intptr_t  len 
) const

Definition at line 23624 of file object.cc.

23626 {
23627 ASSERT(begin_index >= 0);
23628 ASSERT((begin_index == 0) || (begin_index < str.Length()));
23629 ASSERT(len >= 0);
23630 ASSERT(len <= str.Length());
23631 if (len != this->Length()) {
23632 return false; // Lengths don't match.
23633 }
23634
23635 for (intptr_t i = 0; i < len; i++) {
23636 if (CharAt(i) != str.CharAt(begin_index + i)) {
23637 return false;
23638 }
23639 }
23640
23641 return true;
23642}

◆ Equals() [6/7]

bool dart::String::Equals ( const uint16_t *  characters,
intptr_t  len 
) const

Definition at line 23679 of file object.cc.

23679 {
23680 if (len != this->Length()) {
23681 // Lengths don't match.
23682 return false;
23683 }
23684
23685 for (intptr_t i = 0; i < len; i++) {
23686 if (this->CharAt(i) != LoadUnaligned(&utf16_array[i])) {
23687 return false;
23688 }
23689 }
23690 return true;
23691}

◆ Equals() [7/7]

bool dart::String::Equals ( const uint8_t *  characters,
intptr_t  len 
) const
protected

Definition at line 23665 of file object.cc.

23665 {
23666 if (len != this->Length()) {
23667 // Lengths don't match.
23668 return false;
23669 }
23670
23671 for (intptr_t i = 0; i < len; i++) {
23672 if (this->CharAt(i) != latin1_array[i]) {
23673 return false;
23674 }
23675 }
23676 return true;
23677}

◆ EqualsConcat()

bool dart::String::EqualsConcat ( const String str1,
const String str2 
) const

Definition at line 23711 of file object.cc.

23711 {
23712 return (Length() == str1.Length() + str2.Length()) &&
23713 str1.Equals(*this, 0, str1.Length()) &&
23714 str2.Equals(*this, str1.Length(), str2.Length());
23715}

◆ EqualsIgnoringPrivateKey()

bool dart::String::EqualsIgnoringPrivateKey ( const String str1,
const String str2 
)
static

Definition at line 24378 of file object.cc.

24378 {
24379 if (str1.ptr() == str2.ptr()) {
24380 return true; // Both handles point to the same raw instance.
24381 }
24382 NoSafepointScope no_safepoint;
24383 intptr_t str1_class_id = str1.ptr()->GetClassId();
24384 intptr_t str2_class_id = str2.ptr()->GetClassId();
24385 switch (str1_class_id) {
24386 case kOneByteStringCid:
24387 EQUALS_IGNORING_PRIVATE_KEY(str2_class_id, OneByteString, str1, str2);
24388 break;
24389 case kTwoByteStringCid:
24390 EQUALS_IGNORING_PRIVATE_KEY(str2_class_id, TwoByteString, str1, str2);
24391 break;
24392 }
24393 UNREACHABLE();
24394 return false;
24395}
friend class TwoByteString
Definition object.h:10470
friend class OneByteString
Definition object.h:10469
#define EQUALS_IGNORING_PRIVATE_KEY(class_id, type, str1, str2)
Definition object.cc:24369

◆ EqualsLatin1()

bool dart::String::EqualsLatin1 ( const uint8_t *  characters,
intptr_t  len 
) const
inline

Definition at line 10253 of file object.h.

10253 {
10254 return Equals(characters, len);
10255 }

◆ EscapeSpecialCharacters()

StringPtr dart::String::EscapeSpecialCharacters ( const String str)
static

Definition at line 23940 of file object.cc.

23940 {
23941 if (str.IsOneByteString()) {
23943 }
23944 ASSERT(str.IsTwoByteString());
23946}
static OneByteStringPtr EscapeSpecialCharacters(const String &str)
Definition object.cc:24415
static TwoByteStringPtr EscapeSpecialCharacters(const String &str)
Definition object.cc:24609

◆ FINAL_HEAP_OBJECT_IMPLEMENTATION()

dart::String::FINAL_HEAP_OBJECT_IMPLEMENTATION ( String  ,
Instance   
)
protected

◆ FromLatin1()

StringPtr dart::String::FromLatin1 ( const uint8_t *  latin1_array,
intptr_t  array_len,
Heap::Space  space = Heap::kNew 
)
static

Definition at line 23812 of file object.cc.

23814 {
23815 return OneByteString::New(latin1_array, array_len, space);
23816}
static OneByteStringPtr New(intptr_t len, Heap::Space space)
Definition object.cc:24447

◆ FromUTF16()

StringPtr dart::String::FromUTF16 ( const uint16_t *  utf16_array,
intptr_t  array_len,
Heap::Space  space = Heap::kNew 
)
static

Definition at line 23818 of file object.cc.

23820 {
23821 bool is_one_byte_string = true;
23822 for (intptr_t i = 0; i < array_len; ++i) {
23823 if (!Utf::IsLatin1(LoadUnaligned(&utf16_array[i]))) {
23824 is_one_byte_string = false;
23825 break;
23826 }
23827 }
23828 if (is_one_byte_string) {
23829 return OneByteString::New(utf16_array, array_len, space);
23830 }
23831 return TwoByteString::New(utf16_array, array_len, space);
23832}
static TwoByteStringPtr New(intptr_t len, Heap::Space space)
Definition object.cc:24641

◆ FromUTF32()

StringPtr dart::String::FromUTF32 ( const int32_t *  utf32_array,
intptr_t  array_len,
Heap::Space  space = Heap::kNew 
)
static

Definition at line 23834 of file object.cc.

23836 {
23837 bool is_one_byte_string = true;
23838 intptr_t utf16_len = array_len;
23839 for (intptr_t i = 0; i < array_len; ++i) {
23840 if (!Utf::IsLatin1(utf32_array[i])) {
23841 is_one_byte_string = false;
23842 if (Utf::IsSupplementary(utf32_array[i])) {
23843 utf16_len += 1;
23844 }
23845 }
23846 }
23847 if (is_one_byte_string) {
23848 return OneByteString::New(utf32_array, array_len, space);
23849 }
23850 return TwoByteString::New(utf16_len, utf32_array, array_len, space);
23851}

◆ FromUTF8()

StringPtr dart::String::FromUTF8 ( const uint8_t *  utf8_array,
intptr_t  array_len,
Heap::Space  space = Heap::kNew 
)
static

Definition at line 23784 of file object.cc.

23786 {
23788 intptr_t len = Utf8::CodeUnitCount(utf8_array, array_len, &type);
23789 if (type == Utf8::kLatin1) {
23790 const String& strobj = String::Handle(OneByteString::New(len, space));
23791 if (len > 0) {
23792 NoSafepointScope no_safepoint;
23793 if (!Utf8::DecodeToLatin1(utf8_array, array_len,
23794 OneByteString::DataStart(strobj), len)) {
23795 Utf8::ReportInvalidByte(utf8_array, array_len, len);
23796 return String::null();
23797 }
23798 }
23799 return strobj.ptr();
23800 }
23802 const String& strobj = String::Handle(TwoByteString::New(len, space));
23803 NoSafepointScope no_safepoint;
23804 if (!Utf8::DecodeToUTF16(utf8_array, array_len,
23805 TwoByteString::DataStart(strobj), len)) {
23806 Utf8::ReportInvalidByte(utf8_array, array_len, len);
23807 return String::null();
23808 }
23809 return strobj.ptr();
23810}
@ kSupplementary
Definition unicode.h:46
static intptr_t CodeUnitCount(const uint8_t *utf8_array, intptr_t array_len, Type *type)
Definition unicode.cc:46
static intptr_t ReportInvalidByte(const uint8_t *utf8_array, intptr_t array_len, intptr_t len)
Definition unicode.cc:163
static bool DecodeToUTF16(const uint8_t *utf8_array, intptr_t array_len, uint16_t *dst, intptr_t len)
Definition unicode.cc:217
static bool DecodeToLatin1(const uint8_t *utf8_array, intptr_t array_len, uint8_t *dst, intptr_t len)
Definition unicode.cc:194

◆ GetCachedHash()

static uint32_t dart::String::GetCachedHash ( const StringPtr  obj)
inlinestatic

Definition at line 10424 of file object.h.

10424 {
10425 return Smi::Value(obj->untag()->hash_);
10426 }
intptr_t Value() const
Definition object.h:9969

◆ Hash() [1/7]

uword dart::String::Hash ( ) const
inline

Definition at line 10195 of file object.h.

10195 {
10197 if (result != 0) {
10198 return result;
10199 }
10200 result = String::Hash(*this, 0, this->Length());
10201 uword set_hash = SetCachedHashIfNotSet(ptr(), result);
10202 ASSERT(set_hash == result);
10203 return result;
10204 }
static uint32_t SetCachedHashIfNotSet(StringPtr obj, uint32_t hash)
Definition object.h:10428
static uint32_t GetCachedHash(const StringPtr obj)
Definition object.h:10424
GAsyncResult * result
uintptr_t uword
Definition globals.h:501

◆ Hash() [2/7]

uword dart::String::Hash ( const char *  characters,
intptr_t  len 
)
static

Definition at line 23583 of file object.cc.

23583 {
23584 StringHasher hasher;
23585 hasher.Add(reinterpret_cast<const uint8_t*>(characters), len);
23586 return hasher.Finalize();
23587}

◆ Hash() [3/7]

static uword dart::String::Hash ( const int32_t *  characters,
intptr_t  len 
)
static

◆ Hash() [4/7]

uword dart::String::Hash ( const String str,
intptr_t  begin_index,
intptr_t  len 
)
static

Definition at line 23558 of file object.cc.

23558 {
23559 StringHasher hasher;
23560 hasher.Add(str, begin_index, len);
23561 return hasher.Finalize();
23562}

◆ Hash() [5/7]

uword dart::String::Hash ( const uint16_t *  characters,
intptr_t  len 
)
static

Definition at line 23595 of file object.cc.

23595 {
23596 StringHasher hasher;
23597 hasher.Add(characters, len);
23598 return hasher.Finalize();
23599}

◆ Hash() [6/7]

uword dart::String::Hash ( const uint8_t *  characters,
intptr_t  len 
)
staticprotected

Definition at line 23589 of file object.cc.

23589 {
23590 StringHasher hasher;
23591 hasher.Add(characters, len);
23592 return hasher.Finalize();
23593}

◆ Hash() [7/7]

uword dart::String::Hash ( StringPtr  raw)
static

Definition at line 23571 of file object.cc.

23571 {
23572 StringHasher hasher;
23573 uword length = Smi::Value(raw->untag()->length());
23574 if (raw->IsOneByteString()) {
23575 const uint8_t* data = static_cast<OneByteStringPtr>(raw)->untag()->data();
23576 return String::Hash(data, length);
23577 } else {
23578 const uint16_t* data = static_cast<TwoByteStringPtr>(raw)->untag()->data();
23579 return String::Hash(data, length);
23580 }
23581}
size_t length
raw_obj untag() -> num_entries()) VARIABLE_COMPRESSED_VISITOR(Array, Smi::Value(raw_obj->untag() ->length())) VARIABLE_COMPRESSED_VISITOR(TypedData, TypedData::ElementSizeInBytes(raw_obj->GetClassId()) *Smi::Value(raw_obj->untag() ->length())) VARIABLE_COMPRESSED_VISITOR(Record, RecordShape(raw_obj->untag() ->shape()).num_fields()) VARIABLE_NULL_VISITOR(CompressedStackMaps, CompressedStackMaps::PayloadSizeOf(raw_obj)) VARIABLE_NULL_VISITOR(OneByteString, Smi::Value(raw_obj->untag() ->length())) VARIABLE_NULL_VISITOR(TwoByteString, Smi::Value(raw_obj->untag() ->length())) intptr_t UntaggedField::VisitFieldPointers(FieldPtr raw_obj, ObjectPointerVisitor *visitor)
static int8_t data[kExtLength]

◆ hash_offset()

static intptr_t dart::String::hash_offset ( )
inlinestatic

Definition at line 10213 of file object.h.

10213 {
10214#if defined(HASH_IN_OBJECT_HEADER)
10216 return OFFSET_OF(UntaggedObject, tags_) +
10218#else
10219 return OFFSET_OF(UntaggedString, hash_);
10220#endif
10221 }
#define COMPILE_ASSERT(expr)
Definition assert.h:339
constexpr intptr_t kBitsPerByte
Definition globals.h:463
#define OFFSET_OF(type, field)
Definition globals.h:138

◆ HasHash()

bool dart::String::HasHash ( ) const
inline

Definition at line 10208 of file object.h.

10208 {
10209 ASSERT(Smi::New(0) == nullptr);
10210 return GetCachedHash(ptr()) != 0;
10211 }
static SmiPtr New(intptr_t value)
Definition object.h:9985

◆ HashCode()

virtual ObjectPtr dart::String::HashCode ( ) const
inlinevirtual

Reimplemented from dart::Instance.

Definition at line 10236 of file object.h.

10236{ return Integer::New(Hash()); }
static IntegerPtr New(const String &str, Heap::Space space=Heap::kNew)
Definition object.cc:23063

◆ HashConcat()

uword dart::String::HashConcat ( const String str1,
const String str2 
)
static

Definition at line 23564 of file object.cc.

23564 {
23565 StringHasher hasher;
23566 hasher.Add(str1, 0, str1.Length());
23567 hasher.Add(str2, 0, str2.Length());
23568 return hasher.Finalize();
23569}

◆ HashRawSymbol()

static uword dart::String::HashRawSymbol ( const StringPtr  symbol)
inlinestatic

Definition at line 10226 of file object.h.

10226 {
10227 ASSERT(symbol->untag()->IsCanonical());
10228 const uword result = GetCachedHash(symbol);
10229 ASSERT(result != 0);
10230 return result;
10231 }

◆ HeaderSize()

static intptr_t dart::String::HeaderSize ( )
inlinestatic

Definition at line 10154 of file object.h.

10154{ return String::kSizeofRawString; }
static constexpr intptr_t kSizeofRawString
Definition object.h:10149

◆ InstanceSize()

static intptr_t dart::String::InstanceSize ( )
inlinestatic

Definition at line 10156 of file object.h.

10156 {
10157 return RoundedAllocationSize(sizeof(UntaggedString));
10158 }
static constexpr intptr_t RoundedAllocationSize(intptr_t size)
Definition object.h:758

◆ IsOneByteString()

bool dart::String::IsOneByteString ( ) const
inline

Definition at line 10290 of file object.h.

10290 {
10291 return ptr()->GetClassId() == kOneByteStringCid;
10292 }

◆ IsSymbol()

bool dart::String::IsSymbol ( ) const
inline

Definition at line 10288 of file object.h.

10288{ return ptr()->untag()->IsCanonical(); }
UntaggedObject * untag() const
bool IsCanonical() const
Definition raw_object.h:329

◆ IsTwoByteString()

bool dart::String::IsTwoByteString ( ) const
inline

Definition at line 10294 of file object.h.

10294 {
10295 return ptr()->GetClassId() == kTwoByteStringCid;
10296 }

◆ Length()

intptr_t dart::String::Length ( ) const
inline

Definition at line 10189 of file object.h.

10189{ return LengthOf(ptr()); }
static intptr_t LengthOf(StringPtr obj)
Definition object.h:10190

◆ length_offset()

static intptr_t dart::String::length_offset ( )
inlinestatic

Definition at line 10193 of file object.h.

10193{ return OFFSET_OF(UntaggedString, length_); }

◆ LengthOf()

static intptr_t dart::String::LengthOf ( StringPtr  obj)
inlinestatic

Definition at line 10190 of file object.h.

10190 {
10191 return Smi::Value(obj->untag()->length());
10192 }

◆ New() [1/2]

StringPtr dart::String::New ( const char *  cstr,
Heap::Space  space = Heap::kNew 
)
static

Definition at line 23777 of file object.cc.

23777 {
23778 ASSERT(cstr != nullptr);
23779 intptr_t array_len = strlen(cstr);
23780 const uint8_t* utf8_array = reinterpret_cast<const uint8_t*>(cstr);
23781 return String::FromUTF8(utf8_array, array_len, space);
23782}

◆ New() [2/2]

StringPtr dart::String::New ( const String str,
Heap::Space  space = Heap::kNew 
)
static

Definition at line 23853 of file object.cc.

23853 {
23854 // Currently this just creates a copy of the string in the correct space.
23855 // Once we have external string support, this will also create a heap copy of
23856 // the string if necessary. Some optimizations are possible, such as not
23857 // copying internal strings into the same space.
23858 intptr_t len = str.Length();
23859 String& result = String::Handle();
23860 intptr_t char_size = str.CharSize();
23861 if (char_size == kOneByteChar) {
23862 result = OneByteString::New(len, space);
23863 } else {
23864 ASSERT(char_size == kTwoByteChar);
23865 result = TwoByteString::New(len, space);
23866 }
23867 String::Copy(result, 0, str, 0, len);
23868 return result.ptr();
23869}

◆ NewExternal() [1/2]

static StringPtr dart::String::NewExternal ( const uint16_t *  utf16_array,
intptr_t  array_len,
void *  peer,
intptr_t  external_allocation_size,
Dart_HandleFinalizer  callback,
Heap::Space  = Heap::kNew 
)
static

◆ NewExternal() [2/2]

static StringPtr dart::String::NewExternal ( const uint8_t *  utf8_array,
intptr_t  array_len,
void *  peer,
intptr_t  external_allocation_size,
Dart_HandleFinalizer  callback,
Heap::Space  = Heap::kNew 
)
static

◆ NewFormatted() [1/2]

StringPtr dart::String::NewFormatted ( const char *  format,
  ... 
)
static

Definition at line 24083 of file object.cc.

24083 {
24084 va_list args;
24086 StringPtr result = NewFormattedV(format, args);
24087 NoSafepointScope no_safepoint;
24088 va_end(args);
24089 return result;
24090}
static StringPtr static StringPtr static StringPtr NewFormattedV(const char *format, va_list args, Heap::Space space=Heap::kNew)
Definition object.cc:24101
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint32_t uint32_t * format
va_start(args, format)
va_end(args)

◆ NewFormatted() [2/2]

StringPtr dart::String::NewFormatted ( Heap::Space  space,
const char *  format,
  ... 
)
static

Definition at line 24092 of file object.cc.

24092 {
24093 va_list args;
24095 StringPtr result = NewFormattedV(format, args, space);
24096 NoSafepointScope no_safepoint;
24097 va_end(args);
24098 return result;
24099}

◆ NewFormattedV()

StringPtr dart::String::NewFormattedV ( const char *  format,
va_list  args,
Heap::Space  space = Heap::kNew 
)
static

Definition at line 24101 of file object.cc.

24103 {
24104 va_list args_copy;
24105 va_copy(args_copy, args);
24106 intptr_t len = Utils::VSNPrint(nullptr, 0, format, args_copy);
24107 va_end(args_copy);
24108
24109 Zone* zone = Thread::Current()->zone();
24110 char* buffer = zone->Alloc<char>(len + 1);
24111 Utils::VSNPrint(buffer, (len + 1), format, args);
24112
24113 return String::New(buffer, space);
24114}
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
Definition object.cc:23777
static int static int VSNPrint(char *str, size_t size, const char *format, va_list args)
ElementType * Alloc(intptr_t length)
static const uint8_t buffer[]

◆ OperatorEquals()

virtual bool dart::String::OperatorEquals ( const Instance other) const
inlinevirtual

Reimplemented from dart::Instance.

Definition at line 10266 of file object.h.

10266 {
10267 return Equals(other);
10268 }

◆ ParseDouble()

bool dart::String::ParseDouble ( const String str,
intptr_t  start,
intptr_t  end,
double *  result 
)
static

Definition at line 24286 of file object.cc.

24289 {
24290 ASSERT(0 <= start);
24291 ASSERT(start <= end);
24292 ASSERT(end <= str.Length());
24293 intptr_t length = end - start;
24294 NoSafepointScope no_safepoint;
24295 const uint8_t* startChar;
24296 if (str.IsOneByteString()) {
24297 startChar = OneByteString::CharAddr(str, start);
24298 } else {
24299 uint8_t* chars = Thread::Current()->zone()->Alloc<uint8_t>(length);
24300 for (intptr_t i = 0; i < length; i++) {
24301 int32_t ch = str.CharAt(start + i);
24302 if (ch < 128) {
24303 chars[i] = ch;
24304 } else {
24305 return false; // Not ASCII, so definitely not valid double numeral.
24306 }
24307 }
24308 startChar = chars;
24309 }
24310 return CStringToDouble(reinterpret_cast<const char*>(startChar), length,
24311 result);
24312}
bool CStringToDouble(const char *str, intptr_t length, double *result)

◆ RemovePrivateKey()

StringPtr dart::String::RemovePrivateKey ( const String name)
static

Definition at line 233 of file object.cc.

233 {
234 ASSERT(name.IsOneByteString());
235 GrowableArray<uint8_t> without_key(name.Length());
236 intptr_t i = 0;
237 while (i < name.Length()) {
238 while (i < name.Length()) {
239 uint8_t c = name.CharAt(i++);
240 if (c == '@') break;
241 without_key.Add(c);
242 }
243 while (i < name.Length()) {
244 uint8_t c = name.CharAt(i);
245 if ((c < '0') || (c > '9')) break;
246 i++;
247 }
248 }
249
250 return String::FromLatin1(without_key.data(), without_key.length());
251}
static StringPtr FromLatin1(const uint8_t *latin1_array, intptr_t array_len, Heap::Space space=Heap::kNew)
Definition object.cc:23812
const char *const name

◆ ScrubName()

const char * dart::String::ScrubName ( const String name,
bool  is_extension = false 
)
static

Definition at line 287 of file object.cc.

287 {
288 Thread* thread = Thread::Current();
289 NoSafepointScope no_safepoint(thread);
290 Zone* zone = thread->zone();
291 ZoneTextBuffer printer(zone);
292
293#if !defined(DART_PRECOMPILED_RUNTIME)
294 if (name.Equals(Symbols::TopLevel())) {
295 // Name of invisible top-level class.
296 return "";
297 }
298#endif // !defined(DART_PRECOMPILED_RUNTIME)
299
300 const char* cname = name.ToCString();
301 ASSERT(strlen(cname) == static_cast<size_t>(name.Length()));
302 const intptr_t name_len = name.Length();
303 // First remove all private name mangling and if 'is_extension' is true
304 // substitute the first '|' character with '.'.
305 intptr_t start_pos = 0;
306 intptr_t sum_segment_len = 0;
307 for (intptr_t i = 0; i < name_len; i++) {
308 if ((cname[i] == '@') && ((i + 1) < name_len) && (cname[i + 1] >= '0') &&
309 (cname[i + 1] <= '9')) {
310 // Append the current segment to the unmangled name.
311 const intptr_t segment_len = i - start_pos;
312 sum_segment_len += segment_len;
313 AppendSubString(&printer, cname, start_pos, segment_len);
314 // Advance until past the name mangling. The private keys are only
315 // numbers so we skip until the first non-number.
316 i++; // Skip the '@'.
317 while ((i < name.Length()) && (name.CharAt(i) >= '0') &&
318 (name.CharAt(i) <= '9')) {
319 i++;
320 }
321 start_pos = i;
322 i--; // Account for for-loop increment.
323 } else if (is_extension && cname[i] == '|') {
324 // Append the current segment to the unmangled name.
325 const intptr_t segment_len = i - start_pos;
326 AppendSubString(&printer, cname, start_pos, segment_len);
327 // Append the '.' character (replaces '|' with '.').
328 AppendSubString(&printer, ".", 0, 1);
329 start_pos = i + 1;
330 // Account for length of segments added so far.
331 sum_segment_len += (segment_len + 1);
332 }
333 }
334
335 const char* unmangled_name = nullptr;
336 if (start_pos == 0) {
337 // No name unmangling needed, reuse the name that was passed in.
338 unmangled_name = cname;
339 sum_segment_len = name_len;
340 } else if (name.Length() != start_pos) {
341 // Append the last segment.
342 const intptr_t segment_len = name.Length() - start_pos;
343 sum_segment_len += segment_len;
344 AppendSubString(&printer, cname, start_pos, segment_len);
345 }
346 if (unmangled_name == nullptr) {
347 // Merge unmangled_segments.
348 unmangled_name = printer.buffer();
349 }
350
351 printer.Clear();
352 intptr_t start = 0;
353 intptr_t len = sum_segment_len;
354 bool is_setter = false;
355 if (is_extension) {
356 // First scan till we see the '.' character.
357 for (intptr_t i = 0; i < len; i++) {
358 if (unmangled_name[i] == '.') {
359 intptr_t slen = i + 1;
360 intptr_t plen = slen - start;
361 AppendSubString(&printer, unmangled_name, start, plen);
362 unmangled_name += slen;
363 len -= slen;
364 break;
365 } else if (unmangled_name[i] == ':') {
366 if (start != 0) {
367 // Reset and break.
368 start = 0;
369 is_setter = false;
370 break;
371 }
372 if (unmangled_name[0] == 's') {
373 is_setter = true;
374 }
375 start = i + 1;
376 }
377 }
378 }
379 intptr_t dot_pos = -1; // Position of '.' in the name, if any.
380 start = 0;
381 for (intptr_t i = start; i < len; i++) {
382 if (unmangled_name[i] == ':' ||
383 (is_extension && unmangled_name[i] == '#')) {
384 if (start != 0) {
385 // Reset and break.
386 start = 0;
387 dot_pos = -1;
388 break;
389 }
390 ASSERT(start == 0); // Only one : is possible in getters or setters.
391 if (unmangled_name[0] == 's') {
392 ASSERT(!is_setter);
393 is_setter = true;
394 }
395 start = i + 1;
396 } else if (unmangled_name[i] == '.') {
397 if (dot_pos != -1) {
398 // Reset and break.
399 start = 0;
400 dot_pos = -1;
401 break;
402 }
403 ASSERT(dot_pos == -1); // Only one dot is supported.
404 dot_pos = i;
405 }
406 }
407
408 if (!is_extension && (start == 0) && (dot_pos == -1)) {
409 // This unmangled_name is fine as it is.
410 return unmangled_name;
411 }
412
413 // Drop the trailing dot if needed.
414 intptr_t end = ((dot_pos + 1) == len) ? dot_pos : len;
415
416 intptr_t substr_len = end - start;
417 AppendSubString(&printer, unmangled_name, start, substr_len);
418 if (is_setter) {
419 const char* equals = Symbols::Equals().ToCString();
420 const intptr_t equals_len = strlen(equals);
421 AppendSubString(&printer, equals, 0, equals_len);
422 }
423
424 return printer.buffer();
425}
static bool equals(T *a, T *b)
static const char * ToCString(Thread *thread, StringPtr ptr)
Definition object.cc:24205
static const String & Equals()
Definition symbols.h:613
static void AppendSubString(BaseTextBuffer *buffer, const char *name, intptr_t start_pos, intptr_t len)
Definition object.cc:193

◆ ScrubNameRetainPrivate()

StringPtr dart::String::ScrubNameRetainPrivate ( const String name,
bool  is_extension = false 
)
static

Definition at line 427 of file object.cc.

428 {
429#if !defined(DART_PRECOMPILED_RUNTIME)
430 intptr_t len = name.Length();
431 intptr_t start = 0;
432 intptr_t at_pos = -1; // Position of '@' in the name, if any.
433 bool is_setter = false;
434
435 String& result = String::Handle();
436
437 // If extension strip out the leading prefix e.g" ext|func would strip out
438 // 'ext|'.
439 if (is_extension) {
440 // First scan till we see the '|' character.
441 for (intptr_t i = 0; i < len; i++) {
442 if (name.CharAt(i) == '|') {
445 start = i + 1;
446 break;
447 } else if (name.CharAt(i) == ':') {
448 if (start != 0) {
449 // Reset and break.
450 start = 0;
451 is_setter = false;
452 break;
453 }
454 if (name.CharAt(0) == 's') {
455 is_setter = true;
456 }
457 start = i + 1;
458 }
459 }
460 }
461
462 for (intptr_t i = start; i < len; i++) {
463 if (name.CharAt(i) == ':' || (is_extension && name.CharAt(i) == '#')) {
464 // Only one : is possible in getters or setters.
465 ASSERT(is_extension || start == 0);
466 if (name.CharAt(start) == 's') {
467 is_setter = true;
468 }
469 start = i + 1;
470 } else if (name.CharAt(i) == '@') {
471 // Setters should have only one @ so we know where to put the =.
472 ASSERT(!is_setter || (at_pos == -1));
473 at_pos = i;
474 }
475 }
476
477 if (start == 0) {
478 // This unmangled_name is fine as it is.
479 return name.ptr();
480 }
481
482 if (is_extension) {
483 const String& fname =
485 result = String::Concat(result, fname);
486 } else {
488 }
489
490 if (is_setter) {
491 // Setters need to end with '='.
492 if (at_pos == -1) {
494 } else {
495 const String& pre_at =
496 String::Handle(String::SubString(result, 0, at_pos - 4));
497 const String& post_at =
498 String::Handle(String::SubString(name, at_pos, len - at_pos));
500 result = String::Concat(result, post_at);
501 }
502 }
503
504 return result.ptr();
505#endif // !defined(DART_PRECOMPILED_RUNTIME)
506 return name.ptr(); // In AOT, return argument unchanged.
507}
static StringPtr SubString(const String &str, intptr_t begin_index, Heap::Space space=Heap::kNew)
Definition object.cc:24159
static StringPtr Concat(const String &str1, const String &str2, Heap::Space space=Heap::kNew)
Definition object.cc:24116
static const String & Dot()
Definition symbols.h:612

◆ SetCachedHash()

static uint32_t dart::String::SetCachedHash ( StringPtr  obj,
uint32_t  hash 
)
inlinestatic

Definition at line 10433 of file object.h.

10433 {
10434 obj->untag()->hash_ = Smi::New(hash);
10435 return hash;
10436 }
static uint32_t hash(const SkShaderBase::GradientInfo &v)

◆ SetCachedHashIfNotSet()

static uint32_t dart::String::SetCachedHashIfNotSet ( StringPtr  obj,
uint32_t  hash 
)
inlinestatic

Definition at line 10428 of file object.h.

10428 {
10429 ASSERT(Smi::Value(obj->untag()->hash_) == 0 ||
10430 Smi::Value(obj->untag()->hash_) == static_cast<intptr_t>(hash));
10431 return SetCachedHash(obj, hash);
10432 }
static uint32_t SetCachedHash(StringPtr obj, uint32_t hash)
Definition object.h:10433

◆ SetHash()

void dart::String::SetHash ( intptr_t  value) const
inlineprotected

Definition at line 10456 of file object.h.

10456 {
10457 const intptr_t hash_set = SetCachedHashIfNotSet(ptr(), value);
10458 ASSERT(hash_set == value);
10459 }

◆ SetLength()

void dart::String::SetLength ( intptr_t  value) const
inlineprotected

Definition at line 10450 of file object.h.

10450 {
10451 // This is only safe because we create a new Smi, which does not cause
10452 // heap allocation.
10453 untag()->set_length(Smi::New(value));
10454 }

◆ StartsWith() [1/2]

bool dart::String::StartsWith ( const String other) const
inline

Definition at line 10277 of file object.h.

10277 {
10278 NoSafepointScope no_safepoint;
10279 return StartsWith(ptr(), other.ptr());
10280 }
bool StartsWith(const String &other) const
Definition object.h:10277

◆ StartsWith() [2/2]

bool dart::String::StartsWith ( StringPtr  str,
StringPtr  prefix 
)
static

Definition at line 23736 of file object.cc.

23736 {
23737 if (prefix == String::null()) return false;
23738
23739 const intptr_t length = String::LengthOf(str);
23740 const intptr_t prefix_length = String::LengthOf(prefix);
23741 if (prefix_length > length) return false;
23742
23743 for (intptr_t i = 0; i < prefix_length; i++) {
23744 if (String::CharAt(str, i) != String::CharAt(prefix, i)) {
23745 return false;
23746 }
23747 }
23748 return true;
23749}

◆ SubString() [1/3]

StringPtr dart::String::SubString ( const String str,
intptr_t  begin_index,
Heap::Space  space = Heap::kNew 
)
static

Definition at line 24159 of file object.cc.

24161 {
24162 ASSERT(!str.IsNull());
24163 if (begin_index >= str.Length()) {
24164 return String::null();
24165 }
24166 return String::SubString(str, begin_index, (str.Length() - begin_index),
24167 space);
24168}

◆ SubString() [2/3]

static StringPtr dart::String::SubString ( const String str,
intptr_t  begin_index,
intptr_t  length,
Heap::Space  space = Heap::kNew 
)
inlinestatic

Definition at line 10382 of file object.h.

10385 {
10386 return SubString(Thread::Current(), str, begin_index, length, space);
10387 }

◆ SubString() [3/3]

StringPtr dart::String::SubString ( Thread thread,
const String str,
intptr_t  begin_index,
intptr_t  length,
Heap::Space  space = Heap::kNew 
)
static

Definition at line 24170 of file object.cc.

24174 {
24175 ASSERT(!str.IsNull());
24176 ASSERT(begin_index >= 0);
24177 ASSERT(length >= 0);
24178 if (begin_index <= str.Length() && length == 0) {
24179 return Symbols::Empty().ptr();
24180 }
24181 if (begin_index > str.Length()) {
24182 return String::null();
24183 }
24184 bool is_one_byte_string = true;
24185 intptr_t char_size = str.CharSize();
24186 if (char_size == kTwoByteChar) {
24187 for (intptr_t i = begin_index; i < begin_index + length; ++i) {
24188 if (!Utf::IsLatin1(str.CharAt(i))) {
24189 is_one_byte_string = false;
24190 break;
24191 }
24192 }
24193 }
24195 String& result = thread->StringHandle();
24196 if (is_one_byte_string) {
24198 } else {
24200 }
24201 String::Copy(result, 0, str, begin_index, length);
24202 return result.ptr();
24203}
static const String & Empty()
Definition symbols.h:687
#define REUSABLE_STRING_HANDLESCOPE(thread)

◆ ToCString()

const char * dart::String::ToCString ( Thread thread,
StringPtr  ptr 
)
static

Definition at line 24205 of file object.cc.

24205 {
24206 if (IsNull()) {
24207 return "String: null";
24208 }
24209 const intptr_t len = Utf8::Length(*this);
24210 Zone* zone = Thread::Current()->zone();
24211 uint8_t* result = zone->Alloc<uint8_t>(len + 1);
24212 ToUTF8(result, len);
24213 result[len] = 0;
24214 return reinterpret_cast<const char*>(result);
24215}
bool IsNull() const
Definition object.h:363
void ToUTF8(uint8_t *utf8_array, intptr_t array_len) const
Definition object.cc:24225

◆ ToLowerCase()

StringPtr dart::String::ToLowerCase ( const String str,
Heap::Space  space = Heap::kNew 
)
static

Definition at line 24281 of file object.cc.

24281 {
24282 // TODO(cshapiro): create a fast-path for OneByteString instances.
24283 return Transform(CaseMapping::ToLower, str, space);
24284}
static int32_t ToLower(int32_t code_point)
Definition unicode.h:179
static StringPtr Transform(int32_t(*mapping)(int32_t ch), const String &str, Heap::Space space=Heap::kNew)
Definition object.cc:24251

◆ ToMallocCString()

char * dart::String::ToMallocCString ( ) const

Definition at line 24217 of file object.cc.

24217 {
24218 const intptr_t len = Utf8::Length(*this);
24219 uint8_t* result = reinterpret_cast<uint8_t*>(malloc(len + 1));
24220 ToUTF8(result, len);
24221 result[len] = 0;
24222 return reinterpret_cast<char*>(result);
24223}
void * malloc(size_t size)
Definition allocation.cc:19

◆ ToUpperCase()

StringPtr dart::String::ToUpperCase ( const String str,
Heap::Space  space = Heap::kNew 
)
static

Definition at line 24276 of file object.cc.

24276 {
24277 // TODO(cshapiro): create a fast-path for OneByteString instances.
24278 return Transform(CaseMapping::ToUpper, str, space);
24279}
static int32_t ToUpper(int32_t code_point)
Definition unicode.h:174

◆ ToUTF8()

void dart::String::ToUTF8 ( uint8_t *  utf8_array,
intptr_t  array_len 
) const

Definition at line 24225 of file object.cc.

24225 {
24226 ASSERT(array_len >= Utf8::Length(*this));
24227 Utf8::Encode(*this, reinterpret_cast<char*>(utf8_array), array_len);
24228}
static intptr_t Encode(int32_t ch, char *dst)
Definition unicode.cc:110

◆ Transform()

StringPtr dart::String::Transform ( int32_t(*)(int32_t ch)  mapping,
const String str,
Heap::Space  space = Heap::kNew 
)
static

Definition at line 24251 of file object.cc.

24253 {
24254 ASSERT(!str.IsNull());
24255 bool has_mapping = false;
24256 int32_t dst_max = 0;
24257 CodePointIterator it(str);
24258 while (it.Next()) {
24259 int32_t src = it.Current();
24260 int32_t dst = mapping(src);
24261 if (src != dst) {
24262 has_mapping = true;
24263 }
24264 dst_max = Utils::Maximum(dst_max, dst);
24265 }
24266 if (!has_mapping) {
24267 return str.ptr();
24268 }
24269 if (Utf::IsLatin1(dst_max)) {
24270 return OneByteString::Transform(mapping, str, space);
24271 }
24272 ASSERT(Utf::IsBmp(dst_max) || Utf::IsSupplementary(dst_max));
24273 return TwoByteString::Transform(mapping, str, space);
24274}
static OneByteStringPtr Transform(int32_t(*mapping)(int32_t ch), const String &str, Heap::Space space)
Definition object.cc:24573
static TwoByteStringPtr Transform(int32_t(*mapping)(int32_t ch), const String &str, Heap::Space space)
Definition object.cc:24752
static bool IsBmp(int32_t code_point)
Definition unicode.h:27

Friends And Related Symbol Documentation

◆ CharArray

template<typename CharType >
friend class CharArray
friend

Definition at line 10467 of file object.h.

◆ Class

friend class Class
friend

Definition at line 10463 of file object.h.

◆ ConcatString

friend class ConcatString
friend

Definition at line 10468 of file object.h.

◆ OneByteString

friend class OneByteString
friend

Definition at line 10469 of file object.h.

◆ Pass2Visitor

friend class Pass2Visitor
friend

Definition at line 10473 of file object.h.

◆ RODataSerializationCluster

friend class RODataSerializationCluster
friend

Definition at line 10472 of file object.h.

◆ StringSlice

friend class StringSlice
friend

Definition at line 10465 of file object.h.

◆ Symbols

friend class Symbols
friend

Definition at line 10464 of file object.h.

◆ TwoByteString

friend class TwoByteString
friend

Definition at line 10470 of file object.h.

◆ UntaggedOneByteString

friend class UntaggedOneByteString
friend

Definition at line 10471 of file object.h.

Member Data Documentation

◆ kMaxElements

constexpr intptr_t dart::String::kMaxElements = kSmiMax / kTwoByteChar
staticconstexpr

Definition at line 10152 of file object.h.

◆ kOneByteChar

constexpr intptr_t dart::String::kOneByteChar = 1
staticconstexpr

Definition at line 10139 of file object.h.

◆ kSizeofRawString

constexpr intptr_t dart::String::kSizeofRawString
staticconstexpr
Initial value:
=
sizeof(UntaggedInstance) + 2 * kWordSize
constexpr intptr_t kWordSize
Definition globals.h:509

Definition at line 10149 of file object.h.

◆ kTwoByteChar

constexpr intptr_t dart::String::kTwoByteChar = 2
staticconstexpr

Definition at line 10140 of file object.h.


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