V8 Project
v8::internal::Dictionary< Derived, Shape, Key > Class Template Reference

#include <objects.h>

+ Inheritance diagram for v8::internal::Dictionary< Derived, Shape, Key >:
+ Collaboration diagram for v8::internal::Dictionary< Derived, Shape, Key >:

Public Types

enum  SortMode { UNSORTED , SORTED }
 
- 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 }
 

Public Member Functions

ObjectValueAt (int entry)
 
void ValueAtPut (int entry, Object *value)
 
PropertyDetails DetailsAt (int entry)
 
void DetailsAtPut (int entry, PropertyDetails value)
 
void CopyValuesTo (FixedArray *elements)
 
int NumberOfElementsFilterAttributes (PropertyAttributes filter)
 
int NumberOfEnumElements ()
 
void CopyKeysTo (FixedArray *storage, PropertyAttributes filter, SortMode sort_mode)
 
void CopyKeysTo (FixedArray *storage, int index, PropertyAttributes filter, SortMode sort_mode)
 
void SetNextEnumerationIndex (int index)
 
int NextEnumerationIndex ()
 
ObjectSlowReverseLookup (Object *value)
 
void SetEntry (int entry, Handle< Object > key, Handle< Object > value)
 
void SetEntry (int entry, Handle< Object > key, Handle< Object > value, PropertyDetails details)
 
- Public Member Functions inherited from v8::internal::HashTable< Derived, Shape, Key >
uint32_t Hash (Key key)
 
uint32_t HashForObject (Key key, Object *object)
 
int NumberOfElements ()
 
int NumberOfDeletedElements ()
 
int Capacity ()
 
void ElementAdded ()
 
void ElementRemoved ()
 
void ElementsRemoved (int n)
 
ObjectKeyAt (int entry)
 
bool IsKey (Object *k)
 
void IteratePrefix (ObjectVisitor *visitor)
 
void IterateElements (ObjectVisitor *visitor)
 
 INLINE (static uint32_t GetProbeOffset(uint32_t n))
 
int FindEntry (Key key)
 
int FindEntry (Isolate *isolate, Key key)
 
void Rehash (Key key)
 
- Public Member Functions inherited from v8::internal::FixedArray
Objectget (int index)
 
void set (int index, Object *value)
 
bool is_the_hole (int index)
 
void set (int index, Smi *value)
 
void set (int index, Object *value, WriteBarrierMode mode)
 
void set_undefined (int index)
 
void set_null (int index)
 
void set_the_hole (int index)
 
Object ** GetFirstElementAddress ()
 
bool ContainsOnlySmisOrHoles ()
 
Object ** data_start ()
 
void FillWithHoles (int from, int to)
 
void Shrink (int length)
 
void CopyTo (int pos, FixedArray *dest, int dest_pos, int len)
 
Object ** RawFieldOfElementAt (int index)
 
void SwapPairs (FixedArray *numbers, int i, int j)
 
void SortPairs (FixedArray *numbers, uint32_t len)
 
- Public Member Functions inherited from v8::internal::FixedArrayBase
int length () const
 
void set_length (int value)
 
int synchronized_length () const
 
void synchronized_set_length (int value)
 
- 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 Handle< ObjectDeleteProperty (Handle< Derived > dictionary, int entry, JSObject::DeleteMode mode)
 
static MUST_USE_RESULT Handle< Derived > Shrink (Handle< Derived > dictionary, Key key)
 
static MUST_USE_RESULT Handle< Derived > New (Isolate *isolate, int at_least_space_for, PretenureFlag pretenure=NOT_TENURED)
 
static Handle< Derived > EnsureCapacity (Handle< Derived > obj, int n, Key key)
 
static MUST_USE_RESULT Handle< Derived > Add (Handle< Derived > dictionary, Key key, Handle< Object > value, PropertyDetails details)
 
- Static Public Member Functions inherited from v8::internal::HashTable< Derived, Shape, Key >
static MUST_USE_RESULT Handle< Derived > New (Isolate *isolate, int at_least_space_for, MinimumCapacity capacity_option=USE_DEFAULT_MINIMUM_CAPACITY, PretenureFlag pretenure=NOT_TENURED)
 
static int ComputeCapacity (int at_least_space_for)
 
- Static Public Member Functions inherited from v8::internal::FixedArray
static Handle< Objectget (Handle< FixedArray > array, int index)
 
static Handle< FixedArrayCopySize (Handle< FixedArray > array, int new_length, PretenureFlag pretenure=NOT_TENURED)
 
static MUST_USE_RESULT MaybeHandle< FixedArrayAddKeysFromArrayLike (Handle< FixedArray > content, Handle< JSObject > array)
 
static MUST_USE_RESULT MaybeHandle< FixedArrayUnionOfKeys (Handle< FixedArray > first, Handle< FixedArray > second)
 
static int SizeFor (int length)
 
static int OffsetOfElementAt (int index)
 
- 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)
 

Protected Types

typedef HashTable< Derived, Shape, Key > DerivedHashTable
 

Static Protected Member Functions

static MUST_USE_RESULT Handle< Derived > AtPut (Handle< Derived > dictionary, Key key, Handle< Object > value)
 
static void AddEntry (Handle< Derived > dictionary, Key key, Handle< Object > value, PropertyDetails details, uint32_t hash)
 
static void GenerateNewEnumerationIndices (Handle< Derived > dictionary)
 
- Static Protected Member Functions inherited from v8::internal::HashTable< Derived, Shape, Key >
static int EntryToIndex (int entry)
 
static uint32_t GetProbe (uint32_t hash, uint32_t number, uint32_t size)
 
static uint32_t FirstProbe (uint32_t hash, uint32_t size)
 
static uint32_t NextProbe (uint32_t last, uint32_t number, uint32_t size)
 
static MUST_USE_RESULT Handle< Derived > Shrink (Handle< Derived > table, Key key)
 
static MUST_USE_RESULT Handle< Derived > EnsureCapacity (Handle< Derived > table, int n, Key key, PretenureFlag pretenure=NOT_TENURED)
 
- Static Protected Member Functions inherited from v8::internal::FixedArray
static void NoWriteBarrierSet (FixedArray *array, int index, Object *value)
 
static void NoIncrementalWriteBarrierSet (FixedArray *array, int index, Object *value)
 

Static Protected Attributes

static const int kMaxNumberKeyIndex = DerivedHashTable::kPrefixStartIndex
 
static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1
 

Additional Inherited Members

- Static Public Attributes inherited from v8::internal::HashTable< Derived, Shape, Key >
static const int kNumberOfElementsIndex = 0
 
static const int kNumberOfDeletedElementsIndex = 1
 
static const int kCapacityIndex = 2
 
static const int kPrefixStartIndex = 3
 
static const int kElementsStartIndex
 
static const int kEntrySize = Shape::kEntrySize
 
static const int kElementsStartOffset
 
static const int kCapacityOffset
 
static const int kNotFound = -1
 
static const int kMaxCapacity
 
- Static Public Attributes inherited from v8::internal::FixedArray
static const int kMaxSize = 128 * MB * kPointerSize
 
static const int kMaxLength = (kMaxSize - kHeaderSize) / kPointerSize
 
- Static Public Attributes inherited from v8::internal::FixedArrayBase
static const int kLengthOffset = HeapObject::kHeaderSize
 
static const int kHeaderSize = kLengthOffset + kPointerSize
 
- 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
 
- Protected Member Functions inherited from v8::internal::HashTable< Derived, Shape, Key >
uint32_t FindInsertionEntry (uint32_t hash)
 
void SetNumberOfElements (int nof)
 
void SetNumberOfDeletedElements (int nod)
 
void SetCapacity (int capacity)
 
- 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

template<typename Derived, typename Shape, typename Key>
class v8::internal::Dictionary< Derived, Shape, Key >

Definition at line 3485 of file objects.h.

Member Typedef Documentation

◆ DerivedHashTable

template<typename Derived , typename Shape , typename Key >
typedef HashTable<Derived, Shape, Key> v8::internal::Dictionary< Derived, Shape, Key >::DerivedHashTable
protected

Definition at line 3487 of file objects.h.

Member Enumeration Documentation

◆ SortMode

template<typename Derived , typename Shape , typename Key >
enum v8::internal::Dictionary::SortMode
Enumerator
UNSORTED 
SORTED 

Definition at line 3535 of file objects.h.

Member Function Documentation

◆ Add()

template<typename Derived , typename Shape , typename Key >
Handle< Derived > v8::internal::Dictionary< Derived, Shape, Key >::Add ( Handle< Derived >  dictionary,
Key  key,
Handle< Object value,
PropertyDetails  details 
)
static

Definition at line 15024 of file objects.cc.

15028  {
15029  // Valdate key is absent.
15030  SLOW_DCHECK((dictionary->FindEntry(key) == Dictionary::kNotFound));
15031  // Check whether the dictionary should be extended.
15032  dictionary = EnsureCapacity(dictionary, 1, key);
15033 
15034  AddEntry(dictionary, key, value, details, dictionary->Hash(key));
15035  return dictionary;
15036 }
#define SLOW_DCHECK(condition)
Definition: checks.h:30
static Handle< Derived > EnsureCapacity(Handle< Derived > obj, int n, Key key)
Definition: objects.cc:14969
static void AddEntry(Handle< Derived > dictionary, Key key, Handle< Object > value, PropertyDetails details, uint32_t hash)
Definition: objects.cc:15041
static const int kNotFound
Definition: objects.h:3283

References v8::internal::HashTable< Derived, Shape, Key >::kNotFound, and SLOW_DCHECK.

◆ AddEntry()

template<typename Derived , typename Shape , typename Key >
void v8::internal::Dictionary< Derived, Shape, Key >::AddEntry ( Handle< Derived >  dictionary,
Key  key,
Handle< Object value,
PropertyDetails  details,
uint32_t  hash 
)
staticprotected

Definition at line 15041 of file objects.cc.

15046  {
15047  // Compute the key object.
15048  Handle<Object> k = Shape::AsHandle(dictionary->GetIsolate(), key);
15049 
15050  uint32_t entry = dictionary->FindInsertionEntry(hash);
15051  // Insert element at empty or deleted entry
15052  if (!details.IsDeleted() &&
15053  details.dictionary_index() == 0 &&
15054  Shape::kIsEnumerable) {
15055  // Assign an enumeration index to the property and update
15056  // SetNextEnumerationIndex.
15057  int index = dictionary->NextEnumerationIndex();
15058  details = PropertyDetails(details.attributes(), details.type(), index);
15059  dictionary->SetNextEnumerationIndex(index + 1);
15060  }
15061  dictionary->SetEntry(entry, k, value, details);
15062  DCHECK((dictionary->KeyAt(entry)->IsNumber() ||
15063  dictionary->KeyAt(entry)->IsName()));
15064  dictionary->ElementAdded();
15065 }
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK.

◆ AtPut()

template<typename Derived , typename Shape , typename Key >
Handle< Derived > v8::internal::Dictionary< Derived, Shape, Key >::AtPut ( Handle< Derived >  dictionary,
Key  key,
Handle< Object value 
)
staticprotected

Definition at line 15001 of file objects.cc.

15002  {
15003  int entry = dictionary->FindEntry(key);
15004 
15005  // If the entry is present set the value;
15006  if (entry != Dictionary::kNotFound) {
15007  dictionary->ValueAtPut(entry, *value);
15008  return dictionary;
15009  }
15010 
15011  // Check whether the dictionary should be extended.
15012  dictionary = EnsureCapacity(dictionary, 1, key);
15013 #ifdef DEBUG
15014  USE(Shape::AsHandle(dictionary->GetIsolate(), key));
15015 #endif
15016  PropertyDetails details = PropertyDetails(NONE, NORMAL, 0);
15017 
15018  AddEntry(dictionary, key, value, details, dictionary->Hash(key));
15019  return dictionary;
15020 }
void USE(T)
Definition: macros.h:322
@ NONE

References v8::internal::HashTable< Derived, Shape, Key >::kNotFound, NONE, v8::internal::NORMAL, and USE().

+ Here is the call graph for this function:

◆ CopyKeysTo() [1/2]

template<typename Derived , typename Shape , typename Key >
void v8::internal::Dictionary< Derived, Shape, Key >::CopyKeysTo ( FixedArray storage,
int  index,
PropertyAttributes  filter,
SortMode  sort_mode 
)

◆ CopyKeysTo() [2/2]

template<typename Derived , typename Shape , typename Key >
void v8::internal::Dictionary< Derived, Shape, Key >::CopyKeysTo ( FixedArray storage,
PropertyAttributes  filter,
SortMode  sort_mode 
)

Referenced by v8::internal::JSObject::GetOwnElementKeys().

+ Here is the caller graph for this function:

◆ CopyValuesTo()

template<typename Derived , typename Shape , typename Key >
void v8::internal::Dictionary< Derived, Shape, Key >::CopyValuesTo ( FixedArray elements)

Definition at line 13087 of file objects.cc.

13087  {
13088  int pos = 0;
13089  int capacity = DerivedHashTable::Capacity();
13090  DisallowHeapAllocation no_gc;
13091  WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc);
13092  for (int i = 0; i < capacity; i++) {
13093  Object* k = Dictionary::KeyAt(i);
13094  if (Dictionary::IsKey(k)) {
13095  elements->set(pos++, ValueAt(i), mode);
13096  }
13097  }
13098  DCHECK(pos == elements->length());
13099 }
Object * ValueAt(int entry)
Definition: objects.h:3491
bool IsKey(Object *k)
Definition: objects.h:3255
Object * KeyAt(int entry)
Definition: objects.h:3251
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
Definition: assert-scope.h:110
kSerializedDataOffset Object
Definition: objects-inl.h:5322

References DCHECK, v8::internal::HeapObject::GetWriteBarrierMode(), v8::internal::HashTable< Derived, Shape, Key >::IsKey(), v8::internal::HashTable< Derived, Shape, Key >::KeyAt(), v8::internal::FixedArrayBase::length(), mode(), and v8::internal::FixedArray::set().

+ Here is the call graph for this function:

◆ DeleteProperty()

template<typename Derived , typename Shape , typename Key >
Handle< Object > v8::internal::Dictionary< Derived, Shape, Key >::DeleteProperty ( Handle< Derived >  dictionary,
int  entry,
JSObject::DeleteMode  mode 
)
static

Definition at line 14982 of file objects.cc.

14985  {
14986  Factory* factory = dictionary->GetIsolate()->factory();
14987  PropertyDetails details = dictionary->DetailsAt(entry);
14988  // Ignore attributes if forcing a deletion.
14989  if (!details.IsConfigurable() && mode != JSReceiver::FORCE_DELETION) {
14990  return factory->false_value();
14991  }
14992 
14993  dictionary->SetEntry(
14994  entry, factory->the_hole_value(), factory->the_hole_value());
14995  dictionary->ElementRemoved();
14996  return factory->true_value();
14997 }

References v8::internal::JSReceiver::FORCE_DELETION, and mode().

+ Here is the call graph for this function:

◆ DetailsAt()

template<typename Derived , typename Shape , typename Key >
PropertyDetails v8::internal::Dictionary< Derived, Shape, Key >::DetailsAt ( int  entry)
inline

Definition at line 3501 of file objects.h.

3501  {
3502  DCHECK(entry >= 0); // Not found is -1, which is not caught by get().
3503  return PropertyDetails(
3504  Smi::cast(this->get(DerivedHashTable::EntryToIndex(entry) + 2)));
3505  }
Object * get(int index)
Definition: objects-inl.h:2165
static int EntryToIndex(int entry)
Definition: objects.h:3306

References DCHECK.

Referenced by v8::internal::FreezeDictionary(), v8::internal::JSObject::GetAccessor(), v8::internal::RUNTIME_FUNCTION(), v8::internal::JSObject::SetNormalizedProperty(), and v8::internal::UpdateGetterSetterInDictionary().

+ Here is the caller graph for this function:

◆ DetailsAtPut()

template<typename Derived , typename Shape , typename Key >
void v8::internal::Dictionary< Derived, Shape, Key >::DetailsAtPut ( int  entry,
PropertyDetails  value 
)
inline

Definition at line 3508 of file objects.h.

3508  {
3509  this->set(DerivedHashTable::EntryToIndex(entry) + 2, value.AsSmi());
3510  }
void set(int index, Object *value)
Definition: objects-inl.h:2190

References v8::internal::Smi::value().

Referenced by v8::internal::FreezeDictionary(), v8::internal::JSObject::SetNormalizedProperty(), and v8::internal::UpdateGetterSetterInDictionary().

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

◆ EnsureCapacity()

template<typename Derived , typename Shape , typename Key >
Handle< Derived > v8::internal::Dictionary< Derived, Shape, Key >::EnsureCapacity ( Handle< Derived >  obj,
int  n,
Key  key 
)
static

Definition at line 14969 of file objects.cc.

14970  {
14971  // Check whether there are enough enumeration indices to add n elements.
14972  if (Shape::kIsEnumerable &&
14973  !PropertyDetails::IsValidIndex(dictionary->NextEnumerationIndex() + n)) {
14974  // If not, we generate new indices for the properties.
14975  GenerateNewEnumerationIndices(dictionary);
14976  }
14977  return DerivedHashTable::EnsureCapacity(dictionary, n, key);
14978 }
static void GenerateNewEnumerationIndices(Handle< Derived > dictionary)
Definition: objects.cc:14916
static MUST_USE_RESULT Handle< Derived > EnsureCapacity(Handle< Derived > table, int n, Key key, PretenureFlag pretenure=NOT_TENURED)
Definition: objects.cc:13928

◆ GenerateNewEnumerationIndices()

template<typename Derived , typename Shape , typename Key >
void v8::internal::Dictionary< Derived, Shape, Key >::GenerateNewEnumerationIndices ( Handle< Derived >  dictionary)
staticprotected

Definition at line 14916 of file objects.cc.

14917  {
14918  Factory* factory = dictionary->GetIsolate()->factory();
14919  int length = dictionary->NumberOfElements();
14920 
14921  // Allocate and initialize iteration order array.
14922  Handle<FixedArray> iteration_order = factory->NewFixedArray(length);
14923  for (int i = 0; i < length; i++) {
14924  iteration_order->set(i, Smi::FromInt(i));
14925  }
14926 
14927  // Allocate array with enumeration order.
14928  Handle<FixedArray> enumeration_order = factory->NewFixedArray(length);
14929 
14930  // Fill the enumeration order array with property details.
14931  int capacity = dictionary->Capacity();
14932  int pos = 0;
14933  for (int i = 0; i < capacity; i++) {
14934  if (dictionary->IsKey(dictionary->KeyAt(i))) {
14935  int index = dictionary->DetailsAt(i).dictionary_index();
14936  enumeration_order->set(pos++, Smi::FromInt(index));
14937  }
14938  }
14939 
14940  // Sort the arrays wrt. enumeration order.
14941  iteration_order->SortPairs(*enumeration_order, enumeration_order->length());
14942 
14943  // Overwrite the enumeration_order with the enumeration indices.
14944  for (int i = 0; i < length; i++) {
14945  int index = Smi::cast(iteration_order->get(i))->value();
14946  int enum_index = PropertyDetails::kInitialIndex + i;
14947  enumeration_order->set(index, Smi::FromInt(enum_index));
14948  }
14949 
14950  // Update the dictionary with new indices.
14951  capacity = dictionary->Capacity();
14952  pos = 0;
14953  for (int i = 0; i < capacity; i++) {
14954  if (dictionary->IsKey(dictionary->KeyAt(i))) {
14955  int enum_index = Smi::cast(enumeration_order->get(pos++))->value();
14956  PropertyDetails details = dictionary->DetailsAt(i);
14957  PropertyDetails new_details = PropertyDetails(
14958  details.attributes(), details.type(), enum_index);
14959  dictionary->DetailsAtPut(i, new_details);
14960  }
14961  }
14962 
14963  // Set the next enumeration index.
14964  dictionary->SetNextEnumerationIndex(PropertyDetails::kInitialIndex+length);
14965 }
static Smi * FromInt(int value)
Definition: objects-inl.h:1321

References v8::internal::Smi::FromInt(), and v8::internal::FixedArrayBase::length().

+ Here is the call graph for this function:

◆ New()

template<typename Derived , typename Shape , typename Key >
Handle< Derived > v8::internal::Dictionary< Derived, Shape, Key >::New ( Isolate isolate,
int  at_least_space_for,
PretenureFlag  pretenure = NOT_TENURED 
)
static

Definition at line 14899 of file objects.cc.

14902  {
14903  DCHECK(0 <= at_least_space_for);
14904  Handle<Derived> dict = DerivedHashTable::New(isolate,
14905  at_least_space_for,
14907  pretenure);
14908 
14909  // Initialize the next enumeration index.
14910  dict->SetNextEnumerationIndex(PropertyDetails::kInitialIndex);
14911  return dict;
14912 }
static MUST_USE_RESULT Handle< Derived > New(Isolate *isolate, int at_least_space_for, MinimumCapacity capacity_option=USE_DEFAULT_MINIMUM_CAPACITY, PretenureFlag pretenure=NOT_TENURED)
Definition: objects.cc:13756
@ USE_DEFAULT_MINIMUM_CAPACITY
Definition: globals.h:385

References DCHECK, and v8::internal::USE_DEFAULT_MINIMUM_CAPACITY.

◆ NextEnumerationIndex()

template<typename Derived , typename Shape , typename Key >
int v8::internal::Dictionary< Derived, Shape, Key >::NextEnumerationIndex ( )
inline

Definition at line 3552 of file objects.h.

3552  {
3553  return Smi::cast(this->get(kNextEnumerationIndexIndex))->value();
3554  }
static const int kNextEnumerationIndexIndex
Definition: objects.h:3604

Referenced by v8::internal::JSObject::SetNormalizedProperty().

+ Here is the caller graph for this function:

◆ NumberOfElementsFilterAttributes()

template<typename Derived , typename Shape , typename Key >
int v8::internal::Dictionary< Derived, Shape, Key >::NumberOfElementsFilterAttributes ( PropertyAttributes  filter)

Definition at line 15160 of file objects.cc.

15161  {
15162  int capacity = DerivedHashTable::Capacity();
15163  int result = 0;
15164  for (int i = 0; i < capacity; i++) {
15166  if (DerivedHashTable::IsKey(k) && !FilterKey(k, filter)) {
15167  PropertyDetails details = DetailsAt(i);
15168  if (details.IsDeleted()) continue;
15169  PropertyAttributes attr = details.attributes();
15170  if ((attr & filter) == 0) result++;
15171  }
15172  }
15173  return result;
15174 }
PropertyDetails DetailsAt(int entry)
Definition: objects.h:3501
static bool FilterKey(Object *key, PropertyAttributes filter)
Definition: objects.cc:5628
PropertyAttributes

References v8::internal::FilterKey().

Referenced by v8::internal::JSObject::GetOwnElementKeys().

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

◆ NumberOfEnumElements()

template<typename Derived , typename Shape , typename Key >
int v8::internal::Dictionary< Derived, Shape, Key >::NumberOfEnumElements

Definition at line 15178 of file objects.cc.

15178  {
15180  static_cast<PropertyAttributes>(DONT_ENUM | SYMBOLIC));
15181 }
int NumberOfElementsFilterAttributes(PropertyAttributes filter)
Definition: objects.cc:15160
@ DONT_ENUM
@ SYMBOLIC

References DONT_ENUM, and SYMBOLIC.

◆ SetEntry() [1/2]

template<typename Derived , typename Shape , typename Key >
void v8::internal::Dictionary< Derived, Shape, Key >::SetEntry ( int  entry,
Handle< Object key,
Handle< Object value 
)
inline

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

6800  {
6801  SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0)));
6802 }
void SetEntry(int entry, Handle< Object > key, Handle< Object > value)
Definition: objects-inl.h:6798

References v8::internal::Smi::FromInt().

Referenced by v8::internal::JSObject::SetNormalizedProperty().

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

◆ SetEntry() [2/2]

template<typename Derived , typename Shape , typename Key >
void v8::internal::Dictionary< Derived, Shape, Key >::SetEntry ( int  entry,
Handle< Object key,
Handle< Object value,
PropertyDetails  details 
)
inline

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

6809  {
6810  DCHECK(!key->IsName() ||
6811  details.IsDeleted() ||
6812  details.dictionary_index() > 0);
6813  int index = DerivedHashTable::EntryToIndex(entry);
6814  DisallowHeapAllocation no_gc;
6816  FixedArray::set(index, *key, mode);
6817  FixedArray::set(index+1, *value, mode);
6818  FixedArray::set(index+2, details.AsSmi());
6819 }
WriteBarrierMode GetWriteBarrierMode(const DisallowHeapAllocation &promise)
Definition: objects-inl.h:2660

References DCHECK, v8::internal::HeapObject::GetWriteBarrierMode(), mode(), and v8::internal::FixedArray::set().

+ Here is the call graph for this function:

◆ SetNextEnumerationIndex()

template<typename Derived , typename Shape , typename Key >
void v8::internal::Dictionary< Derived, Shape, Key >::SetNextEnumerationIndex ( int  index)
inline

Definition at line 3547 of file objects.h.

3547  {
3548  DCHECK(index != 0);
3550  }

References DCHECK, and v8::internal::Smi::FromInt().

Referenced by v8::internal::JSObject::SetNormalizedProperty().

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

◆ Shrink()

template<typename Derived , typename Shape , typename Key >
static MUST_USE_RESULT Handle<Derived> v8::internal::Dictionary< Derived, Shape, Key >::Shrink ( Handle< Derived >  dictionary,
Key  key 
)
inlinestatic

Definition at line 3522 of file objects.h.

3524  {
3525  return DerivedHashTable::Shrink(dictionary, key);
3526  }
static MUST_USE_RESULT Handle< Derived > Shrink(Handle< Derived > table, Key key)
Definition: objects.cc:13961

◆ SlowReverseLookup()

template<typename Derived , typename Shape , typename Key >
Object * v8::internal::Dictionary< Derived, Shape, Key >::SlowReverseLookup ( Object value)

Definition at line 15270 of file objects.cc.

15270  {
15271  int capacity = DerivedHashTable::Capacity();
15272  for (int i = 0; i < capacity; i++) {
15274  if (Dictionary::IsKey(k)) {
15275  Object* e = ValueAt(i);
15276  if (e->IsPropertyCell()) {
15277  e = PropertyCell::cast(e)->value();
15278  }
15279  if (e == value) return k;
15280  }
15281  }
15282  Heap* heap = Dictionary::GetHeap();
15283  return heap->undefined_value();
15284 }
Heap * GetHeap() const
Definition: objects-inl.h:1379

References v8::internal::HeapObject::GetHeap(), and v8::internal::HashTable< Derived, Shape, Key >::IsKey().

+ Here is the call graph for this function:

◆ ValueAt()

◆ ValueAtPut()

template<typename Derived , typename Shape , typename Key >
void v8::internal::Dictionary< Derived, Shape, Key >::ValueAtPut ( int  entry,
Object value 
)
inline

Definition at line 3496 of file objects.h.

3496  {
3497  this->set(DerivedHashTable::EntryToIndex(entry) + 1, value);
3498  }

References v8::internal::Smi::value().

+ Here is the call graph for this function:

Member Data Documentation

◆ kMaxNumberKeyIndex

template<typename Derived , typename Shape , typename Key >
const int v8::internal::Dictionary< Derived, Shape, Key >::kMaxNumberKeyIndex = DerivedHashTable::kPrefixStartIndex
staticprotected

Definition at line 3603 of file objects.h.

◆ kNextEnumerationIndexIndex

template<typename Derived , typename Shape , typename Key >
const int v8::internal::Dictionary< Derived, Shape, Key >::kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1
staticprotected

Definition at line 3604 of file objects.h.


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