V8 Project
v8::internal::DictionaryElementsAccessor Class Reference
+ Inheritance diagram for v8::internal::DictionaryElementsAccessor:
+ Collaboration diagram for v8::internal::DictionaryElementsAccessor:

Public Member Functions

 DictionaryElementsAccessor (const char *name)
 
- Public Member Functions inherited from v8::internal::ElementsAccessor
 ElementsAccessor (const char *name)
 
virtual ~ElementsAccessor ()
 
const char * name () const
 
bool HasElement (Handle< Object > receiver, Handle< JSObject > holder, uint32_t key)
 
MUST_USE_RESULT MaybeHandle< ObjectGet (Handle< Object > receiver, Handle< JSObject > holder, uint32_t key)
 
MUST_USE_RESULT PropertyAttributes GetAttributes (Handle< Object > receiver, Handle< JSObject > holder, uint32_t key)
 
MUST_USE_RESULT MaybeHandle< AccessorPairGetAccessorPair (Handle< Object > receiver, Handle< JSObject > holder, uint32_t key)
 
void CopyElements (Handle< JSObject > from_holder, Handle< FixedArrayBase > to, ElementsKind from_kind)
 
MUST_USE_RESULT MaybeHandle< FixedArrayAddElementsToFixedArray (Handle< Object > receiver, Handle< JSObject > holder, Handle< FixedArray > to)
 

Static Public Member Functions

static Handle< ObjectSetLengthWithoutNormalize (Handle< FixedArrayBase > store, Handle< JSArray > array, Handle< Object > length_object, uint32_t length)
 
static MUST_USE_RESULT MaybeHandle< ObjectDeleteCommon (Handle< JSObject > obj, uint32_t key, JSReceiver::DeleteMode mode)
 
static void CopyElementsImpl (FixedArrayBase *from, uint32_t from_start, FixedArrayBase *to, ElementsKind from_kind, uint32_t to_start, int packed_size, int copy_size)
 
- Static Public Member Functions inherited from v8::internal::ElementsAccessor
static ElementsAccessorForKind (ElementsKind elements_kind)
 
static ElementsAccessorForArray (Handle< FixedArrayBase > array)
 
static void InitializeOncePerProcess ()
 
static void TearDown ()
 

Protected Member Functions

virtual MUST_USE_RESULT MaybeHandle< ObjectDelete (Handle< JSObject > obj, uint32_t key, JSReceiver::DeleteMode mode) FINAL OVERRIDE
 
- Protected Member Functions inherited from v8::internal::ElementsAccessorBase< DictionaryElementsAccessor, ElementsKindTraits< DICTIONARY_ELEMENTS > >
 ElementsAccessorBase (const char *name)
 
virtual ElementsKind kind () const FINAL OVERRIDE
 
virtual void Validate (Handle< JSObject > holder) FINAL OVERRIDE
 
virtual bool HasElement (Handle< Object > receiver, Handle< JSObject > holder, uint32_t key, Handle< FixedArrayBase > backing_store) FINAL OVERRIDE
 
virtual MUST_USE_RESULT MaybeHandle< ObjectGet (Handle< Object > receiver, Handle< JSObject > holder, uint32_t key, Handle< FixedArrayBase > backing_store) FINAL OVERRIDE
 
virtual MUST_USE_RESULT PropertyAttributes GetAttributes (Handle< Object > receiver, Handle< JSObject > holder, uint32_t key, Handle< FixedArrayBase > backing_store) FINAL OVERRIDE
 
virtual MUST_USE_RESULT MaybeHandle< AccessorPairGetAccessorPair (Handle< Object > receiver, Handle< JSObject > holder, uint32_t key, Handle< FixedArrayBase > backing_store) FINAL OVERRIDE
 
virtual MUST_USE_RESULT MaybeHandle< ObjectSetLength (Handle< JSArray > array, Handle< Object > length) FINAL OVERRIDE
 
virtual void SetCapacityAndLength (Handle< JSArray > array, int capacity, int length) FINAL OVERRIDE
 
virtual void CopyElements (Handle< FixedArrayBase > from, uint32_t from_start, ElementsKind from_kind, Handle< FixedArrayBase > to, uint32_t to_start, int copy_size) FINAL OVERRIDE
 
virtual void CopyElements (JSObject *from_holder, uint32_t from_start, ElementsKind from_kind, Handle< FixedArrayBase > to, uint32_t to_start, int copy_size) FINAL OVERRIDE
 
virtual MaybeHandle< FixedArrayAddElementsToFixedArray (Handle< Object > receiver, Handle< JSObject > holder, Handle< FixedArray > to, Handle< FixedArrayBase > from) FINAL OVERRIDE
 
virtual uint32_t GetCapacity (Handle< FixedArrayBase > backing_store) FINAL OVERRIDE
 
virtual uint32_t GetKeyForIndex (Handle< FixedArrayBase > backing_store, uint32_t index) FINAL OVERRIDE
 

Static Protected Member Functions

static MUST_USE_RESULT MaybeHandle< ObjectGetImpl (Handle< Object > receiver, Handle< JSObject > obj, uint32_t key, Handle< FixedArrayBase > store)
 
static MUST_USE_RESULT PropertyAttributes GetAttributesImpl (Handle< Object > receiver, Handle< JSObject > obj, uint32_t key, Handle< FixedArrayBase > backing_store)
 
static MUST_USE_RESULT MaybeHandle< AccessorPairGetAccessorPairImpl (Handle< Object > receiver, Handle< JSObject > obj, uint32_t key, Handle< FixedArrayBase > store)
 
static bool HasElementImpl (Handle< Object > receiver, Handle< JSObject > holder, uint32_t key, Handle< FixedArrayBase > store)
 
static uint32_t GetKeyForIndexImpl (Handle< FixedArrayBase > store, uint32_t index)
 
- Static Protected Member Functions inherited from v8::internal::ElementsAccessorBase< DictionaryElementsAccessor, ElementsKindTraits< DICTIONARY_ELEMENTS > >
static void ValidateContents (Handle< JSObject > holder, int length)
 
static void ValidateImpl (Handle< JSObject > holder)
 
static bool HasElementImpl (Handle< Object > receiver, Handle< JSObject > holder, uint32_t key, Handle< FixedArrayBase > backing_store)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetImpl (Handle< Object > receiver, Handle< JSObject > obj, uint32_t key, Handle< FixedArrayBase > backing_store)
 
static MUST_USE_RESULT PropertyAttributes GetAttributesImpl (Handle< Object > receiver, Handle< JSObject > obj, uint32_t key, Handle< FixedArrayBase > backing_store)
 
static MUST_USE_RESULT MaybeHandle< AccessorPairGetAccessorPairImpl (Handle< Object > receiver, Handle< JSObject > obj, uint32_t key, Handle< FixedArrayBase > backing_store)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetLengthImpl (Handle< JSObject > obj, Handle< Object > length, Handle< FixedArrayBase > backing_store)
 
static void SetFastElementsCapacityAndLength (Handle< JSObject > obj, int capacity, int length)
 
static void CopyElementsImpl (FixedArrayBase *from, uint32_t from_start, FixedArrayBase *to, ElementsKind from_kind, uint32_t to_start, int packed_size, int copy_size)
 
static uint32_t GetCapacityImpl (Handle< FixedArrayBase > backing_store)
 
static uint32_t GetKeyForIndexImpl (Handle< FixedArrayBase > backing_store, uint32_t index)
 

Friends

class ElementsAccessorBase< DictionaryElementsAccessor, ElementsKindTraits< DICTIONARY_ELEMENTS > >
 

Additional Inherited Members

- Static Public Attributes inherited from v8::internal::ElementsAccessor
static const int kCopyToEnd = -1
 
static const int kCopyToEndAndInitializeToHole = -2
 
- Protected Types inherited from v8::internal::ElementsAccessorBase< DictionaryElementsAccessor, ElementsKindTraits< DICTIONARY_ELEMENTS > >
typedef ElementsKindTraits< DICTIONARY_ELEMENTS > ElementsTraits
 
typedef ElementsTraitsParam::BackingStore BackingStore
 

Detailed Description

Definition at line 1356 of file elements.cc.

Constructor & Destructor Documentation

◆ DictionaryElementsAccessor()

v8::internal::DictionaryElementsAccessor::DictionaryElementsAccessor ( const char *  name)
inlineexplicit

Definition at line 1360 of file elements.cc.

Member Function Documentation

◆ CopyElementsImpl()

static void v8::internal::DictionaryElementsAccessor::CopyElementsImpl ( FixedArrayBase from,
uint32_t  from_start,
FixedArrayBase to,
ElementsKind  from_kind,
uint32_t  to_start,
int  packed_size,
int  copy_size 
)
inlinestatic

Definition at line 1462 of file elements.cc.

1465  {
1466  UNREACHABLE();
1467  }
#define UNREACHABLE()
Definition: logging.h:30

References UNREACHABLE.

◆ Delete()

virtual MUST_USE_RESULT MaybeHandle<Object> v8::internal::DictionaryElementsAccessor::Delete ( Handle< JSObject obj,
uint32_t  key,
JSReceiver::DeleteMode  mode 
)
inlineprotectedvirtual

Implements v8::internal::ElementsAccessorBase< DictionaryElementsAccessor, ElementsKindTraits< DICTIONARY_ELEMENTS > >.

Definition at line 1474 of file elements.cc.

1477  {
1478  return DeleteCommon(obj, key, mode);
1479  }
static MUST_USE_RESULT MaybeHandle< Object > DeleteCommon(Handle< JSObject > obj, uint32_t key, JSReceiver::DeleteMode mode)
Definition: elements.cc:1421
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

References DeleteCommon(), and mode().

+ Here is the call graph for this function:

◆ DeleteCommon()

static MUST_USE_RESULT MaybeHandle<Object> v8::internal::DictionaryElementsAccessor::DeleteCommon ( Handle< JSObject obj,
uint32_t  key,
JSReceiver::DeleteMode  mode 
)
inlinestatic

Definition at line 1421 of file elements.cc.

1424  {
1425  Isolate* isolate = obj->GetIsolate();
1426  Handle<FixedArray> backing_store(FixedArray::cast(obj->elements()),
1427  isolate);
1428  bool is_arguments =
1429  (obj->GetElementsKind() == SLOPPY_ARGUMENTS_ELEMENTS);
1430  if (is_arguments) {
1431  backing_store = handle(FixedArray::cast(backing_store->get(1)), isolate);
1432  }
1433  Handle<SeededNumberDictionary> dictionary =
1434  Handle<SeededNumberDictionary>::cast(backing_store);
1435  int entry = dictionary->FindEntry(key);
1436  if (entry != SeededNumberDictionary::kNotFound) {
1437  Handle<Object> result =
1438  SeededNumberDictionary::DeleteProperty(dictionary, entry, mode);
1439  if (*result == *isolate->factory()->false_value()) {
1441  // Deleting a non-configurable property in strict mode.
1442  Handle<Object> name = isolate->factory()->NewNumberFromUint(key);
1443  Handle<Object> args[2] = { name, obj };
1444  THROW_NEW_ERROR(isolate, NewTypeError("strict_delete_property",
1445  HandleVector(args, 2)),
1446  Object);
1447  }
1448  return isolate->factory()->false_value();
1449  }
1450  Handle<FixedArray> new_elements =
1451  SeededNumberDictionary::Shrink(dictionary, key);
1452 
1453  if (is_arguments) {
1454  FixedArray::cast(obj->elements())->set(1, *new_elements);
1455  } else {
1456  obj->set_elements(*new_elements);
1457  }
1458  }
1459  return isolate->factory()->true_value();
1460  }
static Handle< Object > DeleteProperty(Handle< SeededNumberDictionary > dictionary, int entry, JSObject::DeleteMode mode)
Definition: objects.cc:14982
static MUST_USE_RESULT Handle< SeededNumberDictionary > Shrink(Handle< SeededNumberDictionary > dictionary, uint32_t key)
Definition: objects.h:3522
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
static const int kNotFound
Definition: objects.h:3283
#define THROW_NEW_ERROR(isolate, call, T)
Definition: isolate.h:138
kSerializedDataOffset Object
Definition: objects-inl.h:5322
@ SLOPPY_ARGUMENTS_ELEMENTS
Definition: elements-kind.h:31
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:146
Vector< Handle< Object > > HandleVector(v8::internal::Handle< T > *elms, int length)
Definition: utils.h:1100

References v8::internal::Handle< T >::cast(), v8::internal::Dictionary< SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t >::DeleteProperty(), v8::internal::Isolate::factory(), v8::internal::handle(), v8::internal::HandleVector(), v8::internal::HashTable< Derived, Shape, Key >::kNotFound, mode(), v8::internal::ElementsAccessor::name(), v8::internal::Dictionary< SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t >::Shrink(), v8::internal::SLOPPY_ARGUMENTS_ELEMENTS, v8::internal::JSReceiver::STRICT_DELETION, and THROW_NEW_ERROR.

Referenced by Delete(), and v8::internal::SloppyArgumentsElementsAccessor::Delete().

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

◆ GetAccessorPairImpl()

static MUST_USE_RESULT MaybeHandle<AccessorPair> v8::internal::DictionaryElementsAccessor::GetAccessorPairImpl ( Handle< Object receiver,
Handle< JSObject obj,
uint32_t  key,
Handle< FixedArrayBase store 
)
inlinestaticprotected

Definition at line 1517 of file elements.cc.

1521  {
1522  Handle<SeededNumberDictionary> backing_store =
1524  int entry = backing_store->FindEntry(key);
1525  if (entry != SeededNumberDictionary::kNotFound &&
1526  backing_store->DetailsAt(entry).type() == CALLBACKS &&
1527  backing_store->ValueAt(entry)->IsAccessorPair()) {
1528  return handle(AccessorPair::cast(backing_store->ValueAt(entry)));
1529  }
1530  return MaybeHandle<AccessorPair>();
1531  }

References v8::internal::CALLBACKS, v8::internal::Handle< T >::cast(), v8::internal::handle(), and v8::internal::HashTable< Derived, Shape, Key >::kNotFound.

+ Here is the call graph for this function:

◆ GetAttributesImpl()

static MUST_USE_RESULT PropertyAttributes v8::internal::DictionaryElementsAccessor::GetAttributesImpl ( Handle< Object receiver,
Handle< JSObject obj,
uint32_t  key,
Handle< FixedArrayBase backing_store 
)
inlinestaticprotected

Definition at line 1503 of file elements.cc.

1507  {
1508  Handle<SeededNumberDictionary> dictionary =
1509  Handle<SeededNumberDictionary>::cast(backing_store);
1510  int entry = dictionary->FindEntry(key);
1511  if (entry != SeededNumberDictionary::kNotFound) {
1512  return dictionary->DetailsAt(entry).attributes();
1513  }
1514  return ABSENT;
1515  }
@ ABSENT

References ABSENT, v8::internal::Handle< T >::cast(), and v8::internal::HashTable< Derived, Shape, Key >::kNotFound.

+ Here is the call graph for this function:

◆ GetImpl()

static MUST_USE_RESULT MaybeHandle<Object> v8::internal::DictionaryElementsAccessor::GetImpl ( Handle< Object receiver,
Handle< JSObject obj,
uint32_t  key,
Handle< FixedArrayBase store 
)
inlinestaticprotected

Definition at line 1481 of file elements.cc.

1485  {
1486  Handle<SeededNumberDictionary> backing_store =
1488  Isolate* isolate = backing_store->GetIsolate();
1489  int entry = backing_store->FindEntry(key);
1490  if (entry != SeededNumberDictionary::kNotFound) {
1491  Handle<Object> element(backing_store->ValueAt(entry), isolate);
1492  PropertyDetails details = backing_store->DetailsAt(entry);
1493  if (details.type() == CALLBACKS) {
1495  obj, receiver, element, key, obj);
1496  } else {
1497  return element;
1498  }
1499  }
1500  return isolate->factory()->the_hole_value();
1501  }
static MUST_USE_RESULT MaybeHandle< Object > GetElementWithCallback(Handle< JSObject > object, Handle< Object > receiver, Handle< Object > structure, uint32_t index, Handle< Object > holder)
Definition: objects.cc:11812

References v8::internal::CALLBACKS, v8::internal::Handle< T >::cast(), v8::internal::Isolate::factory(), v8::internal::JSObject::GetElementWithCallback(), and v8::internal::HashTable< Derived, Shape, Key >::kNotFound.

+ Here is the call graph for this function:

◆ GetKeyForIndexImpl()

static uint32_t v8::internal::DictionaryElementsAccessor::GetKeyForIndexImpl ( Handle< FixedArrayBase store,
uint32_t  index 
)
inlinestaticprotected

Definition at line 1542 of file elements.cc.

1543  {
1544  DisallowHeapAllocation no_gc;
1545  Handle<SeededNumberDictionary> dict =
1547  Object* key = dict->KeyAt(index);
1548  return Smi::cast(key)->value();
1549  }
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
Definition: assert-scope.h:110

References v8::internal::Handle< T >::cast().

+ Here is the call graph for this function:

◆ HasElementImpl()

static bool v8::internal::DictionaryElementsAccessor::HasElementImpl ( Handle< Object receiver,
Handle< JSObject holder,
uint32_t  key,
Handle< FixedArrayBase store 
)
inlinestaticprotected

Definition at line 1533 of file elements.cc.

1536  {
1537  Handle<SeededNumberDictionary> backing_store =
1539  return backing_store->FindEntry(key) != SeededNumberDictionary::kNotFound;
1540  }

References v8::internal::Handle< T >::cast(), and v8::internal::HashTable< Derived, Shape, Key >::kNotFound.

+ Here is the call graph for this function:

◆ SetLengthWithoutNormalize()

static Handle<Object> v8::internal::DictionaryElementsAccessor::SetLengthWithoutNormalize ( Handle< FixedArrayBase store,
Handle< JSArray array,
Handle< Object length_object,
uint32_t  length 
)
inlinestatic

Definition at line 1366 of file elements.cc.

1370  {
1371  Handle<SeededNumberDictionary> dict =
1373  Isolate* isolate = array->GetIsolate();
1374  int capacity = dict->Capacity();
1375  uint32_t new_length = length;
1376  uint32_t old_length = static_cast<uint32_t>(array->length()->Number());
1377  if (new_length < old_length) {
1378  // Find last non-deletable element in range of elements to be
1379  // deleted and adjust range accordingly.
1380  for (int i = 0; i < capacity; i++) {
1381  DisallowHeapAllocation no_gc;
1382  Object* key = dict->KeyAt(i);
1383  if (key->IsNumber()) {
1384  uint32_t number = static_cast<uint32_t>(key->Number());
1385  if (new_length <= number && number < old_length) {
1386  PropertyDetails details = dict->DetailsAt(i);
1387  if (!details.IsConfigurable()) new_length = number + 1;
1388  }
1389  }
1390  }
1391  if (new_length != length) {
1392  length_object = isolate->factory()->NewNumberFromUint(new_length);
1393  }
1394  }
1395 
1396  if (new_length == 0) {
1397  // Flush the backing store.
1398  JSObject::ResetElements(array);
1399  } else {
1400  DisallowHeapAllocation no_gc;
1401  // Remove elements that should be deleted.
1402  int removed_entries = 0;
1403  Handle<Object> the_hole_value = isolate->factory()->the_hole_value();
1404  for (int i = 0; i < capacity; i++) {
1405  Object* key = dict->KeyAt(i);
1406  if (key->IsNumber()) {
1407  uint32_t number = static_cast<uint32_t>(key->Number());
1408  if (new_length <= number && number < old_length) {
1409  dict->SetEntry(i, the_hole_value, the_hole_value);
1410  removed_entries++;
1411  }
1412  }
1413  }
1414 
1415  // Update the number of elements.
1416  dict->ElementsRemoved(removed_entries);
1417  }
1418  return length_object;
1419  }
static void ResetElements(Handle< JSObject > object)
Definition: objects.cc:4416

References v8::internal::Handle< T >::cast(), v8::internal::Isolate::factory(), v8::internal::Object::Number(), and v8::internal::JSObject::ResetElements().

Referenced by v8::internal::ElementsAccessorBase< ElementsAccessorSubclass, ElementsTraitsParam >::SetLengthImpl().

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

Friends And Related Function Documentation

◆ ElementsAccessorBase< DictionaryElementsAccessor, ElementsKindTraits< DICTIONARY_ELEMENTS > >


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