Lines Matching defs:object

30 #include "src/objects/heap-object.h"
125 Handle<JSReceiver> object,
127 if (object->IsJSModuleNamespace()) {
129 return JSReceiver::GetOwnPropertyDescriptor(isolate, object, name, &desc);
132 if (object->IsJSObject()) { // Shortcut.
134 LookupIterator it(isolate, object, key, LookupIterator::OWN);
139 JSReceiver::GetOwnPropertyAttributes(object, name);
176 Handle<JSReceiver> object,
178 PrototypeIterator iter(isolate, object, kStartAtReceiver);
286 // If the target is deprecated, the object will be updated on first store. If
304 // We should never try to copy properties from an object itself.
357 // that the object has a simple shape, and that the key is a name.
554 // If the object was instantiated simply with base == new.target, the
693 JSObject object = JSObject::cast(current);
694 DCHECK(!object.IsJSFunction());
695 return object.GetCreationContext();
789 int GetIdentityHashHelper(JSReceiver object) {
791 Object properties = object.raw_properties_or_hash();
814 ReadOnlyRoots roots = object.GetReadOnlyRoots();
883 void JSReceiver::DeleteNormalizedProperty(Handle<JSReceiver> object,
885 DCHECK(!object->HasFastProperties());
886 Isolate* isolate = object->GetIsolate();
889 if (object->IsJSGlobalObject()) {
890 // If we have a global object, invalidate the cell and remove it from the
891 // global object's dictionary.
893 JSGlobalObject::cast(*object).global_dictionary(kAcquireLoad), isolate);
899 JSGlobalObject::cast(*object).set_global_dictionary(*new_dictionary,
906 object->property_dictionary_swiss(), isolate);
909 object->SetProperties(*dictionary);
911 Handle<NameDictionary> dictionary(object->property_dictionary(), isolate);
914 object->SetProperties(*dictionary);
917 if (object->map().is_prototype_map()) {
920 JSObject::InvalidatePrototypeChains(object->map());
997 Maybe<bool> JSReceiver::DeleteElement(Handle<JSReceiver> object, uint32_t index,
999 LookupIterator it(object->GetIsolate(), object, index, object,
1004 Maybe<bool> JSReceiver::DeleteProperty(Handle<JSReceiver> object,
1007 LookupIterator it(object->GetIsolate(), object, name, object,
1012 Maybe<bool> JSReceiver::DeletePropertyOrElement(Handle<JSReceiver> object,
1015 Isolate* isolate = object->GetIsolate();
1017 LookupIterator it(isolate, object, key, object, LookupIterator::OWN);
1023 Object JSReceiver::DefineProperty(Isolate* isolate, Handle<Object> object,
1027 if (!object->IsJSReceiver()) {
1045 DefineOwnProperty(isolate, Handle<JSReceiver>::cast(object), key, &desc,
1051 return *object;
1057 Handle<Object> object,
1060 if (!object->IsJSReceiver()) {
1120 DefineOwnProperty(isolate, Handle<JSReceiver>::cast(object),
1127 return object;
1132 Handle<JSReceiver> object,
1136 if (object->IsJSArray()) {
1137 return JSArray::DefineOwnProperty(isolate, Handle<JSArray>::cast(object),
1140 if (object->IsJSProxy()) {
1141 return JSProxy::DefineOwnProperty(isolate, Handle<JSProxy>::cast(object),
1144 if (object->IsJSTypedArray()) {
1146 isolate, Handle<JSTypedArray>::cast(object), key, desc, should_throw);
1148 if (object->IsJSModuleNamespace()) {
1150 isolate, Handle<JSModuleNamespace>::cast(object), key, desc,
1157 return OrdinaryDefineOwnProperty(isolate, Handle<JSObject>::cast(object), key,
1163 Isolate* isolate, Handle<JSObject> object, Handle<Object> key,
1167 return OrdinaryDefineOwnProperty(isolate, object, lookup_key, desc,
1172 Isolate* isolate, Handle<JSObject> object, const PropertyKey& key,
1174 LookupIterator it(isolate, object, key, LookupIterator::OWN);
1396 Handle<JSObject> object = Handle<JSObject>::cast(it->GetReceiver());
1397 bool extensible = JSObject::IsExtensible(object);
1423 Handle<JSObject> object;
1424 if (it != nullptr) object = Handle<JSObject>::cast(it->GetReceiver());
1446 // object O whose [[Value]], [[Writable]], [[Enumerable]] and
1467 // of object O whose [[Get]], [[Set]], [[Enumerable]] and
1546 // 6b i. If O is not undefined, convert the property named P of object O
1553 // 6c i. If O is not undefined, convert the property named P of object O
1614 // attribute of the property named P of object O to the value of the field.
1676 Handle<JSReceiver> object,
1681 LookupIterator it(isolate, object, lookup_key, LookupIterator::OWN);
1752 Handle<JSReceiver> object,
1757 LookupIterator it(isolate, object, lookup_key, LookupIterator::OWN);
1897 Handle<JSObject> object = Handle<JSObject>::cast(receiver);
1899 if (!object->HasSloppyArgumentsElements() &&
1900 !object->IsJSModuleNamespace()) { // Fast path.
1902 Maybe<bool> test = JSObject::TestIntegrityLevel(object, level);
1907 return JSObject::PreventExtensionsWithTransition<SEALED>(object,
1910 return JSObject::PreventExtensionsWithTransition<FROZEN>(object,
2005 Maybe<bool> JSReceiver::PreventExtensions(Handle<JSReceiver> object,
2007 if (object->IsJSProxy()) {
2008 return JSProxy::PreventExtensions(Handle<JSProxy>::cast(object),
2011 DCHECK(object->IsJSObject());
2012 return JSObject::PreventExtensions(Handle<JSObject>::cast(object),
2016 Maybe<bool> JSReceiver::IsExtensible(Handle<JSReceiver> object) {
2017 if (object->IsJSProxy()) {
2018 return JSProxy::IsExtensible(Handle<JSProxy>::cast(object));
2020 return Just(JSObject::IsExtensible(Handle<JSObject>::cast(object)));
2092 Handle<JSObject> object(JSObject::cast(*receiver), isolate);
2098 object->GetElementsAccessor()->GetCapacity(*object, object->elements());
2111 if (object->elements() != ReadOnlyRoots(isolate).empty_fixed_array()) {
2112 MAYBE_RETURN(object->GetElementsAccessor()->CollectValuesOrEntries(
2113 isolate, object, values_or_entries, get_entries, &count,
2120 bool stable = *map == object->map();
2134 DCHECK_EQ(object->map(), *map);
2146 prop_value = JSObject::FastPropertyAt(isolate, object, representation,
2150 LookupIterator it(isolate, object, next_key,
2155 stable = object->map() == *map;
2160 // the object has a simple shape, and that the key is a name.
2161 LookupIterator it(isolate, object, next_key,
2185 Handle<JSReceiver> object,
2192 isolate, object, get_entries, &values_or_entries);
2203 KeyAccumulator::GetKeys(object, KeyCollectionMode::kOwnOnly, key_filter,
2217 isolate, object, key, &descriptor);
2224 isolate, value, Object::GetPropertyOrElement(isolate, object, key),
2242 MaybeHandle<FixedArray> JSReceiver::GetOwnValues(Handle<JSReceiver> object,
2245 return GetOwnValuesOrEntries(object->GetIsolate(), object, filter,
2249 MaybeHandle<FixedArray> JSReceiver::GetOwnEntries(Handle<JSReceiver> object,
2252 return GetOwnValuesOrEntries(object->GetIsolate(), object, filter,
2257 Handle<JSReceiver> object,
2260 if (object->IsJSProxy()) {
2261 return JSProxy::SetPrototype(isolate, Handle<JSProxy>::cast(object), value,
2264 return JSObject::SetPrototype(isolate, Handle<JSObject>::cast(object), value,
2333 // Actually allocate the object.
2337 void JSObject::EnsureWritableFastElements(Handle<JSObject> object) {
2338 DCHECK(object->HasSmiOrObjectElements() ||
2339 object->HasFastStringWrapperElements() ||
2340 object->HasAnyNonextensibleElements());
2341 FixedArray raw_elems = FixedArray::cast(object->elements());
2342 Isolate* isolate = object->GetIsolate();
2347 object->set_elements(*writable_elems);
2651 void JSObject::SetNormalizedProperty(Handle<JSObject> object, Handle<Name> name,
2654 DCHECK(!object->HasFastProperties());
2656 Isolate* isolate = object->GetIsolate();
2660 if (object->IsJSGlobalObject()) {
2661 Handle<JSGlobalObject> global_obj = Handle<JSGlobalObject>::cast(object);
2685 object->property_dictionary_swiss(), isolate);
2688 DCHECK_IMPLIES(object->map().is_prototype_map(),
2689 Map::IsPrototypeChainInvalidated(object->map()));
2692 object->SetProperties(*dictionary);
2698 Handle<NameDictionary> dictionary(object->property_dictionary(), isolate);
2701 DCHECK_IMPLIES(object->map().is_prototype_map(),
2702 Map::IsPrototypeChainInvalidated(object->map()));
2705 object->SetProperties(*dictionary);
2717 void JSObject::SetNormalizedElement(Handle<JSObject> object, uint32_t index,
2720 DCHECK_EQ(object->GetElementsKind(), DICTIONARY_ELEMENTS);
2722 Isolate* isolate = object->GetIsolate();
2725 handle(NumberDictionary::cast(object->elements()), isolate);
2727 NumberDictionary::Set(isolate, dictionary, index, value, object, details);
2728 object->set_elements(*dictionary);
2865 void JSObject::PrintElementsTransition(FILE* file, Handle<JSObject> object,
2874 JavaScriptFrame::PrintTop(object->GetIsolate(), file, false, true);
2876 object->ShortPrint(file);
2920 Object object = *o;
2921 if (object.IsSmi()) return false;
2922 HeapObject heap_object = HeapObject::cast(object);
2923 if (!object.IsJSObject()) return false;
2924 JSObject js_object = JSObject::cast(object);
2930 // Check that the object is not a key in a WeakMap (over-approximation).
2987 // * Copy inobject properties from the backing store back into the object.
2988 // * Trim the difference in instance size of the object. This also cleanly
2994 void MigrateFastToFast(Isolate* isolate, Handle<JSObject> object,
2996 Handle<Map> old_map(object->map(), isolate);
3002 object->set_map(*new_map, kReleaseStore);
3009 object->set_map(*new_map, kReleaseStore);
3013 // Check if we still have space in the {object}, in which case we
3019 object->property_array(isolate).length()) {
3023 object->FastPropertyAtPut(index, *value);
3025 object->set_map(*new_map, kReleaseStore);
3032 Handle<PropertyArray> old_storage(object->property_array(isolate), isolate);
3052 object->SetProperties(*new_storage);
3053 object->set_map(*new_map, kReleaseStore);
3067 object->set_map(*new_map, kReleaseStore);
3116 value = handle(object->RawFastPropertyAt(isolate, index), isolate);
3163 object->FastPropertyAtPut(index, value);
3166 object->SetProperties(*array);
3168 // Create filler object past the new instance size.
3175 Address address = object->address();
3182 object->set_map(*new_map, kReleaseStore);
3185 void MigrateFastToSlow(Isolate* isolate, Handle<JSObject> object,
3188 // The global object is always normalized.
3189 DCHECK(!object->IsJSGlobalObject(isolate));
3191 DCHECK(!object->IsJSGlobalProxy(isolate));
3197 Handle<Map> map(object->map(isolate), isolate);
3228 value = handle(object->RawFastPropertyAt(isolate, index), isolate);
3236 value = handle(object->RawFastPropertyAt(isolate, index), isolate);
3267 // Resize the object in the heap if necessary.
3274 heap->CreateFillerObjectAt(object->address() + new_instance_size,
3280 object->set_map(*new_map, kReleaseStore);
3283 object->SetProperties(*ord_dictionary);
3285 object->SetProperties(*dictionary);
3288 // Ensure that in-object space of slow-mode object does not contain random
3294 object->FastPropertyAtPut(index, Smi::zero());
3304 object->Print(os);
3311 void JSObject::MigrateToMap(Isolate* isolate, Handle<JSObject> object,
3314 if (object->map(isolate) == *new_map) return;
3315 Handle<Map> old_map(object->map(isolate), isolate);
3324 object->set_map(*new_map, kReleaseStore);
3326 MigrateFastToFast(isolate, object, new_map);
3334 // object with the old map.
3341 DCHECK(object->map(isolate) != *old_map);
3344 MigrateFastToSlow(isolate, object, new_map, expected_additional_properties);
3348 // For some callers of this method, |object| might be in an inconsistent
3349 // state now: the new map might have a new elements_kind, but the object's
3355 void JSObject::ForceSetPrototype(Isolate* isolate, Handle<JSObject> object,
3357 // object.__proto__ = proto;
3358 Handle<Map> old_map = Handle<Map>(object->map(), isolate);
3361 JSObject::MigrateToMap(isolate, object, new_map);
3371 Handle<Map> JSObject::GetElementsTransitionMap(Handle<JSObject> object,
3373 Handle<Map> map(object->map(), object->GetIsolate());
3374 return Map::TransitionElementsTo(object->GetIsolate(), map, to_kind);
3377 void JSObject::AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map) {
3378 DCHECK(object->map().GetInObjectProperties() == map->GetInObjectProperties());
3379 ElementsKind obj_kind = object->map().elements_kind();
3381 Isolate* isolate = object->GetIsolate();
3388 NormalizeElements(object);
3390 TransitionElementsKind(object, to_kind);
3422 object->SetProperties(*array);
3426 object->FastPropertyAtPut(index, value);
3428 object->set_map(*map, kReleaseStore);
3431 void JSObject::MigrateInstance(Isolate* isolate, Handle<JSObject> object) {
3432 Handle<Map> original_map(object->map(), isolate);
3435 JSObject::MigrateToMap(isolate, object, map);
3437 object->PrintInstanceMigration(stdout, *original_map, *map);
3441 object->JSObjectVerify(isolate);
3447 bool JSObject::TryMigrateInstance(Isolate* isolate, Handle<JSObject> object) {
3449 Handle<Map> original_map(object->map(), isolate);
3454 JSObject::MigrateToMap(isolate, object, new_map);
3455 if (FLAG_trace_migration && *original_map != object->map()) {
3456 object->PrintInstanceMigration(stdout, *original_map, object->map());
3460 object->JSObjectVerify(isolate);
3466 void JSObject::AddProperty(Isolate* isolate, Handle<JSObject> object,
3469 LookupIterator it(isolate, object, name, object,
3474 DCHECK(!object->IsJSProxy());
3479 DCHECK(object->map().is_extensible() || name->IsPrivate());
3487 void JSObject::AddProperty(Isolate* isolate, Handle<JSObject> object,
3490 JSObject::AddProperty(isolate, object,
3628 Handle<JSObject> object, Handle<Name> name, Handle<Object> value,
3631 LookupIterator it(object->GetIsolate(), object, name, object,
3637 Handle<JSObject> object, size_t index, Handle<Object> value,
3639 DCHECK(!object->IsJSTypedArray());
3640 Isolate* isolate = object->GetIsolate();
3641 LookupIterator it(isolate, object, index, object, LookupIterator::OWN);
3646 Handle<JSObject> object, Handle<Name> name, Handle<Object> value,
3648 Isolate* isolate = object->GetIsolate();
3650 LookupIterator it(isolate, object, key, object, LookupIterator::OWN);
3659 void JSObject::NormalizeProperties(Isolate* isolate, Handle<JSObject> object,
3663 if (!object->HasFastProperties()) return;
3665 Handle<Map> map(object->map(), isolate);
3669 JSObject::MigrateToMap(isolate, object, new_map,
3673 void JSObject::MigrateSlowToFast(Handle<JSObject> object,
3676 if (object->HasFastProperties()) return;
3677 DCHECK(!object->IsJSGlobalObject());
3678 Isolate* isolate = object->GetIsolate();
3685 swiss_dictionary = handle(object->property_dictionary_swiss(), isolate);
3688 dictionary = handle(object->property_dictionary(), isolate);
3731 Handle<Map> old_map(object->map(), isolate);
3748 // Transform the object.
3750 object->set_map(*new_map, kReleaseStore);
3751 object->SetProperties(ReadOnlyRoots(isolate).empty_fixed_array());
3753 DCHECK(object->HasFastProperties());
3842 object->InObjectPropertyAtPut(current_offset, value,
3868 // Transform the object.
3869 object->set_map(*new_map, kReleaseStore);
3871 object->SetProperties(*fields);
3872 DCHECK(object->IsJSObject());
3875 DCHECK(object->HasFastProperties());
3884 // If this object is a prototype (the callee will check), invalidate any
3890 Handle<NumberDictionary> JSObject::NormalizeElements(Handle<JSObject> object) {
3891 DCHECK(!object->HasTypedArrayOrRabGsabTypedArrayElements());
3892 Isolate* isolate = object->GetIsolate();
3893 bool is_sloppy_arguments = object->HasSloppyArgumentsElements();
3896 FixedArrayBase elements = object->elements();
3907 DCHECK(object->HasSmiOrObjectElements() || object->HasDoubleElements() ||
3908 object->HasFastArgumentsElements() ||
3909 object->HasFastStringWrapperElements() ||
3910 object->HasSealedElements() || object->HasNonextensibleElements());
3913 object->GetElementsAccessor()->Normalize(object);
3918 : object->HasFastStringWrapperElements()
3921 Handle<Map> new_map = JSObject::GetElementsTransitionMap(object, target_kind);
3923 JSObject::MigrateToMap(isolate, object, new_map);
3926 SloppyArgumentsElements::cast(object->elements())
3929 object->set_elements(*dictionary);
3938 object->Print(os);
3942 DCHECK(object->HasDictionaryElements() ||
3943 object->HasSlowArgumentsElements() ||
3944 object->HasSlowStringWrapperElements());
4045 bool TestPropertiesIntegrityLevel(JSObject object, PropertyAttributes level) {
4046 DCHECK(!object.map().IsCustomElementsReceiverMap());
4048 if (object.HasFastProperties()) {
4049 return TestFastPropertiesIntegrityLevel(object.map(), level);
4054 object.property_dictionary_swiss(), object.GetReadOnlyRoots(), level);
4057 object.property_dictionary(), object.GetReadOnlyRoots(), level);
4061 bool TestElementsIntegrityLevel(JSObject object, PropertyAttributes level) {
4062 DCHECK(!object.HasSloppyArgumentsElements());
4064 ElementsKind kind = object.GetElementsKind();
4068 NumberDictionary::cast(object.elements()), object.GetReadOnlyRoots(),
4072 if (level == FROZEN && JSArrayBufferView::cast(object).byte_length() > 0) {
4075 return TestPropertiesIntegrityLevel(object, level);
4084 return accessor->NumberOfElements(object) == 0;
4087 bool FastTestIntegrityLevel(JSObject object, PropertyAttributes level) {
4088 DCHECK(!object.map().IsCustomElementsReceiverMap());
4090 return !object.map().is_extensible() &&
4091 TestElementsIntegrityLevel(object, level) &&
4092 TestPropertiesIntegrityLevel(object, level);
4097 Maybe<bool> JSObject::TestIntegrityLevel(Handle<JSObject> object,
4099 if (!object->map().IsCustomElementsReceiverMap() &&
4100 !object->HasSloppyArgumentsElements()) {
4101 return Just(FastTestIntegrityLevel(*object, level));
4103 return GenericTestIntegrityLevel(Handle<JSReceiver>::cast(object), level);
4106 Maybe<bool> JSObject::PreventExtensions(Handle<JSObject> object,
4108 Isolate* isolate = object->GetIsolate();
4110 if (!object->HasSloppyArgumentsElements()) {
4111 return PreventExtensionsWithTransition<NONE>(object, should_throw);
4114 if (object->IsAccessCheckNeeded() &&
4115 !isolate->MayAccess(handle(isolate->context(), isolate), object)) {
4116 isolate->ReportFailedAccessCheck(object);
4122 if (!object->map().is_extensible()) return Just(true);
4124 if (object->IsJSGlobalProxy()) {
4125 PrototypeIterator iter(isolate, object);
4132 if (object->map().has_named_interceptor() ||
4133 object->map().has_indexed_interceptor()) {
4138 DCHECK(!object->HasTypedArrayOrRabGsabTypedArrayElements());
4141 Handle<NumberDictionary> dictionary = NormalizeElements(object);
4142 DCHECK(object->HasDictionaryElements() || object->HasSlowArgumentsElements());
4146 object->RequireSlowElements(*dictionary);
4153 Map::Copy(isolate, handle(object->map(), isolate), "PreventExtensions");
4156 JSObject::MigrateToMap(isolate, object, new_map);
4157 DCHECK(!object->map().is_extensible());
4162 bool JSObject::IsExtensible(Handle<JSObject> object) {
4163 Isolate* isolate = object->GetIsolate();
4164 if (object->IsAccessCheckNeeded() &&
4165 !isolate->MayAccess(handle(isolate->context(), isolate), object)) {
4168 if (object->IsJSGlobalProxy()) {
4169 PrototypeIterator iter(isolate, *object);
4174 return object->map().is_extensible();
4213 Handle<JSObject> object) {
4215 if (!object->HasTypedArrayOrRabGsabTypedArrayElements() &&
4216 !object->HasDictionaryElements() &&
4217 !object->HasSlowStringWrapperElements()) {
4218 int length = object->IsJSArray()
4219 ? Smi::ToInt(Handle<JSArray>::cast(object)->length())
4220 : object->elements().length();
4223 : object->GetElementsAccessor()->Normalize(object);
4230 Handle<JSObject> object, ShouldThrow should_throw) {
4235 DCHECK(!object->HasSloppyArgumentsElements());
4236 DCHECK_IMPLIES(object->IsJSModuleNamespace(), attrs == NONE);
4238 Isolate* isolate = object->GetIsolate();
4239 if (object->IsAccessCheckNeeded() &&
4240 !isolate->MayAccess(handle(isolate->context(), isolate), object)) {
4241 isolate->ReportFailedAccessCheck(object);
4247 if (attrs == NONE && !object->map().is_extensible()) {
4252 ElementsKind old_elements_kind = object->map().elements_kind();
4259 if (object->IsJSGlobalProxy()) {
4260 PrototypeIterator iter(isolate, object);
4267 if (object->map().has_named_interceptor() ||
4268 object->map().has_indexed_interceptor()) {
4302 switch (object->map().elements_kind()) {
4305 JSObject::TransitionElementsKind(object, PACKED_ELEMENTS);
4309 JSObject::TransitionElementsKind(object, HOLEY_ELEMENTS);
4320 Handle<Map> old_map(object->map(), isolate);
4332 new_element_dictionary = CreateElementDictionary(isolate, object);
4334 JSObject::MigrateToMap(isolate, object, transition_map);
4340 new_element_dictionary = CreateElementDictionary(isolate, object);
4342 JSObject::MigrateToMap(isolate, object, new_map);
4346 NormalizeProperties(isolate, object, CLEAR_INOBJECT_PROPERTIES, 0,
4351 Handle<Map> new_map = Map::Copy(isolate, handle(object->map(), isolate),
4354 new_element_dictionary = CreateElementDictionary(isolate, object);
4362 JSObject::MigrateToMap(isolate, object, new_map);
4366 if (object->IsJSGlobalObject()) {
4368 JSGlobalObject::cast(*object).global_dictionary(kAcquireLoad),
4374 object->property_dictionary_swiss(), isolate);
4378 Handle<NameDictionary> dictionary(object->property_dictionary(),
4386 if (object->map().has_any_nonextensible_elements()) {
4393 if (object->HasTypedArrayOrRabGsabTypedArrayElements()) {
4395 if (attrs == FROZEN && JSTypedArray::cast(*object).GetLength() > 0) {
4403 DCHECK(object->map().has_dictionary_elements() ||
4404 object->map().elements_kind() == SLOW_STRING_WRAPPER_ELEMENTS);
4406 object->set_elements(*new_element_dictionary);
4409 if (object->elements() !=
4411 Handle<NumberDictionary> dictionary(object->element_dictionary(), isolate);
4413 object->RequireSlowElements(*dictionary);
4424 Handle<JSObject> object,
4427 Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate);
4432 Handle<JSObject> object,
4435 Handle<Object> raw_value(object->RawFastPropertyAt(index, tag), isolate);
4441 Handle<JSObject> object,
4445 SwissNameDictionary dict = object->property_dictionary_swiss();
4448 NameDictionary dict = object->property_dictionary();
4454 base::Optional<Object> JSObject::DictionaryPropertyAt(Handle<JSObject> object,
4457 Object backing_store = object->raw_properties_or_hash(kRelaxedLoad);
4477 JSObject object = *this;
4478 switch (object.GetElementsKind()) {
4485 int length = object.IsJSArray()
4486 ? Smi::ToInt(JSArray::cast(object).length())
4487 : object.elements().length();
4495 FixedArray elements = FixedArray::cast(object.elements());
4496 int length = object.IsJSArray()
4497 ? Smi::ToInt(JSArray::cast(object).length())
4506 int length = object.IsJSArray()
4507 ? Smi::ToInt(JSArray::cast(object).length())
4508 : object.elements().length();
4512 FixedDoubleArray elements = FixedDoubleArray::cast(object.elements());
4521 size_t length = JSTypedArray::cast(object).length();
4528 size_t length = JSTypedArray::cast(object).GetLength();
4532 NumberDictionary elements = NumberDictionary::cast(object.elements());
4541 if (String::cast(JSPrimitiveWrapper::cast(object).value()).length() > 0) {
4544 return object.elements().length() > 0;
4554 MaybeHandle<Object> JSObject::DefineAccessor(Handle<JSObject> object,
4559 Isolate* isolate = object->GetIsolate();
4562 LookupIterator it(isolate, object, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
4583 Handle<JSObject> object = Handle<JSObject>::cast(it->GetReceiver());
4585 if (it->IsElement() && object->HasTypedArrayOrRabGsabTypedArrayElements()) {
4598 MaybeHandle<Object> JSObject::SetAccessor(Handle<JSObject> object,
4602 Isolate* isolate = object->GetIsolate();
4605 LookupIterator it(isolate, object, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
4614 isolate->ReportFailedAccessCheck(object);
4622 if (it.IsElement() && object->HasTypedArrayOrRabGsabTypedArrayElements()) {
4636 return object;
4712 static bool PrototypeBenefitsFromNormalization(Handle<JSObject> object) {
4714 if (!object->HasFastProperties()) return false;
4715 if (object->IsJSGlobalProxy()) return false;
4717 if (object->GetIsolate()->bootstrapper()->IsActive()) return false;
4719 return !object->map().is_prototype_map() ||
4720 !object->map().should_be_fast_prototype_map();
4724 void JSObject::OptimizeAsPrototype(Handle<JSObject> object,
4726 Isolate* isolate = object->GetIsolate();
4727 if (object->IsJSGlobalObject()) return;
4728 if (enable_setup_mode && PrototypeBenefitsFromNormalization(object)) {
4730 JSObject::NormalizeProperties(isolate, object, KEEP_INOBJECT_PROPERTIES, 0,
4733 if (object->map().is_prototype_map()) {
4735 object->map().should_be_fast_prototype_map() &&
4736 !object->HasFastProperties()) {
4737 JSObject::MigrateSlowToFast(object, 0, "OptimizeAsPrototype");
4741 Map::Copy(isolate, handle(object->map(), isolate), "CopyAsPrototype");
4756 JSObject::MigrateToMap(isolate, object, new_map);
4758 if (V8_DICT_PROPERTY_CONST_TRACKING_BOOL && !object->HasFastProperties()) {
4773 make_constant(object->property_dictionary_swiss());
4775 make_constant(object->property_dictionary());
4781 enable_setup_mode && !object->IsJSGlobalProxy() &&
4782 !object->GetIsolate()->bootstrapper()->IsActive();
4783 DCHECK_IMPLIES(should_be_dictionary, object->map().is_dictionary_map());
4788 void JSObject::ReoptimizeIfPrototype(Handle<JSObject> object) {
4789 if (!object->map().is_prototype_map()) return;
4790 if (!object->map().should_be_fast_prototype_map()) return;
4791 OptimizeAsPrototype(object);
4965 // Load/StoreGlobalIC handlers that load/store from global object's prototype
4967 // Note, that the normal Load/StoreICs that load/store through the global object
4976 Maybe<bool> JSObject::SetPrototype(Isolate* isolate, Handle<JSObject> object,
4980 int size = object->Size();
4984 if (object->IsAccessCheckNeeded() &&
4985 !isolate->MayAccess(handle(isolate->context(), isolate), object)) {
4986 isolate->ReportFailedAccessCheck(object);
4992 DCHECK(!object->IsAccessCheckNeeded());
4999 bool all_extensible = object->map().is_extensible();
5000 Handle<JSObject> real_receiver = object;
5002 // Find the first object in the chain whose prototype object is not
5023 NewTypeError(MessageTemplate::kImmutablePrototypeSet, object));
5035 NewTypeError(MessageTemplate::kNonExtensibleProto, object));
5045 if (iter.GetCurrent<JSReceiver>() == *object) {
5053 // Set the new prototype of the object.
5062 DCHECK(size == object->Size());
5067 void JSObject::SetImmutableProto(Handle<JSObject> object) {
5068 Handle<Map> map(object->map(), object->GetIsolate());
5074 Map::TransitionToImmutableProto(object->GetIsolate(), map);
5075 object->set_map(*new_map, kReleaseStore);
5078 void JSObject::EnsureCanContainElements(Handle<JSObject> object,
5082 return EnsureCanContainElements(object, args->first_slot(), arg_count, mode);
5085 void JSObject::ValidateElements(JSObject object) {
5088 object.GetElementsAccessor()->Validate(object);
5100 static bool ShouldConvertToFastElements(JSObject object,
5111 if (object.IsJSArray()) {
5112 Object length = JSArray::cast(object).length();
5115 } else if (object.IsJSArgumentsObject()) {
5129 static ElementsKind BestFittingFastElementsKind(JSObject object) {
5130 if (!object.map().CanHaveFastTransitionableElementsKind()) {
5133 if (object.HasSloppyArgumentsElements()) {
5136 if (object.HasStringWrapperElements()) {
5139 DCHECK(object.HasDictionaryElements());
5140 NumberDictionary dictionary = object.element_dictionary();
5157 Maybe<bool> JSObject::AddDataElement(Handle<JSObject> object, uint32_t index,
5160 Isolate* isolate = object->GetIsolate();
5162 DCHECK(object->map(isolate).is_extensible());
5167 if (object->IsJSArray(isolate)) {
5168 CHECK(JSArray::cast(*object).length().ToArrayLength(&old_length));
5171 ElementsKind kind = object->GetElementsKind(isolate);
5172 FixedArrayBase elements = object->elements(isolate);
5185 *object, NumberDictionary::cast(elements), index, &new_capacity)
5186 ? BestFittingFastElementsKind(*object)
5189 *object, static_cast<uint32_t>(elements.length()), index,
5195 if (IsHoleyElementsKind(kind) || !object->IsJSArray(isolate) ||
5202 MAYBE_RETURN(accessor->Add(object, index, value, attributes, new_capacity),
5205 if (object->IsJSArray(isolate) && index >= old_length) {
5208 JSArray::cast(*object).set_length(*new_length);
5214 bool JSObject::UpdateAllocationSite(Handle<JSObject> object,
5216 if (!object->IsJSArray()) return false;
5218 if (!Heap::InYoungGeneration(*object)) return false;
5220 if (Heap::IsLargeObject(*object)) return false;
5226 Heap* heap = object->GetHeap();
5228 heap->FindAllocationMemento<Heap::kForRuntime>(object->map(), *object);
5240 Handle<JSObject> object, ElementsKind to_kind);
5243 Handle<JSObject> object, ElementsKind to_kind);
5245 void JSObject::TransitionElementsKind(Handle<JSObject> object,
5247 ElementsKind from_kind = object->GetElementsKind();
5261 UpdateAllocationSite(object, to_kind);
5262 Isolate* isolate = object->GetIsolate();
5263 if (object->elements() == ReadOnlyRoots(isolate).empty_fixed_array() ||
5267 Handle<Map> new_map = GetElementsTransitionMap(object, to_kind);
5268 JSObject::MigrateToMap(isolate, object, new_map);
5270 Handle<FixedArrayBase> elms(object->elements(), isolate);
5271 PrintElementsTransition(stdout, object, from_kind, elms, to_kind, elms);
5276 uint32_t c = static_cast<uint32_t>(object->elements().length());
5278 ->GrowCapacityAndConvert(object, c)
5292 static int HoleyElementsUsage(JSObject object, BackingStore store) {
5293 Isolate* isolate = object.GetIsolate();
5294 int limit = object.IsJSArray() ? Smi::ToInt(JSArray::cast(object).length())
5350 Handle<JSObject> object,
5353 LookupIterator it(isolate, object, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
5358 Handle<JSObject> object,
5360 LookupIterator it(isolate, object, index, object,
5366 Handle<JSObject> object,
5369 LookupIterator it(isolate, object, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
5383 // Load/StoreGlobalICs that load/store through global object's prototype.
5423 // the number in a Date object representing a particular instant in
5437 Object object(raw_object);
5439 return JSDate::cast(object)