Lines Matching defs:array

20 #include "src/objects/js-array-buffer-inl.h"
21 #include "src/objects/js-array-inl.h"
191 // destination array, padding any remaining uninitialized elements in the
192 // destination array with the hole.
716 Maybe<bool> SetLength(Handle<JSArray> array, uint32_t length) final {
718 array->GetIsolate(), array, length,
719 handle(array->elements(), array->GetIsolate()));
722 static Maybe<bool> SetLengthImpl(Isolate* isolate, Handle<JSArray> array,
725 DCHECK(!array->SetLengthWouldNormalize(length));
726 DCHECK(IsFastElementsKind(array->GetElementsKind()));
728 CHECK(array->length().ToArrayIndex(&old_length));
731 ElementsKind kind = array->GetElementsKind();
734 JSObject::TransitionElementsKind(array, kind);
742 array->initialize_elements();
745 JSObject::EnsureWritableFastElements(array);
746 if (array->elements() != *backing_store) {
747 backing_store = handle(array->elements(), isolate);
751 // If more than half the elements won't be used, trim the array.
770 MAYBE_RETURN(Subclass::GrowCapacityAndConvertImpl(array, capacity),
774 array->set_length(Smi::FromInt(length));
775 JSObject::ValidateElements(*array);
1211 // array.
1413 static Maybe<bool> SetLengthImpl(Isolate* isolate, Handle<JSArray> array,
1419 CHECK(array->length().ToArrayLength(&old_length));
1441 array->initialize_elements();
1465 array->set_length(*length_obj);
1903 // Ensure that notifications fire if the array or object prototypes are
2195 // Adjust the hole offset as the array has been shrunk.
2212 // Ensure indexes are within array bounds
2663 static Maybe<bool> SetLengthImpl(Isolate* isolate, Handle<JSArray> array,
2667 CHECK(array->length().ToArrayIndex(&old_length));
2677 : array->GetElementsAccessor()->Normalize(array);
2680 Handle<Map> new_map = Map::Copy(isolate, handle(array->map(), isolate),
2684 JSObject::MigrateToMap(isolate, array, new_map);
2687 array->set_elements(*new_element_dictionary);
2690 if (array->elements() !=
2692 Handle<NumberDictionary> dictionary(array->element_dictionary(), isolate);
2694 array->RequireSlowElements(*dictionary);
2701 Handle<FixedArrayBase> new_backing_store(array->elements(), isolate);
2702 return DictionaryElementsAccessor::SetLengthImpl(isolate, array, length,
2761 static Maybe<bool> SetLengthImpl(Isolate* isolate, Handle<JSArray> array,
2765 CHECK(array->length().ToArrayIndex(&old_length));
2775 : array->GetElementsAccessor()->Normalize(array);
2778 Handle<Map> new_map = Map::Copy(isolate, handle(array->map(), isolate),
2782 JSObject::MigrateToMap(isolate, array, new_map);
2785 array->set_elements(*new_element_dictionary);
2788 if (array->elements() !=
2790 Handle<NumberDictionary> dictionary(array->element_dictionary(), isolate);
2792 array->RequireSlowElements(*dictionary);
2799 Handle<FixedArrayBase> new_backing_store(array->elements(), isolate);
2800 return DictionaryElementsAccessor::SetLengthImpl(isolate, array, length,
2871 static Maybe<bool> SetLengthImpl(Isolate* isolate, Handle<JSArray> array,
3129 // warnings for the empty array or memcpy to an empty object.
3194 // warnings for the empty array or memcpy to an empty object.
3231 static Maybe<bool> SetLengthImpl(Isolate* isolate, Handle<JSArray> array,
3609 // TODO(v8:11111): Update this once we have external RAB / GSAB array types.
3634 // The source is a typed array, so we know we don't need to do ToNumber
3766 // When the array has the original array prototype, and that prototype has
3873 // This doesn't guarantee that the destination array will be completely
4431 static Maybe<bool> SetLengthImpl(Isolate* isolate, Handle<JSArray> array,
5133 Handle<JSArray> array, JavaScriptArguments* args) {
5136 JSArray::Initialize(array, JSArray::kPreallocatedArrayElements);
5137 return array;
5142 return ThrowArrayLengthRangeError(array->GetIsolate());
5148 ElementsKind elements_kind = array->GetElementsKind();
5149 JSArray::Initialize(array, length, length);
5153 JSObject::TransitionElementsKind(array, elements_kind);
5156 JSArray::Initialize(array, JSArray::kPreallocatedArrayElements);
5159 JSArray::Initialize(array, 0);
5160 MAYBE_RETURN_NULL(JSArray::SetLength(array, length));
5162 return array;
5165 Factory* factory = array->GetIsolate()->factory();
5167 // Set length and elements on the array.
5169 JSObject::EnsureCanContainElements(array, args, number_of_elements,
5172 // Allocate an appropriately typed elements array.
5173 ElementsKind elements_kind = array->GetElementsKind();
5216 array->set_elements(*elms);
5217 array->set_length(Smi::FromInt(number_of_elements));
5218 return array;
5316 // If a double array is concatted into a fast elements array, the fast
5317 // elements array needs to be initialized to contain proper holes, since
5332 // It is crucial to keep |array| in a raw pointer form to avoid
5334 JSArray array = JSArray::cast((*args)[i]);
5336 array.length().ToArrayLength(&len);
5338 ElementsKind from_kind = array.GetElementsKind();
5339 accessor->CopyElements(array, 0, from_kind, storage, insertion_index, len);