V8 Project
v8::internal::JSArray Class Reference

#include <objects.h>

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

Public Member Functions

void set_length (Smi *length)
 
bool AllowsSetElementsLength ()
 
- Public Member Functions inherited from v8::internal::JSObject
 DECL_ACCESSORS (properties, FixedArray) inline void initialize_properties()
 
bool HasFastProperties ()
 
NameDictionaryproperty_dictionary ()
 
void initialize_elements ()
 
ElementsKind GetElementsKind ()
 
ElementsAccessorGetElementsAccessor ()
 
bool HasFastSmiElements ()
 
bool HasFastObjectElements ()
 
bool HasFastSmiOrObjectElements ()
 
bool HasFastElements ()
 
bool HasFastDoubleElements ()
 
bool HasFastHoleyElements ()
 
bool HasSloppyArgumentsElements ()
 
bool HasDictionaryElements ()
 
bool HasExternalUint8ClampedElements ()
 
bool HasExternalArrayElements ()
 
bool HasExternalInt8Elements ()
 
bool HasExternalUint8Elements ()
 
bool HasExternalInt16Elements ()
 
bool HasExternalUint16Elements ()
 
bool HasExternalInt32Elements ()
 
bool HasExternalUint32Elements ()
 
bool HasExternalFloat32Elements ()
 
bool HasExternalFloat64Elements ()
 
bool HasFixedTypedArrayElements ()
 
bool HasFixedUint8ClampedElements ()
 
bool HasFixedArrayElements ()
 
bool HasFixedInt8Elements ()
 
bool HasFixedUint8Elements ()
 
bool HasFixedInt16Elements ()
 
bool HasFixedUint16Elements ()
 
bool HasFixedInt32Elements ()
 
bool HasFixedUint32Elements ()
 
bool HasFixedFloat32Elements ()
 
bool HasFixedFloat64Elements ()
 
bool HasFastArgumentsElements ()
 
bool HasDictionaryArgumentsElements ()
 
SeededNumberDictionaryelement_dictionary ()
 
InterceptorInfoGetNamedInterceptor ()
 
InterceptorInfoGetIndexedInterceptor ()
 
bool IsDirty ()
 
ObjectGetHiddenProperty (Handle< Name > key)
 
bool WouldConvertToSlowElements (Handle< Object > key)
 
bool ShouldConvertToSlowElements (int new_capacity)
 
bool ShouldConvertToFastElements ()
 
bool ShouldConvertToFastDoubleElements (bool *has_smi_only_elements)
 
bool HasNamedInterceptor ()
 
bool HasIndexedInterceptor ()
 
int GetHeaderSize ()
 
int GetInternalFieldCount ()
 
int GetInternalFieldOffset (int index)
 
ObjectGetInternalField (int index)
 
void SetInternalField (int index, Object *value)
 
void SetInternalField (int index, Smi *value)
 
int NumberOfOwnProperties (PropertyAttributes filter=NONE)
 
void GetOwnPropertyNames (FixedArray *storage, int index, PropertyAttributes filter=NONE)
 
int NumberOfOwnElements (PropertyAttributes filter)
 
int NumberOfEnumElements ()
 
int GetOwnElementKeys (FixedArray *storage, PropertyAttributes filter)
 
int GetEnumElementKeys (FixedArray *storage)
 
ObjectRawFastPropertyAt (FieldIndex index)
 
void FastPropertyAtPut (FieldIndex index, Object *value)
 
void WriteToField (int descriptor, Object *value)
 
int GetInObjectPropertyOffset (int index)
 
ObjectInObjectPropertyAt (int index)
 
ObjectInObjectPropertyAtPut (int index, Object *value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
 
void InitializeBody (Map *map, Object *pre_allocated_value, Object *filler_value)
 
bool ReferencesObject (Object *obj)
 
void JSObjectShortPrint (StringStream *accumulator)
 
void PrintInstanceMigration (FILE *file, Map *original_map, Map *new_map)
 
ObjectSlowReverseLookup (Object *value)
 
 STATIC_ASSERT (kHeaderSize==Internals::kJSObjectHeaderSize)
 
ContextGetCreationContext ()
 
- Public Member Functions inherited from v8::internal::JSReceiver
bool IsSimpleEnum ()
 
Stringclass_name ()
 
Stringconstructor_name ()
 
ObjectGetConstructor ()
 
ObjectGetIdentityHash ()
 
- 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 void JSArrayUpdateLengthFromIndex (Handle< JSArray > array, uint32_t index, Handle< Object > value)
 
static bool IsReadOnlyLengthDescriptor (Handle< Map > jsarray_map)
 
static bool WouldChangeReadOnlyLength (Handle< JSArray > array, uint32_t index)
 
static MaybeHandle< ObjectReadOnlyLengthError (Handle< JSArray > array)
 
static void Initialize (Handle< JSArray > array, int capacity, int length=0)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetElementsLength (Handle< JSArray > array, Handle< Object > length)
 
static void SetContent (Handle< JSArray > array, Handle< FixedArrayBase > storage)
 
static void EnsureSize (Handle< JSArray > array, int minimum_size_of_backing_fixed_array)
 
static void Expand (Handle< JSArray > array, int minimum_size_of_backing_fixed_array)
 
- Static Public Member Functions inherited from v8::internal::JSObject
static void ResetElements (Handle< JSObject > object)
 
static void SetMapAndElements (Handle< JSObject > object, Handle< Map > map, Handle< FixedArrayBase > elements)
 
static Handle< FixedArrayEnsureWritableFastElements (Handle< JSObject > object)
 
static Handle< ObjectPrepareElementsForSort (Handle< JSObject > object, uint32_t limit)
 
static Handle< ObjectPrepareSlowElementsForSort (Handle< JSObject > object, uint32_t limit)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetPropertyWithInterceptor (LookupIterator *it, Handle< Object > value)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetOwnPropertyIgnoreAttributes (Handle< JSObject > object, Handle< Name > key, Handle< Object > value, PropertyAttributes attributes, ExecutableAccessorInfoHandling handling=DEFAULT_HANDLING)
 
static void AddProperty (Handle< JSObject > object, Handle< Name > key, Handle< Object > value, PropertyAttributes attributes)
 
static void AllocateStorageForMap (Handle< JSObject > object, Handle< Map > map)
 
static void MigrateInstance (Handle< JSObject > instance)
 
static bool TryMigrateInstance (Handle< JSObject > instance)
 
static void SetNormalizedProperty (Handle< JSObject > object, Handle< Name > key, Handle< Object > value, PropertyDetails details)
 
static void OptimizeAsPrototype (Handle< JSObject > object, PrototypeOptimizationMode mode)
 
static void ReoptimizeIfPrototype (Handle< JSObject > object)
 
static MUST_USE_RESULT Maybe< PropertyAttributesGetPropertyAttributesWithInterceptor (Handle< JSObject > holder, Handle< Object > receiver, Handle< Name > name)
 
static MUST_USE_RESULT Maybe< PropertyAttributesGetPropertyAttributesWithFailedAccessCheck (LookupIterator *it)
 
static MUST_USE_RESULT Maybe< PropertyAttributesGetElementAttributeWithReceiver (Handle< JSObject > object, Handle< JSReceiver > receiver, uint32_t index, bool check_prototype)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetAccessor (Handle< JSObject > object, Handle< Name > name, AccessorComponent component)
 
static MaybeHandle< ObjectDefineAccessor (Handle< JSObject > object, Handle< Name > name, Handle< Object > getter, Handle< Object > setter, PropertyAttributes attributes)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetAccessor (Handle< JSObject > object, Handle< AccessorInfo > info)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetPropertyWithInterceptor (Handle< JSObject > object, Handle< Object > receiver, Handle< Name > name)
 
static Handle< ObjectSetHiddenProperty (Handle< JSObject > object, Handle< Name > key, Handle< Object > value)
 
static void DeleteHiddenProperty (Handle< JSObject > object, Handle< Name > key)
 
static bool HasHiddenProperties (Handle< JSObject > object)
 
static void SetIdentityHash (Handle< JSObject > object, Handle< Smi > hash)
 
static void ValidateElements (Handle< JSObject > object)
 
static void EnsureCanContainHeapObjectElements (Handle< JSObject > obj)
 
static void EnsureCanContainElements (Handle< JSObject > object, Object **elements, uint32_t count, EnsureElementsMode mode)
 
static void EnsureCanContainElements (Handle< JSObject > object, Handle< FixedArrayBase > elements, uint32_t length, EnsureElementsMode mode)
 
static void EnsureCanContainElements (Handle< JSObject > object, Arguments *arguments, uint32_t first_arg, uint32_t arg_count, EnsureElementsMode mode)
 
static int NewElementsCapacity (int old_capacity)
 
static MUST_USE_RESULT MaybeHandle< AccessorPairGetOwnElementAccessorPair (Handle< JSObject > object, uint32_t index)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetFastElement (Handle< JSObject > object, uint32_t index, Handle< Object > value, StrictMode strict_mode, bool check_prototype)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetOwnElement (Handle< JSObject > object, uint32_t index, Handle< Object > value, StrictMode strict_mode)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetElement (Handle< JSObject > object, uint32_t index, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, bool check_prototype=true, SetPropertyMode set_mode=SET_PROPERTY)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetElementWithInterceptor (Handle< JSObject > object, Handle< Object > receiver, uint32_t index)
 
static Handle< FixedArraySetFastElementsCapacityAndLength (Handle< JSObject > object, int capacity, int length, SetFastElementsCapacitySmiMode smi_mode)
 
static void SetFastDoubleElementsCapacityAndLength (Handle< JSObject > object, int capacity, int length)
 
static MUST_USE_RESULT MaybeHandle< JSObjectGetKeysForNamedInterceptor (Handle< JSObject > object, Handle< JSReceiver > receiver)
 
static MUST_USE_RESULT MaybeHandle< JSObjectGetKeysForIndexedInterceptor (Handle< JSObject > object, Handle< JSReceiver > receiver)
 
static MUST_USE_RESULT Maybe< boolHasRealNamedProperty (Handle< JSObject > object, Handle< Name > key)
 
static MUST_USE_RESULT Maybe< boolHasRealElementProperty (Handle< JSObject > object, uint32_t index)
 
static MUST_USE_RESULT Maybe< boolHasRealNamedCallbackProperty (Handle< JSObject > object, Handle< Name > key)
 
static Handle< MapGetElementsTransitionMap (Handle< JSObject > object, ElementsKind to_kind)
 
static void TransitionElementsKind (Handle< JSObject > object, ElementsKind to_kind)
 
static void MigrateToMap (Handle< JSObject > object, Handle< Map > new_map)
 
static void NormalizeProperties (Handle< JSObject > object, PropertyNormalizationMode mode, int expected_additional_properties)
 
static Handle< SeededNumberDictionaryNormalizeElements (Handle< JSObject > object)
 
static void MigrateSlowToFast (Handle< JSObject > object, int unused_property_fields)
 
static Handle< ObjectFastPropertyAt (Handle< JSObject > object, Representation representation, FieldIndex index)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetPrototype (Handle< JSObject > object, Handle< Object > value, bool from_javascript)
 
static MUST_USE_RESULT MaybeHandle< ObjectPreventExtensions (Handle< JSObject > object)
 
static MUST_USE_RESULT MaybeHandle< ObjectFreeze (Handle< JSObject > object)
 
static void SetObserved (Handle< JSObject > object)
 
static Handle< JSObjectCopy (Handle< JSObject > object)
 
static MUST_USE_RESULT MaybeHandle< JSObjectDeepCopy (Handle< JSObject > object, AllocationSiteUsageContext *site_context, DeepCopyHints hints=kNoHints)
 
static MUST_USE_RESULT MaybeHandle< JSObjectDeepWalk (Handle< JSObject > object, AllocationSiteCreationContext *site_context)
 
static Handle< ObjectGetDataProperty (Handle< JSObject > object, Handle< Name > key)
 
static Handle< ObjectGetDataProperty (LookupIterator *it)
 
static void PrintElementsTransition (FILE *file, Handle< JSObject > object, ElementsKind from_kind, Handle< FixedArrayBase > from_elements, ElementsKind to_kind, Handle< FixedArrayBase > to_elements)
 
static void EnqueueChangeRecord (Handle< JSObject > object, const char *type, Handle< Name > name, Handle< Object > old_value)
 
static void MigrateToNewProperty (Handle< JSObject > object, Handle< Map > transition, Handle< Object > value)
 
- Static Public Member Functions inherited from v8::internal::JSReceiver
static MUST_USE_RESULT MaybeHandle< ObjectSetElement (Handle< JSReceiver > object, uint32_t index, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode)
 
static MUST_USE_RESULT Maybe< boolHasProperty (Handle< JSReceiver > object, Handle< Name > name)
 
static MUST_USE_RESULT Maybe< boolHasOwnProperty (Handle< JSReceiver >, Handle< Name > name)
 
static MUST_USE_RESULT Maybe< boolHasElement (Handle< JSReceiver > object, uint32_t index)
 
static MUST_USE_RESULT Maybe< boolHasOwnElement (Handle< JSReceiver > object, uint32_t index)
 
static MUST_USE_RESULT MaybeHandle< ObjectDeleteProperty (Handle< JSReceiver > object, Handle< Name > name, DeleteMode mode=NORMAL_DELETION)
 
static MUST_USE_RESULT MaybeHandle< ObjectDeleteElement (Handle< JSReceiver > object, uint32_t index, DeleteMode mode=NORMAL_DELETION)
 
static MUST_USE_RESULT Maybe< PropertyAttributesGetPropertyAttributes (Handle< JSReceiver > object, Handle< Name > name)
 
static MUST_USE_RESULT Maybe< PropertyAttributesGetPropertyAttributes (LookupIterator *it)
 
static MUST_USE_RESULT Maybe< PropertyAttributesGetOwnPropertyAttributes (Handle< JSReceiver > object, Handle< Name > name)
 
static MUST_USE_RESULT Maybe< PropertyAttributesGetElementAttribute (Handle< JSReceiver > object, uint32_t index)
 
static MUST_USE_RESULT Maybe< PropertyAttributesGetOwnElementAttribute (Handle< JSReceiver > object, uint32_t index)
 
static Handle< SmiGetOrCreateIdentityHash (Handle< JSReceiver > object)
 
static MUST_USE_RESULT MaybeHandle< FixedArrayGetKeys (Handle< JSReceiver > object, KeyCollectionType type)
 
- 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 kPreallocatedArrayElements = 4
 
static const int kLengthOffset = JSObject::kHeaderSize
 
static const int kSize = kLengthOffset + kPointerSize
 
- Static Public Attributes inherited from v8::internal::JSObject
static const uint32_t kMaxElementCount = 0xffffffffu
 
static const uint32_t kMaxGap = 1024
 
static const int kMaxUncheckedFastElementsLength = 5000
 
static const int kMaxUncheckedOldFastElementsLength = 500
 
static const int kInitialMaxFastElementArray = 100000
 
static const int kInitialGlobalObjectUnusedPropertiesCount = 4
 
static const int kMaxInstanceSize = 255 * kPointerSize
 
static const int kFieldsAdded = 3
 
static const int kPropertiesOffset = HeapObject::kHeaderSize
 
static const int kElementsOffset = kPropertiesOffset + kPointerSize
 
static const int kHeaderSize = kElementsOffset + 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
 

Private Member Functions

 DISALLOW_IMPLICIT_CONSTRUCTORS (JSArray)
 

Additional Inherited Members

- Public Types inherited from v8::internal::JSObject
enum  ExecutableAccessorInfoHandling { DEFAULT_HANDLING , DONT_FORCE_FIELD }
 
enum  SetFastElementsCapacitySmiMode { kAllowSmiElements , kForceSmiElements , kDontAllowSmiElements }
 
enum  DeepCopyHints { kNoHints = 0 , kObjectIsShallow = 1 }
 
- Public Types inherited from v8::internal::JSReceiver
enum  DeleteMode { NORMAL_DELETION , STRICT_DELETION , FORCE_DELETION }
 
enum  KeyCollectionType { OWN_ONLY , INCLUDE_PROTOS }
 
- 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 10019 of file objects.h.

Member Function Documentation

◆ AllowsSetElementsLength()

bool v8::internal::JSArray::AllowsSetElementsLength ( )
inline

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

6979  {
6980  bool result = elements()->IsFixedArray() || elements()->IsFixedDoubleArray();
6981  DCHECK(result == !HasExternalArrayElements());
6982  return result;
6983 }
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, and v8::internal::JSObject::HasExternalArrayElements().

+ Here is the call graph for this function:

◆ DISALLOW_IMPLICIT_CONSTRUCTORS()

v8::internal::JSArray::DISALLOW_IMPLICIT_CONSTRUCTORS ( JSArray  )
private

◆ EnsureSize()

void v8::internal::JSArray::EnsureSize ( Handle< JSArray array,
int  minimum_size_of_backing_fixed_array 
)
inlinestatic

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

6955  {
6956  DCHECK(array->HasFastSmiOrObjectElements());
6957  Handle<FixedArray> elts = handle(FixedArray::cast(array->elements()));
6958  const int kArraySizeThatFitsComfortablyInNewSpace = 128;
6959  if (elts->length() < required_size) {
6960  // Doubling in size would be overkill, but leave some slack to avoid
6961  // constantly growing.
6962  Expand(array, required_size + (required_size >> 3));
6963  // It's a performance benefit to keep a frequently used array in new-space.
6964  } else if (!array->GetHeap()->new_space()->Contains(*elts) &&
6965  required_size < kArraySizeThatFitsComfortablyInNewSpace) {
6966  // Expand will allocate a new backing store in new space even if the size
6967  // we asked for isn't larger than what we had before.
6968  Expand(array, required_size);
6969  }
6970 }
static void Expand(Handle< JSArray > array, int minimum_size_of_backing_fixed_array)
Definition: objects.cc:11090
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:146

References DCHECK, Expand(), and v8::internal::handle().

Referenced by v8::internal::RegExpImpl::SetLastMatchInfo().

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

◆ Expand()

void v8::internal::JSArray::Expand ( Handle< JSArray array,
int  minimum_size_of_backing_fixed_array 
)
static

Definition at line 11090 of file objects.cc.

11090  {
11091  ElementsAccessor* accessor = array->GetElementsAccessor();
11092  accessor->SetCapacityAndLength(array, required_size, required_size);
11093 }

References v8::internal::ElementsAccessor::SetCapacityAndLength().

Referenced by EnsureSize().

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

◆ Initialize()

void v8::internal::JSArray::Initialize ( Handle< JSArray array,
int  capacity,
int  length = 0 
)
static

Definition at line 11083 of file objects.cc.

11083  {
11084  DCHECK(capacity >= 0);
11085  array->GetIsolate()->factory()->NewJSArrayStorage(
11086  array, length, capacity, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE);
11087 }
@ INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE
Definition: heap.h:513

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

Referenced by v8::internal::ArrayConstructInitializeElements().

+ Here is the caller graph for this function:

◆ IsReadOnlyLengthDescriptor()

bool v8::internal::JSArray::IsReadOnlyLengthDescriptor ( Handle< Map jsarray_map)
static

Definition at line 12803 of file objects.cc.

12803  {
12804  Isolate* isolate = jsarray_map->GetIsolate();
12805  DCHECK(!jsarray_map->is_dictionary_map());
12806  LookupResult lookup(isolate);
12807  Handle<Name> length_string = isolate->factory()->length_string();
12808  jsarray_map->LookupDescriptor(NULL, *length_string, &lookup);
12809  return lookup.IsReadOnly();
12810 }
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 enable alignment of csp to bytes on platforms which prefer the register to always be NULL

References DCHECK, v8::internal::Isolate::factory(), and NULL.

Referenced by v8::internal::HOptimizedGraphBuilder::TryInlineBuiltinMethodCall().

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

◆ JSArrayUpdateLengthFromIndex()

void v8::internal::JSArray::JSArrayUpdateLengthFromIndex ( Handle< JSArray array,
uint32_t  index,
Handle< Object value 
)
static

Definition at line 12788 of file objects.cc.

12790  {
12791  uint32_t old_len = 0;
12792  CHECK(array->length()->ToArrayIndex(&old_len));
12793  // Check to see if we need to update the length. For now, we make
12794  // sure that the length stays within 32-bits (unsigned).
12795  if (index >= old_len && index != 0xffffffff) {
12796  Handle<Object> len = array->GetIsolate()->factory()->NewNumber(
12797  static_cast<double>(index) + 1);
12798  array->set_length(*len);
12799  }
12800 }
#define CHECK(condition)
Definition: logging.h:36

References CHECK.

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

+ Here is the caller graph for this function:

◆ ReadOnlyLengthError()

MaybeHandle< Object > v8::internal::JSArray::ReadOnlyLengthError ( Handle< JSArray array)
static

Definition at line 12829 of file objects.cc.

12829  {
12830  Isolate* isolate = array->GetIsolate();
12831  Handle<Name> length = isolate->factory()->length_string();
12832  Handle<Object> args[2] = { length, array };
12833  THROW_NEW_ERROR(isolate, NewTypeError("strict_read_only_property",
12834  HandleVector(args, arraysize(args))),
12835  Object);
12836 }
friend class Object
Definition: objects.h:2219
#define THROW_NEW_ERROR(isolate, call, T)
Definition: isolate.h:138
#define arraysize(array)
Definition: macros.h:86
Vector< Handle< Object > > HandleVector(v8::internal::Handle< T > *elms, int length)
Definition: utils.h:1100

References arraysize, v8::internal::Isolate::factory(), v8::internal::HandleVector(), v8::internal::FixedArrayBase::length(), and THROW_NEW_ERROR.

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

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

◆ set_length()

void v8::internal::JSArray::set_length ( Smi length)
inline

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

6973  {
6974  // Don't need a write barrier for a Smi.
6975  set_length(static_cast<Object*>(length), SKIP_WRITE_BARRIER);
6976 }
void set_length(Smi *length)
Definition: objects-inl.h:6973
@ SKIP_WRITE_BARRIER
Definition: objects.h:235

References v8::internal::SKIP_WRITE_BARRIER.

◆ SetContent()

void v8::internal::JSArray::SetContent ( Handle< JSArray array,
Handle< FixedArrayBase storage 
)
inlinestatic

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

6987  {
6988  EnsureCanContainElements(array, storage, storage->length(),
6990 
6991  DCHECK((storage->map() == array->GetHeap()->fixed_double_array_map() &&
6992  IsFastDoubleElementsKind(array->GetElementsKind())) ||
6993  ((storage->map() != array->GetHeap()->fixed_double_array_map()) &&
6994  (IsFastObjectElementsKind(array->GetElementsKind()) ||
6995  (IsFastSmiElementsKind(array->GetElementsKind()) &&
6996  Handle<FixedArray>::cast(storage)->ContainsOnlySmisOrHoles()))));
6997  array->set_elements(*storage);
6998  array->set_length(Smi::FromInt(storage->length()));
6999 }
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
static void EnsureCanContainElements(Handle< JSObject > object, Object **elements, uint32_t count, EnsureElementsMode mode)
Definition: objects-inl.h:1738
static Smi * FromInt(int value)
Definition: objects-inl.h:1321
@ ALLOW_COPIED_DOUBLE_ELEMENTS
Definition: objects.h:1541
bool IsFastDoubleElementsKind(ElementsKind kind)
bool IsFastSmiElementsKind(ElementsKind kind)
bool IsFastObjectElementsKind(ElementsKind kind)

References v8::internal::ALLOW_COPIED_DOUBLE_ELEMENTS, DCHECK, v8::internal::JSObject::EnsureCanContainElements(), v8::internal::Smi::FromInt(), v8::internal::IsFastDoubleElementsKind(), v8::internal::IsFastObjectElementsKind(), and v8::internal::IsFastSmiElementsKind().

Referenced by v8::internal::RUNTIME_FUNCTION(), v8::internal::SearchRegExpMultiple(), v8::internal::ElementsAccessorBase< ElementsAccessorSubclass, ElementsTraitsParam >::SetLengthImpl(), and v8::internal::FixedArrayBuilder::ToJSArray().

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

◆ SetElementsLength()

MaybeHandle< Object > v8::internal::JSArray::SetElementsLength ( Handle< JSArray array,
Handle< Object length 
)
static

Definition at line 11167 of file objects.cc.

11169  {
11170  if (array->HasFastElements()) {
11171  // If the new array won't fit in a some non-trivial fraction of the max old
11172  // space size, then force it to go dictionary mode.
11173  int max_fast_array_size = static_cast<int>(
11174  (array->GetHeap()->MaxOldGenerationSize() / kDoubleSize) / 4);
11175  if (new_length_handle->IsNumber() &&
11176  NumberToInt32(*new_length_handle) >= max_fast_array_size) {
11177  NormalizeElements(array);
11178  }
11179  }
11180 
11181  // We should never end in here with a pixel or external array.
11182  DCHECK(array->AllowsSetElementsLength());
11183  if (!array->map()->is_observed()) {
11184  return array->GetElementsAccessor()->SetLength(array, new_length_handle);
11185  }
11186 
11187  Isolate* isolate = array->GetIsolate();
11188  List<uint32_t> indices;
11189  List<Handle<Object> > old_values;
11190  Handle<Object> old_length_handle(array->length(), isolate);
11191  uint32_t old_length = 0;
11192  CHECK(old_length_handle->ToArrayIndex(&old_length));
11193  uint32_t new_length = 0;
11194  CHECK(new_length_handle->ToArrayIndex(&new_length));
11195 
11196  static const PropertyAttributes kNoAttrFilter = NONE;
11197  int num_elements = array->NumberOfOwnElements(kNoAttrFilter);
11198  if (num_elements > 0) {
11199  if (old_length == static_cast<uint32_t>(num_elements)) {
11200  // Simple case for arrays without holes.
11201  for (uint32_t i = old_length - 1; i + 1 > new_length; --i) {
11202  if (!GetOldValue(isolate, array, i, &old_values, &indices)) break;
11203  }
11204  } else {
11205  // For sparse arrays, only iterate over existing elements.
11206  // TODO(rafaelw): For fast, sparse arrays, we can avoid iterating over
11207  // the to-be-removed indices twice.
11208  Handle<FixedArray> keys = isolate->factory()->NewFixedArray(num_elements);
11209  array->GetOwnElementKeys(*keys, kNoAttrFilter);
11210  while (num_elements-- > 0) {
11211  uint32_t index = NumberToUint32(keys->get(num_elements));
11212  if (index < new_length) break;
11213  if (!GetOldValue(isolate, array, index, &old_values, &indices)) break;
11214  }
11215  }
11216  }
11217 
11218  Handle<Object> hresult;
11220  isolate, hresult,
11221  array->GetElementsAccessor()->SetLength(array, new_length_handle),
11222  Object);
11223 
11224  CHECK(array->length()->ToArrayIndex(&new_length));
11225  if (old_length == new_length) return hresult;
11226 
11227  BeginPerformSplice(array);
11228 
11229  for (int i = 0; i < indices.length(); ++i) {
11230  // For deletions where the property was an accessor, old_values[i]
11231  // will be the hole, which instructs EnqueueChangeRecord to elide
11232  // the "oldValue" property.
11234  array, "delete", isolate->factory()->Uint32ToString(indices[i]),
11235  old_values[i]);
11236  }
11238  array, "update", isolate->factory()->length_string(),
11239  old_length_handle);
11240 
11241  EndPerformSplice(array);
11242 
11243  uint32_t index = Min(old_length, new_length);
11244  uint32_t add_count = new_length > old_length ? new_length - old_length : 0;
11245  uint32_t delete_count = new_length < old_length ? old_length - new_length : 0;
11246  Handle<JSArray> deleted = isolate->factory()->NewJSArray(0);
11247  if (delete_count > 0) {
11248  for (int i = indices.length() - 1; i >= 0; i--) {
11249  // Skip deletions where the property was an accessor, leaving holes
11250  // in the array of old values.
11251  if (old_values[i]->IsTheHole()) continue;
11253  deleted, indices[i] - index, old_values[i], NONE, SLOPPY).Assert();
11254  }
11255 
11256  SetProperty(deleted, isolate->factory()->length_string(),
11257  isolate->factory()->NewNumberFromUint(delete_count),
11258  STRICT).Assert();
11259  }
11260 
11261  EnqueueSpliceRecord(array, index, deleted, add_count);
11262 
11263  return hresult;
11264 }
static MUST_USE_RESULT MaybeHandle< Object > SetElement(Handle< JSObject > object, uint32_t index, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, bool check_prototype=true, SetPropertyMode set_mode=SET_PROPERTY)
Definition: objects.cc:12336
static void EnqueueChangeRecord(Handle< JSObject > object, const char *type, Handle< Name > name, Handle< Object > old_value)
Definition: objects.cc:1809
static Handle< SeededNumberDictionary > NormalizeElements(Handle< JSObject > object)
Definition: objects.cc:4459
static MUST_USE_RESULT MaybeHandle< Object > SetProperty(Handle< Object > object, Handle< Name > key, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
Definition: objects.cc:2798
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 enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property keys(0 means random)" "(with snapshots this option cannot override the baked-in seed)") DEFINE_BOOL(profile_deserialization
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call, T)
Definition: isolate.h:135
static LifetimePosition Min(LifetimePosition a, LifetimePosition b)
const int kDoubleSize
Definition: globals.h:127
static void EndPerformSplice(Handle< JSArray > object)
Definition: objects.cc:11154
int32_t NumberToInt32(Object *number)
Definition: conversions.h:189
uint32_t NumberToUint32(Object *number)
Definition: conversions.h:195
static bool GetOldValue(Isolate *isolate, Handle< JSObject > object, uint32_t index, List< Handle< Object > > *old_values, List< uint32_t > *indices)
Definition: objects.cc:11099
static void BeginPerformSplice(Handle< JSArray > object)
Definition: objects.cc:11141
static void EnqueueSpliceRecord(Handle< JSArray > object, uint32_t index, Handle< JSArray > deleted, uint32_t add_count)
Definition: objects.cc:11120
PropertyAttributes
@ NONE

References ASSIGN_RETURN_ON_EXCEPTION, v8::internal::BeginPerformSplice(), CHECK, DCHECK, v8::internal::EndPerformSplice(), v8::internal::JSObject::EnqueueChangeRecord(), v8::internal::EnqueueSpliceRecord(), v8::internal::Isolate::factory(), v8::internal::GetOldValue(), v8::internal::kDoubleSize, keys(), v8::internal::Min(), NONE, v8::internal::JSObject::NormalizeElements(), v8::internal::NumberToInt32(), v8::internal::NumberToUint32(), v8::internal::JSObject::SetElement(), v8::internal::Object::SetProperty(), v8::internal::SLOPPY, and v8::internal::STRICT.

Referenced by v8::internal::ArrayConstructInitializeElements().

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

◆ WouldChangeReadOnlyLength()

bool v8::internal::JSArray::WouldChangeReadOnlyLength ( Handle< JSArray array,
uint32_t  index 
)
static

Definition at line 12813 of file objects.cc.

12814  {
12815  uint32_t length = 0;
12816  CHECK(array->length()->ToArrayIndex(&length));
12817  if (length <= index) {
12818  LookupIterator it(array, array->GetIsolate()->factory()->length_string(),
12819  LookupIterator::OWN_SKIP_INTERCEPTOR);
12820  CHECK_NE(LookupIterator::ACCESS_CHECK, it.state());
12821  CHECK(it.IsFound());
12822  CHECK_EQ(LookupIterator::ACCESSOR, it.state());
12823  return it.IsReadOnly();
12824  }
12825  return false;
12826 }
friend class LookupIterator
Definition: objects.h:1226
#define CHECK_EQ(expected, value)
Definition: logging.h:169
#define CHECK_NE(unexpected, value)
Definition: logging.h:173

References v8::internal::ACCESSOR, CHECK, CHECK_EQ, CHECK_NE, v8::internal::FixedArrayBase::length(), and v8::internal::Object::LookupIterator.

Referenced by v8::internal::BUILTIN(), and v8::internal::JSObject::SetElementWithoutInterceptor().

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

Member Data Documentation

◆ kLengthOffset

◆ kPreallocatedArrayElements

const int v8::internal::JSArray::kPreallocatedArrayElements = 4
static

◆ kSize

const int v8::internal::JSArray::kSize = kLengthOffset + kPointerSize
static

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