V8 Project
v8::internal::Name Class Reference

#include <objects.h>

+ Inheritance diagram for v8::internal::Name:
+ Collaboration diagram for v8::internal::Name:

Classes

class  ArrayIndexLengthBits
 
class  ArrayIndexValueBits
 

Public Member Functions

uint32_t hash_field ()
 
void set_hash_field (uint32_t value)
 
bool HasHashCode ()
 
uint32_t Hash ()
 
bool Equals (Name *other)
 
bool AsArrayIndex (uint32_t *index)
 
bool IsOwn ()
 
 STATIC_ASSERT ((kArrayIndexLengthBits > 0))
 
 STATIC_ASSERT (IS_POWER_OF_TWO(kMaxCachedArrayIndexLength+1))
 
- Public Member Functions inherited from v8::internal::HeapObject
Mapmap () const
 
void set_map (Map *value)
 
void set_map_no_write_barrier (Map *value)
 
Mapsynchronized_map ()
 
MapWord synchronized_map_word () const
 
void synchronized_set_map (Map *value)
 
void synchronized_set_map_no_write_barrier (Map *value)
 
void synchronized_set_map_word (MapWord map_word)
 
MapWord map_word () const
 
void set_map_word (MapWord map_word)
 
HeapGetHeap () const
 
IsolateGetIsolate () const
 
Address address ()
 
void Iterate (ObjectVisitor *v)
 
void IterateBody (InstanceType type, int object_size, ObjectVisitor *v)
 
int Size ()
 
bool MayContainRawValues ()
 
int SizeFromMap (Map *map)
 
WriteBarrierMode GetWriteBarrierMode (const DisallowHeapAllocation &promise)
 
void HeapObjectShortPrint (OStream &os)
 
 STATIC_ASSERT (kMapOffset==Internals::kHeapObjectMapOffset)
 
- Public Member Functions inherited from v8::internal::Object
bool IsObject () const
 
 INLINE (bool IsFixedArrayBase() const)
 
 INLINE (bool IsExternal() const)
 
 INLINE (bool IsAccessorInfo() const)
 
 INLINE (bool IsStruct() const)
 
 INLINE (bool IsSpecObject()) const
 
 INLINE (bool IsSpecFunction()) const
 
 INLINE (bool IsTemplateInfo()) const
 
 INLINE (bool IsNameDictionary() const)
 
 INLINE (bool IsSeededNumberDictionary() const)
 
 INLINE (bool IsUnseededNumberDictionary() const)
 
 INLINE (bool IsOrderedHashSet() const)
 
 INLINE (bool IsOrderedHashMap() const)
 
bool IsCallable () const
 
 INLINE (bool IsUndefined() const)
 
 INLINE (bool IsNull() const)
 
 INLINE (bool IsTheHole() const)
 
 INLINE (bool IsException() const)
 
 INLINE (bool IsUninitialized() const)
 
 INLINE (bool IsTrue() const)
 
 INLINE (bool IsFalse() const)
 
 INLINE (bool IsArgumentsMarker() const)
 
 INLINE (bool IsFiller() const)
 
double Number ()
 
 INLINE (bool IsNaN() const)
 
 INLINE (bool IsMinusZero() const)
 
bool ToInt32 (int32_t *value)
 
bool ToUint32 (uint32_t *value)
 
Representation OptimalRepresentation ()
 
bool FitsRepresentation (Representation representation)
 
Handle< HeapTypeOptimalType (Isolate *isolate, Representation representation)
 
bool HasValidElements ()
 
bool HasSpecificClassOf (String *name)
 
bool BooleanValue ()
 
ObjectGetHash ()
 
bool SameValue (Object *other)
 
bool SameValueZero (Object *other)
 
bool ToArrayIndex (uint32_t *index)
 
bool IsStringObjectWithCharacterAt (uint32_t index)
 
void VerifyApiCallResultType ()
 
void ShortPrint (FILE *out=stdout)
 
void ShortPrint (StringStream *accumulator)
 

Static Public Member Functions

static bool Equals (Handle< Name > one, Handle< Name > two)
 
- Static Public Member Functions inherited from v8::internal::HeapObject
static HeapObjectFromAddress (Address address)
 
static Object ** RawField (HeapObject *obj, int offset)
 
static void UpdateMapCodeCache (Handle< HeapObject > object, Handle< Name > name, Handle< Code > code)
 
- Static Public Member Functions inherited from v8::internal::Object
static Handle< ObjectNewStorageFor (Isolate *isolate, Handle< Object > object, Representation representation)
 
static Handle< ObjectWrapForRead (Isolate *isolate, Handle< Object > object, Representation representation)
 
static MaybeHandle< JSReceiverToObject (Isolate *isolate, Handle< Object > object)
 
static MaybeHandle< JSReceiverToObject (Isolate *isolate, Handle< Object > object, Handle< Context > context)
 
static MUST_USE_RESULT MaybeHandle< SmiToSmi (Isolate *isolate, Handle< Object > object)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetProperty (LookupIterator *it)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetProperty (Handle< Object > object, Handle< Name > key, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetProperty (LookupIterator *it, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode, StorePropertyMode data_store_mode=NORMAL_PROPERTY)
 
static MUST_USE_RESULT MaybeHandle< ObjectWriteToReadOnlyProperty (LookupIterator *it, Handle< Object > value, StrictMode strict_mode)
 
static Handle< ObjectSetDataProperty (LookupIterator *it, Handle< Object > value)
 
static MUST_USE_RESULT MaybeHandle< ObjectAddDataProperty (LookupIterator *it, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, StoreFromKeyed store_mode)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetPropertyOrElement (Handle< Object > object, Handle< Name > key)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetProperty (Isolate *isolate, Handle< Object > object, const char *key)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetProperty (Handle< Object > object, Handle< Name > key)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetPropertyWithAccessor (Handle< Object > receiver, Handle< Name > name, Handle< JSObject > holder, Handle< Object > structure)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetPropertyWithAccessor (Handle< Object > receiver, Handle< Name > name, Handle< Object > value, Handle< JSObject > holder, Handle< Object > structure, StrictMode strict_mode)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetPropertyWithDefinedGetter (Handle< Object > receiver, Handle< JSReceiver > getter)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetPropertyWithDefinedSetter (Handle< Object > receiver, Handle< JSReceiver > setter, Handle< Object > value)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetElement (Isolate *isolate, Handle< Object > object, uint32_t index)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetElementWithReceiver (Isolate *isolate, Handle< Object > object, Handle< Object > receiver, uint32_t index)
 
static Handle< SmiGetOrCreateHash (Isolate *isolate, Handle< Object > object)
 

Static Public Attributes

static const int kHashFieldOffset = HeapObject::kHeaderSize
 
static const int kSize = kHashFieldOffset + kPointerSize
 
static const int kHashNotComputedMask = 1
 
static const int kIsNotArrayIndexMask = 1 << 1
 
static const int kNofHashBitFields = 2
 
static const int kHashShift = kNofHashBitFields
 
static const uint32_t kHashBitMask = 0xffffffffu >> kHashShift
 
static const int kMaxCachedArrayIndexLength = 7
 
static const int kArrayIndexValueBits = 24
 
static const int kArrayIndexLengthBits
 
static const unsigned int kContainsCachedArrayIndexMask
 
static const int kEmptyHashField
 
- Static Public Attributes inherited from v8::internal::HeapObject
static const int kMapOffset = Object::kHeaderSize
 
static const int kHeaderSize = kMapOffset + kPointerSize
 
- Static Public Attributes inherited from v8::internal::Object
static const int kHeaderSize = 0
 

Static Protected Member Functions

static bool IsHashFieldComputed (uint32_t field)
 

Private Member Functions

 DISALLOW_IMPLICIT_CONSTRUCTORS (Name)
 

Additional Inherited Members

- Public Types inherited from v8::internal::Object
enum  StoreFromKeyed { MAY_BE_STORE_FROM_KEYED , CERTAINLY_NOT_STORE_FROM_KEYED }
 
enum  StorePropertyMode { NORMAL_PROPERTY , SUPER_PROPERTY }
 
- Protected Member Functions inherited from v8::internal::HeapObject
void IteratePointers (ObjectVisitor *v, int start, int end)
 
void IteratePointer (ObjectVisitor *v, int offset)
 
void IterateNextCodeLink (ObjectVisitor *v, int offset)
 

Detailed Description

Definition at line 8459 of file objects.h.

Member Function Documentation

◆ AsArrayIndex()

bool v8::internal::Name::AsArrayIndex ( uint32_t index)
inline

Definition at line 6601 of file objects-inl.h.

6601  {
6602  return IsString() && String::cast(this)->AsArrayIndex(index);
6603 }

◆ DISALLOW_IMPLICIT_CONSTRUCTORS()

v8::internal::Name::DISALLOW_IMPLICIT_CONSTRUCTORS ( Name  )
private

◆ Equals() [1/2]

bool v8::internal::Name::Equals ( Handle< Name one,
Handle< Name two 
)
inlinestatic

Definition at line 3319 of file objects-inl.h.

3319  {
3320  if (one.is_identical_to(two)) return true;
3321  if ((one->IsInternalizedString() && two->IsInternalizedString()) ||
3322  one->IsSymbol() || two->IsSymbol()) {
3323  return false;
3324  }
3326  Handle<String>::cast(two));
3327 }
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
bool SlowEquals(String *other)
Definition: objects.cc:8671

References v8::internal::String::SlowEquals().

+ Here is the call graph for this function:

◆ Equals() [2/2]

bool v8::internal::Name::Equals ( Name other)
inline

Definition at line 3309 of file objects-inl.h.

3309  {
3310  if (other == this) return true;
3311  if ((this->IsInternalizedString() && other->IsInternalizedString()) ||
3312  this->IsSymbol() || other->IsSymbol()) {
3313  return false;
3314  }
3315  return String::cast(this)->SlowEquals(String::cast(other));
3316 }

Referenced by v8::internal::BinarySearch(), v8::internal::CheckForName(), v8::internal::LoadIC::CompileHandler(), v8::internal::OrderedHashTable< OrderedHashSet, JSSetIterator, 1 >::FindEntry(), v8::internal::LinearSearch(), v8::internal::KeyedLookupCache::Lookup(), and v8::internal::TransitionArray::Search().

+ Here is the caller graph for this function:

◆ Hash()

uint32_t v8::internal::Name::Hash ( )
inline

Definition at line 6465 of file objects-inl.h.

6465  {
6466  // Fast case: has hash code already been computed?
6467  uint32_t field = hash_field();
6468  if (IsHashFieldComputed(field)) return field >> kHashShift;
6469  // Slow case: compute hash code and set it. Has to be a string.
6470  return String::cast(this)->ComputeAndSetHash();
6471 }
static const int kHashShift
Definition: objects.h:8499
static bool IsHashFieldComputed(uint32_t field)
Definition: objects-inl.h:6455
uint32_t hash_field()
Definition: objects-inl.h:3296

References hash_field(), IsHashFieldComputed(), and kHashShift.

Referenced by v8::internal::Logger::ApiNamedPropertyAccess(), v8::internal::DescriptorArray::Append(), v8::internal::CodeEventLogger::NameBuffer::AppendName(), v8::internal::BinarySearch(), v8::internal::Logger::CallbackEventInternal(), v8::internal::HeapObject::HeapObjectShortPrint(), v8::internal::InsertionPointFound(), v8::internal::LinearSearch(), v8::internal::RegExpResultsCache::Lookup(), v8::internal::String::SlowAsArrayIndex(), v8::internal::String::SlowEquals(), and v8::internal::StringSharedKey::StringSharedHashHelper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hash_field()

uint32_t v8::internal::Name::hash_field ( )
inline

Definition at line 3296 of file objects-inl.h.

3296  {
3297  return READ_UINT32_FIELD(this, kHashFieldOffset);
3298 }
static const int kHashFieldOffset
Definition: objects.h:8486
#define READ_UINT32_FIELD(p, offset)
Definition: objects-inl.h:1272

References READ_UINT32_FIELD.

Referenced by v8::internal::String::AsArrayIndex(), Hash(), HasHashCode(), and v8::internal::String::SlowAsArrayIndex().

+ Here is the caller graph for this function:

◆ HasHashCode()

bool v8::internal::Name::HasHashCode ( )
inline

Definition at line 6460 of file objects-inl.h.

6460  {
6461  return IsHashFieldComputed(hash_field());
6462 }

References hash_field(), and IsHashFieldComputed().

Referenced by v8::internal::String::ComputeAndSetHash(), v8::internal::String::GetForwardedInternalizedString(), v8::internal::String::SetForwardedInternalizedString(), and v8::internal::String::SlowEquals().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsHashFieldComputed()

bool v8::internal::Name::IsHashFieldComputed ( uint32_t  field)
inlinestaticprotected

Definition at line 6455 of file objects-inl.h.

6455  {
6456  return (field & kHashNotComputedMask) == 0;
6457 }
static const int kHashNotComputedMask
Definition: objects.h:8494

References kHashNotComputedMask.

Referenced by v8::internal::String::AsArrayIndex(), Hash(), and HasHashCode().

+ Here is the caller graph for this function:

◆ IsOwn()

bool v8::internal::Name::IsOwn ( )
inline

Definition at line 6473 of file objects-inl.h.

6473  {
6474  return this->IsSymbol() && Symbol::cast(this)->is_own();
6475 }

◆ set_hash_field()

void v8::internal::Name::set_hash_field ( uint32_t  value)
inline

Definition at line 3301 of file objects-inl.h.

3301  {
3302  WRITE_UINT32_FIELD(this, kHashFieldOffset, value);
3303 #if V8_HOST_ARCH_64_BIT
3305 #endif
3306 }
const int kIntSize
Definition: globals.h:124
#define WRITE_UINT32_FIELD(p, offset, value)
Definition: objects-inl.h:1275

References v8::internal::kIntSize, and WRITE_UINT32_FIELD.

Referenced by v8::internal::Heap::AllocateInternalizedStringImpl(), v8::internal::Heap::AllocateOneByteInternalizedString(), v8::internal::Heap::AllocateTwoByteInternalizedString(), and v8::internal::String::ComputeAndSetHash().

+ Here is the caller graph for this function:

◆ STATIC_ASSERT() [1/2]

v8::internal::Name::STATIC_ASSERT ( (kArrayIndexLengthBits > 0)  )

◆ STATIC_ASSERT() [2/2]

v8::internal::Name::STATIC_ASSERT ( IS_POWER_OF_TWO(kMaxCachedArrayIndexLength+1)  )

Member Data Documentation

◆ kArrayIndexLengthBits

const int v8::internal::Name::kArrayIndexLengthBits
static
Initial value:
=
static const int kNofHashBitFields
Definition: objects.h:8496
static const int kArrayIndexValueBits
Definition: objects.h:8511
const int kBitsPerInt
Definition: globals.h:165

Definition at line 8512 of file objects.h.

◆ kArrayIndexValueBits

const int v8::internal::Name::kArrayIndexValueBits = 24
static

Definition at line 8511 of file objects.h.

◆ kContainsCachedArrayIndexMask

const unsigned int v8::internal::Name::kContainsCachedArrayIndexMask
static
Initial value:
=
(~static_cast<unsigned>(kMaxCachedArrayIndexLength)
static const U kShift
Definition: utils.h:204
static const int kMaxCachedArrayIndexLength
Definition: objects.h:8506
static const int kIsNotArrayIndexMask
Definition: objects.h:8495

Definition at line 8528 of file objects.h.

◆ kEmptyHashField

◆ kHashBitMask

const uint32_t v8::internal::Name::kHashBitMask = 0xffffffffu >> kHashShift
static

◆ kHashFieldOffset

◆ kHashNotComputedMask

const int v8::internal::Name::kHashNotComputedMask = 1
static

Definition at line 8494 of file objects.h.

Referenced by IsHashFieldComputed().

◆ kHashShift

◆ kIsNotArrayIndexMask

◆ kMaxCachedArrayIndexLength

const int v8::internal::Name::kMaxCachedArrayIndexLength = 7
static

Definition at line 8506 of file objects.h.

◆ kNofHashBitFields

const int v8::internal::Name::kNofHashBitFields = 2
static

Definition at line 8496 of file objects.h.

◆ kSize

const int v8::internal::Name::kSize = kHashFieldOffset + kPointerSize
static

Definition at line 8487 of file objects.h.


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