34inline bool IsJSArrayFastElementMovingAllowed(Isolate* isolate,
41 !current->GetElementsAccessor()->HasAccessors(current);
44inline bool HasOnlySimpleReceiverElements(Isolate* isolate,
47 if (!HasSimpleElements(
receiver))
return false;
51inline bool HasOnlySimpleElements(Isolate* isolate,
55 for (; !iter.IsAtEnd(); iter.Advance()) {
56 if (!IsJSObject(iter.GetCurrent()))
return false;
58 if (!HasSimpleElements(current))
return false;
66void MatchArrayElementsKindToArguments(Isolate* isolate,
67 DirectHandle<JSArray> array,
68 BuiltinArguments*
args,
69 int first_arg_index,
int num_arguments) {
70 int args_length =
args->length();
71 if (first_arg_index >= args_length)
return;
81 int last_arg_index = std::min(first_arg_index + num_arguments, args_length);
82 for (
int i = first_arg_index;
i < last_arg_index;
i++) {
85 if (IsHeapNumber(arg)) {
94 if (target_kind != origin_kind) {
97 HandleScope scope(isolate);
106inline bool IsJSArrayWithExtensibleFastElements(Isolate* isolate,
108 DirectHandle<JSArray>* array) {
113 DCHECK((*array)->map()->is_extensible());
122inline bool IsJSArrayWithAddableFastElements(Isolate* isolate,
124 DirectHandle<JSArray>* array) {
125 if (!IsJSArrayWithExtensibleFastElements(isolate,
receiver, array))
130 if (!IsJSArrayFastElementMovingAllowed(isolate, **array))
return false;
134 if (isolate->IsInitialArrayPrototype(**array))
return false;
145 DirectHandle<Object> index,
146 double init_if_undefined) {
147 double relative_index = init_if_undefined;
148 if (!IsUndefined(*index)) {
154 if (relative_index < 0) {
155 return Just(std::max(length + relative_index, 0.0));
158 return Just(std::min(relative_index, length));
163 Isolate* isolate, DirectHandle<JSReceiver>
receiver) {
172 DirectHandle<Object> raw_length_number;
174 isolate, raw_length_number,
182 Isolate* isolate, DirectHandle<JSReceiver>
receiver,
double length) {
194 isolate,
receiver, isolate->factory()->length_string(),
200 Isolate* isolate, DirectHandle<JSReceiver>
receiver,
201 DirectHandle<Object> value,
double start,
double end) {
205 PropertyKey
key(isolate, k);
213 ReadOnlyRoots(isolate).exception());
228 Isolate* isolate, DirectHandle<JSArray> array,
ElementsKind origin_kind,
230 Tagged<Map> map = array->map();
239 if (Tagged<Map> target_map;
TryCast<Map>(maybe_target_map, &target_map)) {
240 map->NotifyLeafMapLayoutChange(isolate);
258 Isolate* isolate, BuiltinArguments*
args, DirectHandle<JSReceiver>
receiver,
259 DirectHandle<Object> value,
double start_index,
double end_index) {
263 if (!IsJSObject(*
receiver))
return false;
265 DirectHandle<JSArray> array;
266 if (!IsJSArrayWithAddableFastElements(isolate,
receiver, &array)) {
296 if (target_kind != origin_kind) {
299 HandleScope scope(isolate);
301 bool is_replacing_all_elements =
303 bool did_transition_map =
false;
304 if (is_replacing_all_elements) {
308 DirectHandle<Map> new_map;
310 if (GetReplacedElementsKindsMap(isolate, array, origin_kind, target_kind)
311 .ToHandle(&new_map)) {
312 DirectHandle<FixedArrayBase> elements(array->elements(), isolate);
317 elements = isolate->factory()->NewFixedDoubleArray(
end);
319 elements = isolate->factory()->NewFixedArrayWithZeroes(
end);
328 did_transition_map =
true;
332 if (!did_transition_map) {
338 ElementsAccessor* accessor = array->GetElementsAccessor();
339 accessor->Fill(array, value,
start,
end).Check();
350 CHECK(accessor->SetLength(array,
end).FromJust());
368 isolate, length, GetLengthProperty(isolate,
receiver));
377 isolate, start_index, GetRelativeIndex(isolate, length,
start, 0));
387 isolate, end_index, GetRelativeIndex(isolate, length,
end, length));
389 if (start_index >= end_index)
return *
receiver;
398 if (TryFastArrayFill(isolate, &
args,
receiver, value, start_index,
402 return GenericArrayFill(isolate,
receiver, value, start_index, end_index);
407 BuiltinArguments*
args) {
414 DirectHandle<Object> raw_length_number;
416 isolate, raw_length_number,
422 int arg_count =
args->length() - 1;
428 isolate, NewTypeError(MessageTemplate::kPushPastSafeLength,
429 isolate->factory()->NewNumberFromInt(arg_count),
434 for (
int i = 0;
i < arg_count; ++
i) {
437 DirectHandle<Object> element =
args->at(
i + 1);
445 PropertyKey
key(isolate, length);
449 ReadOnlyRoots(isolate).exception());
457 DirectHandle<Object> final_length = isolate->factory()->NewNumber(length);
460 isolate->factory()->length_string(),
465 return *final_length;
473 if (!IsJSArrayWithAddableFastElements(isolate,
receiver, &array)) {
474 return GenericArrayPush(isolate, &
args);
478 if (has_read_only_length) {
479 return GenericArrayPush(isolate, &
args);
483 int to_add =
args.length() - 1;
486 return *isolate->factory()->NewNumberFromUint(len);
493 MatchArrayElementsKindToArguments(isolate, array, &
args, 1,
500 return *isolate->factory()->NewNumberFromUint((
new_length));
506 BuiltinArguments*
args) {
513 DirectHandle<Object> raw_length_number;
515 isolate, raw_length_number,
524 isolate->factory()->length_string(),
530 return ReadOnlyRoots(isolate).undefined_value();
535 DirectHandle<Object>
new_length = isolate->factory()->NewNumber(length - 1);
541 DirectHandle<Object> element;
548 ReadOnlyRoots(isolate).exception());
553 isolate->factory()->length_string(),
567 if (!IsJSArrayWithExtensibleFastElements(isolate,
receiver, &array)) {
568 return GenericArrayPop(isolate, &
args);
574 return GenericArrayPop(isolate, &
args);
576 if (len == 0)
return ReadOnlyRoots(isolate).undefined_value();
579 if (IsJSArrayFastElementMovingAllowed(isolate, *array)) {
582 isolate,
result, array->GetElementsAccessor()->Pop(array));
593 isolate, NewTypeError(MessageTemplate::kStrictReadOnlyProperty,
594 isolate->factory()->length_string(),
612 DirectHandle<JSArray> array;
613 if (!IsJSArrayWithExtensibleFastElements(isolate,
receiver, &array)) {
616 if (!IsJSArrayFastElementMovingAllowed(isolate, *array)) {
623 Isolate* isolate, DirectHandle<JSReceiver>
receiver,
double length) {
625 DirectHandle<Object> first;
633 PropertyKey
from(isolate, k);
636 PropertyKey
to(isolate, k - 1);
641 isolate, from_present,
647 DirectHandle<Object> from_val;
661 ReadOnlyRoots(isolate).exception());
668 PropertyKey new_length_key(isolate, length - 1);
671 ReadOnlyRoots(isolate).exception());
675 SetLengthProperty(isolate,
receiver, length - 1));
693 isolate, length, GetLengthProperty(isolate,
receiver));
699 SetLengthProperty(isolate,
receiver, length));
705 if (CanUseFastArrayShift(isolate,
receiver)) {
708 array->GetElementsAccessor()->Shift(array));
711 return GenericArrayShift(isolate,
receiver, length);
720 DCHECK(array->map()->is_extensible());
722 DCHECK(IsJSArrayFastElementMovingAllowed(isolate, *array));
723 DCHECK(!isolate->IsInitialArrayPrototype(*array));
725 MatchArrayElementsKindToArguments(isolate, array, &
args, 1,
728 int to_add =
args.length() - 1;
729 if (to_add == 0)
return array->length();
757class ArrayConcatVisitor {
764 storage_(isolate->global_handles()->Create(*storage)),
766 bit_field_(FastElementsField::encode(fast_elements) |
767 ExceedsLimitField::encode(false) |
768 IsFixedArrayField::encode(IsFixedArray(*storage, isolate)) |
769 HasSimpleElementsField::encode(
770 IsFixedArray(*storage, isolate) ||
774 !IsJSTypedArray(*storage, isolate)))) {
778 ~ArrayConcatVisitor() { clear_storage(); }
787 set_exceeds_array_limit(
true);
794 if (!is_fixed_array()) {
802 if (fast_elements()) {
803 if (index <
static_cast<uint32_t
>(storage_fixed_array()->
length())) {
804 storage_fixed_array()->set(index, *elm);
819 DirectHandle<JSObject> not_a_prototype_holder;
821 isolate_, dict, index, elm, not_a_prototype_holder);
822 if (!
result.is_identical_to(dict)) {
832 void increase_index_offset(uint32_t delta) {
841 if (fast_elements() &&
848 bool exceeds_array_limit()
const {
852 DirectHandle<JSArray> ToArray() {
854 DirectHandle<JSArray> array =
isolate_->factory()->NewJSArray(0);
855 DirectHandle<Number> length =
856 isolate_->factory()->NewNumber(
static_cast<double>(index_offset_));
862 raw->set_length(*length);
863 raw->set_elements(*storage_fixed_array());
870 DCHECK(!is_fixed_array());
872 DirectHandle<Object> length =
873 isolate_->factory()->NewNumber(
static_cast<double>(index_offset_));
876 isolate_->factory()->length_string(),
881 bool has_simple_elements()
const {
887 void SetDictionaryMode() {
888 DCHECK(fast_elements() && is_fixed_array());
889 DirectHandle<FixedArray> current_storage = storage_fixed_array();
890 DirectHandle<NumberDictionary> slow_storage(
891 NumberDictionary::New(isolate_, current_storage->length()));
892 uint32_t current_length =
static_cast<uint32_t
>(current_storage->length());
894 isolate_, uint32_t,
i = 0,
i,
i < current_length,
i++, {
895 DirectHandle<Object> element(current_storage->get(
i), isolate_);
896 if (!IsTheHole(*element, isolate_)) {
899 DirectHandle<JSObject> not_a_prototype_holder;
901 isolate_, slow_storage,
i, element, not_a_prototype_holder);
902 if (!new_storage.is_identical_to(slow_storage)) {
903 slow_storage = loop_scope.CloseAndEscape(new_storage);
908 set_storage(*slow_storage);
909 set_fast_elements(
false);
916 DCHECK(has_simple_elements());
920 using FastElementsField = base::BitField<bool, 0, 1>;
921 using ExceedsLimitField = base::BitField<bool, 1, 1>;
922 using IsFixedArrayField = base::BitField<bool, 2, 1>;
923 using HasSimpleElementsField = base::BitField<bool, 3, 1>;
926 void set_fast_elements(
bool fast) {
929 void set_exceeds_array_limit(
bool exceeds) {
933 DirectHandle<FixedArray> storage_fixed_array() {
935 DCHECK(has_simple_elements());
948uint32_t EstimateElementCount(Isolate* isolate, DirectHandle<JSArray> array) {
951 int element_count = 0;
952 switch (array->GetElementsKind()) {
966 int fast_length =
static_cast<int>(
length);
968 for (
int i = 0;
i < fast_length;
i++) {
969 if (!IsTheHole(elements->get(
i), isolate)) element_count++;
978 int fast_length =
static_cast<int>(
length);
979 if (IsFixedArray(array->elements())) {
985 for (
int i = 0;
i < fast_length;
i++) {
986 if (!elements->is_the_hole(
i)) element_count++;
993 ReadOnlyRoots roots(isolate);
994 for (InternalIndex
i : dictionary->IterateEntries()) {
996 if (dictionary->IsKey(roots,
key)) {
1002#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype) case TYPE##_ELEMENTS:
1009#undef TYPED_ARRAY_CASE
1022 return element_count;
1025void CollectElementIndices(Isolate* isolate, DirectHandle<JSObject>
object,
1026 uint32_t range, std::vector<uint32_t>* indices) {
1041 uint32_t length =
static_cast<uint32_t
>(elements->length());
1042 if (range < length) length = range;
1044 if (!IsTheHole(elements->get(
i), isolate)) {
1045 indices->push_back(
i);
1052 if (IsFixedArray(object->elements())) {
1053 DCHECK_EQ(object->elements()->length(), 0);
1056 DirectHandle<FixedDoubleArray> elements(
1058 uint32_t length =
static_cast<uint32_t
>(elements->length());
1059 if (range < length) length = range;
1061 if (!elements->is_the_hole(
i)) {
1062 indices->push_back(
i);
1071 uint32_t capacity = dict->Capacity();
1072 ReadOnlyRoots roots(isolate);
1075 if (!dict->IsKey(roots, k))
continue;
1078 if (index < range) {
1079 indices->push_back(index);
1084#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype) case TYPE##_ELEMENTS:
1088 if (range <= length) {
1095 DCHECK_LE(length, std::numeric_limits<uint32_t>::max());
1097 indices->push_back(
i);
1099 if (length == range)
return;
1103#undef TYPED_ARRAY_CASE
1110 ElementsAccessor* accessor =
object->GetElementsAccessor();
1111 for (uint32_t
i = 0;
i < range;
i++) {
1112 if (accessor->HasElement(raw_object,
i, elements)) {
1113 indices->push_back(
i);
1120 DCHECK(IsJSPrimitiveWrapper(*
object));
1122 DCHECK(IsString(js_value->value()));
1124 uint32_t length =
static_cast<uint32_t
>(
string->length());
1126 uint32_t limit = std::min(length, range);
1127 for (;
i < limit;
i++) {
1128 indices->push_back(
i);
1130 ElementsAccessor* accessor =
object->GetElementsAccessor();
1131 for (;
i < range;
i++) {
1132 if (accessor->HasElement(*
object,
i)) {
1133 indices->push_back(
i);
1143 if (range <= length) {
1149 SLOW_DCHECK(object->GetElementsAccessor()->HasElement(
1150 *
object,
i, object->elements()));
1151 indices->push_back(
i);
1153 if (length == range)
return;
1160 PrototypeIterator iter(isolate,
object);
1161 if (!iter.IsAtEnd()) {
1166 CollectElementIndices(
1171bool IterateElementsSlow(Isolate* isolate, DirectHandle<JSReceiver>
receiver,
1172 uint32_t length, ArrayConcatVisitor* visitor) {
1175 if (maybe.IsNothing())
return false;
1176 if (maybe.FromJust()) {
1177 DirectHandle<Object> element_value;
1181 if (!visitor->visit(
i, element_value))
return false;
1184 visitor->increase_index_offset(length);
1197bool IterateElements(Isolate* isolate, DirectHandle<JSReceiver>
receiver,
1198 ArrayConcatVisitor* visitor) {
1199 uint32_t length = 0;
1205 DirectHandle<Object> val;
1209 isolate->Throw(*isolate->factory()->NewTypeError(
1210 MessageTemplate::kInvalidArrayLength));
1218 return IterateElementsSlow(isolate,
receiver, length, visitor);
1221 if (!visitor->has_simple_elements() ||
1222 !HasOnlySimpleElements(isolate, *
receiver)) {
1223 return IterateElementsSlow(isolate,
receiver, length, visitor);
1227 switch (array->GetElementsKind()) {
1239 DisallowJavascriptExecution no_js(isolate);
1245 int fast_length =
static_cast<int>(
length);
1248 DirectHandle<Object> element_value(elements->get(j), isolate);
1249 if (!IsTheHole(*element_value, isolate)) {
1250 if (!visitor->visit(j, element_value))
return false;
1253 if (maybe.IsNothing())
return false;
1254 if (maybe.FromJust()) {
1258 isolate, element_value,
1260 if (!visitor->visit(j, element_value))
return false;
1269 DisallowJavascriptExecution no_js(isolate);
1272 if (length == 0)
break;
1275 if (IsFixedArray(array->elements())) {
1276 DCHECK_EQ(array->elements()->length(), 0);
1279 DirectHandle<FixedDoubleArray> elements(
1281 int fast_length =
static_cast<int>(
length);
1284 if (!elements->is_the_hole(j)) {
1285 double double_value = elements->get_scalar(j);
1286 DirectHandle<Object> element_value =
1287 isolate->factory()->NewNumber(double_value);
1288 if (!visitor->visit(j, element_value))
return false;
1291 if (maybe.IsNothing())
return false;
1292 if (maybe.FromJust()) {
1295 DirectHandle<Object> element_value;
1297 isolate, element_value,
1299 if (!visitor->visit(j, element_value))
return false;
1308 DisallowJavascriptExecution no_js(isolate);
1310 DirectHandle<NumberDictionary> dict(array->element_dictionary(), isolate);
1311 std::vector<uint32_t> indices;
1312 indices.reserve(dict->Capacity() / 2);
1316 CollectElementIndices(isolate, array, length, &indices);
1317 std::sort(indices.begin(), indices.end());
1318 size_t n = indices.size();
1320 uint32_t index = indices[j];
1321 DirectHandle<Object> element;
1325 if (!visitor->visit(index, element))
return false;
1329 }
while (j < n && indices[j] == index);
1336 isolate, uint32_t, index = 0, index, index < length, index++, {
1337 DirectHandle<Object> element;
1341 if (!visitor->visit(index, element))
return false;
1351#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype) case TYPE##_ELEMENTS:
1354#undef TYPED_ARRAY_CASE
1360 visitor->increase_index_offset(length);
1364static Maybe<bool> IsConcatSpreadable(Isolate* isolate,
1365 DirectHandle<Object> obj) {
1366 HandleScope handle_scope(isolate);
1369 if (!Protectors::IsIsConcatSpreadableLookupChainIntact(isolate) ||
1370 receiver->HasProxyInPrototype(isolate)) {
1372 DirectHandle<Symbol>
key(isolate->factory()->is_concat_spreadable_symbol());
1373 DirectHandle<Object>
value;
1374 MaybeDirectHandle<Object> maybeValue =
1375 i::Runtime::GetObjectProperty(isolate,
receiver,
key);
1377 if (!IsUndefined(*value, isolate))
1384 DirectHandle<Object> species,
1386 int argument_count =
args->length();
1388 bool is_array_species = *species == isolate->context()->array_function();
1397 uint32_t estimate_result_length = 0;
1398 uint32_t estimate_nof = 0;
1400 DirectHandle<Object> obj =
args->at(
i);
1401 uint32_t length_estimate;
1402 uint32_t element_estimate;
1403 if (IsJSArray(*obj)) {
1407 if (length_estimate != 0) {
1415 element_estimate = EstimateElementCount(isolate, array);
1421 length_estimate = 1;
1422 element_estimate = 1;
1428 estimate_result_length += length_estimate;
1433 estimate_nof += element_estimate;
1440 bool fast_case = is_array_species &&
1441 (estimate_nof * 2) >= estimate_result_length &&
1442 Protectors::IsIsConcatSpreadableLookupChainIntact(isolate);
1445 DirectHandle<FixedArrayBase> storage =
1446 isolate->factory()->NewFixedDoubleArray(estimate_result_length);
1448 bool failure =
false;
1449 if (estimate_result_length > 0) {
1451 for (
int i = 0;
i < argument_count;
i++) {
1452 DirectHandle<Object> obj =
args->at(
i);
1464 switch (array->GetElementsKind()) {
1468 if (length == 0)
break;
1471 for (uint32_t k = 0; k <
length; k++) {
1472 if (elements->is_the_hole(k)) {
1481 double double_value = elements->get_scalar(k);
1482 double_storage->set(j, double_value);
1489 Tagged<Object> the_hole = ReadOnlyRoots(isolate).the_hole_value();
1491 for (uint32_t k = 0; k <
length; k++) {
1493 if (element == the_hole) {
1498 double_storage->set(j, int_value);
1526 double_storage->FillWithHoles(0, estimate_result_length);
1534 return *isolate->factory()->NewJSArrayWithElements(storage,
kind, j);
1539 DirectHandle<UnionOf<JSReceiver, FixedArray, NumberDictionary>> storage;
1544 isolate->factory()->NewFixedArrayWithHoles(estimate_result_length);
1545 }
else if (is_array_species) {
1546 storage = NumberDictionary::New(isolate, estimate_nof);
1548 DCHECK(IsConstructor(*species));
1550 DirectHandle<JSReceiver> storage_object;
1552 isolate, storage_object,
1554 storage = storage_object;
1557 ArrayConcatVisitor visitor(isolate, storage, fast_case);
1559 for (
int i = 0;
i < argument_count;
i++) {
1560 DirectHandle<Object> obj =
args->at(
i);
1561 Maybe<bool> spreadable = IsConcatSpreadable(isolate, obj);
1562 MAYBE_RETURN(spreadable, ReadOnlyRoots(isolate).exception());
1563 if (spreadable.FromJust()) {
1565 if (!IterateElements(isolate,
object, &visitor)) {
1566 return ReadOnlyRoots(isolate).exception();
1569 if (!visitor.visit(0, obj))
return ReadOnlyRoots(isolate).exception();
1570 visitor.increase_index_offset(1);
1574 if (visitor.exceeds_array_limit()) {
1576 isolate, NewRangeError(MessageTemplate::kInvalidArrayLength));
1579 if (is_array_species) {
1580 return *visitor.ToArray();
1586bool IsSimpleArray(Isolate* isolate, DirectHandle<JSArray> obj) {
1588 Tagged<Map> map = obj->map();
1590 if (map->prototype() ==
1591 isolate->native_context()->initial_array_prototype() &&
1592 map->NumberOfOwnDescriptors() == 1) {
1600MaybeDirectHandle<JSArray> Fast_ArrayConcat(Isolate* isolate,
1601 BuiltinArguments*
args) {
1602 if (!Protectors::IsIsConcatSpreadableLookupChainIntact(isolate)) {
1611 int n_arguments =
args->length();
1617 for (
int i = 0;
i < n_arguments;
i++) {
1619 if (!IsJSArray(arg))
return {};
1620 if (!HasOnlySimpleReceiverElements(isolate,
Cast<JSObject>(arg))) {
1628 if (!IsSimpleArray(isolate, array)) {
1640 NewRangeError(MessageTemplate::kInvalidArrayLength));
1665 Protectors::IsArraySpeciesLookupChainIntact(isolate))) {
1666 if (Fast_ArrayConcat(isolate, &
args).ToHandle(&result_array)) {
1667 return *result_array;
1669 if (isolate->has_exception())
return ReadOnlyRoots(isolate).exception();
1676 if (*species == *isolate->array_function()) {
1677 if (Fast_ArrayConcat(isolate, &
args).ToHandle(&result_array)) {
1678 return *result_array;
1680 if (isolate->has_exception())
return ReadOnlyRoots(isolate).exception();
1682 return Slow_ArrayConcat(&
args, species, isolate);
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype)
#define SLOW_DCHECK(condition)
static constexpr T decode(U value)
static V8_NODISCARD constexpr U update(U previous, T value)
static constexpr int kReceiverIndex
static int ArrayMapIndex(ElementsKind elements_kind)
virtual V8_WARN_UNUSED_RESULT Maybe< uint32_t > Push(DirectHandle< JSArray > receiver, BuiltinArguments *args, uint32_t push_size)=0
static DirectHandle< JSArray > Concat(Isolate *isolate, BuiltinArguments *args, uint32_t concat_size, uint32_t result_length)
virtual V8_WARN_UNUSED_RESULT Maybe< uint32_t > Unshift(DirectHandle< JSArray > receiver, BuiltinArguments *args, uint32_t unshift_size)=0
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSReceiver > New(Isolate *isolate, DirectHandle< Object > constructor, base::Vector< const DirectHandle< Object > > args)
static constexpr int kMaxLength
static void Destroy(Address *location)
static V8_EXPORT_PRIVATE Maybe< bool > SetLength(DirectHandle< JSArray > array, uint32_t length)
static constexpr uint32_t kMaxArrayLength
static bool HasReadOnlyLength(DirectHandle< JSArray > array)
static bool PrototypeHasNoElements(Isolate *isolate, Tagged< JSObject > object)
static constexpr uint32_t kMaxElementIndex
static void SetMapAndElements(DirectHandle< JSObject > object, DirectHandle< Map > map, DirectHandle< FixedArrayBase > elements)
static V8_EXPORT_PRIVATE void TransitionElementsKind(DirectHandle< JSObject > object, ElementsKind to_kind)
static DirectHandle< Map > GetElementsTransitionMap(DirectHandle< JSObject > object, ElementsKind to_kind)
static bool UpdateAllocationSite(DirectHandle< JSObject > object, ElementsKind to_kind)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > DeletePropertyOrElement(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Name > name, LanguageMode language_mode=LanguageMode::kSloppy)
static V8_WARN_UNUSED_RESULT Maybe< bool > HasElement(Isolate *isolate, DirectHandle< JSReceiver > object, uint32_t index)
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > GetElement(Isolate *isolate, DirectHandle< JSReceiver > receiver, uint32_t index)
static V8_WARN_UNUSED_RESULT Maybe< bool > CreateDataProperty(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Name > key, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT Maybe< bool > HasPropertyOrElement(Isolate *isolate, DirectHandle< JSReceiver > object, PropertyKey key)
static V8_WARN_UNUSED_RESULT HandleType< NumberDictionary > Set(Isolate *isolate, HandleType< NumberDictionary > dictionary, uint32_t key, DirectHandle< Object > value, DirectHandle< JSObject > dictionary_holder=DirectHandle< JSObject >::null(), PropertyDetails details=PropertyDetails::Empty())
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > SetProperty(LookupIterator *it, DirectHandle< Object > value, StoreOrigin store_origin, Maybe< ShouldThrow > should_throw=Nothing< ShouldThrow >())
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > GetPropertyOrElement(Isolate *isolate, DirectHandle< JSAny > object, DirectHandle< Name > name)
static Handle< String > TypeOf(Isolate *isolate, DirectHandle< Object > object)
static V8_EXPORT_PRIVATE bool BooleanValue(Tagged< Object > obj, IsolateT *isolate)
static ElementsKind OptimalElementsKind(Tagged< Object > obj, PtrComprCageBase cage_base)
static V8_WARN_UNUSED_RESULT HandleType< JSReceiver >::MaybeType ToObject(Isolate *isolate, HandleType< T > object, const char *method_name=nullptr)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > SetElement(Isolate *isolate, DirectHandle< JSAny > object, uint32_t index, DirectHandle< Object > value, ShouldThrow should_throw)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > SetPropertyOrElement(Isolate *isolate, DirectHandle< JSAny > object, DirectHandle< Name > name, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw=Nothing< ShouldThrow >(), StoreOrigin store_origin=StoreOrigin::kMaybeKeyed)
static double NumberValue(Tagged< Number > obj)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > GetLengthFromArrayLike(Isolate *isolate, DirectHandle< JSReceiver > object)
static V8_WARN_UNUSED_RESULT Maybe< double > IntegerValue(Isolate *isolate, HandleType< T > input)
static bool ToUint32(Tagged< Object > obj, uint32_t *value)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > ArraySpeciesConstructor(Isolate *isolate, DirectHandle< JSAny > original_array)
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > GetElement(Isolate *isolate, DirectHandle< JSAny > object, uint32_t index)
static constexpr int kMaxLength
Tagged< T > GetCurrent() const
static constexpr int ToInt(const Tagged< Object > object)
static constexpr Tagged< Smi > FromInt(int value)
static constexpr Tagged< Smi > zero()
static constexpr int kMaxValue
#define V8_COMPRESS_POINTERS_8GB_BOOL
#define RAB_GSAB_TYPED_ARRAYS(V)
#define RETURN_ON_EXCEPTION(isolate, call)
#define ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call)
#define THROW_NEW_ERROR(isolate, call)
#define ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, value)
#define THROW_NEW_ERROR_RETURN_FAILURE(isolate, call)
#define RETURN_FAILURE_ON_EXCEPTION(isolate, call)
#define FOR_WITH_HANDLE_SCOPE(isolate, loop_var_type, init, loop_var, limit_check, increment, body)
#define MAYBE_RETURN_NULL(call)
#define MAYBE_RETURN(call, value)
#define RETURN_ON_EXCEPTION_VALUE(isolate, call, value)
#define RETURN_RESULT_OR_FAILURE(isolate, call)
#define MAYBE_ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call)
#define MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, value)
base::Vector< const DirectHandle< Object > > args
ZoneVector< RpoNumber > & result
bool TryCast(Tagged< From > value, Tagged< To > *out)
constexpr double kMaxSafeInteger
PerThreadAssertScopeDebugOnly< false, SAFEPOINTS_ASSERT, HEAP_ALLOCATION_ASSERT > DisallowGarbageCollection
bool DoubleToUint32IfEqualToSelf(double value, uint32_t *uint32_value)
bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, ElementsKind to_kind)
bool IsNumber(Tagged< Object > obj)
bool IsCustomElementsReceiverMap(Tagged< Map > map)
Tagged(T object) -> Tagged< T >
ElementsKind GetPackedElementsKind(ElementsKind holey_kind)
V8_INLINE constexpr bool IsSmi(TaggedImpl< kRefType, StorageType > obj)
bool IsAnyNonextensibleElementsKind(ElementsKind kind)
constexpr bool IsObjectElementsKind(ElementsKind kind)
kStaticElementsTemplateOffset kInstancePropertiesTemplateOffset Tagged< FixedArray >
@ HOLEY_NONEXTENSIBLE_ELEMENTS
@ SLOW_STRING_WRAPPER_ELEMENTS
@ PACKED_NONEXTENSIBLE_ELEMENTS
@ SLOW_SLOPPY_ARGUMENTS_ELEMENTS
@ FAST_SLOPPY_ARGUMENTS_ELEMENTS
@ FAST_STRING_WRAPPER_ELEMENTS
V8_INLINE DirectHandle< T > direct_handle(Tagged< T > object, Isolate *isolate)
return Cast< NumberDictionary >(elements(cage_base))
PerThreadAssertScopeDebugOnly< false, GC_MOLE > DisableGCMole
PerThreadAssertScopeDebugOnly< true, SAFEPOINTS_ASSERT, HEAP_ALLOCATION_ASSERT > AllowGarbageCollection
Handle< T > IndirectHandle
DONT_OVERRIDE DISABLE_ALLOCATION_SITES HOLEY_ELEMENTS
constexpr int kBitsPerInt
typename detail::FlattenUnionHelper< Union<>, Ts... >::type UnionOf
bool IsFastElementsKind(ElementsKind kind)
DONT_OVERRIDE DISABLE_ALLOCATION_SITES DISABLE_ALLOCATION_SITES HOLEY_DOUBLE_ELEMENTS
bool IsDictionaryElementsKind(ElementsKind kind)
V8_INLINE constexpr bool IsHeapObject(TaggedImpl< kRefType, StorageType > obj)
V8_EXPORT_PRIVATE FlagValues v8_flags
Tagged< NumberDictionary >
constexpr bool IsDoubleElementsKind(ElementsKind kind)
ElementsKind GetMoreGeneralElementsKind(ElementsKind from_kind, ElementsKind to_kind)
constexpr uint32_t kMaxUInt32
template const char * string
!IsContextMap !IsContextMap native_context
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
static constexpr ReleaseStoreTag kReleaseStore
Maybe< T > Just(const T &t)
#define DCHECK_LE(v1, v2)
#define DCHECK_IMPLIES(v1, v2)
#define DCHECK_GE(v1, v2)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)
#define V8_LIKELY(condition)
#define V8_WARN_UNUSED_RESULT