78 static const int kPackedSizeNotKnown = -1;
86 #define ELEMENTS_LIST(V) \
87 V(FastPackedSmiElementsAccessor, FAST_SMI_ELEMENTS, FixedArray) \
88 V(FastHoleySmiElementsAccessor, FAST_HOLEY_SMI_ELEMENTS, \
90 V(FastPackedObjectElementsAccessor, FAST_ELEMENTS, FixedArray) \
91 V(FastHoleyObjectElementsAccessor, FAST_HOLEY_ELEMENTS, FixedArray) \
92 V(FastPackedDoubleElementsAccessor, FAST_DOUBLE_ELEMENTS, \
94 V(FastHoleyDoubleElementsAccessor, FAST_HOLEY_DOUBLE_ELEMENTS, \
96 V(DictionaryElementsAccessor, DICTIONARY_ELEMENTS, \
97 SeededNumberDictionary) \
98 V(SloppyArgumentsElementsAccessor, SLOPPY_ARGUMENTS_ELEMENTS, \
100 V(ExternalInt8ElementsAccessor, EXTERNAL_INT8_ELEMENTS, \
102 V(ExternalUint8ElementsAccessor, \
103 EXTERNAL_UINT8_ELEMENTS, ExternalUint8Array) \
104 V(ExternalInt16ElementsAccessor, EXTERNAL_INT16_ELEMENTS, \
105 ExternalInt16Array) \
106 V(ExternalUint16ElementsAccessor, \
107 EXTERNAL_UINT16_ELEMENTS, ExternalUint16Array) \
108 V(ExternalInt32ElementsAccessor, EXTERNAL_INT32_ELEMENTS, \
109 ExternalInt32Array) \
110 V(ExternalUint32ElementsAccessor, \
111 EXTERNAL_UINT32_ELEMENTS, ExternalUint32Array) \
112 V(ExternalFloat32ElementsAccessor, \
113 EXTERNAL_FLOAT32_ELEMENTS, ExternalFloat32Array) \
114 V(ExternalFloat64ElementsAccessor, \
115 EXTERNAL_FLOAT64_ELEMENTS, ExternalFloat64Array) \
116 V(ExternalUint8ClampedElementsAccessor, \
117 EXTERNAL_UINT8_CLAMPED_ELEMENTS, \
118 ExternalUint8ClampedArray) \
119 V(FixedUint8ElementsAccessor, UINT8_ELEMENTS, FixedUint8Array) \
120 V(FixedInt8ElementsAccessor, INT8_ELEMENTS, FixedInt8Array) \
121 V(FixedUint16ElementsAccessor, UINT16_ELEMENTS, FixedUint16Array) \
122 V(FixedInt16ElementsAccessor, INT16_ELEMENTS, FixedInt16Array) \
123 V(FixedUint32ElementsAccessor, UINT32_ELEMENTS, FixedUint32Array) \
124 V(FixedInt32ElementsAccessor, INT32_ELEMENTS, FixedInt32Array) \
125 V(FixedFloat32ElementsAccessor, FLOAT32_ELEMENTS, FixedFloat32Array) \
126 V(FixedFloat64ElementsAccessor, FLOAT64_ELEMENTS, FixedFloat64Array) \
127 V(FixedUint8ClampedElementsAccessor, UINT8_CLAMPED_ELEMENTS, \
128 FixedUint8ClampedArray)
136 #define ELEMENTS_TRAITS(Class, KindParam, Store) \
137 template<> class ElementsKindTraits<KindParam> { \
139 static const ElementsKind Kind = KindParam; \
140 typedef Store BackingStore; \
143 #undef ELEMENTS_TRAITS
146 ElementsAccessor** ElementsAccessor::elements_accessors_;
149 static bool HasKey(FixedArray* array,
Object* key) {
150 int len0 = array->length();
151 for (
int i = 0; i < len0; i++) {
152 Object* element = array->get(i);
153 if (element->IsSmi() && element == key)
return true;
154 if (element->IsString() &&
163 static Handle<Object> ThrowArrayLengthRangeError(Isolate* isolate) {
165 *isolate->factory()->NewRangeError(
"invalid_array_length",
166 HandleVector<Object>(
NULL, 0)));
167 return Handle<Object>();
171 static void CopyObjectToObjectElements(Handle<FixedArrayBase> from_base,
174 Handle<FixedArrayBase> to_base,
179 from_base->GetIsolate()->heap()->fixed_cow_array_map());
181 int copy_size = raw_copy_size;
182 if (raw_copy_size < 0) {
185 copy_size =
Min(from_base->length() - from_start,
186 to_base->length() - to_start);
188 int start = to_start + copy_size;
189 int length = to_base->length() - start;
191 Heap* heap = from_base->GetHeap();
192 MemsetPointer(Handle<FixedArray>::cast(to_base)->data_start() + start,
193 heap->the_hole_value(), length);
197 ASSERT((copy_size + static_cast<int>(to_start)) <= to_base->length() &&
198 (copy_size +
static_cast<int>(from_start)) <= from_base->length());
199 if (copy_size == 0)
return;
206 CopyWords(reinterpret_cast<Object**>(to_address) + to_start,
207 reinterpret_cast<Object**>(from_address) + from_start,
208 static_cast<size_t>(copy_size));
211 Heap* heap = from->GetHeap();
212 if (!heap->InNewSpace(*to)) {
213 heap->RecordWrites(to->address(),
214 to->OffsetOfElementAt(to_start),
217 heap->incremental_marking()->RecordWrites(*to);
222 static void CopyDictionaryToObjectElements(Handle<FixedArrayBase> from_base,
224 Handle<FixedArrayBase> to_base,
228 Handle<SeededNumberDictionary> from =
231 int copy_size = raw_copy_size;
232 Heap* heap = from->GetHeap();
233 if (raw_copy_size < 0) {
236 copy_size = from->max_number_key() + 1 - from_start;
238 int start = to_start + copy_size;
239 int length = to_base->length() - start;
241 Heap* heap = from->GetHeap();
242 MemsetPointer(Handle<FixedArray>::cast(to_base)->data_start() + start,
243 heap->the_hole_value(), length);
247 ASSERT(*to_base != *from_base);
249 if (copy_size == 0)
return;
251 uint32_t to_length = to->length();
252 if (to_start + copy_size > to_length) {
253 copy_size = to_length - to_start;
255 for (
int i = 0; i < copy_size; i++) {
256 int entry = from->FindEntry(i + from_start);
258 Object* value = from->ValueAt(entry);
259 ASSERT(!value->IsTheHole());
262 to->set_the_hole(i + to_start);
266 if (!heap->InNewSpace(*to)) {
267 heap->RecordWrites(to->address(),
268 to->OffsetOfElementAt(to_start),
271 heap->incremental_marking()->RecordWrites(*to);
276 static void CopyDoubleToObjectElements(Handle<FixedArrayBase> from_base,
278 Handle<FixedArrayBase> to_base,
283 int copy_size = raw_copy_size;
284 if (raw_copy_size < 0) {
287 copy_size =
Min(from_base->length() - from_start,
288 to_base->length() - to_start);
293 int start = to_start;
294 int length = to_base->length() - start;
296 Heap* heap = from_base->GetHeap();
297 MemsetPointer(Handle<FixedArray>::cast(to_base)->data_start() + start,
298 heap->the_hole_value(), length);
302 ASSERT((copy_size + static_cast<int>(to_start)) <= to_base->length() &&
303 (copy_size +
static_cast<int>(from_start)) <= from_base->length());
304 if (copy_size == 0)
return;
307 for (
int i = 0; i < copy_size; ++i) {
308 HandleScope scope(from_base->GetIsolate());
313 Handle<Object> value = from->get_as_handle(i + from_start);
320 static void CopyDoubleToDoubleElements(Handle<FixedArrayBase> from_base,
322 Handle<FixedArrayBase> to_base,
326 int copy_size = raw_copy_size;
327 if (raw_copy_size < 0) {
330 copy_size =
Min(from_base->length() - from_start,
331 to_base->length() - to_start);
333 for (
int i = to_start + copy_size; i < to_base->length(); ++i) {
338 ASSERT((copy_size + static_cast<int>(to_start)) <= to_base->length() &&
339 (copy_size +
static_cast<int>(from_start)) <= from_base->length());
340 if (copy_size == 0)
return;
348 CopyWords(reinterpret_cast<Object**>(to_address),
349 reinterpret_cast<Object**>(from_address),
350 static_cast<size_t>(words_per_double * copy_size));
354 static void CopySmiToDoubleElements(Handle<FixedArrayBase> from_base,
356 Handle<FixedArrayBase> to_base,
360 int copy_size = raw_copy_size;
361 if (raw_copy_size < 0) {
364 copy_size = from_base->length() - from_start;
366 for (
int i = to_start + copy_size; i < to_base->length(); ++i) {
371 ASSERT((copy_size + static_cast<int>(to_start)) <= to_base->length() &&
372 (copy_size +
static_cast<int>(from_start)) <= from_base->length());
373 if (copy_size == 0)
return;
376 Handle<Object> the_hole = from->GetIsolate()->factory()->the_hole_value();
377 for (uint32_t from_end = from_start + static_cast<uint32_t>(copy_size);
378 from_start < from_end; from_start++, to_start++) {
379 Object* hole_or_smi = from->get(from_start);
380 if (hole_or_smi == *the_hole) {
381 to->set_the_hole(to_start);
383 to->set(to_start,
Smi::cast(hole_or_smi)->value());
389 static void CopyPackedSmiToDoubleElements(Handle<FixedArrayBase> from_base,
391 Handle<FixedArrayBase> to_base,
396 int copy_size = raw_copy_size;
398 if (raw_copy_size < 0) {
401 copy_size = packed_size - from_start;
403 to_end = to_base->length();
404 for (uint32_t i = to_start + copy_size; i < to_end; ++i) {
408 to_end = to_start +
static_cast<uint32_t
>(copy_size);
411 to_end = to_start +
static_cast<uint32_t
>(copy_size);
413 ASSERT(static_cast<int>(to_end) <= to_base->length());
414 ASSERT(packed_size >= 0 && packed_size <= copy_size);
415 ASSERT((copy_size + static_cast<int>(to_start)) <= to_base->length() &&
416 (copy_size +
static_cast<int>(from_start)) <= from_base->length());
417 if (copy_size == 0)
return;
420 for (uint32_t from_end = from_start + static_cast<uint32_t>(packed_size);
421 from_start < from_end; from_start++, to_start++) {
422 Object* smi = from->get(from_start);
423 ASSERT(!smi->IsTheHole());
424 to->set(to_start,
Smi::cast(smi)->value());
429 static void CopyObjectToDoubleElements(Handle<FixedArrayBase> from_base,
431 Handle<FixedArrayBase> to_base,
435 int copy_size = raw_copy_size;
436 if (raw_copy_size < 0) {
439 copy_size = from_base->length() - from_start;
441 for (
int i = to_start + copy_size; i < to_base->length(); ++i) {
446 ASSERT((copy_size + static_cast<int>(to_start)) <= to_base->length() &&
447 (copy_size +
static_cast<int>(from_start)) <= from_base->length());
448 if (copy_size == 0)
return;
451 Handle<Object> the_hole = from->GetIsolate()->factory()->the_hole_value();
452 for (uint32_t from_end = from_start + copy_size;
453 from_start < from_end; from_start++, to_start++) {
454 Object* hole_or_object = from->get(from_start);
455 if (hole_or_object == *the_hole) {
456 to->set_the_hole(to_start);
458 to->set(to_start, hole_or_object->Number());
464 static void CopyDictionaryToDoubleElements(Handle<FixedArrayBase> from_base,
466 Handle<FixedArrayBase> to_base,
469 Handle<SeededNumberDictionary> from =
472 int copy_size = raw_copy_size;
476 copy_size = from->max_number_key() + 1 - from_start;
478 for (
int i = to_start + copy_size; i < to_base->length(); ++i) {
483 if (copy_size == 0)
return;
485 uint32_t to_length = to->length();
486 if (to_start + copy_size > to_length) {
487 copy_size = to_length - to_start;
489 for (
int i = 0; i < copy_size; i++) {
490 int entry = from->FindEntry(i + from_start);
492 to->set(i + to_start, from->ValueAt(entry)->Number());
494 to->set_the_hole(i + to_start);
500 static void TraceTopFrame(Isolate* isolate) {
501 StackFrameIterator it(isolate);
503 PrintF(
"unknown location (no JavaScript frames present)");
507 if (raw_frame->is_internal()) {
508 Code* apply_builtin = isolate->builtins()->builtin(
509 Builtins::kFunctionApply);
510 if (raw_frame->unchecked_code() == apply_builtin) {
513 raw_frame = it.frame();
521 bool allow_appending) {
523 const char* elements_type =
"array";
524 if (obj->IsJSArray()) {
526 raw_length = array->length();
529 elements_type =
"object";
532 if (raw_length->IsNumber()) {
533 double n = raw_length->
Number();
536 uint32_t compare_length =
static_cast<uint32_t
>(int32_length);
537 if (allow_appending) compare_length++;
538 if (key >= compare_length) {
539 PrintF(
"[OOB %s %s (%s length = %d, element accessed = %d) in ",
540 elements_type, op, elements_type,
541 static_cast<int>(int32_length),
542 static_cast<int>(key));
547 PrintF(
"[%s elements length not integer value in ", elements_type);
552 PrintF(
"[%s elements length not a number in ", elements_type);
576 template <
typename ElementsAccessorSubclass,
577 typename ElementsTraitsParam>
587 return ElementsTraits::Kind;
596 if (fixed_array_base->IsFailure())
return;
597 if (!fixed_array_base->IsHeapObject())
return;
599 if (fixed_array_base->
IsFiller())
return;
601 if (holder->IsJSArray()) {
603 if (length_obj->IsSmi()) {
607 length = fixed_array_base->
length();
609 ElementsAccessorSubclass::ValidateContents(holder, length);
613 ElementsAccessorSubclass::ValidateImpl(holder);
620 return ElementsAccessorSubclass::GetAttributesImpl(
621 receiver, holder, key, backing_store) !=
ABSENT;
628 if (backing_store ==
NULL) {
629 backing_store = holder->elements();
631 return ElementsAccessorSubclass::HasElementImpl(
632 receiver, holder, key, backing_store);
642 Get(*receiver, *holder, key,
643 backing_store.is_null()
644 ?
NULL : *backing_store),
653 if (backing_store ==
NULL) {
654 backing_store = holder->elements();
658 FLAG_trace_js_array_abuse) {
663 FLAG_trace_external_array_abuse) {
667 return ElementsAccessorSubclass::GetImpl(
668 receiver, holder, key, backing_store);
675 return (key < ElementsAccessorSubclass::GetCapacityImpl(backing_store))
676 ? BackingStore::cast(backing_store)->get(key)
677 : backing_store->
GetHeap()->the_hole_value();
685 if (backing_store ==
NULL) {
686 backing_store = holder->elements();
688 return ElementsAccessorSubclass::GetAttributesImpl(
689 receiver, holder, key, backing_store);
697 if (key >= ElementsAccessorSubclass::GetCapacityImpl(backing_store)) {
700 return BackingStore::cast(backing_store)->is_the_hole(key) ?
ABSENT :
NONE;
708 if (backing_store ==
NULL) {
709 backing_store = holder->elements();
711 return ElementsAccessorSubclass::GetTypeImpl(
712 receiver, holder, key, backing_store);
720 if (key >= ElementsAccessorSubclass::GetCapacityImpl(backing_store)) {
723 return BackingStore::cast(backing_store)->is_the_hole(key)
732 if (backing_store ==
NULL) {
733 backing_store = holder->elements();
735 return ElementsAccessorSubclass::GetAccessorPairImpl(
736 receiver, holder, key, backing_store);
750 return ElementsAccessorSubclass::SetLengthImpl(
751 array, length,
handle(array->elements()));
763 ElementsAccessorSubclass::
764 SetFastElementsCapacityAndLength(array, capacity, length);
797 int packed_size = kPackedSizeNotKnown;
798 if (from.is_null()) {
799 from =
handle(from_holder->elements());
802 if (!from_holder.is_null()) {
804 from_holder->IsJSArray();
808 if (copy_size >= 0 && packed_size > copy_size) {
809 packed_size = copy_size;
813 ElementsAccessorSubclass::CopyElementsImpl(
814 from, from_start, to, from_kind, to_start, packed_size, copy_size);
822 int len0 = to->length();
823 #ifdef ENABLE_SLOW_ASSERTS
825 for (
int i = 0; i < len0; i++) {
826 ASSERT(!to->get(i)->IsTheHole());
831 from = holder->elements();
836 uint32_t len1 = ElementsAccessorSubclass::GetCapacityImpl(from);
837 if (len1 == 0)
return to;
841 for (uint32_t y = 0; y < len1; y++) {
842 uint32_t key = ElementsAccessorSubclass::GetKeyForIndexImpl(from, y);
843 if (ElementsAccessorSubclass::HasElementImpl(
844 receiver, holder, key, from)) {
845 MaybeObject* maybe_value =
846 ElementsAccessorSubclass::GetImpl(receiver, holder, key, from);
848 if (!maybe_value->To(&value))
return maybe_value;
849 ASSERT(!value->IsTheHole());
850 if (!HasKey(to, value)) {
856 if (extra == 0)
return to;
861 if (!maybe_obj->To(&result))
return maybe_obj;
867 for (
int i = 0; i < len0; i++) {
869 ASSERT(e->IsString() || e->IsNumber());
870 result->
set(i, e, mode);
875 for (uint32_t y = 0; y < len1; y++) {
877 ElementsAccessorSubclass::GetKeyForIndexImpl(from, y);
878 if (ElementsAccessorSubclass::HasElementImpl(
879 receiver, holder, key, from)) {
880 MaybeObject* maybe_value =
881 ElementsAccessorSubclass::GetImpl(receiver, holder, key, from);
883 if (!maybe_value->To(&value))
return maybe_value;
884 if (!value->IsTheHole() && !HasKey(to, value)) {
885 result->
set(len0 + index, value);
896 return backing_store->
length();
901 return ElementsAccessorSubclass::GetCapacityImpl(backing_store);
911 return ElementsAccessorSubclass::GetKeyForIndexImpl(backing_store, index);
920 template<
typename FastElementsAccessorSubclass,
942 Isolate* isolate = array->GetIsolate();
943 uint32_t old_capacity = backing_store->length();
945 bool same_or_smaller_size = old_length->IsSmi() &&
956 if (length <= old_capacity) {
957 if (array->HasFastSmiOrObjectElements()) {
960 if (2 * length <= old_capacity) {
963 array->initialize_elements();
965 backing_store->set_length(length);
966 Address filler_start = backing_store->address() +
967 BackingStore::OffsetOfElementAt(length);
968 int filler_size = (old_capacity - length) * ElementSize;
969 array->GetHeap()->CreateFillerObjectAt(filler_start, filler_size);
974 for (
int i = length; i < old_length; i++) {
978 return length_object;
983 uint32_t new_capacity = length > min ? length : min;
984 if (!array->ShouldConvertToSlowElements(new_capacity)) {
985 FastElementsAccessorSubclass::
986 SetFastElementsCapacityAndLength(array, new_capacity, length);
987 array->ValidateElements();
988 return length_object;
992 return isolate->
factory()->undefined_value();
998 ASSERT(obj->HasFastSmiOrObjectElements() ||
999 obj->HasFastDoubleElements() ||
1000 obj->HasFastArgumentsElements());
1001 Isolate* isolate = obj->GetIsolate();
1002 Heap* heap = obj->GetHeap();
1004 if (*elements == heap->empty_fixed_array()) {
1005 return isolate->factory()->true_value();
1008 bool is_sloppy_arguments_elements_map =
1009 backing_store->map() == heap->sloppy_arguments_elements_map();
1010 if (is_sloppy_arguments_elements_map) {
1014 uint32_t length =
static_cast<uint32_t
>(
1017 : backing_store->length());
1019 if (!is_sloppy_arguments_elements_map) {
1029 backing_store->set_the_hole(key);
1034 const int kMinLengthForSparsenessCheck = 64;
1035 if (backing_store->length() >= kMinLengthForSparsenessCheck &&
1037 ((key > 0 && backing_store->is_the_hole(key - 1)) ||
1038 (key + 1 < length && backing_store->is_the_hole(key + 1)))) {
1040 for (
int i = 0; i < backing_store->length(); ++i) {
1041 if (!backing_store->is_the_hole(i)) ++num_used;
1043 if (4 * num_used > backing_store->length())
break;
1045 if (4 * num_used <= backing_store->length()) {
1050 return isolate->factory()->true_value();
1065 if (key >= static_cast<uint32_t>(backing_store->
length())) {
1068 return !BackingStore::cast(backing_store)->is_the_hole(key);
1077 (map == heap->fixed_array_map() ||
1078 map == heap->fixed_cow_array_map())) ||
1080 ((map == heap->fixed_array_map() && length == 0) ||
1081 map == heap->fixed_double_array_map())));
1082 for (
int i = 0; i < length; i++) {
1083 BackingStore* backing_store = BackingStore::cast(elements);
1085 static_cast<Object*>(backing_store->get(i))->IsSmi()) ||
1087 backing_store->is_the_hole(i)));
1094 static inline ElementsKind ElementsKindForArray(FixedArrayBase* array) {
1095 switch (array->map()->instance_type()) {
1097 if (array->IsDictionary()) {
1105 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
1106 case EXTERNAL_##TYPE##_ARRAY_TYPE: \
1107 return EXTERNAL_##TYPE##_ELEMENTS; \
1108 case FIXED_##TYPE##_ARRAY_TYPE: \
1109 return TYPE##_ELEMENTS;
1112 #undef TYPED_ARRAY_CASE
1121 template<
typename FastElementsAccessorSubclass,
1122 typename KindTraits>
1134 uint32_t from_start,
1141 switch (from_kind) {
1146 CopyObjectToObjectElements(
1147 from, from_kind, from_start, to, to_kind, to_start, copy_size);
1151 CopyDoubleToObjectElements(
1152 from, from_start, to, to_kind, to_start, copy_size);
1155 CopyDictionaryToObjectElements(
1156 from, from_start, to, to_kind, to_start, copy_size);
1165 ElementsKind from_kind = ElementsKindForArray(*arguments);
1167 to_start, packed_size, copy_size);
1170 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
1171 case EXTERNAL_##TYPE##_ELEMENTS: \
1172 case TYPE##_ELEMENTS: \
1175 #undef TYPED_ARRAY_CASE
1185 obj->HasFastSmiElements()
1189 obj, capacity, length, set_capacity_mode);
1196 FastPackedSmiElementsAccessor,
1197 ElementsKindTraits<FAST_SMI_ELEMENTS> > {
1208 FastHoleySmiElementsAccessor,
1209 ElementsKindTraits<FAST_HOLEY_SMI_ELEMENTS> > {
1220 FastPackedObjectElementsAccessor,
1221 ElementsKindTraits<FAST_ELEMENTS> > {
1232 FastHoleyObjectElementsAccessor,
1233 ElementsKindTraits<FAST_HOLEY_ELEMENTS> > {
1242 template<
typename FastElementsAccessorSubclass,
1243 typename KindTraits>
1262 uint32_t from_start,
1268 switch (from_kind) {
1270 CopyPackedSmiToDoubleElements(
1271 from, from_start, to, to_start, packed_size, copy_size);
1274 CopySmiToDoubleElements(from, from_start, to, to_start, copy_size);
1278 CopyDoubleToDoubleElements(from, from_start, to, to_start, copy_size);
1282 CopyObjectToDoubleElements(from, from_start, to, to_start, copy_size);
1285 CopyDictionaryToDoubleElements(
1286 from, from_start, to, to_start, copy_size);
1291 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
1292 case EXTERNAL_##TYPE##_ELEMENTS: \
1293 case TYPE##_ELEMENTS: \
1296 #undef TYPED_ARRAY_CASE
1304 FastPackedDoubleElementsAccessor,
1305 ElementsKindTraits<FAST_DOUBLE_ELEMENTS> > {
1311 FastPackedDoubleElementsAccessor,
1318 FastHoleyDoubleElementsAccessor,
1319 ElementsKindTraits<FAST_HOLEY_DOUBLE_ELEMENTS> > {
1322 FastHoleyDoubleElementsAccessor,
1326 FastHoleyDoubleElementsAccessor,
1332 template<ElementsKind Kind>
1335 ElementsKindTraits<Kind> > {
1355 : backing_store->
GetHeap()->undefined_value();
1392 return obj->GetIsolate()->factory()->true_value();
1401 return key < capacity;
1407 #define EXTERNAL_ELEMENTS_ACCESSOR(Type, type, TYPE, ctype, size) \
1408 typedef TypedElementsAccessor<EXTERNAL_##TYPE##_ELEMENTS> \
1409 External##Type##ElementsAccessor;
1412 #undef EXTERNAL_ELEMENTS_ACCESSOR
1414 #define FIXED_ELEMENTS_ACCESSOR(Type, type, TYPE, ctype, size) \
1415 typedef TypedElementsAccessor<TYPE##_ELEMENTS > \
1416 Fixed##Type##ElementsAccessor;
1419 #undef FIXED_ELEMENTS_ACCESSOR
1425 ElementsKindTraits<DICTIONARY_ELEMENTS> > {
1441 uint32_t new_length = length;
1442 uint32_t old_length =
static_cast<uint32_t
>(array->length()->
Number());
1443 if (new_length < old_length) {
1446 for (
int i = 0; i < capacity; i++) {
1448 if (key->IsNumber()) {
1449 uint32_t number =
static_cast<uint32_t
>(key->
Number());
1450 if (new_length <= number && number < old_length) {
1451 PropertyDetails details = dict->
DetailsAt(i);
1452 if (details.IsDontDelete()) new_length = number + 1;
1456 if (new_length != length) {
1458 if (!maybe_object->To(&length_object))
return maybe_object;
1462 if (new_length == 0) {
1468 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
1471 int removed_entries = 0;
1472 Object* the_hole_value = heap->the_hole_value();
1473 for (
int i = 0; i < capacity; i++) {
1475 if (key->IsNumber()) {
1476 uint32_t number =
static_cast<uint32_t
>(key->
Number());
1477 if (new_length <= number && number < old_length) {
1478 dict->
SetEntry(i, the_hole_value, the_hole_value);
1487 return length_object;
1498 *store, *array, *length_object, length),
1519 if (result == heap->false_value()) {
1529 return isolate->
Throw(*error);
1531 return heap->false_value();
1533 MaybeObject* maybe_elements = dictionary->
Shrink(key);
1535 if (!maybe_elements->To(&new_elements)) {
1536 return maybe_elements;
1541 obj->set_elements(new_elements);
1544 return heap->true_value();
1558 uint32_t from_start,
1585 int entry = backing_store->
FindEntry(key);
1588 PropertyDetails details = backing_store->
DetailsAt(entry);
1590 return obj->GetElementWithCallback(receiver,
1598 return obj->
GetHeap()->the_hole_value();
1610 return dictionary->
DetailsAt(entry).attributes();
1621 int entry = backing_store->
FindEntry(key);
1623 return backing_store->
DetailsAt(entry).type();
1634 int entry = backing_store->
FindEntry(key);
1637 backing_store->
ValueAt(entry)->IsAccessorPair()) {
1661 SloppyArgumentsElementsAccessor,
1662 ElementsKindTraits<SLOPPY_ARGUMENTS_ELEMENTS> > {
1678 Object* probe = GetParameterMapArg(obj, parameter_map, key);
1679 if (!probe->IsTheHole()) {
1682 ASSERT(!context->
get(context_index)->IsTheHole());
1683 return context->
get(context_index);
1688 receiver, obj, key, arguments);
1690 if (!maybe_result->ToObject(&result))
return maybe_result;
1692 if (result->IsAliasedArgumentsEntry()) {
1696 ASSERT(!context->
get(context_index)->IsTheHole());
1697 return context->
get(context_index);
1710 Object* probe = GetParameterMapArg(obj, parameter_map, key);
1711 if (!probe->IsTheHole()) {
1717 receiver, obj, key, arguments);
1727 Object* probe = GetParameterMapArg(obj, parameter_map, key);
1728 if (!probe->IsTheHole()) {
1734 receiver, obj, key, arguments);
1744 Object* probe = GetParameterMapArg(obj, parameter_map, key);
1745 if (!probe->IsTheHole()) {
1751 receiver, obj, key, arguments);
1772 if (!probe->IsTheHole()) {
1776 parameter_map->set_the_hole(key + 2);
1779 if (arguments->IsDictionary()) {
1788 return isolate->
factory()->true_value();
1792 uint32_t from_start,
1804 return Max(static_cast<uint32_t>(parameter_map->
length() - 2),
1818 Object* probe = GetParameterMapArg(holder, parameter_map, key);
1819 if (!probe->IsTheHole()) {
1825 return !accessor->
Get(receiver, holder, key, arguments)->IsTheHole();
1834 uint32_t length = holder->IsJSArray()
1836 : parameter_map->
length();
1837 return key < (length - 2)
1838 ? parameter_map->
get(key + 2)
1839 : parameter_map->
GetHeap()->the_hole_value();
1845 Isolate* isolate = holder->GetIsolate();
1846 uint32_t length = holder->IsJSArray()
1848 : parameter_map->length();
1849 return key < (length - 2)
1850 ?
handle(parameter_map->get(key + 2), isolate)
1857 return elements_accessors_[ElementsKindForArray(array)];
1863 #define ACCESSOR_ARRAY(Class, Kind, Store) new Class(#Kind),
1865 #undef ACCESSOR_ARRAY
1868 STATIC_ASSERT((
sizeof(accessor_array) /
sizeof(*accessor_array)) ==
1871 elements_accessors_ = accessor_array;
1876 #define ACCESSOR_DELETE(Class, Kind, Store) delete elements_accessors_[Kind];
1878 #undef ACCESSOR_DELETE
1879 elements_accessors_ =
NULL;
1883 template <
typename ElementsAccessorSub
class,
typename ElementsKindTraits>
1889 Isolate* isolate = obj->GetIsolate();
1895 if (!smi_length.is_null() && smi_length->IsSmi()) {
1899 SetLengthWithoutNormalize(backing_store, array, smi_length, value);
1906 ASSERT(new_length->IsSmi() || new_length->IsHeapNumber() ||
1907 new_length->IsUndefined());
1908 if (new_length->IsSmi()) {
1911 }
else if (new_length->IsHeapNumber()) {
1912 array->set_length(*new_length);
1916 return ThrowArrayLengthRangeError(isolate);
1922 if (length->IsNumber()) {
1933 ASSERT(new_length->IsNumber());
1934 array->set_length(*new_length);
1937 return ThrowArrayLengthRangeError(isolate);
1944 new_backing_store->set(0, *length);
1954 if (args->length() == 1) {
1967 }
else if (len == 0) {
1980 if (args->length() == 0) {
1985 Factory* factory = array->GetIsolate()->factory();
1988 int number_of_elements = args->length();
2004 switch (array->GetElementsKind()) {
2008 for (
int index = 0; index < number_of_elements; index++) {
2018 for (
int index = 0; index < number_of_elements; index++) {
2019 object_elms->set(index, (*args)[index], mode);
2027 for (
int index = 0; index < number_of_elements; index++) {
2028 double_elms->set(index, (*args)[index]->
Number());
2037 array->set_elements(*elms);
static MUST_USE_RESULT PropertyType GetTypeImpl(Object *receiver, JSObject *obj, uint32_t key, FixedArrayBase *parameters)
virtual MUST_USE_RESULT AccessorPair * GetAccessorPair(Object *receiver, JSObject *holder, uint32_t key, FixedArrayBase *backing_store=NULL)=0
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
virtual MUST_USE_RESULT PropertyAttributes GetAttributes(Object *receiver, JSObject *holder, uint32_t key, FixedArrayBase *backing_store) V8_FINAL V8_OVERRIDE
Object * KeyAt(int entry)
static void EnsureCanContainElements(Handle< JSObject > object, Object **elements, uint32_t count, EnsureElementsMode mode)
virtual MUST_USE_RESULT MaybeObject * Get(Object *receiver, JSObject *holder, uint32_t key, FixedArrayBase *backing_store) V8_FINAL V8_OVERRIDE
FastDoubleElementsAccessor(const char *name)
#define ACCESSOR_DELETE(Class, Kind, Store)
#define ACCESSOR_ARRAY(Class, Kind, Store)
static const int kNotFound
bool IsExternalArrayElementsKind(ElementsKind kind)
static MUST_USE_RESULT MaybeObject * SetLengthWithoutNormalize(FixedArrayBase *store, JSArray *array, Object *length_object, uint32_t length)
static void SetFastElementsCapacityAndLength(Handle< JSObject > obj, uint32_t capacity, uint32_t length)
virtual MUST_USE_RESULT PropertyAttributes GetAttributes(Object *receiver, JSObject *holder, uint32_t key, FixedArrayBase *backing_store=NULL)=0
static MUST_USE_RESULT MaybeObject * GetImpl(Object *receiver, JSObject *obj, uint32_t key, FixedArrayBase *parameters)
void set(int index, Object *value)
virtual MUST_USE_RESULT Handle< Object > Delete(Handle< JSObject > obj, uint32_t key, JSReceiver::DeleteMode mode) V8_FINAL V8_OVERRIDE
static Handle< FixedArray > SetFastElementsCapacityAndLength(Handle< JSObject > object, int capacity, int length, SetFastElementsCapacitySmiMode smi_mode)
static MUST_USE_RESULT PropertyAttributes GetAttributesImpl(Object *receiver, JSObject *obj, uint32_t key, FixedArrayBase *backing_store)
void PrintF(const char *format,...)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf map
bool InNewSpace(Object *object)
TypedElementsAccessor(const char *name)
static String * cast(Object *obj)
FastSmiOrObjectElementsAccessor(const char *name)
ElementsTraitsParam::BackingStore BackingStore
virtual MUST_USE_RESULT AccessorPair * GetAccessorPair(Object *receiver, JSObject *holder, uint32_t key, FixedArrayBase *backing_store) V8_FINAL V8_OVERRIDE
Handle< FixedArray > NewFixedArrayWithHoles(int size, PretenureFlag pretenure=NOT_TENURED)
static Smi * FromInt(int value)
bool IsFastObjectElementsKind(ElementsKind kind)
MUST_USE_RESULT MaybeObject * ToSmi()
static void CopyElementsImpl(Handle< FixedArrayBase > from, uint32_t from_start, Handle< FixedArrayBase > to, ElementsKind from_kind, uint32_t to_start, int packed_size, int copy_size)
ElementsKindTraits< Kind >::BackingStore BackingStore
static MUST_USE_RESULT PropertyType GetTypeImpl(Object *receiver, JSObject *obj, uint32_t key, FixedArrayBase *backing_store)
virtual MUST_USE_RESULT Handle< Object > Get(Handle< Object > receiver, Handle< JSObject > holder, uint32_t key, Handle< FixedArrayBase > backing_store=Handle< FixedArrayBase >::null())=0
static Handle< T > cast(Handle< S > that)
static AccessorPair * cast(Object *obj)
static uint32_t GetCapacityImpl(FixedArrayBase *backing_store)
kSerializedDataOffset Object
static uint32_t GetKeyForIndexImpl(FixedArrayBase *backing_store, uint32_t index)
static MUST_USE_RESULT MaybeObject * GetImpl(Object *receiver, JSObject *obj, uint32_t key, FixedArrayBase *backing_store)
WriteBarrierMode GetWriteBarrierMode(const DisallowHeapAllocation &promise)
static AliasedArgumentsEntry * cast(Object *obj)
void CheckArrayAbuse(JSObject *obj, const char *op, uint32_t key, bool allow_appending)
DictionaryElementsAccessor(const char *name)
Handle< Object > ArrayConstructInitializeElements(Handle< JSArray > array, Arguments *args)
#define ASSERT(condition)
virtual MUST_USE_RESULT Handle< Object > Delete(Handle< JSObject > obj, uint32_t key, JSReceiver::DeleteMode mode) V8_FINAL V8_OVERRIDE
static bool HasElementImpl(Object *receiver, JSObject *holder, uint32_t key, FixedArrayBase *backing_store)
KindTraits::BackingStore BackingStore
static Context * cast(Object *context)
ElementsTraitsParam ElementsTraits
FixedArrayBase BackingStore
FastElementsAccessor(const char *name)
const bool FLAG_enable_slow_asserts
bool IsFastElementsKind(ElementsKind kind)
MUST_USE_RESULT MaybeObject * EnsureWritableFastElements()
virtual void Validate(JSObject *holder) V8_FINAL V8_OVERRIDE
virtual void CopyElements(Handle< JSObject > from_holder, uint32_t from_start, ElementsKind from_kind, Handle< FixedArrayBase > to, uint32_t to_start, int copy_size, Handle< FixedArrayBase > from) V8_FINAL V8_OVERRIDE
static MUST_USE_RESULT Handle< Object > SetLengthImpl(Handle< JSObject > obj, Handle< Object > length, Handle< FixedArrayBase > backing_store)
#define RETURN_IF_EMPTY_HANDLE_VALUE(isolate, call, value)
static Smi * cast(Object *object)
bool Equals(String *other)
static MUST_USE_RESULT MaybeObject * DeleteCommon(JSObject *obj, uint32_t key, JSReceiver::DeleteMode mode)
virtual MUST_USE_RESULT PropertyType GetType(Object *receiver, JSObject *holder, uint32_t key, FixedArrayBase *backing_store=NULL)=0
static uint32_t GetKeyForIndexImpl(FixedArrayBase *store, uint32_t index)
static void TransitionElementsKind(Handle< JSObject > object, ElementsKind to_kind)
FastHoleyObjectElementsAccessor(const char *name)
static const int kCopyToEnd
Object * ValueAt(int entry)
static void SetContent(Handle< JSArray > array, Handle< FixedArrayBase > storage)
static MUST_USE_RESULT MaybeObject * GetImpl(Object *receiver, JSObject *obj, uint32_t key, FixedArrayBase *backing_store)
HANDLE HANDLE LPSTACKFRAME64 StackFrame
#define EXTERNAL_ELEMENTS_ACCESSOR(Type, type, TYPE, ctype, size)
static MUST_USE_RESULT PropertyAttributes GetAttributesImpl(Object *receiver, JSObject *obj, uint32_t key, FixedArrayBase *backing_store)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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_string(expose_natives_as
static void ValidateImpl(JSObject *holder)
static uint32_t GetKeyForIndexImpl(FixedArrayBase *dict, uint32_t index)
static SeededNumberDictionary * cast(Object *obj)
static MUST_USE_RESULT MaybeObject * GetImpl(Object *receiver, JSObject *obj, uint32_t key, FixedArrayBase *store)
static bool HasElementImpl(Object *receiver, JSObject *holder, uint32_t key, FixedArrayBase *backing_store)
STATIC_ASSERT(sizeof(CPURegister)==sizeof(Register))
bool IsFastPackedElementsKind(ElementsKind kind)
static void ValidateContents(JSObject *holder, int length)
int FastD2IChecked(double x)
#define CALL_HEAP_FUNCTION(ISOLATE, FUNCTION_CALL, TYPE)
virtual MUST_USE_RESULT MaybeObject * AddElementsToFixedArray(Object *receiver, JSObject *holder, FixedArray *to, FixedArrayBase *from) V8_FINAL V8_OVERRIDE
bool ToArrayIndex(uint32_t *index)
MUST_USE_RESULT MaybeObject * ResetElements()
ElementsKind GetElementsKind()
static void PrintTop(Isolate *isolate, FILE *file, bool print_args, bool print_line_number)
FastPackedObjectElementsAccessor(const char *name)
Handle< Object > NewTypeError(const char *message, Vector< Handle< Object > > args)
unsigned int FastD2UI(double x)
static MUST_USE_RESULT Handle< Object > SetLengthImpl(Handle< JSObject > obj, Handle< Object > length, Handle< FixedArrayBase > backing_store)
static void InitializeOncePerProcess()
Handle< FixedDoubleArray > NewFixedDoubleArray(int size, PretenureFlag pretenure=NOT_TENURED)
Handle< FixedArray > NewFixedArray(int size, PretenureFlag pretenure=NOT_TENURED)
static void CopyElementsImpl(Handle< FixedArrayBase > from, uint32_t from_start, Handle< FixedArrayBase > to, ElementsKind from_kind, uint32_t to_start, int packed_size, int copy_size)
SetFastElementsCapacitySmiMode
#define ELEMENTS_TRAITS(Class, KindParam, Store)
bool IsFastSmiElementsKind(ElementsKind kind)
void CopyWords(T *dst, const T *src, size_t num_words)
#define FIXED_ELEMENTS_ACCESSOR(Type, type, TYPE, ctype, size)
static ElementsAccessor * ForArray(FixedArrayBase *array)
SloppyArgumentsElementsAccessor(const char *name)
static Handle< Object > SetLengthWithoutNormalize(Handle< FixedArrayBase > backing_store, Handle< JSArray > array, Handle< Object > length_object, uint32_t length)
static void SetFastElementsCapacityAndLength(Handle< JSObject > obj, uint32_t capacity, uint32_t length)
MUST_USE_RESULT MaybeObject * Shrink(Key key)
static bool HasElementImpl(Object *receiver, JSObject *holder, uint32_t key, FixedArrayBase *backing_store)
virtual Handle< Object > Delete(Handle< JSObject > obj, uint32_t key, JSReceiver::DeleteMode mode) V8_FINAL V8_OVERRIDE
Failure * Throw(Object *exception, MessageLocation *location=NULL)
virtual uint32_t GetCapacity(FixedArrayBase *backing_store) V8_FINAL V8_OVERRIDE
static JSArray * cast(Object *obj)
virtual MUST_USE_RESULT Handle< Object > Get(Handle< Object > receiver, Handle< JSObject > holder, uint32_t key, Handle< FixedArrayBase > backing_store) V8_FINAL V8_OVERRIDE
virtual ElementsKind kind() const V8_FINAL V8_OVERRIDE
bool IsFastSmiOrObjectElementsKind(ElementsKind kind)
static Handle< Object > DeleteCommon(Handle< JSObject > obj, uint32_t key, JSReceiver::DeleteMode mode)
FastPackedSmiElementsAccessor(const char *name)
const int kElementsKindCount
static const int kHeaderSize
FastPackedDoubleElementsAccessor(const char *name)
static void Initialize(Handle< JSArray > array, int capacity, int length=0)
static void CopyElementsImpl(Handle< FixedArrayBase > from, uint32_t from_start, Handle< FixedArrayBase > to, ElementsKind from_kind, uint32_t to_start, int packed_size, int copy_size)
static const int kCopyToEndAndInitializeToHole
int32_t DoubleToInt32(double x)
static Handle< Object > SetElementsLength(Handle< JSArray > array, Handle< Object > length)
Handle< T > handle(T *t, Isolate *isolate)
static void CopyElementsImpl(Handle< FixedArrayBase > from, uint32_t from_start, Handle< FixedArrayBase > to, ElementsKind from_kind, uint32_t to_start, int packed_size, int copy_size)
MUST_USE_RESULT MaybeObject * NumberFromUint32(uint32_t value, PretenureFlag pretenure=NOT_TENURED)
PropertyDetails DetailsAt(int entry)
Object * DeleteProperty(int entry, JSObject::DeleteMode mode)
virtual uint32_t GetKeyForIndex(FixedArrayBase *backing_store, uint32_t index) V8_FINAL V8_OVERRIDE
static Handle< SeededNumberDictionary > NormalizeElements(Handle< JSObject > object)
void MemsetPointer(T **dest, U *value, int counter)
static uint32_t GetCapacityImpl(FixedArrayBase *backing_store)
MUST_USE_RESULT MaybeObject * AllocateFixedArray(int length, PretenureFlag pretenure=NOT_TENURED)
static MUST_USE_RESULT PropertyAttributes GetAttributesImpl(Object *receiver, JSObject *obj, uint32_t key, FixedArrayBase *backing_store)
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
virtual MUST_USE_RESULT Handle< Object > Delete(Handle< JSObject > obj, uint32_t key, JSReceiver::DeleteMode mode) V8_FINAL V8_OVERRIDE
static FixedArray * cast(Object *obj)
static void SetFastDoubleElementsCapacityAndLength(Handle< JSObject > object, int capacity, int length)
virtual MUST_USE_RESULT PropertyType GetType(Object *receiver, JSObject *holder, uint32_t key, FixedArrayBase *backing_store) V8_FINAL V8_OVERRIDE
static bool HasElementImpl(Object *receiver, JSObject *holder, uint32_t key, FixedArrayBase *backing_store)
static MUST_USE_RESULT PropertyType GetTypeImpl(Object *receiver, JSObject *obj, uint32_t key, FixedArrayBase *backing_store)
static MUST_USE_RESULT Handle< Object > DeleteCommon(Handle< JSObject > obj, uint32_t key, JSReceiver::DeleteMode mode)
TypedElementsAccessor< Kind > AccessorClass
void SetEntry(int entry, Object *key, Object *value)
static const int kPreallocatedArrayElements
bool IsFastHoleyElementsKind(ElementsKind kind)
static MUST_USE_RESULT AccessorPair * GetAccessorPairImpl(Object *receiver, JSObject *obj, uint32_t key, FixedArrayBase *parameters)
static MUST_USE_RESULT PropertyAttributes GetAttributesImpl(Object *receiver, JSObject *obj, uint32_t key, FixedArrayBase *backing_store)
static bool HasElementImpl(Object *receiver, JSObject *holder, uint32_t key, FixedArrayBase *parameters)
static MUST_USE_RESULT Handle< Object > SetLengthImpl(Handle< JSObject > obj, Handle< Object > length, Handle< FixedArrayBase > parameter_map)
static MUST_USE_RESULT AccessorPair * GetAccessorPairImpl(Object *receiver, JSObject *obj, uint32_t key, FixedArrayBase *backing_store)
Vector< Handle< Object > > HandleVector(v8::internal::Handle< T > *elms, int length)
int aliased_context_slot()
virtual uint32_t GetCapacity(FixedArrayBase *backing_store)=0
static void SetFastElementsCapacityAndLength(Handle< JSObject > obj, int capacity, int length)
virtual void SetCapacityAndLength(Handle< JSArray > array, int capacity, int length) V8_FINAL V8_OVERRIDE
static void CopyElementsImpl(Handle< FixedArrayBase > from, uint32_t from_start, Handle< FixedArrayBase > to, ElementsKind from_kind, uint32_t to_start, int packed_size, int copy_size)
static int NewElementsCapacity(int old_capacity)
static FixedArrayBase * cast(Object *object)
ElementsAccessorBase(const char *name)
static const int kInitialMaxFastElementArray
static MUST_USE_RESULT Handle< Object > SetLengthWithoutNormalize(Handle< FixedArrayBase > store, Handle< JSArray > array, Handle< Object > length_object, uint32_t length)
virtual MUST_USE_RESULT Handle< Object > SetLength(Handle< JSArray > array, Handle< Object > length) V8_FINAL V8_OVERRIDE
virtual MUST_USE_RESULT Handle< Object > Delete(Handle< JSObject > obj, uint32_t key, JSReceiver::DeleteMode mode) V8_OVERRIDE=0
Handle< Object > NewNumberFromUint(uint32_t value, PretenureFlag pretenure=NOT_TENURED)
static MUST_USE_RESULT PropertyType GetTypeImpl(Object *receiver, JSObject *obj, uint32_t key, FixedArrayBase *store)
static void ValidateContents(JSObject *holder, int length)
ElementsKind GetHoleyElementsKind(ElementsKind packed_kind)
const char * name() const
void ElementsRemoved(int n)
virtual bool HasElement(Object *receiver, JSObject *holder, uint32_t key, FixedArrayBase *backing_store) V8_FINAL V8_OVERRIDE
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size)
FastHoleyDoubleElementsAccessor(const char *name)
FastHoleySmiElementsAccessor(const char *name)
bool IsFastDoubleElementsKind(ElementsKind kind)
static MUST_USE_RESULT AccessorPair * GetAccessorPairImpl(Object *receiver, JSObject *obj, uint32_t key, FixedArrayBase *store)