74#if V8_ENABLE_WEBASSEMBLY
100 switch (it->state()) {
116 if (it->HasAccess())
continue;
139 if (IsJSModuleNamespace(*
object)) {
144 if (IsJSObject(*
object)) {
158 for (;; it->Next()) {
159 switch (it->state()) {
166 if (!it->isolate()->context().is_null() && it->HasAccess())
continue;
170 return it->isolate()->factory()->undefined_value();
177 return it->isolate()->factory()->undefined_value();
179 return it->isolate()->factory()->undefined_value();
181 return it->GetDataValue(allocation_policy);
183 return it->isolate()->factory()->undefined_value();
206 DCHECK(it->GetName()->IsPrivateName());
210 for (;; it->Next()) {
211 switch (it->state()) {
219 if (!it->HasAccess()) {
221 isolate->ReportFailedAccessCheck(
230 it->GetName()->IsPrivateBrand()
231 ? MessageTemplate::kInvalidPrivateBrandReinitialization
232 : MessageTemplate::kInvalidPrivateFieldReinitialization;
235 NewTypeError(message, name_string, it->GetReceiver()));
240 NewTypeError(MessageTemplate::kWasmObjectsAreOpaque));
245 NewTypeError(MessageTemplate::kInvalidPrivateMemberWrite,
246 name_string, it->GetReceiver()));
248 }
else if (it->ExtendingNonExtensible(
252 NewTypeError(MessageTemplate::kDefineDisallowed, name_string));
278 Isolate* isolate, DirectHandle<JSReceiver> target,
280 base::Vector<DirectHandle<Object>> excluded_properties,
bool use_set) {
283 if (!IsJSReceiver(*source)) {
291 if (target->map()->is_deprecated()) {
297 if (!IsJSObjectMap(*map))
return Just(
false);
298 if (!map->OnlyHasSimpleProperties())
return Just(
false);
301 if (from->elements() != ReadOnlyRoots(isolate).empty_fixed_array()) {
311 bool has_symbol =
false;
312 bool process_symbol_only =
false;
314 for (InternalIndex
i : map->IterateOwnDescriptors()) {
315 HandleScope inner_scope(isolate);
319 DirectHandle<Name> next_key(map->instance_descriptors(isolate)->GetKey(
i),
322 if (IsSymbol(*next_key)) {
324 if (!process_symbol_only)
continue;
326 if (process_symbol_only)
continue;
329 DirectHandle<Object> prop_value;
335 PropertyDetails details =
336 map->instance_descriptors(isolate)->GetDetails(
i);
337 if (!details.IsEnumerable())
continue;
340 Representation representation = details.representation();
342 *map, details.field_index(), representation);
346 LookupIterator it(isolate, from, next_key,
350 stable = from->map() == *
map;
355 LookupIterator it(isolate, from, next_key, from,
357 if (!it.IsFound())
continue;
360 if (!it.IsEnumerable())
continue;
368 PropertyKey
key(isolate, next_key);
369 LookupIterator it(isolate, target,
key);
375 stable = from->map() == *
map;
380 if (!excluded_properties.empty() &&
381 HasExcludedProperty(excluded_properties, next_key)) {
394 if (process_symbol_only || !has_symbol) {
398 process_symbol_only =
true;
415 FastAssign(isolate, target, source, mode, excluded_properties, use_set);
430 if (!from->HasFastProperties() && target->HasFastProperties() &&
431 IsJSObject(*target) && !IsJSGlobalProxy(*target)) {
435 if (IsJSGlobalObject(*from)) {
438 ->NumberOfEnumerableProperties();
441 from->property_dictionary_swiss()->NumberOfEnumerableProperties();
444 from->property_dictionary()->NumberOfEnumerableProperties();
449 "Copying data properties");
454 for (
int i = 0;
i < keys->
length(); ++
i) {
456 if (!excluded_properties.empty() &&
457 HasExcludedProperty(excluded_properties, next_key)) {
467 if (found.
FromJust() && desc.enumerable()) {
498 if (IsJSFunctionOrBoundFunctionOrWrappedFunction(*
this)) {
499 return roots.Function_string();
501 if (IsJSArgumentsObject(*
this))
return roots.Arguments_string();
502 if (IsJSArray(*
this))
return roots.Array_string();
503 if (IsJSArrayBuffer(*
this)) {
505 return roots.SharedArrayBuffer_string();
507 return roots.ArrayBuffer_string();
509 if (IsJSArrayIterator(*
this))
return roots.ArrayIterator_string();
510 if (IsJSDate(*
this))
return roots.Date_string();
511 if (IsJSError(*
this))
return roots.Error_string();
512 if (IsJSGeneratorObject(*
this))
return roots.Generator_string();
513 if (IsJSMap(*
this))
return roots.Map_string();
514 if (IsJSMapIterator(*
this))
return roots.MapIterator_string();
515 if (IsJSProxy(*
this)) {
516 return map()->is_callable() ? roots.Function_string()
517 : roots.Object_string();
519 if (IsJSRegExp(*
this))
return roots.RegExp_string();
520 if (IsJSSet(*
this))
return roots.Set_string();
521 if (IsJSSetIterator(*
this))
return roots.SetIterator_string();
522 if (IsJSTypedArray(*
this)) {
523#define SWITCH_KIND(Type, type, TYPE, ctype) \
524 if (map()->elements_kind() == TYPE##_ELEMENTS) { \
525 return roots.Type##Array_string(); \
530 if (IsJSPrimitiveWrapper(*
this)) {
532 if (IsBoolean(value))
return roots.Boolean_string();
533 if (IsString(value))
return roots.String_string();
534 if (
IsNumber(value))
return roots.Number_string();
535 if (IsBigInt(value))
return roots.BigInt_string();
536 if (IsSymbol(value))
return roots.Symbol_string();
537 if (IsScript(value))
return roots.Script_string();
540 if (IsJSWeakMap(*
this))
return roots.WeakMap_string();
541 if (IsJSWeakSet(*
this))
return roots.WeakSet_string();
542 if (IsJSGlobalProxy(*
this))
return roots.global_string();
544 if (IsJSSharedStruct(*
this))
return roots.SharedStruct_string();
545 if (IsJSSharedArray(*
this))
return roots.SharedArray_string();
546 if (IsJSAtomicsMutex(*
this))
return roots.AtomicsMutex_string();
547 if (IsJSAtomicsCondition(*
this))
return roots.AtomicsCondition_string();
552 return roots.Object_string();
563 !
receiver->map()->is_prototype_map()) {
566 if (IsJSFunction(*maybe_constructor)) {
571 if (name->length() != 0 &&
575 }
else if (IsFunctionTemplateInfo(*maybe_constructor)) {
576 DirectHandle<FunctionTemplateInfo> function_template =
578 if (!IsUndefined(function_template->class_name(), isolate)) {
579 return std::make_pair(
580 MaybeHandle<JSFunction>(),
587 it.AdvanceIgnoringProxies()) {
590 LookupIterator it_to_string_tag(
591 isolate,
receiver, isolate->factory()->to_string_tag_symbol(), current,
595 if (IsString(*maybe_to_string_tag)) {
596 return std::make_pair(MaybeHandle<JSFunction>(),
610 if (!
receiver.is_identical_to(current)) {
611 LookupIterator it_constructor(
612 isolate,
receiver, isolate->factory()->constructor_string(), current,
616 if (IsJSFunction(*maybe_constructor)) {
621 if (name->length() != 0 &&
622 !name->Equals(ReadOnlyRoots(isolate).Object_string())) {
623 return std::make_pair(constructor, name);
629 return std::make_pair(MaybeHandle<JSFunction>(),
637 return GetConstructorHelper(isolate,
receiver).first;
643 return GetConstructorHelper(isolate,
receiver).second;
656 DCHECK(current->map()->is_constructor());
657 InstanceType instance_type = current->map()->instance_type();
658 if (InstanceTypeChecker::IsJSProxy(instance_type)) {
660 if (proxy->IsRevoked()) {
662 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kProxyRevoked));
667 if (InstanceTypeChecker::IsJSFunction(instance_type)) {
671 if (InstanceTypeChecker::IsJSBoundFunction(instance_type)) {
673 current = function->bound_target_function();
676 if (InstanceTypeChecker::IsJSWrappedFunction(instance_type)) {
678 current = function->wrapped_target_function();
682 DCHECK(!IsJSFunction(
object));
683 return object->GetCreationContext(isolate);
709 for (;; it->Next()) {
710 switch (it->state()) {
725 if (it->HasAccess())
continue;
730 if (IsJSModuleNamespace(*it->GetHolder<
Object>())) {
733 return Just(it->property_attributes());
736 return Just(it->property_attributes());
752 if (properties == roots.empty_fixed_array() ||
753 properties == roots.empty_property_array() ||
754 properties == roots.empty_property_dictionary() ||
755 properties == roots.empty_swiss_property_dictionary()) {
759 if (IsPropertyArray(properties)) {
765 if (IsGlobalDictionary(properties)) {
779 if (
IsSmi(properties)) {
783 if (IsPropertyArray(properties)) {
791 if (IsGlobalDictionary(properties)) {
797 DCHECK(properties == roots.empty_fixed_array() ||
798 properties == roots.empty_property_dictionary() ||
799 properties == roots.empty_swiss_property_dictionary());
814 SetHashAndUpdateProperties(existing_properties, hash);
823 int hash = GetIdentityHashHelper(*
this);
829 new_properties = SetHashAndUpdateProperties(properties, hash);
838 int hash = GetIdentityHashHelper(*
this);
853 key->SetIdentityHash(hash);
860 int hash = GetIdentityHashHelper(*
this);
870 DCHECK(!object->HasFastProperties());
871 Isolate* isolate =
object->GetIsolate();
874 if (IsJSGlobalObject(*
object)) {
884 GlobalDictionary::DeleteEntry(isolate, dictionary, entry);
888 cell->ClearAndInvalidate(isolate);
892 object->property_dictionary_swiss(), isolate);
895 object->SetProperties(*dictionary);
900 dictionary = NameDictionary::DeleteEntry(isolate, dictionary, entry);
901 object->SetProperties(*dictionary);
904 if (object->map()->is_prototype_map()) {
913 it->UpdateProtector();
919 it->GetName(), language_mode);
922 if (IsJSProxy(*it->GetReceiver())) {
925 DCHECK(it->name()->IsPrivate());
931 for (;; it->Next()) {
932 switch (it->state()) {
938 NewTypeError(MessageTemplate::kWasmObjectsAreOpaque));
940 if (it->HasAccess())
continue;
943 isolate->ReportFailedAccessCheck(it->GetHolder<
JSObject>()),
971 if (!it->IsConfigurable() ||
972 (IsJSTypedArray(*holder) && it->IsElement(*holder))) {
976 isolate->Throw(*isolate->factory()->NewTypeError(
977 MessageTemplate::kStrictDeleteProperty, it->GetName(),
1034 if (!IsJSReceiver(*
object)) {
1036 isolate->factory()->InternalizeUtf8String(
"Object.defineProperty");
1038 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject, fun_name));
1067 if (!IsJSReceiver(*
object)) {
1069 isolate->factory()->InternalizeUtf8String(
"Object.defineProperties");
1071 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject, fun_name));
1087 int capacity = keys->length();
1088 std::vector<PropertyDescriptor> descriptors(capacity);
1089 size_t descriptors_index = 0;
1091 for (
int i = 0;
i < keys->
length(); ++
i) {
1101 if (attrs ==
ABSENT)
continue;
1110 isolate, desc_obj, &descriptors[descriptors_index]);
1115 descriptors[descriptors_index].set_name(next_key);
1116 descriptors_index++;
1119 for (
size_t i = 0;
i < descriptors_index; ++
i) {
1129 CHECK(status.FromJust());
1141 if (IsJSArray(*
object)) {
1145 if (IsJSProxy(*
object)) {
1149 if (IsJSTypedArray(*
object)) {
1151 key, desc, should_throw);
1153 if (IsJSModuleNamespace(*
object)) {
1159 NewTypeError(MessageTemplate::kWasmObjectsAreOpaque));
1161 if (IsAlwaysSharedSpaceJSObject(*
object)) {
1194 if (!interceptor->has_getter()) {
1195 return isolate->factory()->undefined_value();
1198 DirectHandle<JSObject> holder = it->GetHolder<JSObject>();
1199 DirectHandle<JSAny>
result;
1200 DirectHandle<Object>
receiver = it->GetReceiver();
1205 PropertyCallbackArguments
args(isolate, interceptor->data(), *
receiver,
1208 if (it->IsElement(*holder)) {
1209 result =
args.CallIndexedGetter(interceptor, it->array_index());
1211 result =
args.CallNamedGetter(interceptor, it->name());
1215 if (
result.is_null())
return isolate->factory()->undefined_value();
1217 args.AcceptSideEffects();
1222Maybe<PropertyAttributes> GetPropertyAttributesWithInterceptorInternal(
1223 LookupIterator* it, DirectHandle<InterceptorInfo> interceptor) {
1224 Isolate* isolate = it->isolate();
1227 AssertNoContextChange ncc(isolate);
1228 HandleScope scope(isolate);
1230 DirectHandle<JSObject> holder = it->GetHolder<JSObject>();
1232 interceptor->can_intercept_symbols());
1233 DirectHandle<Object>
receiver = it->GetReceiver();
1239 PropertyCallbackArguments
args(isolate, interceptor->data(), *
receiver,
1241 if (interceptor->has_query()) {
1242 DirectHandle<Object>
result;
1243 if (it->IsElement(*holder)) {
1244 result =
args.CallIndexedQuery(interceptor, it->array_index());
1246 result =
args.CallNamedQuery(interceptor, it->name());
1261 args.AcceptSideEffects();
1265 }
else if (interceptor->has_getter()) {
1267 DirectHandle<Object>
result;
1268 if (it->IsElement(*holder)) {
1269 result =
args.CallIndexedGetter(interceptor, it->array_index());
1271 result =
args.CallNamedGetter(interceptor, it->name());
1278 args.AcceptSideEffects();
1285Maybe<InterceptorResult> SetPropertyWithInterceptorInternal(
1286 LookupIterator* it, DirectHandle<InterceptorInfo> interceptor,
1287 Maybe<ShouldThrow> should_throw, DirectHandle<Object> value) {
1288 Isolate* isolate = it->isolate();
1291 AssertNoContextChange ncc(isolate);
1293 if (!interceptor->has_setter()) {
1297 DirectHandle<JSObject> holder = it->GetHolder<JSObject>();
1298 DirectHandle<Object>
receiver = it->GetReceiver();
1304 PropertyCallbackArguments
args(isolate, interceptor->data(), *
receiver,
1305 *holder, should_throw);
1308 it->IsElement(*holder)
1309 ?
args.CallIndexedSetter(interceptor, it->array_index(), value)
1310 :
args.CallNamedSetter(interceptor, it->name(), value);
1312 return args.GetBooleanReturnValue(intercepted,
"Setter");
1315Maybe<InterceptorResult> DefinePropertyWithInterceptorInternal(
1316 LookupIterator* it, DirectHandle<InterceptorInfo> interceptor,
1317 Maybe<ShouldThrow> should_throw, PropertyDescriptor* desc) {
1318 Isolate* isolate = it->isolate();
1321 AssertNoContextChange ncc(isolate);
1323 if (!interceptor->has_definer()) {
1327 DirectHandle<JSObject> holder = it->GetHolder<JSObject>();
1328 DirectHandle<Object>
receiver = it->GetReceiver();
1335 std::unique_ptr<v8::PropertyDescriptor> descriptor(
1338 DirectHandle<Object>
getter = desc->get();
1339 if (!
getter.is_null() && IsFunctionTemplateInfo(*
getter)) {
1344 MaybeDirectHandle<Name>()),
1347 DirectHandle<Object>
setter = desc->set();
1348 if (!
setter.is_null() && IsFunctionTemplateInfo(*
setter)) {
1353 MaybeDirectHandle<Name>()),
1357 v8::Utils::ToLocal(
setter)));
1359 if (desc->has_writable()) {
1361 v8::Utils::ToLocal(desc->value()), desc->writable()));
1367 if (desc->has_enumerable()) {
1368 descriptor->set_enumerable(desc->enumerable());
1370 if (desc->has_configurable()) {
1371 descriptor->set_configurable(desc->configurable());
1374 PropertyCallbackArguments
args(isolate, interceptor->data(), *
receiver,
1375 *holder, should_throw);
1378 it->IsElement(*holder)
1379 ?
args.CallIndexedDefiner(interceptor, it->array_index(), *descriptor)
1380 :
args.CallNamedDefiner(interceptor, it->name(), *descriptor);
1382 return args.GetBooleanReturnValue(intercepted,
"Definer");
1396 if (!it.HasAccess()) {
1398 isolate, isolate->ReportFailedAccessCheck(it.GetHolder<
JSObject>()),
1425 if (it.HolderIsReceiverOrHiddenPrototype()) {
1427 if (!DefinePropertyWithInterceptorInternal(&it, it.GetInterceptor(),
1453 ¤t, should_throw, {});
1465 isolate,
nullptr, extensible, desc, current, should_throw, property_name);
1477 bool desc_is_accessor_descriptor =
1479 bool desc_is_generic_descriptor =
1483 if (current->is_empty()) {
1488 NewTypeError(MessageTemplate::kDefineDisallowed,
1489 it !=
nullptr ? it->GetName() : property_name));
1493 DCHECK_EQ(desc_is_generic_descriptor || desc_is_data_descriptor,
1494 !desc_is_accessor_descriptor);
1495 if (!desc_is_accessor_descriptor) {
1501 if (it !=
nullptr) {
1502 if (!desc->has_writable()) desc->set_writable(
false);
1503 if (!desc->has_enumerable()) desc->set_enumerable(
false);
1504 if (!desc->has_configurable()) desc->set_configurable(
false);
1508 :
Cast<Object>(isolate->factory()->undefined_value()));
1511 desc->ToAttributes());
1516 DCHECK(desc_is_accessor_descriptor);
1522 if (it !=
nullptr) {
1523 if (!desc->has_enumerable()) desc->set_enumerable(
false);
1524 if (!desc->has_configurable()) desc->set_configurable(
false);
1526 desc->has_get() ? desc->get()
1529 desc->has_set() ? desc->set()
1533 desc->ToAttributes());
1542 if ((!desc->has_enumerable() ||
1543 desc->enumerable() == current->enumerable()) &&
1544 (!desc->has_configurable() ||
1545 desc->configurable() == current->configurable()) &&
1546 !desc->has_value() &&
1547 (!desc->has_writable() ||
1548 (current->has_writable() && current->writable() == desc->writable())) &&
1549 (!desc->has_get() ||
1550 (current->has_get() &&
1552 (!desc->has_set() ||
1553 (current->has_set() &&
1558 if (!current->configurable()) {
1561 if (desc->has_configurable() && desc->configurable()) {
1564 NewTypeError(MessageTemplate::kRedefineDisallowed,
1565 it !=
nullptr ? it->GetName() : property_name));
1570 if (desc->has_enumerable() && desc->enumerable() != current->enumerable()) {
1573 NewTypeError(MessageTemplate::kRedefineDisallowed,
1574 it !=
nullptr ? it->GetName() : property_name));
1578 bool current_is_data_descriptor =
1582 if (desc_is_generic_descriptor) {
1587 }
else if (current_is_data_descriptor != desc_is_data_descriptor) {
1589 if (!current->configurable()) {
1592 NewTypeError(MessageTemplate::kRedefineDisallowed,
1593 it !=
nullptr ? it->GetName() : property_name));
1596 if (current_is_data_descriptor) {
1614 }
else if (current_is_data_descriptor && desc_is_data_descriptor) {
1617 if (!current->configurable() && !current->writable()) {
1620 if (desc->has_writable() && desc->writable()) {
1623 NewTypeError(MessageTemplate::kRedefineDisallowed,
1624 it !=
nullptr ? it->GetName() : property_name));
1628 if (desc->has_value()) {
1636 NewTypeError(MessageTemplate::kRedefineDisallowed,
1637 it !=
nullptr ? it->GetName() : property_name));
1645 desc_is_accessor_descriptor);
1647 if (!current->configurable()) {
1650 if (desc->has_set() &&
1654 NewTypeError(MessageTemplate::kRedefineDisallowed,
1655 it !=
nullptr ? it->GetName() : property_name));
1659 if (desc->has_get() &&
1663 NewTypeError(MessageTemplate::kRedefineDisallowed,
1664 it !=
nullptr ? it->GetName() : property_name));
1670 if (it !=
nullptr) {
1675 if (desc->has_enumerable()) {
1682 if (desc->has_configurable()) {
1689 if (desc_is_data_descriptor ||
1690 (desc_is_generic_descriptor && current_is_data_descriptor)) {
1691 if (desc->has_writable()) {
1699 desc->has_value() ? desc->value()
1700 : current->has_value()
1702 :
Cast<Object>(isolate->factory()->undefined_value()));
1706 DCHECK(desc_is_accessor_descriptor ||
1707 (desc_is_generic_descriptor &&
1710 desc->has_get() ? desc->get()
1711 : current->has_get()
1715 desc->has_set() ? desc->set()
1716 : current->has_set()
1746 if (!IsJSReceiver(*
object)) {
1760 if (IsJSObject(*
object)) {
1762 value, should_throw);
1772 &new_desc, should_throw);
1782 DCHECK(it->GetName()->IsPrivateName());
1785 switch (it->state()) {
1793 &new_desc, should_throw);
1797 NewTypeError(MessageTemplate::kWasmObjectsAreOpaque));
1805 if (!it->HasAccess()) {
1808 it->isolate()->ReportFailedAccessCheck(it->GetHolder<
JSObject>()),
1841 if (it->HasAccess()) {
1844 interceptor = it->GetInterceptorForFailedAccessCheck();
1854 interceptor = it->GetInterceptor();
1857 Isolate* isolate = it->isolate();
1858 if (!interceptor->has_descriptor())
return Just(
false);
1861 DirectHandle<JSObject> holder = it->GetHolder<JSObject>();
1863 DirectHandle<Object>
receiver = it->GetReceiver();
1870 PropertyCallbackArguments
args(isolate, interceptor->data(), *
receiver,
1872 if (it->IsElement(*holder)) {
1873 result =
args.CallIndexedDescriptor(interceptor, it->array_index());
1875 result =
args.CallNamedDescriptor(interceptor, it->name());
1882 args.AcceptSideEffects();
1885 it->IsElement(*holder) ?
"v8::IndexedPropertyDescriptorCallback"
1886 :
"v8::NamedPropertyDescriptorCallback",
1887 "Invalid property descriptor.");
1905 if (it->IsFound() && IsJSProxy(*it->GetHolder<
JSReceiver>())) {
1907 it->GetName(), desc);
1910 Maybe<bool> intercepted = GetPropertyDescriptorWithInterceptor(it, desc);
1923 DCHECK(!isolate->has_exception());
1926 DCHECK(desc->is_empty());
1930 IsAccessorPair(*it->GetAccessors());
1931 if (!is_accessor_pair) {
1935 DCHECK(isolate->has_exception());
1938 desc->set_value(value);
1940 desc->set_writable((attrs &
READ_ONLY) == 0);
1955 desc->set_enumerable((attrs &
DONT_ENUM) == 0);
1957 desc->set_configurable((attrs &
DONT_DELETE) == 0);
1973 if (!object->HasSloppyArgumentsElements() &&
1974 !IsJSModuleNamespace(*
object)) {
1978 if (test.FromJust())
return test;
1982 isolate,
object, should_throw);
1985 isolate,
object, should_throw);
2006 for (
int i = 0;
i < keys->
length(); ++
i) {
2015 for (
int i = 0;
i < keys->
length(); ++
i) {
2049 for (
int i = 0;
i < keys->
length(); ++
i) {
2076 return GenericTestIntegrityLevel(isolate,
receiver, level);
2082 if (IsJSProxy(*
object)) {
2087 NewTypeError(MessageTemplate::kWasmObjectsAreOpaque));
2089 DCHECK(IsJSObject(*
object));
2096 if (IsJSProxy(*
object)) {
2106template <
template <
typename>
typename HandleType>
2113 isolate, exotic_to_prim,
2115 isolate->factory()->to_primitive_symbol()));
2116 if (!IsUndefined(*exotic_to_prim, isolate)) {
2118 isolate->factory()->ToPrimitiveHintString(hint);
2119 HandleType<Object>
result;
2125 NewTypeError(MessageTemplate::kCannotConvertToPrimitive));
2127 return OrdinaryToPrimitive<HandleType>(
2140template <
template <
typename>
typename HandleType>
2148 method_names[0] = isolate->factory()->valueOf_string();
2149 method_names[1] = isolate->factory()->toString_string();
2152 method_names[0] = isolate->factory()->toString_string();
2153 method_names[1] = isolate->factory()->valueOf_string();
2160 if (IsCallable(*
method)) {
2161 HandleType<Object>
result;
2168 NewTypeError(MessageTemplate::kCannotConvertToPrimitive));
2176 if (!IsJSObjectMap(*map))
return Just(
false);
2177 if (!map->OnlyHasSimpleProperties())
return Just(
false);
2183 int number_of_own_descriptors = map->NumberOfOwnDescriptors();
2184 size_t number_of_own_elements =
2185 object->GetElementsAccessor()->GetCapacity(*
object, object->elements());
2187 if (number_of_own_elements >
2189 isolate->Throw(*isolate->factory()->NewRangeError(
2190 MessageTemplate::kInvalidArrayLength));
2195 static_cast<int>(number_of_own_descriptors + number_of_own_elements));
2198 if (object->elements() !=
ReadOnlyRoots(isolate).empty_fixed_array()) {
2199 MAYBE_RETURN(object->GetElementsAccessor()->CollectValuesOrEntries(
2200 isolate,
object, values_or_entries, get_entries, &
count,
2207 bool stable = *map ==
object->map();
2209 descriptors.
SetValue(map->instance_descriptors(isolate));
2216 if (!IsString(*next_key))
continue;
2222 DCHECK_EQ(*descriptors, map->instance_descriptors(isolate));
2243 stable =
object->map() == *
map;
2244 descriptors.
SetValue(map->instance_descriptors(isolate));
2251 if (!it.IsFound())
continue;
2254 if (!it.IsEnumerable())
continue;
2263 values_or_entries->set(
count, *prop_value);
2274 bool try_fast_path,
bool get_entries) {
2278 isolate,
object, get_entries, &values_or_entries);
2281 if (fast_values_or_entries.
FromJust())
return values_or_entries;
2294 values_or_entries = isolate->factory()->NewFixedArray(keys->length());
2297 for (
int i = 0;
i < keys->
length(); ++
i) {
2303 isolate,
object,
key, &descriptor);
2315 isolate->factory()->NewFixedArray(2);
2316 entry_storage->set(0, *
key);
2317 entry_storage->set(1, *value);
2318 value = isolate->factory()->NewJSArrayWithElements(entry_storage,
2322 values_or_entries->set(length, *value);
2325 DCHECK_LE(length, values_or_entries->length());
2331 bool try_fast_path) {
2337 bool try_fast_path) {
2344 bool from_javascript,
2348 NewTypeError(MessageTemplate::kWasmObjectsAreOpaque));
2351 if (IsJSProxy(*
object)) {
2353 from_javascript, should_throw);
2356 from_javascript, should_throw);
2362 !iter.
IsAtEnd(); iter.AdvanceIgnoringProxies()) {
2363 if (IsJSProxy(iter.GetCurrent()))
return true;
2371 if (!IsJSFunction(maybe_constructor))
return false;
2378 ->GetInstanceTemplate();
2379 if (IsUndefined(instance_template, isolate))
return false;
2393 Isolate*
const isolate = constructor->GetIsolate();
2394 DCHECK(IsConstructor(*constructor));
2396 DCHECK(!constructor->has_initial_map() ||
2397 !InstanceTypeChecker::IsJSFunction(
2398 constructor->initial_map()->instance_type()));
2402 isolate, initial_map,
2407 new_js_object_type);
2417 isolate->factory()->NewFastOrSlowJSObjectFromMap(
2419 new_js_object_type);
2434 return isolate->factory()->NewFastOrSlowJSObjectFromMap(map);
2438 DCHECK(object->HasSmiOrObjectElements() ||
2439 object->HasFastStringWrapperElements() ||
2440 object->HasAnyNonextensibleElements());
2442 Isolate* isolate =
object->GetIsolate();
2443 if (raw_elems->map() !=
ReadOnlyRoots(isolate).fixed_cow_array_map())
return;
2446 isolate->factory()->CopyFixedArrayWithMap(
2447 elems, isolate->factory()->fixed_array_map());
2448 object->set_elements(*writable_elems);
2453 DCHECK(!InstanceTypeChecker::IsJSApiObject(instance_type));
2454 switch (instance_type) {
2455#define WRITE_TYPE(TYPE) \
2465 bool function_has_prototype_slot) {
2467 case JS_SPECIAL_API_OBJECT_TYPE:
2468 case JS_API_OBJECT_TYPE:
2470 case JS_ITERATOR_PROTOTYPE_TYPE:
2471 case JS_MAP_ITERATOR_PROTOTYPE_TYPE:
2472 case JS_OBJECT_PROTOTYPE_TYPE:
2473 case JS_OBJECT_TYPE:
2474 case JS_PROMISE_PROTOTYPE_TYPE:
2475 case JS_REG_EXP_PROTOTYPE_TYPE:
2476 case JS_SET_ITERATOR_PROTOTYPE_TYPE:
2477 case JS_SET_PROTOTYPE_TYPE:
2478 case JS_STRING_ITERATOR_PROTOTYPE_TYPE:
2479 case JS_ARRAY_ITERATOR_PROTOTYPE_TYPE:
2480 case JS_TYPED_ARRAY_PROTOTYPE_TYPE:
2481 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
2482 case JS_ARGUMENTS_OBJECT_TYPE:
2484 return JSObject::kHeaderSize;
2485 case JS_GENERATOR_OBJECT_TYPE:
2486 return JSGeneratorObject::kHeaderSize;
2487 case JS_ASYNC_FUNCTION_OBJECT_TYPE:
2488 return JSAsyncFunctionObject::kHeaderSize;
2489 case JS_ASYNC_GENERATOR_OBJECT_TYPE:
2490 return JSAsyncGeneratorObject::kHeaderSize;
2491 case JS_ASYNC_FROM_SYNC_ITERATOR_TYPE:
2492 return JSAsyncFromSyncIterator::kHeaderSize;
2493 case JS_GLOBAL_PROXY_TYPE:
2494 return JSGlobalProxy::kHeaderSize;
2495 case JS_GLOBAL_OBJECT_TYPE:
2496 return JSGlobalObject::kHeaderSize;
2497 case JS_BOUND_FUNCTION_TYPE:
2498 return JSBoundFunction::kHeaderSize;
2499 case JS_FUNCTION_TYPE:
2500 case JS_CLASS_CONSTRUCTOR_TYPE:
2501 case JS_PROMISE_CONSTRUCTOR_TYPE:
2502 case JS_REG_EXP_CONSTRUCTOR_TYPE:
2503 case JS_ARRAY_CONSTRUCTOR_TYPE:
2504#define TYPED_ARRAY_CONSTRUCTORS_SWITCH(Type, type, TYPE, Ctype) \
2505 case TYPE##_TYPED_ARRAY_CONSTRUCTOR_TYPE:
2507#undef TYPED_ARRAY_CONSTRUCTORS_SWITCH
2509 case JS_PRIMITIVE_WRAPPER_TYPE:
2510 return JSPrimitiveWrapper::kHeaderSize;
2512 return JSDate::kHeaderSize;
2513 case JS_DISPOSABLE_STACK_BASE_TYPE:
2514 return JSDisposableStackBase::kHeaderSize;
2515 case JS_ASYNC_DISPOSABLE_STACK_TYPE:
2516 return JSAsyncDisposableStack::kHeaderSize;
2517 case JS_SYNC_DISPOSABLE_STACK_TYPE:
2518 return JSSyncDisposableStack::kHeaderSize;
2520 return JSArray::kHeaderSize;
2521 case JS_ARRAY_BUFFER_TYPE:
2522 return JSArrayBuffer::kHeaderSize;
2523 case JS_ARRAY_ITERATOR_TYPE:
2524 return JSArrayIterator::kHeaderSize;
2525 case JS_TYPED_ARRAY_TYPE:
2526 return JSTypedArray::kHeaderSize;
2527 case JS_DATA_VIEW_TYPE:
2528 return JSDataView::kHeaderSize;
2529 case JS_RAB_GSAB_DATA_VIEW_TYPE:
2530 return JSRabGsabDataView::kHeaderSize;
2532 return JSSet::kHeaderSize;
2534 return JSMap::kHeaderSize;
2535 case JS_SET_KEY_VALUE_ITERATOR_TYPE:
2536 case JS_SET_VALUE_ITERATOR_TYPE:
2537 return JSSetIterator::kHeaderSize;
2538 case JS_MAP_KEY_ITERATOR_TYPE:
2539 case JS_MAP_KEY_VALUE_ITERATOR_TYPE:
2540 case JS_MAP_VALUE_ITERATOR_TYPE:
2541 return JSMapIterator::kHeaderSize;
2542 case JS_WEAK_REF_TYPE:
2543 return JSWeakRef::kHeaderSize;
2544 case JS_FINALIZATION_REGISTRY_TYPE:
2545 return JSFinalizationRegistry::kHeaderSize;
2546 case JS_WEAK_MAP_TYPE:
2547 return JSWeakMap::kHeaderSize;
2548 case JS_WEAK_SET_TYPE:
2549 return JSWeakSet::kHeaderSize;
2550 case JS_PROMISE_TYPE:
2551 return JSPromise::kHeaderSize;
2552 case JS_REG_EXP_TYPE:
2553 return JSRegExp::kHeaderSize;
2554 case JS_REG_EXP_STRING_ITERATOR_TYPE:
2555 return JSRegExpStringIterator::kHeaderSize;
2556 case JS_MESSAGE_OBJECT_TYPE:
2557 return JSMessageObject::kHeaderSize;
2558 case JS_EXTERNAL_OBJECT_TYPE:
2559 return JSExternalObject::kHeaderSize;
2560 case JS_SHADOW_REALM_TYPE:
2561 return JSShadowRealm::kHeaderSize;
2562 case JS_STRING_ITERATOR_TYPE:
2563 return JSStringIterator::kHeaderSize;
2564 case JS_ITERATOR_MAP_HELPER_TYPE:
2565 return JSIteratorMapHelper::kHeaderSize;
2566 case JS_ITERATOR_FILTER_HELPER_TYPE:
2567 return JSIteratorFilterHelper::kHeaderSize;
2568 case JS_ITERATOR_TAKE_HELPER_TYPE:
2569 return JSIteratorTakeHelper::kHeaderSize;
2570 case JS_ITERATOR_DROP_HELPER_TYPE:
2571 return JSIteratorDropHelper::kHeaderSize;
2572 case JS_ITERATOR_FLAT_MAP_HELPER_TYPE:
2573 return JSIteratorFlatMapHelper::kHeaderSize;
2574 case JS_MODULE_NAMESPACE_TYPE:
2575 return JSModuleNamespace::kHeaderSize;
2576 case JS_SHARED_ARRAY_TYPE:
2577 return JSSharedArray::kHeaderSize;
2578 case JS_SHARED_STRUCT_TYPE:
2579 return JSSharedStruct::kHeaderSize;
2580 case JS_ATOMICS_MUTEX_TYPE:
2581 return JSAtomicsMutex::kHeaderSize;
2582 case JS_ATOMICS_CONDITION_TYPE:
2583 return JSAtomicsCondition::kHeaderSize;
2584 case JS_TEMPORAL_CALENDAR_TYPE:
2585 return JSTemporalCalendar::kHeaderSize;
2586 case JS_TEMPORAL_DURATION_TYPE:
2587 return JSTemporalDuration::kHeaderSize;
2588 case JS_TEMPORAL_INSTANT_TYPE:
2589 return JSTemporalInstant::kHeaderSize;
2590 case JS_TEMPORAL_PLAIN_DATE_TYPE:
2591 return JSTemporalPlainDate::kHeaderSize;
2592 case JS_TEMPORAL_PLAIN_DATE_TIME_TYPE:
2593 return JSTemporalPlainDateTime::kHeaderSize;
2594 case JS_TEMPORAL_PLAIN_MONTH_DAY_TYPE:
2595 return JSTemporalPlainMonthDay::kHeaderSize;
2596 case JS_TEMPORAL_PLAIN_TIME_TYPE:
2597 return JSTemporalPlainTime::kHeaderSize;
2598 case JS_TEMPORAL_PLAIN_YEAR_MONTH_TYPE:
2599 return JSTemporalPlainYearMonth::kHeaderSize;
2600 case JS_TEMPORAL_TIME_ZONE_TYPE:
2601 return JSTemporalTimeZone::kHeaderSize;
2602 case JS_TEMPORAL_ZONED_DATE_TIME_TYPE:
2603 return JSTemporalZonedDateTime::kHeaderSize;
2604 case JS_VALID_ITERATOR_WRAPPER_TYPE:
2605 return JSValidIteratorWrapper::kHeaderSize;
2606 case JS_WRAPPED_FUNCTION_TYPE:
2607 return JSWrappedFunction::kHeaderSize;
2608 case JS_RAW_JSON_TYPE:
2609 return JSRawJson::kHeaderSize;
2610#ifdef V8_INTL_SUPPORT
2611 case JS_V8_BREAK_ITERATOR_TYPE:
2612 return JSV8BreakIterator::kHeaderSize;
2613 case JS_COLLATOR_TYPE:
2614 return JSCollator::kHeaderSize;
2615 case JS_DATE_TIME_FORMAT_TYPE:
2616 return JSDateTimeFormat::kHeaderSize;
2617 case JS_DISPLAY_NAMES_TYPE:
2618 return JSDisplayNames::kHeaderSize;
2619 case JS_DURATION_FORMAT_TYPE:
2620 return JSDurationFormat::kHeaderSize;
2621 case JS_LIST_FORMAT_TYPE:
2622 return JSListFormat::kHeaderSize;
2623 case JS_LOCALE_TYPE:
2624 return JSLocale::kHeaderSize;
2625 case JS_NUMBER_FORMAT_TYPE:
2626 return JSNumberFormat::kHeaderSize;
2627 case JS_PLURAL_RULES_TYPE:
2628 return JSPluralRules::kHeaderSize;
2629 case JS_RELATIVE_TIME_FORMAT_TYPE:
2630 return JSRelativeTimeFormat::kHeaderSize;
2631 case JS_SEGMENT_ITERATOR_TYPE:
2632 return JSSegmentIterator::kHeaderSize;
2633 case JS_SEGMENTER_TYPE:
2634 return JSSegmenter::kHeaderSize;
2635 case JS_SEGMENTS_TYPE:
2636 return JSSegments::kHeaderSize;
2638#if V8_ENABLE_WEBASSEMBLY
2639 case WASM_GLOBAL_OBJECT_TYPE:
2640 return WasmGlobalObject::kHeaderSize;
2641 case WASM_INSTANCE_OBJECT_TYPE:
2642 return WasmInstanceObject::kHeaderSize;
2643 case WASM_MEMORY_OBJECT_TYPE:
2644 return WasmMemoryObject::kHeaderSize;
2645 case WASM_MEMORY_MAP_DESCRIPTOR_TYPE:
2646 return WasmMemoryMapDescriptor::kHeaderSize;
2647 case WASM_MODULE_OBJECT_TYPE:
2648 return WasmModuleObject::kHeaderSize;
2649 case WASM_TABLE_OBJECT_TYPE:
2650 return WasmTableObject::kHeaderSize;
2651 case WASM_VALUE_OBJECT_TYPE:
2652 return WasmValueObject::kHeaderSize;
2653 case WASM_TAG_OBJECT_TYPE:
2654 return WasmTagObject::kHeaderSize;
2655 case WASM_EXCEPTION_PACKAGE_TYPE:
2656 return WasmExceptionPackage::kHeaderSize;
2657 case WASM_SUSPENDING_OBJECT_TYPE:
2658 return WasmSuspendingObject::kHeaderSize;
2663 if (InstanceTypeChecker::IsJSApiObject(type)) {
2676 it->GetInterceptorForFailedAccessCheck();
2677 if (!interceptor.is_null()) {
2682 GetPropertyWithInterceptorInternal(it, interceptor, &done));
2689 if (IsSymbol(*name) &&
Cast<Symbol>(*name)->is_well_known_symbol()) {
2690 return it->factory()->undefined_value();
2702 it->GetInterceptorForFailedAccessCheck();
2703 if (!interceptor.is_null()) {
2705 GetPropertyAttributesWithInterceptorInternal(it, interceptor);
2720 it->GetInterceptorForFailedAccessCheck();
2721 if (!interceptor.is_null()) {
2723 if (!SetPropertyWithInterceptorInternal(it, interceptor, should_throw,
2748 DCHECK(!object->HasFastProperties());
2750 Isolate* isolate =
object->GetIsolate();
2752 uint32_t hash = name->hash();
2754 if (IsJSGlobalObject(*
object)) {
2759 InternalIndex entry = dictionary->FindEntry(isolate, roots, name, hash);
2767 auto cell = isolate->factory()->NewPropertyCell(name, details, value);
2769 GlobalDictionary::Add(isolate, dictionary, name, cell, details);
2770 global_obj->set_global_dictionary(*dictionary,
kReleaseStore);
2774 DCHECK_EQ(dictionary->CellAt(entry)->value(), *value);
2779 object->property_dictionary_swiss(), isolate);
2780 InternalIndex entry = dictionary->FindEntry(isolate, *name);
2786 object->SetProperties(*dictionary);
2788 dictionary->ValueAtPut(entry, *value);
2789 dictionary->DetailsAtPut(entry, details);
2799 NameDictionary::Add(isolate, dictionary, name, value, details);
2800 object->SetProperties(*dictionary);
2805 details = details.
set_index(enumeration_index);
2806 dictionary->SetEntry(entry, *name, *value, details);
2809 if (name->IsInteresting(isolate)) {
2810 dictionary->set_may_have_interesting_properties(
true);
2821 Isolate* isolate =
object->GetIsolate();
2827 object->set_elements(*dictionary);
2831 switch (
map()->instance_type()) {
2832 case JS_ARRAY_TYPE: {
2836 accumulator->
Add(
"<JSArray[%u]>",
static_cast<uint32_t
>(length));
2839 case JS_BOUND_FUNCTION_TYPE: {
2841 accumulator->
Add(
"<JSBoundFunction");
2842 accumulator->
Add(
" (BoundTargetFunction %p)>",
2843 reinterpret_cast<void*
>(
2844 bound_function->bound_target_function().
ptr()));
2847 case JS_WEAK_MAP_TYPE: {
2848 accumulator->
Add(
"<JSWeakMap>");
2851 case JS_WEAK_SET_TYPE: {
2852 accumulator->
Add(
"<JSWeakSet>");
2855 case JS_REG_EXP_TYPE: {
2856 accumulator->
Add(
"<JSRegExp");
2858 if (IsString(regexp->source())) {
2859 accumulator->
Add(
" ");
2860 Cast<String>(regexp->source())->StringShortPrint(accumulator);
2862 accumulator->
Add(
">");
2866 case JS_PROMISE_CONSTRUCTOR_TYPE:
2867 case JS_REG_EXP_CONSTRUCTOR_TYPE:
2868 case JS_ARRAY_CONSTRUCTOR_TYPE:
2869#define TYPED_ARRAY_CONSTRUCTORS_SWITCH(Type, type, TYPE, Ctype) \
2870 case TYPE##_TYPED_ARRAY_CONSTRUCTOR_TYPE:
2872#undef TYPED_ARRAY_CONSTRUCTORS_SWITCH
2873 case JS_CLASS_CONSTRUCTOR_TYPE:
2874 case JS_FUNCTION_TYPE: {
2876 std::unique_ptr<char[]> fun_name = function->shared()->DebugNameCStr();
2877 if (fun_name[0] !=
'\0') {
2878 accumulator->
Add(
"<JSFunction ");
2879 accumulator->
Add(fun_name.get());
2881 accumulator->
Add(
"<JSFunction");
2886 if (IsString(source_name)) {
2888 if (str->length() > 0) {
2889 accumulator->
Add(
" <");
2890 accumulator->
Put(str);
2891 accumulator->
Add(
">");
2895 accumulator->
Add(
" (sfi = %p)",
2896 reinterpret_cast<void*
>(function->shared().ptr()));
2897 accumulator->
Put(
'>');
2900 case JS_GENERATOR_OBJECT_TYPE: {
2901 accumulator->
Add(
"<JSGenerator>");
2904 case JS_ASYNC_FUNCTION_OBJECT_TYPE: {
2905 accumulator->
Add(
"<JSAsyncFunctionObject>");
2908 case JS_ASYNC_GENERATOR_OBJECT_TYPE: {
2909 accumulator->
Add(
"<JS AsyncGenerator>");
2912 case JS_SHARED_ARRAY_TYPE:
2913 accumulator->
Add(
"<JSSharedArray>");
2915 case JS_SHARED_STRUCT_TYPE:
2916 accumulator->
Add(
"<JSSharedStruct>");
2918 case JS_ATOMICS_MUTEX_TYPE:
2919 accumulator->
Add(
"<JSAtomicsMutex>");
2921 case JS_ATOMICS_CONDITION_TYPE:
2922 accumulator->
Add(
"<JSAtomicsCondition>");
2924 case JS_MESSAGE_OBJECT_TYPE:
2925 accumulator->
Add(
"<JSMessageObject>");
2927 case JS_EXTERNAL_OBJECT_TYPE:
2928 accumulator->
Add(
"<JSExternalObject>");
2934 bool printed =
false;
2935 bool is_global_proxy = IsJSGlobalProxy(*
this);
2936 if (IsJSFunction(constructor)) {
2940 if (constructor_name->length() > 0) {
2941 accumulator->
Add(is_global_proxy ?
"<GlobalObject " :
"<");
2942 accumulator->
Put(constructor_name);
2943 accumulator->
Add(
" %smap = %p",
2944 map_of_this->is_deprecated() ?
"deprecated-" :
"",
2948 }
else if (IsFunctionTemplateInfo(constructor)) {
2949 accumulator->
Add(
"<RemoteObject>");
2953 accumulator->
Add(
"<JS");
2954 if (is_global_proxy) {
2955 accumulator->
Add(
"GlobalProxy");
2956 }
else if (IsJSGlobalObject(*
this)) {
2957 accumulator->
Add(
"GlobalObject");
2959 accumulator->
Add(
"Object");
2962 if (IsJSPrimitiveWrapper(*
this)) {
2963 accumulator->
Add(
" value = ");
2966 accumulator->
Put(
'>');
2976 if (from_kind != to_kind) {
2993 if (new_map->is_dictionary_map()) {
2994 PrintF(file,
"[migrating to slow]\n");
2997 PrintF(file,
"[migrating]");
2998 Isolate* isolate = GetIsolate();
3010 if (IsString(name)) {
3013 PrintF(file,
"{symbol %p}",
reinterpret_cast<void*
>(name.ptr()));
3018 if (original_map->elements_kind() != new_map->elements_kind()) {
3019 PrintF(file,
"elements_kind[%i->%i]", original_map->elements_kind(),
3020 new_map->elements_kind());
3028 if (
IsSmi(
object))
return false;
3031 if (!InstanceTypeChecker::IsJSObject(map))
return false;
3034 if (!IsJSFunction(maybe_constructor))
return false;
3036 if (js_object->elements()->length() != 0)
return false;
3038 if (!IsUndefined(js_object->GetIdentityHash()))
return false;
3041 return constructor->initial_map() ==
map;
3048 DCHECK(old_map->is_prototype_map());
3049 DCHECK(new_map->is_prototype_map());
3051 new_map->set_prototype_info(old_map->prototype_info(),
kReleaseStore);
3053 if (
v8_flags.trace_prototype_users) {
3054 PrintF(
"Moving prototype_info %p from map %p to map %p.\n",
3055 reinterpret_cast<void*
>(new_map->prototype_info().ptr()),
3056 reinterpret_cast<void*
>(old_map->ptr()),
3057 reinterpret_cast<void*
>(new_map->ptr()));
3059 if (was_registered) {
3060 if (new_map->has_prototype_info()) {
3073 if (!old_map->is_prototype_map())
return;
3106 if (new_map->GetBackPointer(isolate) == *old_map) {
3108 if (old_map->NumberOfOwnDescriptors() ==
3109 new_map->NumberOfOwnDescriptors()) {
3115 PropertyDetails details = new_map->GetLastDescriptorDetails(isolate);
3125 if (index.is_inobject() || index.outobject_array_index() <
3126 object->property_array(isolate)->length()) {
3128 if (index.is_double()) {
3129 auto value = isolate->factory()->NewHeapNumberWithHoleNaN();
3130 object->FastPropertyAtPut(index, *value);
3138 int grow_by = new_map->UnusedPropertyFields() + 1;
3139 DirectHandle<PropertyArray> old_storage(object->property_array(isolate),
3141 DirectHandle<PropertyArray> new_storage =
3142 isolate->factory()->CopyPropertyArrayAndGrow(old_storage, grow_by);
3145 DirectHandle<Object>
value;
3146 if (details.representation().IsDouble()) {
3147 value = isolate->factory()->NewHeapNumberWithHoleNaN();
3149 value = isolate->factory()->uninitialized_value();
3153 DCHECK(!index.is_inobject());
3154 new_storage->set(index.outobject_array_index(), *value);
3160 object->SetProperties(*new_storage);
3165 int old_number_of_fields;
3167 int inobject = new_map->GetInObjectProperties();
3168 int unused = new_map->UnusedPropertyFields();
3172 if (!old_map->InstancesNeedRewriting(*new_map, number_of_fields, inobject,
3173 unused, &old_number_of_fields,
3179 int total_size = number_of_fields + unused;
3180 int external = total_size - inobject;
3181 DirectHandle<PropertyArray> array =
3182 isolate->factory()->NewPropertyArray(external);
3185 DirectHandle<FixedArray> inobject_props =
3186 isolate->factory()->NewFixedArray(inobject);
3188 DirectHandle<DescriptorArray> old_descriptors(
3189 old_map->instance_descriptors(isolate), isolate);
3190 DirectHandle<DescriptorArray> new_descriptors(
3191 new_map->instance_descriptors(isolate), isolate);
3192 int old_nof = old_map->NumberOfOwnDescriptors();
3193 int new_nof = new_map->NumberOfOwnDescriptors();
3197 DCHECK(old_nof <= new_nof);
3199 for (InternalIndex
i : InternalIndex::Range(old_nof)) {
3200 PropertyDetails details = new_descriptors->GetDetails(
i);
3203 PropertyDetails old_details = old_descriptors->GetDetails(
i);
3204 Representation old_representation = old_details.representation();
3205 Representation representation = details.representation();
3211 DCHECK(!details.representation().IsNone());
3212 if (details.representation().IsDouble()) {
3213 value = isolate->factory()->NewHeapNumberWithHoleNaN();
3215 value = isolate->factory()->uninitialized_value();
3221 DCHECK(!old_representation.IsDouble() && !representation.IsDouble());
3226 value =
handle(object->RawFastPropertyAt(isolate, index), isolate);
3227 if (!old_representation.IsDouble() && representation.IsDouble()) {
3229 IsUninitialized(*value, isolate));
3231 }
else if (old_representation.IsDouble() && !representation.IsDouble()) {
3233 old_representation);
3236 DCHECK(!(representation.IsDouble() &&
IsSmi(*value)));
3237 int target_index = new_descriptors->GetFieldIndex(
i);
3238 if (target_index < inobject) {
3239 inobject_props->set(target_index, *value);
3241 array->set(target_index - inobject, *value);
3245 for (InternalIndex
i : InternalIndex::Range(old_nof, new_nof)) {
3246 PropertyDetails details = new_descriptors->GetDetails(
i);
3249 DirectHandle<Object>
value;
3250 if (details.representation().IsDouble()) {
3251 value = isolate->factory()->NewHeapNumberWithHoleNaN();
3253 value = isolate->factory()->uninitialized_value();
3255 int target_index = new_descriptors->GetFieldIndex(
i);
3256 if (target_index < inobject) {
3257 inobject_props->set(target_index, *value);
3259 array->set(target_index - inobject, *value);
3266 Heap*
heap = isolate->heap();
3270 int limit = std::min(inobject, number_of_fields);
3271 for (
int i = 0;
i < limit;
i++) {
3274 object->FastPropertyAtPut(index, value);
3277 object->SetProperties(*array);
3280 int old_instance_size = old_map->instance_size();
3281 int new_instance_size = new_map->instance_size();
3282 int instance_size_delta = old_instance_size - new_instance_size;
3285 if (instance_size_delta > 0) {
3286 heap->NotifyObjectSizeChange(*
object, old_instance_size, new_instance_size,
3295void MigrateFastToSlow(Isolate* isolate, DirectHandle<JSObject>
object,
3296 DirectHandle<Map> new_map,
3297 int expected_additional_properties) {
3299 DCHECK(!IsJSGlobalObject(*
object, isolate));
3301 DCHECK(!IsJSGlobalProxy(*
object, isolate));
3306 HandleScope scope(isolate);
3307 DirectHandle<Map>
map(object->map(isolate), isolate);
3310 int real_size = map->NumberOfOwnDescriptors();
3311 int property_count = real_size;
3312 if (expected_additional_properties > 0) {
3313 property_count += expected_additional_properties;
3317 property_count += initial_capacity;
3320 DirectHandle<NameDictionary> dictionary;
3321 DirectHandle<SwissNameDictionary> ord_dictionary;
3323 ord_dictionary = isolate->factory()->NewSwissNameDictionary(property_count);
3325 dictionary = isolate->factory()->NewNameDictionary(property_count);
3328 DirectHandle<DescriptorArray> descs(map->instance_descriptors(isolate),
3330 for (InternalIndex
i : InternalIndex::Range(real_size)) {
3331 PropertyDetails details = descs->GetDetails(
i);
3332 DirectHandle<Name>
key(descs->GetKey(isolate,
i), isolate);
3333 DirectHandle<Object>
value;
3338 direct_handle(object->RawFastPropertyAt(isolate, index), isolate);
3339 if (details.representation().IsDouble()) {
3340 DCHECK(IsHeapNumber(*value, isolate));
3342 value = isolate->factory()->NewHeapNumber(old_value);
3347 direct_handle(object->RawFastPropertyAt(isolate, index), isolate);
3352 value =
direct_handle(descs->GetStrongValue(isolate,
i), isolate);
3354 DCHECK(!value.is_null());
3356 ? details.constness()
3358 PropertyDetails d(details.kind(), details.attributes(), constness);
3364 dictionary = NameDictionary::Add(isolate, dictionary,
key, value, d);
3370 dictionary->set_next_enumeration_index(real_size + 1);
3372 dictionary->set_may_have_interesting_properties(
3373 map->may_have_interesting_properties());
3379 Heap*
heap = isolate->heap();
3382 int old_instance_size = map->instance_size();
3383 int new_instance_size = new_map->instance_size();
3384 int instance_size_delta = old_instance_size - new_instance_size;
3387 if (instance_size_delta > 0) {
3388 heap->NotifyObjectSizeChange(*
object, old_instance_size, new_instance_size,
3397 object->SetProperties(*ord_dictionary);
3399 object->SetProperties(*dictionary);
3404 int inobject_properties = new_map->GetInObjectProperties();
3405 if (inobject_properties) {
3406 for (
int i = 0;
i < inobject_properties;
i++) {
3408 object->FastPropertyAtPut(index,
Smi::zero());
3413 if (
v8_flags.trace_normalization) {
3415 os <<
"Object properties have been normalized:\n";
3425 int expected_additional_properties) {
3426 if (object->map(isolate) == *new_map)
return;
3430 if (old_map->is_dictionary_map()) {
3433 CHECK(new_map->is_dictionary_map());
3437 }
else if (!new_map->is_dictionary_map()) {
3438 MigrateFastToFast(isolate,
object, new_map);
3439 if (old_map->is_prototype_map()) {
3440 DCHECK(!old_map->is_stable());
3441 DCHECK(new_map->is_stable());
3442 DCHECK(new_map->owns_descriptors());
3443 DCHECK(old_map->owns_descriptors());
3447 old_map->set_owns_descriptors(
false);
3448 DCHECK(old_map->is_abandoned_prototype_map());
3452 DCHECK(IsUndefined(new_map->GetBackPointer(isolate), isolate));
3453 DCHECK(object->map(isolate) != *old_map);
3456 MigrateFastToSlow(isolate,
object, new_map, expected_additional_properties);
3481 return SetPropertyWithInterceptorInternal(it, it->GetInterceptor(),
3482 should_throw, value);
3493 DCHECK(object->map()->GetInObjectProperties() ==
3494 map->GetInObjectProperties());
3495 ElementsKind obj_kind =
object->map()->elements_kind();
3497 Isolate* isolate =
object->GetIsolate();
3498 if (map_kind != obj_kind) {
3511 int inobject = map->GetInObjectProperties();
3512 int unused = map->UnusedPropertyFields();
3513 int total_size = number_of_fields + unused;
3514 int external = total_size - inobject;
3522 isolate->factory()->NewFixedArray(inobject);
3525 isolate->factory()->NewPropertyArray(external);
3530 if (!representation.
IsDouble())
continue;
3532 auto box = isolate->factory()->NewHeapNumberWithHoleNaN();
3533 if (index.is_inobject()) {
3534 storage->set(index.property_index(), *box);
3536 array->set(index.outobject_array_index(), *box);
3540 object->SetProperties(*array);
3541 for (
int i = 0;
i < inobject;
i++) {
3544 object->FastPropertyAtPut(index, value);
3553 map->set_is_migration_target(
true);
3556 object->PrintInstanceMigration(stdout, *original_map, *map);
3560 object->JSObjectVerify(isolate);
3568 DisallowDeoptimization no_deoptimization(isolate);
3575 if (
v8_flags.trace_migration && *original_map != object->map()) {
3576 object->PrintInstanceMigration(stdout, *original_map, object->map());
3580 object->JSObjectVerify(isolate);
3595 if (map.is_null())
return false;
3596 DCHECK(!map->is_dictionary_map());
3599 if (map->is_deprecated()) {
3601 if (new_map->is_dictionary_map())
return false;
3604 InternalIndex descriptor = new_map->LastAdded();
3610 object->WriteToField(descriptor,
3611 new_map->instance_descriptors()->GetDetails(descriptor),
3621 name = isolate->factory()->InternalizeName(name);
3622 if (TryFastAddDataProperty(isolate,
object, name, value, attributes)) {
3631 DCHECK(!IsJSProxy(*
object));
3633 DCHECK(!name->AsArrayIndex(&index));
3637 DCHECK(object->map()->is_extensible() || name->IsPrivate());
3649 isolate->factory()->InternalizeUtf8String(name), value,
3662 it->UpdateProtector();
3664 for (;; it->Next()) {
3665 switch (it->state()) {
3672 if (!it->HasAccess()) {
3676 isolate->ReportFailedAccessCheck(it->GetHolder<
JSObject>()),
3698 if (!DefinePropertyWithInterceptorInternal(it, it->GetInterceptor(),
3699 should_throw, &descriptor)
3729 it->isolate(), it, value, should_throw);
3742 &own_lookup, value, attributes, should_throw, handling, semantics,
3758 if (current_attributes != attributes) {
3759 it->TransitionToAccessorPair(accessors, attributes);
3765 it->ReconfigureDataProperty(value, attributes);
3770 it->isolate(), it->GetName(), value, should_throw);
3774 if (it->property_attributes() == attributes) {
3780 DCHECK(!it->IsElement() ||
3782 ->HasTypedArrayOrRabGsabTypedArrayElements());
3784 it->ReconfigureDataProperty(value, attributes);
3791 store_origin, semantics);
3800 DCHECK(!IsTheHole(*value));
3809 DCHECK(!IsJSTypedArray(*
object));
3810 Isolate* isolate =
object->GetIsolate();
3818 Isolate* isolate =
object->GetIsolate();
3826 return GetPropertyAttributesWithInterceptorInternal(it, it->GetInterceptor());
3832 int expected_additional_properties,
3833 bool use_cache,
const char* reason) {
3834 if (!object->HasFastProperties())
return;
3838 {}, mode, use_cache, reason);
3841 expected_additional_properties);
3845 int unused_property_fields,
3846 const char* reason) {
3847 if (object->HasFastProperties())
return;
3848 DCHECK(!IsJSGlobalObject(*
object));
3849 Isolate* isolate =
object->GetIsolate();
3850 Factory* factory = isolate->factory();
3854 int number_of_elements;
3857 direct_handle(object->property_dictionary_swiss(), isolate);
3858 number_of_elements = swiss_dictionary->NumberOfElements();
3860 dictionary =
direct_handle(object->property_dictionary(), isolate);
3861 number_of_elements = dictionary->NumberOfElements();
3869 int iteration_length;
3872 iteration_length = swiss_dictionary->UsedCapacity();
3874 iteration_order = NameDictionary::IterationIndices(isolate, dictionary);
3875 iteration_length = dictionary->NumberOfElements();
3878 int number_of_fields = 0;
3882 for (
int i = 0;
i < iteration_length;
i++) {
3891 kind = swiss_dictionary->DetailsAt(index).kind();
3894 DCHECK(dictionary->IsKey(roots, dictionary->KeyAt(isolate, index)));
3895 kind = dictionary->DetailsAt(index).kind();
3899 number_of_fields += 1;
3905 int inobject_props = old_map->GetInObjectProperties();
3911 new_map->set_may_have_interesting_properties(
3912 new_map->has_named_interceptor() || new_map->is_access_check_needed());
3913 new_map->set_is_dictionary_map(
false);
3917 if (number_of_elements == 0) {
3919 DCHECK_LE(unused_property_fields, inobject_props);
3921 new_map->SetInObjectUnusedPropertyFields(inobject_props);
3923 object->SetProperties(
ReadOnlyRoots(isolate).empty_fixed_array());
3925 DCHECK(object->HasFastProperties());
3927 LOG(isolate, MapEvent(
"SlowToFast", old_map, new_map, reason));
3936 int number_of_allocated_fields =
3937 number_of_fields + unused_property_fields - inobject_props;
3938 if (number_of_allocated_fields < 0) {
3940 number_of_allocated_fields = 0;
3941 unused_property_fields = inobject_props - number_of_fields;
3948 bool is_transitionable_elements_kind =
3952 int current_offset = 0;
3953 int descriptor_index = 0;
3954 for (
int i = 0;
i < iteration_length;
i++) {
3967 value = swiss_dictionary->ValueAt(index);
3968 details = swiss_dictionary->DetailsAt(index);
3971 k = dictionary->NameAt(index);
3973 value = dictionary->ValueAt(index);
3974 details = dictionary->DetailsAt(index);
3983 if (
key->IsInteresting(isolate)) {
3984 new_map->set_may_have_interesting_properties(
true);
4012 details = d.GetDetails();
4014 if (current_offset < inobject_props) {
4015 object->InObjectPropertyAtPut(current_offset, value,
4018 int offset = current_offset - inobject_props;
4019 fields->set(
offset, value);
4025 DCHECK_EQ(current_offset, number_of_fields);
4026 DCHECK_EQ(descriptor_index, number_of_elements);
4028 descriptors->Sort();
4031 new_map->InitializeDescriptors(isolate, *descriptors);
4032 if (number_of_allocated_fields == 0) {
4033 new_map->SetInObjectUnusedPropertyFields(unused_property_fields);
4035 new_map->SetOutOfObjectUnusedPropertyFields(unused_property_fields);
4039 LOG(isolate, MapEvent(
"SlowToFast", old_map, new_map, reason));
4044 object->SetProperties(*fields);
4045 DCHECK(IsJSObject(*
object));
4048 DCHECK(object->HasFastProperties());
4053 ReadOnlyRoots(GetIsolate()).empty_slow_element_dictionary());
4054 if (dictionary->requires_slow_elements())
return;
4055 dictionary->set_requires_slow_elements();
4065 DCHECK(!object->HasTypedArrayOrRabGsabTypedArrayElements());
4066 Isolate* isolate =
object->GetIsolate();
4067 bool is_sloppy_arguments =
object->HasSloppyArgumentsElements();
4072 if (is_sloppy_arguments) {
4076 if (IsNumberDictionary(
elements)) {
4081 DCHECK(object->HasSmiOrObjectElements() || object->HasDoubleElements() ||
4082 object->HasFastArgumentsElements() ||
4083 object->HasFastStringWrapperElements() ||
4084 object->HasSealedElements() || object->HasNonextensibleElements());
4087 object->GetElementsAccessor()->Normalize(
object);
4100 if (is_sloppy_arguments) {
4102 ->set_arguments(*dictionary);
4104 object->set_elements(*dictionary);
4108 if (
v8_flags.trace_normalization) {
4110 os <<
"Object elements have been normalized:\n";
4115 DCHECK(object->HasDictionaryElements() ||
4116 object->HasSlowArgumentsElements() ||
4117 object->HasSlowStringWrapperElements());
4130 if (!interceptor->has_deleter()) {
4142 *holder,
Just(should_throw));
4145 it->IsElement(*holder)
4146 ?
args.CallIndexedDeleter(interceptor, it->array_index())
4147 :
args.CallNamedDeleter(interceptor, it->name());
4149 return args.GetBooleanReturnValue(intercepted,
"Deleter");
4157 if (!
key.is_element()) {
4158 if (TryFastAddDataProperty(isolate,
object,
key.name(), value,
NONE)) {
4165 isolate, &it, value, should_throw);
4179template <
typename Dictionary>
4187 if (!dict->ToKey(roots,
i, &
key))
continue;
4199bool TestFastPropertiesIntegrityLevel(Tagged<Map> map,
4203 DCHECK(!map->is_dictionary_map());
4206 for (InternalIndex
i : map->IterateOwnDescriptors()) {
4207 if (descriptors->GetKey(
i)->IsPrivate())
continue;
4208 PropertyDetails details = descriptors->GetDetails(
i);
4209 if (details.IsConfigurable())
return false;
4211 !details.IsReadOnly()) {
4222 if (object->HasFastProperties()) {
4223 return TestFastPropertiesIntegrityLevel(object->map(), level);
4227 return TestDictionaryPropertiesIntegrityLevel(
4230 return TestDictionaryPropertiesIntegrityLevel(object->property_dictionary(),
4237 DCHECK(!object->HasSloppyArgumentsElements());
4242 return TestDictionaryPropertiesIntegrityLevel(
4249 return TestPropertiesIntegrityLevel(
object, level);
4258 return accessor->NumberOfElements(isolate,
object) == 0;
4265 return !
object->map()->is_extensible() &&
4266 TestElementsIntegrityLevel(isolate,
object, level) &&
4267 TestPropertiesIntegrityLevel(
object, level);
4276 !object->HasSloppyArgumentsElements()) {
4277 return Just(FastTestIntegrityLevel(isolate, *
object, level));
4279 return GenericTestIntegrityLevel(isolate,
Cast<JSReceiver>(
object), level);
4285 if (!object->HasSloppyArgumentsElements()) {
4289 if (IsAccessCheckNeeded(*
object) &&
4290 !isolate->MayAccess(isolate->native_context(),
object)) {
4296 if (!object->map()->is_extensible())
return Just(
true);
4298 if (IsJSGlobalProxy(*
object)) {
4306 if (object->map()->has_named_interceptor() ||
4307 object->map()->has_indexed_interceptor()) {
4309 NewTypeError(MessageTemplate::kCannotPreventExt));
4312 DCHECK(!object->HasTypedArrayOrRabGsabTypedArrayElements());
4316 DCHECK(object->HasDictionaryElements() || object->HasSlowArgumentsElements());
4319 if (*dictionary !=
ReadOnlyRoots(isolate).empty_slow_element_dictionary()) {
4320 object->RequireSlowElements(*dictionary);
4327 isolate,
direct_handle(object->map(), isolate),
"PreventExtensions");
4329 new_map->set_is_extensible(
false);
4331 DCHECK(!object->map()->is_extensible());
4337 if (IsAccessCheckNeeded(*
object) &&
4338 !isolate->MayAccess(isolate->native_context(),
object)) {
4341 if (IsJSGlobalProxy(*
object)) {
4343 if (iter.
IsAtEnd())
return false;
4347 return object->map()->is_extensible();
4354 if (IsJSReceiver(*options)) {
4356 return JSObject::GetProperty(isolate, js_options, option_name);
4361template <
typename Dictionary>
4367 if (!dictionary->ToKey(roots,
i, &k))
continue;
4370 int attrs = attributes;
4374 if (IsAccessorPair(v)) attrs &= ~READ_ONLY;
4377 dictionary->DetailsAtPut(
i, details);
4389 if (!object->HasTypedArrayOrRabGsabTypedArrayElements() &&
4390 !object->HasDictionaryElements() &&
4391 !object->HasSlowStringWrapperElements()) {
4392 int length = IsJSArray(*
object)
4394 :
object->elements()->length();
4395 new_element_dictionary =
4396 length == 0 ? isolate->factory()->empty_slow_element_dictionary()
4397 :
object->GetElementsAccessor()->Normalize(
object);
4399 return new_element_dictionary;
4402template <PropertyAttributes attrs>
4409 DCHECK(!object->HasSloppyArgumentsElements());
4412 if (IsAccessCheckNeeded(*
object) &&
4413 !isolate->MayAccess(isolate->native_context(),
object)) {
4419 if (attrs ==
NONE && !object->map()->is_extensible()) {
4424 ElementsKind old_elements_kind =
object->map()->elements_kind();
4431 if (IsJSGlobalProxy(*
object)) {
4443 if (IsAlwaysSharedSpaceJSObject(*
object)) {
4444 DCHECK(FastTestIntegrityLevel(isolate, *
object,
SEALED));
4447 NewTypeError(MessageTemplate::kCannotFreeze));
4450 if (object->map()->has_named_interceptor() ||
4451 object->map()->has_indexed_interceptor() ||
4452 (object->HasTypedArrayOrRabGsabTypedArrayElements() &&
4457 message = MessageTemplate::kCannotPreventExt;
4461 message = MessageTemplate::kCannotSeal;
4465 message = MessageTemplate::kCannotFreeze;
4472 if (attrs ==
NONE) {
4473 transition_marker = isolate->factory()->nonextensible_symbol();
4474 }
else if (attrs ==
SEALED) {
4475 transition_marker = isolate->factory()->sealed_symbol();
4478 transition_marker = isolate->factory()->frozen_symbol();
4486 switch (object->map()->elements_kind()) {
4508 if (maybe_transition_map.
ToHandle(&transition_map)) {
4509 DCHECK(transition_map->has_dictionary_elements() ||
4510 transition_map->has_typed_array_or_rab_gsab_typed_array_elements() ||
4512 transition_map->has_any_nonextensible_elements());
4513 DCHECK(!transition_map->is_extensible());
4514 if (!transition_map->has_any_nonextensible_elements()) {
4521 isolate, old_map, attrs, transition_marker,
"CopyForPreventExtensions");
4522 if (!new_map->has_any_nonextensible_elements()) {
4527 DCHECK(old_map->is_dictionary_map() || !old_map->is_prototype_map());
4530 "SlowPreventExtensions");
4536 "SlowCopyForPreventExtensions");
4537 new_map->set_is_extensible(
false);
4539 if (!new_element_dictionary.
is_null()) {
4544 new_map->set_elements_kind(new_kind);
4548 if (attrs !=
NONE) {
4550 if (IsJSGlobalObject(*
object)) {
4558 object->property_dictionary_swiss(), isolate);
4570 if (object->map()->has_any_nonextensible_elements()) {
4580 if (object->HasTypedArrayOrRabGsabTypedArrayElements()) {
4583 isolate->Throw(*isolate->factory()->NewTypeError(
4584 attrs ==
SEALED ? MessageTemplate::kCannotSealArrayBufferView
4585 : MessageTemplate::kCannotFreezeArrayBufferView));
4591 DCHECK(object->map()->has_dictionary_elements() ||
4593 if (!new_element_dictionary.
is_null()) {
4594 object->set_elements(*new_element_dictionary);
4597 if (object->elements() !=
4602 object->RequireSlowElements(*dictionary);
4603 if (attrs !=
NONE) {
4616 Handle<JSAny> raw_value(object->RawFastPropertyAt(index), isolate);
4625 Handle<JSAny> raw_value(object->RawFastPropertyAt(index, tag), isolate);
4636 return handle(dict->ValueAt(dict_index), isolate);
4639 return handle(dict->ValueAt(dict_index), isolate);
4650 if (!IsPropertyDictionary(backing_store))
return {};
4651 std::optional<Tagged<Object>> maybe_obj =
4654 if (!maybe_obj)
return {};
4655 return maybe_obj.value();
4662 switch (object->GetElementsKind()) {
4670 int length = IsJSArray(
object)
4672 :
object->elements()->length();
4681 int length = IsJSArray(
object)
4684 Isolate* isolate = GetIsolate();
4686 if (!
elements->is_the_hole(isolate,
i))
return true;
4691 int length = IsJSArray(
object)
4693 :
object->elements()->length();
4695 if (length == 0)
return false;
4700 if (!
elements->is_the_hole(
i))
return true;
4704#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype) case TYPE##_ELEMENTS:
4712#undef TYPED_ARRAY_CASE
4720 return elements->NumberOfEnumerableProperties() > 0;
4732 return object->elements()->length() > 0;
4746 Isolate* isolate =
object->GetIsolate();
4758 it->UpdateProtector();
4761 if (!it->HasAccess()) {
4763 isolate, isolate->ReportFailedAccessCheck(it->GetHolder<
JSObject>()));
4771 if (it->IsElement() && object->HasTypedArrayOrRabGsabTypedArrayElements()) {
4772 return it->factory()->undefined_value();
4779 it->TransitionToAccessorProperty(
getter,
setter, attributes);
4781 return isolate->factory()->undefined_value();
4788 Isolate* isolate =
object->GetIsolate();
4796 if (!it.HasAccess()) {
4804 if (it.IsElement() && object->HasTypedArrayOrRabGsabTypedArrayElements()) {
4805 return it.factory()->undefined_value();
4811 if (!can_define.
FromJust())
return it.factory()->undefined_value();
4813 it.TransitionToAccessorPair(info, attributes);
4822 DCHECK(IsJSObject(*it->GetReceiver()));
4823 if (it->IsFound()) {
4830 NewTypeError(MessageTemplate::kRedefineDisallowed, it->GetName()));
4839 NewTypeError(MessageTemplate::kDefineDisallowed, it->GetName()));
4845 if (HasFastProperties()) {
4847 bool value_is_number =
IsNumber(value);
4855 DCHECK(IsHeapNumber(property));
4858 return descs->GetKey(
i);
4860 }
else if (property == value) {
4861 return descs->GetKey(
i);
4866 if (descs->GetStrongValue(
i) == value) {
4867 return descs->GetKey(
i);
4873 }
else if (IsJSGlobalObject(*
this)) {
4876 ->SlowReverseLookup(value);
4878 return property_dictionary_swiss()->SlowReverseLookup(GetIsolate(), value);
4880 return property_dictionary()->SlowReverseLookup(value);
4889 DCHECK(IsPrototypeInfo(map->prototype_info()));
4891 DCHECK_EQ(old_index, proto_info->registry_slot());
4892 proto_info->set_registry_slot(new_index);
4899 if (!IsJSReceiver(*
receiver))
return;
4902 !iter.
IsAtEnd(); iter.Advance()) {
4907 if (current_map->is_prototype_map()) {
4910 if (current_map->should_be_fast_prototype_map())
return;
4920 if (!object->HasFastProperties())
return false;
4921 if (IsJSGlobalProxy(
object))
return false;
4923 if (object->GetIsolate()->bootstrapper()->IsActive())
return false;
4925 return !
object->map()->is_prototype_map() ||
4926 !
object->map()->should_be_fast_prototype_map();
4931 bool enable_setup_mode) {
4933 if (IsJSGlobalObject(*
object))
return;
4934 Isolate* isolate =
object->GetIsolate();
4935 if (object->map()->is_prototype_map()) {
4938 DCHECK(!object->map()->should_be_fast_prototype_map());
4940 constexpr bool kUseCache =
true;
4942 0, kUseCache,
"NormalizeAsPrototype");
4945 object->map()->should_be_fast_prototype_map() &&
4946 !object->HasFastProperties()) {
4958 constexpr bool kUseCache =
false;
4961 "NormalizeAndCopyAsPrototype");
4963 DCHECK_NE(*old_map, object->map(isolate));
4970 new_map->set_is_prototype_map(
true);
4977 if (IsTuple2(maybe_constructor)) {
4981 maybe_constructor = tuple->value1();
4983 if (IsJSFunction(maybe_constructor)) {
4985 if (!constructor->shared()->IsApiFunction()) {
4989 tuple->set_value1(object_function);
4991 new_map->SetConstructor(object_function);
5001 auto make_constant = [&](
auto dict) {
5004 if (!dict->ToKey(roots, index, &k))
continue;
5008 dict->DetailsAtPut(index, details);
5012 make_constant(object->property_dictionary_swiss());
5014 make_constant(object->property_dictionary());
5020 enable_setup_mode && !IsJSGlobalProxy(*
object) &&
5023 object->map(isolate)->is_dictionary_map());
5031 if (!map->is_prototype_map())
return;
5032 if (!map->should_be_fast_prototype_map())
return;
5042 DCHECK(user->is_prototype_map());
5066 Handle<Object> maybe_registry(proto_info->prototype_users(), isolate);
5068 IsSmi(*maybe_registry)
5075 current_user_info->set_registry_slot(slot);
5077 proto_info->set_prototype_users(*new_array);
5079 if (
v8_flags.trace_prototype_users) {
5080 PrintF(
"Registering %p as a user of prototype %p (map=%p).\n",
5081 reinterpret_cast<void*
>(current_user->ptr()),
5082 reinterpret_cast<void*
>(proto->ptr()),
5083 reinterpret_cast<void*
>(proto->map().ptr()));
5087 current_user_info = proto_info;
5096 DCHECK(user->is_prototype_map());
5098 if (!user->has_prototype_info())
return false;
5099 DCHECK(IsPrototypeInfo(user->prototype_info()));
5102 if (!IsJSObject(user->prototype())) {
5105 return IsWeakArrayList(users);
5110 int slot = user_info->registry_slot();
5112 DCHECK(prototype->map()->is_prototype_map());
5113 Tagged<Object> maybe_proto_info = prototype->map()->prototype_info();
5115 DCHECK(IsPrototypeInfo(maybe_proto_info));
5122 if (
v8_flags.trace_prototype_users) {
5123 PrintF(
"Unregistering %p as a user of prototype %p.\n",
5124 reinterpret_cast<void*
>(user->ptr()),
5125 reinterpret_cast<void*
>(prototype->ptr()));
5135void InvalidateOnePrototypeValidityCellInternal(
Tagged<Map> map) {
5136 DCHECK(map->is_prototype_map());
5137 if (
v8_flags.trace_prototype_users) {
5138 PrintF(
"Invalidating prototype map %p 's cell\n",
5139 reinterpret_cast<void*
>(map.ptr()));
5142 if (IsCell(maybe_cell)) {
5146 if (cell->value() != invalid_value) {
5147 cell->set_value(invalid_value);
5151 if (map->TryGetPrototypeInfo(&prototype_info)) {
5152 prototype_info->set_prototype_chain_enum_cache(
Smi::zero());
5174void InvalidatePrototypeChainsInternal(Tagged<Map> map) {
5179 Tagged<Map> next_map;
5180 for (; !map.is_null(); map = next_map, next_map =
Map()) {
5181 InvalidateOnePrototypeValidityCellInternal(map);
5184 if (!map->TryGetPrototypeInfo(&proto_info))
return;
5185 if (!IsWeakArrayList(proto_info->prototype_users())) {
5194 if (prototype_users->Get(
i).GetHeapObjectIfWeak(&heap_object) &&
5195 IsMap(heap_object)) {
5198 if (next_map.is_null()) {
5201 InvalidatePrototypeChainsInternal(
Cast<Map>(heap_object));
5213 InvalidatePrototypeChainsInternal(map);
5227 InvalidateOnePrototypeValidityCellInternal(global->map());
5233 bool from_javascript,
5236 int size =
object->Size();
5239 if (from_javascript) {
5240 if (IsAccessCheckNeeded(*
object) &&
5241 !isolate->MayAccess(isolate->native_context(),
object)) {
5243 isolate, isolate->ReportFailedAccessCheck(
object),
Nothing<bool>());
5247 DCHECK(!IsAccessCheckNeeded(*
object));
5253 if (!
TryCast(value_obj, &value))
return Just(
true);
5255 bool all_extensible =
object->map()->is_extensible();
5257 if (from_javascript) {
5267 all_extensible = all_extensible && real_receiver->map()->is_extensible();
5273 if (map->prototype() == *value)
return Just(
true);
5275 bool immutable_proto = map->is_immutable_proto();
5276 if (immutable_proto) {
5278 if (IsJSObjectPrototype(*
object)) {
5279 msg = isolate->factory()->Object_prototype_string();
5284 NewTypeError(MessageTemplate::kImmutablePrototypeSet, msg));
5294 if (!all_extensible) {
5296 NewTypeError(MessageTemplate::kNonExtensibleProto,
object));
5304 !iter.
IsAtEnd(); iter.Advance()) {
5305 if (iter.GetCurrent<
JSReceiver>() == *
object) {
5308 NewTypeError(MessageTemplate::kCyclicProto));
5315 isolate->UpdateProtectorsOnSetPrototype(real_receiver, value);
5318 v8_flags.move_prototype_transitions_first
5322 DCHECK(new_map->prototype() == *value);
5325 DCHECK_IMPLIES(!new_map->is_dictionary_map() && !map->is_deprecated() &&
5326 !IsUndefined(new_map->GetBackPointer()),
5327 size == object->Size());
5337 if (map->is_immutable_proto())
return;
5352#ifdef ENABLE_SLOW_DCHECKS
5353 if (
v8_flags.enable_slow_asserts) {
5354 object->GetElementsAccessor()->Validate(
object);
5360 if (!HasFastElements())
return false;
5361 uint32_t capacity =
static_cast<uint32_t
>(
elements()->length());
5362 uint32_t new_capacity;
5369 uint32_t* new_capacity) {
5372 if (dictionary->requires_slow_elements())
return false;
5375 if (index >=
static_cast<uint32_t
>(
Smi::kMaxValue))
return false;
5377 if (IsJSArray(
object)) {
5379 if (!
IsSmi(length))
return false;
5380 *new_capacity =
static_cast<uint32_t
>(
Smi::ToInt(length));
5381 }
else if (IsJSArgumentsObject(
object)) {
5384 *new_capacity = dictionary->max_number_key() + 1;
5386 *new_capacity = std::max(index + 1, *new_capacity);
5388 uint32_t dictionary_size =
static_cast<uint32_t
>(dictionary->Capacity()) *
5389 NumberDictionary::kEntrySize;
5392 return 2 * dictionary_size >= *new_capacity;
5396 if (!object->map()->CanHaveFastTransitionableElementsKind()) {
5399 if (object->HasSloppyArgumentsElements()) {
5402 if (object->HasStringWrapperElements()) {
5405 DCHECK(object->HasDictionaryElements());
5413 if (!
IsSmi(value)) {
5426 Isolate* isolate =
object->GetIsolate();
5428 DCHECK(object->map(isolate)->is_extensible());
5430 uint32_t old_length = 0;
5431 uint32_t new_capacity = 0;
5433 if (IsJSArray(*
object, isolate)) {
5447 if (attributes !=
NONE) {
5448 kind = dictionary_kind;
5449 }
else if (IsNumberDictionary(
elements, isolate)) {
5455 *
object,
static_cast<uint32_t
>(
elements->length()), index,
5457 kind = dictionary_kind;
5462 index > old_length) {
5468 MAYBE_RETURN(accessor->
Add(
object, index, value, attributes, new_capacity),
5471 if (IsJSArray(*
object, isolate) && index >= old_length) {
5473 isolate->factory()->NewNumberFromUint(index + 1);
5479template <AllocationSiteUpdateMode update_or_check>
5482 if (!IsJSArray(*
object))
return false;
5486 if (Heap::IsLargeObject(*
object))
return false;
5496 if (memento.
is_null())
return false;
5506JSObject::UpdateAllocationSite<AllocationSiteUpdateMode::kCheckOnly>(
5509template bool JSObject::UpdateAllocationSite<AllocationSiteUpdateMode::kUpdate>(
5520 if (from_kind == to_kind)
return;
5529 Isolate* isolate =
object->GetIsolate();
5530 if (object->elements() ==
ReadOnlyRoots(isolate).empty_fixed_array() ||
5536 if (
v8_flags.trace_elements_transitions) {
5543 uint32_t c =
static_cast<uint32_t
>(
object->elements()->
length());
5545 ->GrowCapacityAndConvert(
object, c)
5551 "Fatal JavaScript invalid size error when transitioning elements "
5558template <
typename BackingStore>
5561 Isolate* isolate =
object->GetIsolate();
5565 for (
int i = 0;
i < limit; ++
i) {
5566 if (!store->is_the_hole(isolate,
i)) ++used;
5573 switch (GetElementsKind()) {
5602#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype) case TYPE##_ELEMENTS:
5606#undef TYPED_ARRAY_CASE
5615 return GetPropertyWithInterceptorInternal(it, it->GetInterceptor(), done);
5623 return HasProperty(&it);
5631 return HasProperty(&it);
5658 Isolate* isolate = global->GetIsolate();
5662 DCHECK(!global->HasFastProperties());
5682 constructor->GetIsolate(),
result,
5694 if (
v8_flags.log_timer_events)
LOG(isolate, CurrentTimeEvent());
5695 if (
v8_flags.correctness_fuzzer_suppressions)
return 4;
5710 DisallowJavascriptExecution no_js(isolate);
5715 ->DoGetField(isolate,
static_cast<FieldIndex>(index.value()))
5720 DateCache* date_cache = isolate->date_cache();
5724 if (stamp != date_cache->
stamp() &&
IsSmi(stamp)) {
5726 int64_t local_time_ms =
5754 double time =
value();
5757 int64_t local_time_ms = date_cache->
ToLocal(
static_cast<int64_t
>(time));
5774 int64_t time_ms =
static_cast<int64_t
>(
value);
5785 int year, month, day;
5796 return Smi::FromInt(time_in_day_ms / (60 * 60 * 1000));
5798 return Smi::FromInt((time_in_day_ms / (60 * 1000)) % 60);
5817 DCHECK(!std::isnan(value));
5818 double clipped_value =
value;
5826 set_value(std::numeric_limits<double>::quiet_NaN());
5842 int year, month, day;
5845 int hour = time_in_day_ms / (60 * 60 * 1000);
5846 int min = (time_in_day_ms / (60 * 1000)) % 60;
5847 int sec = (time_in_day_ms / 1000) % 60;
5848 set_cache_stamp(date_cache->
stamp());
5861 DCHECK(!message->DidEnsureSourcePositionsAvailable());
5867 DCHECK(IsSharedFunctionInfo(message->shared_info()));
5875 DCHECK(shared_info->HasBytecodeArray());
5876 int position = shared_info->abstract_code(isolate)->SourcePosition(
5877 isolate, message->bytecode_offset().value());
5879 message->set_start_position(
position);
5880 message->set_end_position(
position + 1);
5892 if (!
script()->GetPositionInfo(start_position(), &info)) {
5895 return info.
line + 1;
5901 if (start_position() == -1)
return -1;
5906 if (!
script()->GetPositionInfo(start_position(), &info)) {
5915 if (script_object->HasValidSource()) {
5923 Isolate* isolate = GetIsolate();
5925#if V8_ENABLE_WEBASSEMBLY
5926 if (
script()->
type() == Script::Type::kWasm) {
5927 return isolate->factory()->empty_string();
5935 if (!
script()->GetPositionInfo(start_position(), &info)) {
5936 return isolate->factory()->empty_string();
5941 return isolate->factory()->NewSubString(src, info.line_start, info.line_end);
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype)
V8_INLINE bool IsJust() const
V8_INLINE T FromJust() const &
V8_INLINE bool IsNothing() const
static const int kNoLineNumberInfo
static V8_INLINE bool ApiCheck(bool condition, const char *location, const char *message)
static constexpr bool is_valid(T value)
static Handle< JSAny > GetComponent(Isolate *isolate, DirectHandle< NativeContext > native_context, DirectHandle< AccessorPair > accessor_pair, AccessorComponent component)
static bool DigestTransitionFeedback(DirectHandle< AllocationSite > site, ElementsKind to_kind)
static V8_WARN_UNUSED_RESULT Maybe< bool > DefineOwnProperty(Isolate *isolate, DirectHandle< AlwaysSharedSpaceJSObject > shared_obj, DirectHandle< Object > key, PropertyDescriptor *desc, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT MaybeHandle< JSFunction > InstantiateFunction(Isolate *isolate, DirectHandle< NativeContext > native_context, DirectHandle< FunctionTemplateInfo > data, MaybeDirectHandle< Name > maybe_name={})
static int TimeInDay(int64_t time_ms, int days)
void YearMonthDayFromDays(int days, int *year, int *month, int *day)
static const int kInvalidStamp
int64_t ToLocal(int64_t time_ms)
static bool TryTimeClip(double *time)
static int DaysFromTime(int64_t time_ms)
int TimezoneOffset(int64_t time_ms)
static void DeoptimizeDependencyGroups(Isolate *isolate, ObjectT object, DependencyGroups groups)
static V8_EXPORT_PRIVATE Handle< DescriptorArray > Allocate(IsolateT *isolate, int nof_descriptors, int slack, AllocationType allocation=AllocationType::kYoung)
static Descriptor DataField(Isolate *isolate, DirectHandle< Name > key, int field_index, PropertyAttributes attributes, Representation representation)
static Descriptor AccessorConstant(DirectHandle< Name > key, DirectHandle< Object > foreign, PropertyAttributes attributes)
V8_INLINE bool is_null() const
V8_INLINE void SetValue(Tagged< T > new_value)
static ElementsAccessor * ForKind(ElementsKind elements_kind)
virtual V8_WARN_UNUSED_RESULT Maybe< bool > Add(DirectHandle< JSObject > object, uint32_t index, DirectHandle< Object > value, PropertyAttributes attributes, uint32_t new_capacity)=0
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeHandle< Object > Call(Isolate *isolate, DirectHandle< Object > callable, DirectHandle< Object > receiver, base::Vector< const DirectHandle< Object > > args)
Isolate * isolate() const
DirectHandle< PropertyArray > NewPropertyArray(int length, AllocationType allocation=AllocationType::kYoung)
static FieldIndex ForPropertyIndex(Tagged< Map > map, int index, Representation representation=Representation::Tagged())
static FieldIndex ForDetails(Tagged< Map > map, PropertyDetails details)
static V8_EXPORT_PRIVATE Tagged< FieldType > Any()
static constexpr int kMaxLength
static HandleType< FixedArray > RightTrimOrEmpty(Isolate *isolate, HandleType< FixedArray > array, int new_length)
V8_INLINE bool is_identical_to(const HandleBase &that) const
static V8_INLINE bool InYoungGeneration(Tagged< Object > object)
static Tagged< Object > SeqCst_CompareAndSwapField(Tagged< Object > expected_value, Tagged< Object > new_value, CompareAndSwapImpl compare_and_swap_impl)
bool is_not_found() const
Bootstrapper * bootstrapper()
static constexpr int kHeaderSize
static V8_WARN_UNUSED_RESULT Maybe< bool > DefineOwnProperty(Isolate *isolate, DirectHandle< JSArray > o, DirectHandle< Object > name, PropertyDescriptor *desc, Maybe< ShouldThrow > should_throw)
static int64_t CurrentTimeValue(Isolate *isolate)
static Address GetField(Isolate *isolate, Address raw_date, Address smi_index)
Tagged< Object > GetUTCField(FieldIndex index, double value, DateCache *date_cache)
Tagged< Object > DoGetField(Isolate *isolate, FieldIndex index)
void SetCachedFields(int64_t local_time_ms, DateCache *date_cache)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSDate > New(DirectHandle< JSFunction > constructor, DirectHandle< JSReceiver > new_target, double tv)
static V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT MaybeHandle< Map > GetDerivedMap(Isolate *isolate, DirectHandle< JSFunction > constructor, DirectHandle< JSReceiver > new_target)
static int GetHeaderSize(bool function_has_prototype_slot)
static void InvalidatePropertyCell(DirectHandle< JSGlobalObject > object, DirectHandle< Name > name)
V8_EXPORT_PRIVATE bool IsDetached()
bool DidEnsureSourcePositionsAvailable() const
MessageTemplate type() const
DirectHandle< String > GetSourceLine() const
V8_EXPORT_PRIVATE Tagged< String > GetSource() const
V8_EXPORT_PRIVATE int GetLineNumber() const
static void V8_PRESERVE_MOST V8_EXPORT_PRIVATE InitializeSourcePositions(Isolate *isolate, DirectHandle< JSMessageObject > message)
V8_EXPORT_PRIVATE int GetColumnNumber() const
static V8_WARN_UNUSED_RESULT Maybe< bool > DefineOwnProperty(Isolate *isolate, DirectHandle< JSModuleNamespace > o, DirectHandle< Object > key, PropertyDescriptor *desc, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT Maybe< PropertyAttributes > GetPropertyAttributes(LookupIterator *it)
static bool UnregisterPrototypeUser(DirectHandle< Map > user, Isolate *isolate)
static V8_EXPORT_PRIVATE DirectHandle< NumberDictionary > NormalizeElements(DirectHandle< JSObject > object)
static bool IsExtensible(Isolate *isolate, DirectHandle< JSObject > object)
Tagged< Object > RawFastPropertyAtCompareAndSwapInternal(FieldIndex index, Tagged< Object > expected, Tagged< Object > value, SeqCstAccessTag tag)
static V8_WARN_UNUSED_RESULT Maybe< bool > PreventExtensionsWithTransition(Isolate *isolate, DirectHandle< JSObject > object, ShouldThrow should_throw)
static V8_WARN_UNUSED_RESULT MaybeHandle< JSAny > GetPropertyWithInterceptor(LookupIterator *it, bool *done)
static void InvalidatePrototypeValidityCell(Tagged< JSGlobalObject > global)
static V8_WARN_UNUSED_RESULT HandleType< Object >::MaybeType DefineOwnPropertyIgnoreAttributes(LookupIterator *it, HandleType< T > value, PropertyAttributes attributes, AccessorInfoHandling handling=DONT_FORCE_FIELD, EnforceDefineSemantics semantics=EnforceDefineSemantics::kSet)
void RequireSlowElements(Tagged< NumberDictionary > dictionary)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > DefinePropertyOrElementIgnoreAttributes(DirectHandle< JSObject > object, DirectHandle< Name > name, DirectHandle< Object > value, PropertyAttributes attributes=NONE)
static void SetNormalizedElement(DirectHandle< JSObject > object, uint32_t index, DirectHandle< Object > value, PropertyDetails details)
static V8_EXPORT_PRIVATE void AddProperty(Isolate *isolate, DirectHandle< JSObject > object, DirectHandle< Name > name, DirectHandle< Object > value, PropertyAttributes attributes)
static V8_EXPORT_PRIVATE void MigrateSlowToFast(DirectHandle< JSObject > object, int unused_property_fields, const char *reason)
static void OptimizeAsPrototype(DirectHandle< JSObject > object, bool enable_setup_mode=true)
static V8_WARN_UNUSED_RESULT Maybe< InterceptorResult > SetPropertyWithInterceptor(LookupIterator *it, Maybe< ShouldThrow > should_throw, DirectHandle< Object > value)
static Handle< JSAny > FastPropertyAt(Isolate *isolate, DirectHandle< JSObject > object, Representation representation, FieldIndex index)
static void ApplyAttributesToDictionary(Isolate *isolate, ReadOnlyRoots roots, DirectHandle< Dictionary > dictionary, const PropertyAttributes attributes)
void JSObjectShortPrint(StringStream *accumulator)
static MaybeDirectHandle< JSObject > NewWithMap(Isolate *isolate, DirectHandle< Map > initial_map, DirectHandle< AllocationSite > site, NewJSObjectType=NewJSObjectType::kNoAPIWrapper)
Tagged< JSAny > RawFastPropertyAt(FieldIndex index) const
static void LazyRegisterPrototypeUser(DirectHandle< Map > user, Isolate *isolate)
static void ValidateElements(Tagged< JSObject > object)
static V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT MaybeHandle< JSObject > New(DirectHandle< JSFunction > constructor, DirectHandle< JSReceiver > new_target, DirectHandle< AllocationSite > site, NewJSObjectType=NewJSObjectType::kNoAPIWrapper)
static V8_WARN_UNUSED_RESULT Maybe< PropertyAttributes > GetPropertyAttributesWithInterceptor(LookupIterator *it)
static void ForceSetPrototype(Isolate *isolate, DirectHandle< JSObject > object, DirectHandle< JSPrototype > proto)
static Handle< Object > DictionaryPropertyAt(Isolate *isolate, DirectHandle< JSObject > object, InternalIndex dict_index)
static V8_WARN_UNUSED_RESULT Maybe< bool > TestIntegrityLevel(Isolate *isolate, DirectHandle< JSObject > object, IntegrityLevel lvl)
static void EnsureCanContainElements(DirectHandle< JSObject > object, TSlot elements, uint32_t count, EnsureElementsMode mode)
static void UpdatePrototypeUserRegistration(DirectHandle< Map > old_map, DirectHandle< Map > new_map, Isolate *isolate)
static Tagged< Map > InvalidatePrototypeChains(Tagged< Map > map)
static V8_WARN_UNUSED_RESULT Maybe< bool > HasRealNamedCallbackProperty(Isolate *isolate, DirectHandle< JSObject > object, DirectHandle< Name > name)
static void SetImmutableProto(Isolate *isolate, DirectHandle< JSObject > object)
int GetFastElementsUsage()
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > V8_EXPORT_PRIVATE SetOwnPropertyIgnoreAttributes(DirectHandle< JSObject > object, DirectHandle< Name > name, DirectHandle< Object > value, PropertyAttributes attributes)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetPrototype(Isolate *isolate, DirectHandle< JSObject > object, DirectHandle< Object > value, bool from_javascript, ShouldThrow should_throw)
Tagged< FixedArrayBase > elements(PtrComprCageBase cage_base, AcquireLoadTag tag) const =delete
static V8_WARN_UNUSED_RESULT Maybe< bool > HasRealElementProperty(Isolate *isolate, DirectHandle< JSObject > object, uint32_t index)
static void SetNormalizedProperty(DirectHandle< JSObject > object, DirectHandle< Name > name, DirectHandle< Object > value, PropertyDetails details)
static void NotifyMapChange(DirectHandle< Map > old_map, DirectHandle< Map > new_map, Isolate *isolate)
static V8_EXPORT_PRIVATE void NormalizeProperties(Isolate *isolate, DirectHandle< JSObject > object, PropertyNormalizationMode mode, int expected_additional_properties, bool use_cache, const char *reason)
static V8_WARN_UNUSED_RESULT Maybe< bool > CheckIfCanDefineAsConfigurable(Isolate *isolate, LookupIterator *it, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static V8_EXPORT_PRIVATE Maybe< bool > AddDataElement(DirectHandle< JSObject > receiver, uint32_t index, DirectHandle< Object > value, PropertyAttributes attributes)
static void PrototypeRegistryCompactionCallback(Tagged< HeapObject > value, int old_index, int new_index)
Tagged< Object > RawFastPropertyAtCompareAndSwap(FieldIndex index, Tagged< Object > expected, Tagged< Object > value, SeqCstAccessTag tag)
bool HasEnumerableElements()
static void MakePrototypesFast(DirectHandle< Object > receiver, WhereToStart where_to_start, Isolate *isolate)
static V8_EXPORT_PRIVATE void TransitionElementsKind(DirectHandle< JSObject > object, ElementsKind to_kind)
static void PrintElementsTransition(FILE *file, DirectHandle< JSObject > object, ElementsKind from_kind, DirectHandle< FixedArrayBase > from_elements, ElementsKind to_kind, DirectHandle< FixedArrayBase > to_elements)
static V8_EXPORT_PRIVATE MaybeDirectHandle< Object > DefineOwnAccessorIgnoreAttributes(DirectHandle< JSObject > object, DirectHandle< Name > name, DirectHandle< Object > getter, DirectHandle< Object > setter, PropertyAttributes attributes)
static V8_EXPORT_PRIVATE void MigrateToMap(Isolate *isolate, DirectHandle< JSObject > object, DirectHandle< Map > new_map, int expected_additional_properties=0)
bool WouldConvertToSlowElements(uint32_t index)
static V8_WARN_UNUSED_RESULT MaybeHandle< JSAny > GetPropertyWithFailedAccessCheck(LookupIterator *it)
static bool IsUnmodifiedApiObject(FullObjectSlot o)
static DirectHandle< Map > GetElementsTransitionMap(DirectHandle< JSObject > object, ElementsKind to_kind)
Tagged< Object > SlowReverseLookup(Tagged< Object > value)
static V8_WARN_UNUSED_RESULT Maybe< InterceptorResult > DeletePropertyWithInterceptor(LookupIterator *it, ShouldThrow should_throw)
static MaybeDirectHandle< Object > ReadFromOptionsBag(DirectHandle< Object > options, DirectHandle< String > option_name, Isolate *isolate)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetPropertyWithFailedAccessCheck(LookupIterator *it, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static void MigrateInstance(Isolate *isolate, DirectHandle< JSObject > instance)
static bool UpdateAllocationSite(DirectHandle< JSObject > object, ElementsKind to_kind)
static bool TryMigrateInstance(Isolate *isolate, DirectHandle< JSObject > instance)
bool IsDroppableApiObject() const
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > SetAccessor(DirectHandle< JSObject > object, DirectHandle< Name > name, DirectHandle< AccessorInfo > info, PropertyAttributes attributes)
static void AllocateStorageForMap(DirectHandle< JSObject > object, DirectHandle< Map > map)
void PrintInstanceMigration(FILE *file, Tagged< Map > original_map, Tagged< Map > new_map)
static V8_WARN_UNUSED_RESULT Maybe< bool > HasRealNamedProperty(Isolate *isolate, DirectHandle< JSObject > object, DirectHandle< Name > name)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSObject > ObjectCreate(Isolate *isolate, DirectHandle< JSPrototype > prototype)
static V8_WARN_UNUSED_RESULT Maybe< bool > CreateDataProperty(Isolate *isolate, DirectHandle< JSObject > object, PropertyKey key, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw=Just(kDontThrow))
static V8_WARN_UNUSED_RESULT Maybe< bool > PreventExtensions(Isolate *isolate, DirectHandle< JSObject > object, ShouldThrow should_throw)
static void ReoptimizeIfPrototype(DirectHandle< JSObject > object)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > SetOwnElementIgnoreAttributes(DirectHandle< JSObject > object, size_t index, DirectHandle< Object > value, PropertyAttributes attributes)
static void EnsureWritableFastElements(DirectHandle< JSObject > object)
static V8_WARN_UNUSED_RESULT Maybe< PropertyAttributes > GetPropertyAttributesWithFailedAccessCheck(LookupIterator *it)
static V8_EXPORT_PRIVATE int GetHeaderSize(InstanceType instance_type, bool function_has_prototype_slot=false)
static V8_WARN_UNUSED_RESULT Maybe< bool > HasProperty(Isolate *isolate, DirectHandle< JSProxy > proxy, DirectHandle< Name > name)
static Maybe< bool > SetPrivateSymbol(Isolate *isolate, DirectHandle< JSProxy > proxy, DirectHandle< Symbol > private_name, PropertyDescriptor *desc, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT Maybe< bool > GetOwnPropertyDescriptor(Isolate *isolate, DirectHandle< JSProxy > proxy, DirectHandle< Name > name, PropertyDescriptor *desc)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetPrototype(Isolate *isolate, DirectHandle< JSProxy > proxy, DirectHandle< Object > value, bool from_javascript, ShouldThrow should_throw)
static V8_WARN_UNUSED_RESULT Maybe< bool > IsExtensible(DirectHandle< JSProxy > proxy)
static V8_WARN_UNUSED_RESULT Maybe< bool > DeletePropertyOrElement(DirectHandle< JSProxy > proxy, DirectHandle< Name > name, LanguageMode language_mode)
static V8_WARN_UNUSED_RESULT Maybe< bool > PreventExtensions(DirectHandle< JSProxy > proxy, ShouldThrow should_throw)
static V8_WARN_UNUSED_RESULT Maybe< PropertyAttributes > GetPropertyAttributes(LookupIterator *it)
static V8_WARN_UNUSED_RESULT Maybe< bool > DefineOwnProperty(Isolate *isolate, DirectHandle< JSProxy > object, DirectHandle< Object > key, PropertyDescriptor *desc, Maybe< ShouldThrow > should_throw)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > GetOwnPropertyDescriptor(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Object > key, PropertyDescriptor *desc)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > DeletePropertyOrElement(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Name > name, LanguageMode language_mode=LanguageMode::kSloppy)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > SetPrototype(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Object > value, bool from_javascript, ShouldThrow should_throw)
bool HasProxyInPrototype(Isolate *isolate)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< FixedArray > OwnPropertyKeys(Isolate *isolate, DirectHandle< JSReceiver > object)
static V8_WARN_UNUSED_RESULT Maybe< bool > OrdinaryDefineOwnProperty(Isolate *isolate, DirectHandle< JSObject > object, DirectHandle< Object > key, PropertyDescriptor *desc, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT Maybe< PropertyAttributes > GetOwnPropertyAttributes(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Name > name)
static Tagged< Smi > CreateIdentityHash(Isolate *isolate, Tagged< JSReceiver > key)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > DeleteProperty(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Name > name, LanguageMode language_mode=LanguageMode::kSloppy)
static V8_WARN_UNUSED_RESULT Maybe< bool > TestIntegrityLevel(Isolate *isolate, DirectHandle< JSReceiver > object, IntegrityLevel lvl)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetIntegrityLevel(Isolate *isolate, DirectHandle< JSReceiver > object, IntegrityLevel lvl, ShouldThrow should_throw)
V8_EXPORT_PRIVATE Tagged< String > class_name()
static MaybeDirectHandle< NativeContext > GetFunctionRealm(DirectHandle< JSReceiver > receiver)
static V8_WARN_UNUSED_RESULT Maybe< bool > ValidateAndApplyPropertyDescriptor(Isolate *isolate, LookupIterator *it, bool extensible, PropertyDescriptor *desc, PropertyDescriptor *current, Maybe< ShouldThrow > should_throw, DirectHandle< Name > property_name)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > HasOwnProperty(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Name > name)
bool IsCodeLike(Isolate *isolate) const
V8_EXPORT_PRIVATE Tagged< Object > GetIdentityHash()
static V8_WARN_UNUSED_RESULT Maybe< bool > PreventExtensions(Isolate *isolate, DirectHandle< JSReceiver > object, ShouldThrow should_throw)
static V8_WARN_UNUSED_RESULT Maybe< bool > HasInPrototypeChain(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Object > proto)
static V8_WARN_UNUSED_RESULT HandleType< Object >::MaybeType ToPrimitive(Isolate *isolate, HandleType< JSReceiver > receiver, ToPrimitiveHint hint=ToPrimitiveHint::kDefault)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< FixedArray > GetOwnValues(Isolate *isolate, DirectHandle< JSReceiver > object, PropertyFilter filter, bool try_fast_path=true)
static V8_WARN_UNUSED_RESULT Maybe< bool > DeleteElement(Isolate *isolate, DirectHandle< JSReceiver > object, uint32_t index, LanguageMode language_mode=LanguageMode::kSloppy)
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 Tagged< Object > DefineProperty(Isolate *isolate, DirectHandle< Object > object, DirectHandle< Object > name, Handle< Object > attributes)
static Handle< Object > GetDataProperty(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Name > name)
static V8_WARN_UNUSED_RESULT Maybe< bool > IsExtensible(Isolate *isolate, DirectHandle< JSReceiver > object)
static V8_WARN_UNUSED_RESULT HandleType< Object >::MaybeType OrdinaryToPrimitive(Isolate *isolate, DirectHandle< JSReceiver > receiver, OrdinaryToPrimitiveHint hint)
static V8_WARN_UNUSED_RESULT Maybe< PropertyAttributes > GetPropertyAttributes(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Name > name)
static V8_WARN_UNUSED_RESULT Maybe< bool > IsCompatiblePropertyDescriptor(Isolate *isolate, bool extensible, PropertyDescriptor *desc, PropertyDescriptor *current, DirectHandle< Name > property_name, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > GetProperty(Isolate *isolate, DirectHandle< JSReceiver > receiver, const char *key)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< FixedArray > GetOwnEntries(Isolate *isolate, DirectHandle< JSReceiver > object, PropertyFilter filter, bool try_fast_path=true)
static MaybeDirectHandle< JSFunction > GetConstructor(Isolate *isolate, DirectHandle< JSReceiver > receiver)
static V8_WARN_UNUSED_RESULT Maybe< bool > DefineOwnProperty(Isolate *isolate, DirectHandle< JSReceiver > object, DirectHandle< Object > key, PropertyDescriptor *desc, Maybe< ShouldThrow > should_throw)
static void DeleteNormalizedProperty(DirectHandle< JSReceiver > object, InternalIndex entry)
static DirectHandle< String > GetConstructorName(Isolate *isolate, DirectHandle< JSReceiver > receiver)
static V8_WARN_UNUSED_RESULT Maybe< bool > CheckPrivateNameStore(LookupIterator *it, bool is_define)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetOrCopyDataProperties(Isolate *isolate, DirectHandle< JSReceiver > target, DirectHandle< Object > source, PropertiesEnumerationMode mode, base::Vector< DirectHandle< Object > > excluded_properties={}, bool use_set=true)
static V8_EXPORT_PRIVATE MaybeHandle< NativeContext > GetContextForMicrotask(DirectHandle< JSReceiver > receiver)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > HasProperty(LookupIterator *it)
V8_EXPORT_PRIVATE void SetIdentityHash(int masked_hash)
V8_EXPORT_PRIVATE Tagged< Smi > GetOrCreateIdentityHash(Isolate *isolate)
static V8_WARN_UNUSED_RESULT Maybe< bool > AddPrivateField(LookupIterator *it, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
V8_EXPORT_PRIVATE std::optional< Tagged< NativeContext > > GetCreationContext()
NEVER_READ_ONLY_SPACE void SetProperties(Tagged< HeapObject > properties)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > DefineProperties(Isolate *isolate, DirectHandle< Object > object, DirectHandle< Object > properties)
static V8_WARN_UNUSED_RESULT Maybe< bool > DefineOwnProperty(Isolate *isolate, DirectHandle< JSTypedArray > o, DirectHandle< Object > key, PropertyDescriptor *desc, Maybe< ShouldThrow > should_throw)
static void PrintTop(Isolate *isolate, FILE *file, bool print_args, bool print_line_number)
static MaybeHandle< FixedArray > GetKeys(Isolate *isolate, DirectHandle< JSReceiver > object, KeyCollectionMode mode, PropertyFilter filter, GetKeysConversion keys_conversion=GetKeysConversion::kKeepNumbers, bool is_for_in=false, bool skip_indices=false)
@ TYPED_ARRAY_INDEX_NOT_FOUND
DirectHandle< Map > ReconfigureElementsKind(ElementsKind elements_kind)
Handle< Map > ApplyPrototypeTransition(DirectHandle< JSPrototype > prototype)
static bool IsPrototypeChainInvalidated(Tagged< Map > map)
static DirectHandle< PrototypeInfo > GetOrCreatePrototypeInfo(DirectHandle< Map > prototype_map, Isolate *isolate)
static V8_EXPORT_PRIVATE Handle< Map > TransitionToUpdatePrototype(Isolate *isolate, DirectHandle< Map > map, DirectHandle< JSPrototype > prototype)
static DirectHandle< Map > GetObjectCreateMap(Isolate *isolate, DirectHandle< JSPrototype > prototype)
static Handle< Map > CopyDropDescriptors(Isolate *isolate, DirectHandle< Map > map)
static void SetShouldBeFastPrototypeMap(DirectHandle< Map > map, bool value, Isolate *isolate)
static Handle< Map > Copy(Isolate *isolate, DirectHandle< Map > map, const char *reason, TransitionKindFlag kind=SPECIAL_TRANSITION)
static V8_EXPORT_PRIVATE MaybeHandle< Map > TryUpdate(Isolate *isolate, Handle< Map > map) V8_WARN_UNUSED_RESULT
static V8_EXPORT_PRIVATE DirectHandle< Map > PrepareForDataProperty(Isolate *isolate, DirectHandle< Map > old_map, InternalIndex descriptor_number, PropertyConstness constness, DirectHandle< Object > value)
static constexpr int kPrototypeChainInvalid
static V8_EXPORT_PRIVATE void SetPrototype(Isolate *isolate, DirectHandle< Map > map, DirectHandle< JSPrototype > prototype, bool enable_prototype_setup_mode=true)
static V8_EXPORT_PRIVATE Handle< Map > Normalize(Isolate *isolate, DirectHandle< Map > map, ElementsKind new_elements_kind, DirectHandle< JSPrototype > new_prototype, PropertyNormalizationMode mode, bool use_cache, const char *reason)
static V8_EXPORT_PRIVATE DirectHandle< Map > Update(Isolate *isolate, DirectHandle< Map > map)
static V8_EXPORT_PRIVATE Handle< Map > CopyForPreventExtensions(Isolate *isolate, DirectHandle< Map > map, PropertyAttributes attrs_to_add, DirectHandle< Symbol > transition_marker, const char *reason, bool old_map_is_dictionary_elements_kind=false)
static DirectHandle< Map > TransitionElementsTo(Isolate *isolate, DirectHandle< Map > map, ElementsKind to_kind)
static DirectHandle< Map > TransitionToImmutableProto(Isolate *isolate, DirectHandle< Map > map)
V8_WARN_UNUSED_RESULT V8_INLINE bool ToHandle(DirectHandle< S > *out) const
static const int kInitialCapacity
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())
static V8_WARN_UNUSED_RESULT Maybe< bool > RedefineIncompatibleProperty(Isolate *isolate, DirectHandle< Object > name, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static bool ToArrayLength(Tagged< Object > obj, uint32_t *index)
static V8_EXPORT_PRIVATE Handle< UnionOf< JSAny, Hole > > NewStorageFor(Isolate *isolate, Handle< UnionOf< JSAny, Hole > > object, Representation representation)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > AddDataProperty(LookupIterator *it, DirectHandle< Object > value, PropertyAttributes attributes, Maybe< ShouldThrow > should_throw, StoreOrigin store_origin, EnforceDefineSemantics semantics=EnforceDefineSemantics::kSet)
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 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 bool FilterKey(Tagged< Object > obj, PropertyFilter filter)
static V8_WARN_UNUSED_RESULT HandleType< Object >::MaybeType ToPropertyKey(Isolate *isolate, HandleType< T > value)
static double NumberValue(Tagged< Number > obj)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetPropertyWithAccessor(LookupIterator *it, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT Maybe< bool > TransitionAndWriteDataProperty(LookupIterator *it, DirectHandle< Object > value, PropertyAttributes attributes, Maybe< ShouldThrow > should_throw, StoreOrigin store_origin)
static Handle< JSAny > WrapForRead(IsolateT *isolate, Handle< JSAny > object, Representation representation)
static V8_EXPORT_PRIVATE bool SameValue(Tagged< Object > obj, Tagged< Object > other)
static V8_EXPORT_PRIVATE bool ToInt32(Tagged< Object > obj, int32_t *value)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSReceiver > ConvertReceiver(Isolate *isolate, DirectHandle< Object > object)
static V8_WARN_UNUSED_RESULT Maybe< bool > CannotCreateProperty(Isolate *isolate, DirectHandle< JSAny > receiver, DirectHandle< Object > name, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > GetMethod(Isolate *isolate, DirectHandle< JSReceiver > receiver, DirectHandle< Name > name)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeHandle< Object > GetProperty(LookupIterator *it, bool is_global_reference=false)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetDataProperty(LookupIterator *it, DirectHandle< Object > value)
static Tagged< AllocationMemento > FindAllocationMemento(Heap *heap, Tagged< Map > map, Tagged< HeapObject > object)
static const int kNoHashSentinel
static Handle< PropertyCell > PrepareForAndSetValue(Isolate *isolate, DirectHandle< GlobalDictionary > dictionary, InternalIndex entry, DirectHandle< Object > value, PropertyDetails details)
static Handle< PropertyCell > InvalidateAndReplaceEntry(Isolate *isolate, DirectHandle< GlobalDictionary > dictionary, InternalIndex entry, PropertyDetails new_details, DirectHandle< Object > new_value)
void set_value(DirectHandle< JSAny > value)
void set_configurable(bool configurable)
static bool IsAccessorDescriptor(PropertyDescriptor *desc)
void set_writable(bool writable)
static bool IsGenericDescriptor(PropertyDescriptor *desc)
static bool ToPropertyDescriptor(Isolate *isolate, Handle< JSAny > obj, PropertyDescriptor *desc)
bool configurable() const
static bool IsDataDescriptor(PropertyDescriptor *desc)
void set_enumerable(bool enumerable)
PropertyAttributes attributes() const
PropertyDetails CopyWithConstness(PropertyConstness constness) const
PropertyLocation location() const
int field_width_in_words() const
Representation representation() const
int dictionary_index() const
PropertyKind kind() const
PropertyDetails set_index(int index) const
static constexpr PropertyDetails Empty(PropertyCellType cell_type=PropertyCellType::kNoCell)
PropertyConstness constness() const
bool IsConfigurable() const
PropertyDetails CopyAddAttributes(PropertyAttributes new_attributes) const
PropertyDetails set_cell_type(PropertyCellType type) const
bool IsEnumerable() const
V8_WARN_UNUSED_RESULT bool AdvanceFollowingProxies()
Tagged< T > GetCurrent() const
static Handle< WeakArrayList > Add(Isolate *isolate, Handle< WeakArrayList > array, DirectHandle< Map > value, int *assigned_index)
static const int kFirstIndex
static void MarkSlotEmpty(Tagged< WeakArrayList > array, int index)
const char * Mnemonic() const
bool Equals(const Representation &other) const
static constexpr Representation Tagged()
constexpr bool IsDouble() const
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > SetObjectProperty(Isolate *isolate, DirectHandle< JSAny > object, DirectHandle< Object > key, DirectHandle< Object > value, MaybeDirectHandle< JSAny > receiver, StoreOrigin store_origin, Maybe< ShouldThrow > should_throw=Nothing< ShouldThrow >())
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > GetObjectProperty(Isolate *isolate, DirectHandle< JSAny > lookup_start_object, DirectHandle< Object > key, DirectHandle< JSAny > receiver={}, bool *is_found=nullptr)
static void InitLineEnds(Isolate *isolate, DirectHandle< Script > script)
static void EnsureSourcePositionsAvailable(Isolate *isolate, DirectHandle< SharedFunctionInfo > shared_info)
static void EnsureBytecodeArrayAvailable(Isolate *isolate, Handle< SharedFunctionInfo > shared_info, IsCompiledScope *is_compiled_scope, CreateSourcePositions flag=CreateSourcePositions::kNo)
static Handle< String > DebugName(Isolate *isolate, DirectHandle< SharedFunctionInfo > shared)
static constexpr int ToInt(const Tagged< Object > object)
static constexpr Tagged< Smi > FromInt(int value)
static constexpr Tagged< Smi > zero()
static constexpr int kMaxValue
void Add(const char *format)
static bool IsKey(ReadOnlyRoots roots, Tagged< Object > key_candidate)
static HandleType< SwissNameDictionary > Add(IsolateT *isolate, HandleType< SwissNameDictionary > table, DirectHandle< Name > key, DirectHandle< Object > value, PropertyDetails details, InternalIndex *entry_out=nullptr)
static HandleType< SwissNameDictionary > DeleteEntry(Isolate *isolate, HandleType< SwissNameDictionary > table, InternalIndex entry)
V8_INLINE constexpr StorageType ptr() const
V8_INLINE constexpr bool is_null() const
static ThreadId Current()
static bool CanHaveMoreTransitions(Isolate *isolate, DirectHandle< Map > map)
Tagged< Map > SearchTransition(Tagged< Name > name, PropertyKind kind, PropertyAttributes attributes)
Tagged< Map > SearchSpecial(Tagged< Symbol > name)
static V8_EXPORT_PRIVATE v8::Platform * GetCurrentPlatform()
#define V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL
#define V8_DICT_PROPERTY_CONST_TRACKING_BOOL
Handle< SharedFunctionInfo > info
#define RAB_GSAB_TYPED_ARRAYS(V)
#define RETURN_ON_EXCEPTION(isolate, call)
#define ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call)
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call)
#define RETURN_FAILURE(isolate, should_throw, 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 MAYBE_RETURN_NULL(call)
#define MAYBE_RETURN(call, value)
#define RETURN_ON_EXCEPTION_VALUE(isolate, call, value)
#define RETURN_VALUE_IF_EXCEPTION_DETECTOR(isolate, detector, value)
base::Vector< const DirectHandle< Object > > args
DirectHandle< Object > new_target
SharedFunctionInfoRef shared
#define SWITCH_KIND(Type, type, TYPE, ctype)
ZoneVector< RpoNumber > & result
#define LOG(isolate, Call)
InstructionOperand source
V8_INLINE constexpr bool IsPropertyDictionary(InstanceType instance_type)
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
PropertiesEnumerationMode
bool TryCast(Tagged< From > value, Tagged< To > *out)
constexpr int kFunctionEntryBytecodeOffset
constexpr NullMaybeHandleType kNullMaybeHandle
V8_WARN_UNUSED_RESULT Maybe< bool > FastGetOwnValuesOrEntries(Isolate *isolate, DirectHandle< JSReceiver > receiver, bool get_entries, Handle< FixedArray > *result)
PerThreadAssertScopeDebugOnly< false, SAFEPOINTS_ASSERT, HEAP_ALLOCATION_ASSERT > DisallowGarbageCollection
bool is_sloppy(LanguageMode language_mode)
constexpr bool IsHoleyElementsKind(ElementsKind kind)
static DirectHandle< Object > MakeEntryPair(Isolate *isolate, size_t index, DirectHandle< Object > value)
bool IsNumber(Tagged< Object > obj)
ReadOnlyRoots GetReadOnlyRoots()
void PrintF(const char *format,...)
Map::Bits1::HasPrototypeSlotBit Map::Bits1::HasNamedInterceptorBit Map::Bits1::IsUndetectableBit Map::Bits1::IsConstructorBit Map::Bits2::IsImmutablePrototypeBit Map::Bits3::IsDeprecatedBit is_prototype_map
bool IsSealedElementsKind(ElementsKind kind)
Tagged< DescriptorArray >
bool IsCustomElementsReceiverMap(Tagged< Map > map)
Tagged(T object) -> Tagged< T >
constexpr bool IsSmiElementsKind(ElementsKind kind)
V8_INLINE Isolate * GetIsolateFromWritableObject(Tagged< HeapObject > object)
V8_INLINE constexpr bool IsSmi(TaggedImpl< kRefType, StorageType > obj)
V8_INLINE IndirectHandle< T > indirect_handle(DirectHandle< T > handle)
kInterpreterTrampolineOffset Tagged< HeapObject >
constexpr bool IsObjectElementsKind(ElementsKind kind)
bool IsNonextensibleElementsKind(ElementsKind kind)
@ HOLEY_NONEXTENSIBLE_ELEMENTS
@ SLOW_STRING_WRAPPER_ELEMENTS
@ PACKED_NONEXTENSIBLE_ELEMENTS
@ TERMINAL_FAST_ELEMENTS_KIND
@ 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))
const char * ElementsKindToString(ElementsKind kind)
void Print(Tagged< Object > obj)
static int HoleyElementsUsage(Tagged< JSObject > object, Tagged< BackingStore > store)
DirectHandle< NumberDictionary > CreateElementDictionary(Isolate *isolate, DirectHandle< JSObject > object)
ShouldThrow GetShouldThrow(Isolate *isolate, Maybe< ShouldThrow > should_throw)
bool IsPrimitive(Tagged< Object > obj)
ElementsKind GetHoleyElementsKind(ElementsKind packed_kind)
bool IsShared(Tagged< Object > obj)
bool IsSloppyArgumentsElementsKind(ElementsKind kind)
DONT_OVERRIDE DISABLE_ALLOCATION_SITES HOLEY_ELEMENTS
bool IsFrozenElementsKind(ElementsKind kind)
void ShortPrint(Tagged< Object > obj, FILE *out)
bool IsJSObjectThatCanBeTrackedAsPrototype(Tagged< Object > obj)
static const char * NonAPIInstanceTypeToString(InstanceType instance_type)
bool IsFastElementsKind(ElementsKind kind)
Tagged< MaybeWeak< T > > MakeWeak(Tagged< T > value)
static ElementsKind BestFittingFastElementsKind(Tagged< JSObject > object)
DONT_OVERRIDE DISABLE_ALLOCATION_SITES DISABLE_ALLOCATION_SITES HOLEY_DOUBLE_ELEMENTS
static const int kMaxNumberOfDescriptors
bool is_strict(LanguageMode language_mode)
bool IsDictionaryElementsKind(ElementsKind kind)
V8_INLINE constexpr bool IsHeapObject(TaggedImpl< kRefType, StorageType > obj)
V8_EXPORT_PRIVATE FlagValues v8_flags
bool IsUniqueName(Tagged< Name > obj)
V8_INLINE PropertyAttributes PropertyAttributesFromInt(int value)
V8_INLINE bool IsWasmObject(T obj, Isolate *=nullptr)
static bool ShouldConvertToSlowElements(uint32_t used_elements, uint32_t new_capacity)
static bool ShouldConvertToFastElements(Tagged< JSObject > object, Tagged< NumberDictionary > dictionary, uint32_t index, uint32_t *new_capacity)
bool IsTypedArrayOrRabGsabTypedArrayElementsKind(ElementsKind kind)
bool IsStringWrapperElementsKind(ElementsKind kind)
constexpr bool IsDoubleElementsKind(ElementsKind kind)
ElementsKind GetMoreGeneralElementsKind(ElementsKind from_kind, ElementsKind to_kind)
bool IsTransitionableFastElementsKind(ElementsKind from_kind)
static bool PrototypeBenefitsFromNormalization(Tagged< JSObject > object)
MaybeDirectHandle< FixedArray > GetOwnValuesOrEntries(Isolate *isolate, DirectHandle< JSReceiver > object, PropertyFilter filter, bool try_fast_path, bool get_entries)
kInstanceDescriptorsOffset kTransitionsOrPrototypeInfoOffset IsNull(value)||IsJSProxy(value)||IsWasmObject(value)||(IsJSObject(value) &&(HeapLayout
kInstanceDescriptorsOffset kTransitionsOrPrototypeInfoOffset prototype
kInterpreterTrampolineOffset script
!IsContextMap !IsContextMap native_context
PropertyNormalizationMode
@ KEEP_INOBJECT_PROPERTIES
@ CLEAR_INOBJECT_PROPERTIES
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
static constexpr ReleaseStoreTag kReleaseStore
static constexpr RelaxedLoadTag kRelaxedLoad
static constexpr RelaxedStoreTag kRelaxedStore
static constexpr AcquireLoadTag kAcquireLoad
Maybe< T > Just(const T &t)
#define INSTANCE_TYPE_LIST(V)
#define DCHECK_LE(v1, v2)
#define CHECK_IMPLIES(lhs, rhs)
#define DCHECK_IMPLIES(v1, v2)
#define DCHECK_NE(v1, v2)
#define CHECK_NE(lhs, rhs)
#define DCHECK_GE(v1, v2)
#define CHECK_EQ(lhs, rhs)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)
#define DCHECK_GT(v1, v2)
#define TYPED_ARRAY_CONSTRUCTORS_SWITCH(Type, type, TYPE, Ctype)
#define V8_WARN_UNUSED_RESULT