5 #ifndef V8_OBJECTS_JS_ARRAY_H_ 6 #define V8_OBJECTS_JS_ARRAY_H_ 8 #include "src/objects/allocation-site.h" 9 #include "src/objects/fixed-array.h" 10 #include "src/objects/js-objects.h" 13 #include "src/objects/object-macros.h" 26 DECL_ACCESSORS(length,
Object)
30 inline void set_length(
Smi length);
38 static void Initialize(
Handle<JSArray> array,
int capacity,
int length = 0);
42 bool SetLengthWouldNormalize(
uint32_t new_length);
43 static inline bool SetLengthWouldNormalize(
Heap* heap,
uint32_t new_length);
46 inline bool AllowsSetLength();
55 V8_WARN_UNUSED_RESULT
static Maybe<bool> DefineOwnProperty(
59 static bool AnythingToArrayLength(
Isolate* isolate,
62 V8_WARN_UNUSED_RESULT
static Maybe<bool> ArraySetLength(
64 ShouldThrow should_throw);
96 inline bool HasArrayPrototype(
Isolate* isolate);
105 static const int kPreallocatedArrayElements = 4;
108 #define JS_ARRAY_FIELDS(V) \ 109 V(kLengthOffset, kTaggedSize) \ 113 DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JS_ARRAY_FIELDS)
114 #undef JS_ARRAY_FIELDS 116 static const int kLengthDescriptorIndex = 0;
119 static const int kMaxCopyElements = 100;
122 static const uint32_t kMaxFastArrayLength = 32 * 1024 * 1024;
125 static const uint32_t kMinJoinStackSize = 2;
127 static const int kInitialMaxFastElementArray =
128 (kMaxRegularHeapObjectSize - FixedArray::kHeaderSize - kSize -
129 AllocationMemento::kSize) >>
133 static const uint32_t kMaxArrayIndex = kMaxUInt32 - 1;
136 DISALLOW_IMPLICIT_CONSTRUCTORS(
JSArray);
152 DECL_ACCESSORS(iterated_object,
Object)
177 DECL_ACCESSORS(next_index,
Object)
180 inline IterationKind kind()
const;
181 inline void set_kind(IterationKind kind);
184 #define JS_ARRAY_ITERATOR_FIELDS(V) \ 185 V(kIteratedObjectOffset, kTaggedSize) \ 186 V(kNextIndexOffset, kTaggedSize) \ 187 V(kKindOffset, kTaggedSize) \ 191 DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JS_ARRAY_ITERATOR_FIELDS)
192 #undef JS_ARRAY_ITERATOR_FIELDS 201 #include "src/objects/object-macros-undef.h" 203 #endif // V8_OBJECTS_JS_ARRAY_H_