Lines Matching defs:isolate

13 #include "src/execution/isolate.h"
96 return JSProxy::HasProperty(it->isolate(), it->GetHolder<JSProxy>(),
124 Maybe<bool> JSReceiver::HasOwnProperty(Isolate* isolate,
129 return JSReceiver::GetOwnPropertyDescriptor(isolate, object, name, &desc);
133 PropertyKey key(isolate, name);
134 LookupIterator it(isolate, object, key, LookupIterator::OWN);
155 if (!it->isolate()->context().is_null() && it->HasAccess()) continue;
159 return it->isolate()->factory()->undefined_value();
164 return it->isolate()->factory()->undefined_value();
166 return it->isolate()->factory()->undefined_value();
171 return it->isolate()->factory()->undefined_value();
175 Maybe<bool> JSReceiver::HasInPrototypeChain(Isolate* isolate,
178 PrototypeIterator iter(isolate, object, kStartAtReceiver);
191 Isolate* isolate = it->isolate();
194 isolate);
195 bool should_throw = GetShouldThrow(isolate, Nothing<ShouldThrow>()) ==
208 isolate->ReportFailedAccessCheck(
210 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, false);
220 isolate->Throw(*(isolate->factory()->NewTypeError(
229 isolate->Throw(*(isolate->factory()->NewTypeError(
238 Maybe<bool> JSReceiver::CheckIfCanDefine(Isolate* isolate, LookupIterator* it,
246 isolate, GetShouldThrow(isolate, should_throw),
252 isolate, GetShouldThrow(isolate, should_throw),
284 Isolate* isolate = target->GetIsolate();
291 JSObject::MigrateInstance(isolate, Handle<JSObject>::cast(target));
294 Handle<Map> map(JSReceiver::cast(*source).map(), isolate);
300 if (from->elements() != ReadOnlyRoots(isolate).empty_fixed_array()) {
307 Handle<DescriptorArray> descriptors(map->instance_descriptors(isolate),
308 isolate);
317 HandleScope inner_scope(isolate);
319 Handle<Name> next_key(descriptors->GetKey(i), isolate);
333 DCHECK_EQ(*descriptors, map->instance_descriptors(isolate));
339 prop_value = handle(descriptors->GetStrongValue(i), isolate);
345 JSObject::FastPropertyAt(isolate, from, representation, index);
348 LookupIterator it(isolate, from, next_key,
351 isolate, prop_value, Object::GetProperty(&it), Nothing<bool>());
353 descriptors.PatchValue(map->instance_descriptors(isolate));
358 LookupIterator it(isolate, from, next_key, from,
365 isolate, prop_value, Object::GetProperty(&it), Nothing<bool>());
371 PropertyKey key(isolate, next_key);
372 LookupIterator it(isolate, target, key);
379 descriptors.PatchValue(map->instance_descriptors(isolate));
392 LookupIterator it(isolate, target, next_key, LookupIterator::OWN);
415 Isolate* isolate, Handle<JSReceiver> target, Handle<Object> source,
424 Handle<JSReceiver> from = Object::ToObject(isolate, source).ToHandleChecked();
429 isolate, keys,
453 JSObject::NormalizeProperties(isolate, Handle<JSObject>::cast(target),
461 Handle<Object> next_key(keys->get(i), isolate);
470 JSReceiver::GetOwnPropertyDescriptor(isolate, from, next_key, &desc);
477 isolate, prop_value,
478 Runtime::GetObjectProperty(isolate, from, next_key), Nothing<bool>());
484 isolate, status,
485 Runtime::SetObjectProperty(isolate, target, next_key, prop_value,
491 PropertyKey key(isolate, next_key);
492 LookupIterator it(isolate, target, key, LookupIterator::OWN);
553 Isolate* isolate, Handle<JSReceiver> receiver) {
560 Handle<Object> maybe_constructor(receiver->map().GetConstructor(), isolate);
565 SharedFunctionInfo::DebugName(handle(constructor->shared(), isolate));
567 !name->Equals(ReadOnlyRoots(isolate).Object_string())) {
573 for (PrototypeIterator it(isolate, receiver, kStartAtReceiver); !it.IsAtEnd();
578 isolate, receiver, isolate->factory()->to_string_tag_symbol(), current,
599 isolate, receiver, isolate->factory()->constructor_string(), current,
606 handle(constructor->shared(), isolate));
609 !name->Equals(ReadOnlyRoots(isolate).Object_string())) {
617 handle(receiver->class_name(), isolate));
623 Isolate* isolate, Handle<JSReceiver> receiver) {
624 return GetConstructorHelper(isolate, receiver).first;
628 Handle<String> JSReceiver::GetConstructorName(Isolate* isolate,
630 return GetConstructorHelper(isolate, receiver).second;
661 Isolate* isolate = receiver->GetIsolate();
673 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kProxyRevoked),
681 return handle(function.native_context(), isolate);
702 Isolate* isolate = receiver->GetIsolate();
707 isolate);
710 Handle<Object> target(Handle<JSProxy>::cast(receiver)->target(), isolate);
717 return handle(Handle<JSFunction>::cast(receiver)->native_context(), isolate);
863 Smi JSReceiver::CreateIdentityHash(Isolate* isolate, JSReceiver key) {
865 int hash = isolate->GenerateIdentityHash(PropertyArray::HashField::kMax);
872 Smi JSReceiver::GetOrCreateIdentityHash(Isolate* isolate) {
880 return JSReceiver::CreateIdentityHash(isolate, *this);
886 Isolate* isolate = object->GetIsolate();
893 JSGlobalObject::cast(*object).global_dictionary(kAcquireLoad), isolate);
895 Handle<PropertyCell> cell(dictionary->CellAt(entry), isolate);
898 GlobalDictionary::DeleteEntry(isolate, dictionary, entry);
902 cell->ClearAndInvalidate(ReadOnlyRoots(isolate));
906 object->property_dictionary_swiss(), isolate);
908 dictionary = SwissNameDictionary::DeleteEntry(isolate, dictionary, entry);
911 Handle<NameDictionary> dictionary(object->property_dictionary(), isolate);
913 dictionary = NameDictionary::DeleteEntry(isolate, dictionary, entry);
928 Isolate* isolate = it->isolate();
953 isolate->ReportFailedAccessCheck(it->GetHolder<JSObject>());
954 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
962 if (isolate->has_pending_exception()) return Nothing<bool>();
979 isolate->Throw(*isolate->factory()->NewTypeError(
1015 Isolate* isolate = object->GetIsolate();
1016 PropertyKey key(isolate, name);
1017 LookupIterator it(isolate, object, key, object, LookupIterator::OWN);
1023 Object JSReceiver::DefineProperty(Isolate* isolate, Handle<Object> object,
1029 isolate->factory()->InternalizeUtf8String("Object.defineProperty");
1031 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject, fun_name));
1035 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, key,
1036 Object::ToPropertyKey(isolate, key));
1040 if (!PropertyDescriptor::ToPropertyDescriptor(isolate, attributes, &desc)) {
1041 return ReadOnlyRoots(isolate).exception();
1045 DefineOwnProperty(isolate, Handle<JSReceiver>::cast(object), key, &desc,
1048 MAYBE_RETURN(success, ReadOnlyRoots(isolate).exception());
1056 MaybeHandle<Object> JSReceiver::DefineProperties(Isolate* isolate,
1062 isolate->factory()->InternalizeUtf8String("Object.defineProperties");
1063 THROW_NEW_ERROR(isolate,
1070 ASSIGN_RETURN_ON_EXCEPTION(isolate, props,
1071 Object::ToObject(isolate, properties), Object);
1077 isolate, keys,
1087 Handle<Object> next_key(keys->get(i), isolate);
1090 PropertyKey key(isolate, next_key);
1091 LookupIterator it(isolate, props, key, LookupIterator::OWN);
1101 ASSIGN_RETURN_ON_EXCEPTION(isolate, desc_obj, Object::GetProperty(&it),
1105 isolate, desc_obj, &descriptors[descriptors_index]);
1120 DefineOwnProperty(isolate, Handle<JSReceiver>::cast(object),
1131 Maybe<bool> JSReceiver::DefineOwnProperty(Isolate* isolate,
1137 return JSArray::DefineOwnProperty(isolate, Handle<JSArray>::cast(object),
1141 return JSProxy::DefineOwnProperty(isolate, Handle<JSProxy>::cast(object),
1146 isolate, Handle<JSTypedArray>::cast(object), key, desc, should_throw);
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,
1166 PropertyKey lookup_key(isolate, 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);
1179 isolate->ReportFailedAccessCheck(it.GetHolder<JSObject>());
1180 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
1194 Isolate* isolate = it->isolate();
1197 AssertNoContextChange ncc(isolate);
1199 if (interceptor->getter().IsUndefined(isolate)) {
1200 return isolate->factory()->undefined_value();
1208 isolate, receiver, Object::ConvertReceiver(isolate, receiver), Object);
1210 PropertyCallbackArguments args(isolate, interceptor->data(), *receiver,
1219 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
1220 if (result.is_null()) return isolate->factory()->undefined_value();
1223 return handle(*result, isolate);
1228 Isolate* isolate = it->isolate();
1231 AssertNoContextChange ncc(isolate);
1232 HandleScope scope(isolate);
1239 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver,
1240 Object::ConvertReceiver(isolate, receiver),
1243 PropertyCallbackArguments args(isolate, interceptor->data(), *receiver,
1245 if (!interceptor->query().IsUndefined(isolate)) {
1259 } else if (!interceptor->getter().IsUndefined(isolate)) {
1270 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<PropertyAttributes>());
1277 Isolate* isolate = it->isolate();
1280 AssertNoContextChange ncc(isolate);
1282 if (interceptor->setter().IsUndefined(isolate)) return Just(false);
1288 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver,
1289 Object::ConvertReceiver(isolate, receiver),
1292 PropertyCallbackArguments args(isolate, interceptor->data(), *receiver,
1304 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(it->isolate(), Nothing<bool>());
1311 Isolate* isolate = it->isolate();
1314 AssertNoContextChange ncc(isolate);
1316 if (interceptor->definer().IsUndefined(isolate)) return Just(false);
1322 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver,
1323 Object::ConvertReceiver(isolate, receiver),
1326 PropertyCallbackArguments args(isolate, interceptor->data(), *receiver,
1359 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(it->isolate(), Nothing<bool>());
1370 Isolate* isolate = it->isolate();
1400 isolate, it, extensible, desc, &current, should_throw, Handle<Name>());
1406 Isolate* isolate, bool extensible, PropertyDescriptor* desc,
1412 isolate, nullptr, extensible, desc, current, should_throw, property_name);
1418 Isolate* isolate, LookupIterator* it, bool extensible,
1436 isolate, GetShouldThrow(isolate, should_throw),
1457 : Handle<Object>::cast(isolate->factory()->undefined_value()));
1477 : Handle<Object>::cast(isolate->factory()->null_value()));
1481 : Handle<Object>::cast(isolate->factory()->null_value()));
1512 isolate, GetShouldThrow(isolate, should_throw),
1521 isolate, GetShouldThrow(isolate, should_throw),
1540 isolate, GetShouldThrow(isolate, should_throw),
1571 isolate, GetShouldThrow(isolate, should_throw),
1579 isolate, GetShouldThrow(isolate, should_throw),
1596 isolate, GetShouldThrow(isolate, should_throw),
1604 isolate, GetShouldThrow(isolate, should_throw),
1645 isolate->factory()->undefined_value()));
1657 : Handle<Object>::cast(isolate->factory()->null_value()));
1663 : Handle<Object>::cast(isolate->factory()->null_value()));
1675 Maybe<bool> JSReceiver::CreateDataProperty(Isolate* isolate,
1680 PropertyKey lookup_key(isolate, key);
1681 LookupIterator it(isolate, object, lookup_key, LookupIterator::OWN);
1691 Isolate* isolate = receiver->GetIsolate();
1703 return JSReceiver::DefineOwnProperty(isolate, receiver, it->GetName(),
1712 Isolate* isolate = receiver->GetIsolate();
1723 return JSProxy::SetPrivateSymbol(isolate, Handle<JSProxy>::cast(receiver),
1734 it->isolate()->ReportFailedAccessCheck(it->GetHolder<JSObject>());
1735 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(it->isolate(), Nothing<bool>());
1751 Maybe<bool> JSReceiver::GetOwnPropertyDescriptor(Isolate* isolate,
1756 PropertyKey lookup_key(isolate, key);
1757 LookupIterator it(isolate, object, lookup_key, LookupIterator::OWN);
1785 Isolate* isolate = it->isolate();
1786 if (interceptor->descriptor().IsUndefined(isolate)) return Just(false);
1793 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver,
1794 Object::ConvertReceiver(isolate, receiver),
1798 PropertyCallbackArguments args(isolate, interceptor->data(), *receiver,
1806 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
1811 PropertyDescriptor::ToPropertyDescriptor(isolate, result, desc),
1830 Isolate* isolate = it->isolate();
1833 return JSProxy::GetOwnPropertyDescriptor(isolate, it->GetHolder<JSProxy>(),
1850 DCHECK(!isolate->has_pending_exception());
1862 DCHECK(isolate->has_pending_exception());
1875 desc->set_get(AccessorPair::GetComponent(isolate, native_context, accessors,
1878 desc->set_set(AccessorPair::GetComponent(isolate, native_context, accessors,
1916 Isolate* isolate = receiver->GetIsolate();
1923 isolate, keys, JSReceiver::OwnPropertyKeys(receiver), Nothing<bool>());
1934 Handle<Object> key(keys->get(i), isolate);
1935 MAYBE_RETURN(DefineOwnProperty(isolate, receiver, key, &no_conf,
1943 Handle<Object> key(keys->get(i), isolate);
1946 isolate, receiver, key, &current_desc);
1954 DefineOwnProperty(isolate, receiver, key, &desc, Just(kThrowOnError)),
1970 Isolate* isolate = receiver->GetIsolate();
1974 isolate, keys, JSReceiver::OwnPropertyKeys(receiver), Nothing<bool>());
1977 Handle<Object> key(keys->get(i), isolate);
1980 isolate, receiver, key, &current_desc);
2024 MaybeHandle<Object> JSReceiver::ToPrimitive(Isolate* isolate,
2029 isolate, exotic_to_prim,
2030 Object::GetMethod(receiver, isolate->factory()->to_primitive_symbol()),
2032 if (!exotic_to_prim->IsUndefined(isolate)) {
2034 isolate->factory()->ToPrimitiveHintString(hint);
2037 isolate, result,
2038 Execution::Call(isolate, exotic_to_prim, receiver, 1, &hint_string),
2041 THROW_NEW_ERROR(isolate,
2045 return OrdinaryToPrimitive(isolate, receiver,
2053 Isolate* isolate, Handle<JSReceiver> receiver,
2058 method_names[0] = isolate->factory()->valueOf_string();
2059 method_names[1] = isolate->factory()->toString_string();
2062 method_names[0] = isolate->factory()->toString_string();
2063 method_names[1] = isolate->factory()->valueOf_string();
2068 ASSIGN_RETURN_ON_EXCEPTION(isolate, method,
2069 JSReceiver::GetProperty(isolate, receiver, name),
2074 isolate, result,
2075 Execution::Call(isolate, method, receiver, 0, nullptr), Object);
2079 THROW_NEW_ERROR(isolate,
2085 Isolate* isolate, Handle<JSReceiver> receiver, bool get_entries,
2087 Handle<Map> map(JSReceiver::cast(*receiver).map(), isolate);
2092 Handle<JSObject> object(JSObject::cast(*receiver), isolate);
2093 Handle<DescriptorArray> descriptors(map->instance_descriptors(isolate),
2094 isolate);
2102 isolate->Throw(*isolate->factory()->NewRangeError(
2107 Handle<FixedArray> values_or_entries = isolate->factory()->NewFixedArray(
2111 if (object->elements() != ReadOnlyRoots(isolate).empty_fixed_array()) {
2113 isolate, object, values_or_entries, get_entries, &count,
2122 descriptors.PatchValue(map->instance_descriptors(isolate));
2126 HandleScope inner_scope(isolate);
2128 Handle<Name> next_key(descriptors->GetKey(index), isolate);
2135 DCHECK_EQ(*descriptors, map->instance_descriptors(isolate));
2141 prop_value = handle(descriptors->GetStrongValue(index), isolate);
2146 prop_value = JSObject::FastPropertyAt(isolate, object, representation,
2150 LookupIterator it(isolate, object, next_key,
2154 isolate, prop_value, Object::GetProperty(&it), Nothing<bool>());
2156 descriptors.PatchValue(map->instance_descriptors(isolate));
2161 LookupIterator it(isolate, object, next_key,
2168 isolate, prop_value, Object::GetProperty(&it), Nothing<bool>());
2172 prop_value = MakeEntryPair(isolate, next_key, prop_value);
2180 *result = FixedArray::ShrinkOrEmpty(isolate, values_or_entries, count);
2184 MaybeHandle<FixedArray> GetOwnValuesOrEntries(Isolate* isolate,
2192 isolate, object, get_entries, &values_or_entries);
2202 isolate, keys,
2207 values_or_entries = isolate->factory()->NewFixedArray(keys->length());
2212 Handle<Name>::cast(handle(keys->get(isolate, i), isolate));
2217 isolate, object, key, &descriptor);
2224 isolate, value, Object::GetPropertyOrElement(isolate, object, key),
2228 Handle<FixedArray> entry_storage = isolate->factory()->NewFixedArray(2);
2231 value = isolate->factory()->NewJSArrayWithElements(entry_storage,
2239 return FixedArray::ShrinkOrEmpty(isolate, values_or_entries, length);
2256 Maybe<bool> JSReceiver::SetPrototype(Isolate* isolate,
2261 return JSProxy::SetPrototype(isolate, Handle<JSProxy>::cast(object), value,
2264 return JSObject::SetPrototype(isolate, Handle<JSObject>::cast(object), value,
2268 bool JSReceiver::HasProxyInPrototype(Isolate* isolate) {
2269 for (PrototypeIterator iter(isolate, *this, kStartAtReceiver,
2277 bool JSReceiver::IsCodeLike(Isolate* isolate) const {
2288 if (instance_template.IsUndefined(isolate)) return false;
2301 Isolate* const isolate = constructor->GetIsolate();
2310 isolate, initial_map,
2311 JSFunction::GetDerivedMap(isolate, constructor, new_target), JSObject);
2315 Handle<JSObject> result = isolate->factory()->NewFastOrSlowJSObjectFromMap(
2317 isolate->counters()->constructed_objects()->Increment();
2318 isolate->counters()->constructed_objects_runtime()->Increment();
2324 MaybeHandle<JSObject> JSObject::ObjectCreate(Isolate* isolate,
2331 Map::GetObjectCreateMap(isolate, Handle<HeapObject>::cast(prototype));
2334 return isolate->factory()->NewFastOrSlowJSObjectFromMap(map);
2342 Isolate* isolate = object->GetIsolate();
2343 if (raw_elems.map() != ReadOnlyRoots(isolate).fixed_cow_array_map()) return;
2344 Handle<FixedArray> elems(raw_elems, isolate);
2345 Handle<FixedArray> writable_elems = isolate->factory()->CopyFixedArrayWithMap(
2346 elems, isolate->factory()->fixed_array_map());
2348 isolate->counters()->cow_arrays_converted()->Increment();
2552 Isolate* isolate = it->isolate();
2564 ASSIGN_RETURN_ON_EXCEPTION(isolate, result,
2573 isolate, result,
2585 isolate->ReportFailedAccessCheck(checked);
2586 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
2592 Isolate* isolate = it->isolate();
2603 if (isolate->has_scheduled_exception()) break;
2609 if (isolate->has_pending_exception()) return Nothing<PropertyAttributes>();
2612 isolate->ReportFailedAccessCheck(checked);
2613 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<PropertyAttributes>());
2632 Isolate* isolate = it->isolate();
2643 if (isolate->has_pending_exception()) return Nothing<bool>();
2646 isolate->ReportFailedAccessCheck(checked);
2647 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
2656 Isolate* isolate = object->GetIsolate();
2663 global_obj->global_dictionary(kAcquireLoad), isolate);
2664 ReadOnlyRoots roots(isolate);
2665 InternalIndex entry = dictionary->FindEntry(isolate, roots, name, hash);
2673 auto cell = isolate->factory()->NewPropertyCell(name, details, value);
2675 GlobalDictionary::Add(isolate, dictionary, name, cell, details);
2678 PropertyCell::PrepareForAndSetValue(isolate, dictionary, entry, value,
2685 object->property_dictionary_swiss(), isolate);
2686 InternalIndex entry = dictionary->FindEntry(isolate, *name);
2691 SwissNameDictionary::Add(isolate, dictionary, name, value, details);
2698 Handle<NameDictionary> dictionary(object->property_dictionary(), isolate);
2699 InternalIndex entry = dictionary->FindEntry(isolate, name);
2704 NameDictionary::Add(isolate, dictionary, name, value, details);
2722 Isolate* isolate = object->GetIsolate();
2725 handle(NumberDictionary::cast(object->elements()), isolate);
2727 NumberDictionary::Set(isolate, dictionary, index, value, object, details);
2892 Isolate* isolate = GetIsolate();
2893 DescriptorArray o = original_map.instance_descriptors(isolate);
2894 DescriptorArray n = new_map.instance_descriptors(isolate);
2939 Isolate* isolate) {
2942 bool was_registered = JSObject::UnregisterPrototypeUser(old_map, isolate);
2958 JSObject::LazyRegisterPrototypeUser(new_map, isolate);
2964 Isolate* isolate) {
2974 UpdatePrototypeUserRegistration(old_map, new_map, isolate);
2994 void MigrateFastToFast(Isolate* isolate, Handle<JSObject> object,
2996 Handle<Map> old_map(object->map(), isolate);
2998 if (new_map->GetBackPointer(isolate) == *old_map) {
3007 PropertyDetails details = new_map->GetLastDescriptorDetails(isolate);
3017 FieldIndex::ForDescriptor(isolate, *new_map, new_map->LastAdded());
3019 object->property_array(isolate).length()) {
3022 auto value = isolate->factory()->NewHeapNumberWithHoleNaN();
3032 Handle<PropertyArray> old_storage(object->property_array(isolate), isolate);
3034 isolate->factory()->CopyPropertyArrayAndGrow(old_storage, grow_by);
3039 value = isolate->factory()->NewHeapNumberWithHoleNaN();
3041 value = isolate->factory()->uninitialized_value();
3073 Handle<PropertyArray> array = isolate->factory()->NewPropertyArray(external);
3077 isolate->factory()->NewFixedArray(inobject);
3080 old_map->instance_descriptors(isolate), isolate);
3082 new_map->instance_descriptors(isolate), isolate);
3104 value = isolate->factory()->NewHeapNumberWithHoleNaN();
3106 value = isolate->factory()->uninitialized_value();
3110 value = handle(old_descriptors->GetStrongValue(isolate, i), isolate);
3115 FieldIndex index = FieldIndex::ForDescriptor(isolate, *old_map, i);
3116 value = handle(object->RawFastPropertyAt(isolate, index), isolate);
3119 value->IsUninitialized(isolate));
3120 value = Object::NewStorageFor(isolate, value, representation);
3122 value = Object::WrapForRead(isolate, value, old_representation);
3140 value = isolate->factory()->NewHeapNumberWithHoleNaN();
3142 value = isolate->factory()->uninitialized_value();
3155 Heap* heap = isolate->heap();
3162 Object value = inobject_props->get(isolate, i);
3185 void MigrateFastToSlow(Isolate* isolate, Handle<JSObject> object,
3189 DCHECK(!object->IsJSGlobalObject(isolate));
3191 DCHECK(!object->IsJSGlobalProxy(isolate));
3196 HandleScope scope(isolate);
3197 Handle<Map> map(object->map(isolate), isolate);
3215 ord_dictionary = isolate->factory()->NewSwissNameDictionary(property_count);
3217 dictionary = isolate->factory()->NewNameDictionary(property_count);
3220 Handle<DescriptorArray> descs(map->instance_descriptors(isolate), isolate);
3223 Handle<Name> key(descs->GetKey(isolate, i), isolate);
3226 FieldIndex index = FieldIndex::ForDescriptor(isolate, *map, i);
3228 value = handle(object->RawFastPropertyAt(isolate, index), isolate);
3230 DCHECK(value->IsHeapNumber(isolate));
3232 value = isolate->factory()->NewHeapNumber(old_value);
3236 value = handle(object->RawFastPropertyAt(isolate, index), isolate);
3241 value = handle(descs->GetStrongValue(isolate, i), isolate);
3251 SwissNameDictionary::Add(isolate, ord_dictionary, key, value, d);
3253 dictionary = NameDictionary::Add(isolate, dictionary, key, value, d);
3265 Heap* heap = isolate->heap();
3298 isolate->counters()->props_to_dictionary()->Increment();
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);
3316 NotifyMapChange(old_map, new_map, isolate);
3326 MigrateFastToFast(isolate, object, new_map);
3339 TransitionsAccessor(isolate, *old_map).NumberOfTransitions());
3340 DCHECK(new_map->GetBackPointer(isolate).IsUndefined(isolate));
3341 DCHECK(object->map(isolate) != *old_map);
3344 MigrateFastToSlow(isolate, object, new_map, expected_additional_properties);
3355 void JSObject::ForceSetPrototype(Isolate* isolate, Handle<JSObject> object,
3358 Handle<Map> old_map = Handle<Map>(object->map(), isolate);
3359 Handle<Map> new_map = Map::Copy(isolate, old_map, "ForceSetPrototype");
3360 Map::SetPrototype(isolate, new_map, proto);
3361 JSObject::MigrateToMap(isolate, object, new_map);
3381 Isolate* isolate = object->GetIsolate();
3392 map = MapUpdater{isolate, map}.ReconfigureElementsKind(to_kind);
3403 Handle<DescriptorArray> descriptors(map->instance_descriptors(isolate),
3404 isolate);
3405 Handle<FixedArray> storage = isolate->factory()->NewFixedArray(inobject);
3407 Handle<PropertyArray> array = isolate->factory()->NewPropertyArray(external);
3414 auto box = isolate->factory()->NewHeapNumberWithHoleNaN();
3431 void JSObject::MigrateInstance(Isolate* isolate, Handle<JSObject> object) {
3432 Handle<Map> original_map(object->map(), isolate);
3433 Handle<Map> map = Map::Update(isolate, original_map);
3435 JSObject::MigrateToMap(isolate, object, map);
3441 object->JSObjectVerify(isolate);
3447 bool JSObject::TryMigrateInstance(Isolate* isolate, Handle<JSObject> object) {
3448 DisallowDeoptimization no_deoptimization(isolate);
3449 Handle<Map> original_map(object->map(), isolate);
3451 if (!Map::TryUpdate(isolate, original_map).ToHandle(&new_map)) {
3454 JSObject::MigrateToMap(isolate, object, new_map);
3460 object->JSObjectVerify(isolate);
3466 void JSObject::AddProperty(Isolate* isolate, Handle<JSObject> object,
3469 LookupIterator it(isolate, object, name, object,
3487 void JSObject::AddProperty(Isolate* isolate, Handle<JSObject> object,
3490 JSObject::AddProperty(isolate, object,
3491 isolate->factory()->InternalizeUtf8String(name), value,
3523 it->isolate()->ReportFailedAccessCheck(it->GetHolder<JSObject>());
3524 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(it->isolate(), Nothing<bool>());
3559 it->isolate(), it, value, should_throw);
3567 Isolate* isolate = it->isolate();
3571 it->IsElement() ? LookupIterator(isolate, receiver, it->index(), c)
3572 : LookupIterator(isolate, receiver, it->name(), c);
3586 AssertNoContextChange ncc(it->isolate());
3602 it->isolate(), it->GetName(), value, should_throw);
3640 Isolate* isolate = object->GetIsolate();
3641 LookupIterator it(isolate, object, index, object, LookupIterator::OWN);
3648 Isolate* isolate = object->GetIsolate();
3649 PropertyKey key(isolate, name);
3650 LookupIterator it(isolate, object, key, object, LookupIterator::OWN);
3659 void JSObject::NormalizeProperties(Isolate* isolate, Handle<JSObject> object,
3665 Handle<Map> map(object->map(), isolate);
3667 Map::Normalize(isolate, map, map->elements_kind(), mode, reason);
3669 JSObject::MigrateToMap(isolate, object, new_map,
3678 Isolate* isolate = object->GetIsolate();
3679 Factory* factory = isolate->factory();
3685 swiss_dictionary = handle(object->property_dictionary_swiss(), isolate);
3688 dictionary = handle(object->property_dictionary(), isolate);
3702 iteration_order = NameDictionary::IterationIndices(isolate, dictionary);
3709 ReadOnlyRoots roots(isolate);
3722 DCHECK(dictionary->IsKey(roots, dictionary->KeyAt(isolate, index)));
3731 Handle<Map> old_map(object->map(), isolate);
3736 Handle<Map> new_map = Map::CopyDropDescriptors(isolate, old_map);
3743 NotifyMapChange(old_map, new_map, isolate);
3751 object->SetProperties(ReadOnlyRoots(isolate).empty_fixed_array());
3755 LOG(isolate, MapEvent("SlowToFast", old_map, new_map, reason));
3762 DescriptorArray::Allocate(isolate, number_of_elements, 0);
3808 Handle<Name> key(k, isolate);
3833 Representation::Tagged(), MaybeObjectHandle(FieldType::Any(isolate)));
3836 d = Descriptor::AccessorConstant(key, handle(value, isolate),
3858 new_map->InitializeDescriptors(isolate, *descriptors);
3866 LOG(isolate, MapEvent("SlowToFast", old_map, new_map, reason));
3892 Isolate* isolate = object->GetIsolate();
3903 return handle(NumberDictionary::cast(elements), isolate);
3923 JSObject::MigrateToMap(isolate, object, new_map);
3932 isolate->counters()->elements_to_dictionary()->Increment();
3950 Isolate* isolate = it->isolate();
3953 AssertNoContextChange ncc(isolate);
3957 if (interceptor->deleter().IsUndefined(isolate)) return Nothing<bool>();
3962 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver,
3963 Object::ConvertReceiver(isolate, receiver),
3967 PropertyCallbackArguments args(isolate, interceptor->data(), *receiver,
3976 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
3981 return Just(result->IsTrue(isolate));
3990 Isolate* isolate = receiver->GetIsolate();
3993 JSReceiver::CheckIfCanDefine(isolate, it, value, should_throw);
3998 RETURN_ON_EXCEPTION_VALUE(it->isolate(),
4108 Isolate* isolate = object->GetIsolate();
4115 !isolate->MayAccess(handle(isolate->context(), isolate), object)) {
4116 isolate->ReportFailedAccessCheck(object);
4117 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
4118 RETURN_FAILURE(isolate, should_throw,
4125 PrototypeIterator iter(isolate, object);
4134 RETURN_FAILURE(isolate, should_throw,
4145 if (*dictionary != ReadOnlyRoots(isolate).empty_slow_element_dictionary()) {
4153 Map::Copy(isolate, handle(object->map(), isolate), "PreventExtensions");
4156 JSObject::MigrateToMap(isolate, object, new_map);
4163 Isolate* isolate = object->GetIsolate();
4165 !isolate->MayAccess(handle(isolate->context(), isolate), object)) {
4169 PrototypeIterator iter(isolate, *object);
4180 Isolate* isolate) {
4183 return JSObject::GetProperty(isolate, js_options, option_name);
4185 return MaybeHandle<Object>(isolate->factory()->undefined_value());
4190 Isolate* isolate, ReadOnlyRoots roots, Handle<Dictionary> dictionary,
4209 Isolate* isolate, ReadOnlyRoots roots, Handle<NumberDictionary> dictionary,
4212 Handle<NumberDictionary> CreateElementDictionary(Isolate* isolate,
4222 length == 0 ? isolate->factory()->empty_slow_element_dictionary()
4238 Isolate* isolate = object->GetIsolate();
4240 !isolate->MayAccess(handle(isolate->context(), isolate), object)) {
4241 isolate->ReportFailedAccessCheck(object);
4242 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
4243 RETURN_FAILURE(isolate, should_throw,
4260 PrototypeIterator iter(isolate, object);
4283 RETURN_FAILURE(isolate, should_throw, NewTypeError(message));
4288 transition_marker = isolate->factory()->nonextensible_symbol();
4290 transition_marker = isolate->factory()->sealed_symbol();
4293 transition_marker = isolate->factory()->frozen_symbol();
4320 Handle<Map> old_map(object->map(), isolate);
4321 old_map = Map::Update(isolate, old_map);
4324 TransitionsAccessor::SearchSpecial(isolate, old_map, *transition_marker);
4332 new_element_dictionary = CreateElementDictionary(isolate, object);
4334 JSObject::MigrateToMap(isolate, object, transition_map);
4335 } else if (TransitionsAccessor::CanHaveMoreTransitions(isolate, old_map)) {
4338 isolate, old_map, attrs, transition_marker, "CopyForPreventExtensions");
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);
4365 ReadOnlyRoots roots(isolate);
4369 isolate);
4370 JSObject::ApplyAttributesToDictionary(isolate, roots, dictionary,
4374 object->property_dictionary_swiss(), isolate);
4375 JSObject::ApplyAttributesToDictionary(isolate, roots, dictionary,
4379 isolate);
4380 JSObject::ApplyAttributesToDictionary(isolate, roots, dictionary,
4396 isolate->Throw(*isolate->factory()->NewTypeError(
4410 ReadOnlyRoots(isolate).empty_slow_element_dictionary()) {
4411 Handle<NumberDictionary> dictionary(object->element_dictionary(), isolate);
4415 JSObject::ApplyAttributesToDictionary(isolate, ReadOnlyRoots(isolate),
4423 Handle<Object> JSObject::FastPropertyAt(Isolate* isolate,
4427 Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate);
4428 return Object::WrapForRead(isolate, raw_value, representation);
4431 Handle<Object> JSObject::FastPropertyAt(Isolate* isolate,
4435 Handle<Object> raw_value(object->RawFastPropertyAt(index, tag), isolate);
4436 return Object::WrapForRead(isolate, raw_value, representation);
4440 Handle<Object> JSObject::DictionaryPropertyAt(Isolate* isolate,
4443 DCHECK_EQ(ThreadId::Current(), isolate->thread_id());
4446 return handle(dict.ValueAt(dict_index), isolate);
4449 return handle(dict.ValueAt(dict_index), isolate);
4499 Isolate* isolate = GetIsolate();
4501 if (!elements.is_the_hole(isolate, i)) return true;
4559 Isolate* isolate = object->GetIsolate();
4561 PropertyKey key(isolate, name);
4562 LookupIterator it(isolate, object, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
4570 Isolate* isolate = it->isolate();
4576 isolate->ReportFailedAccessCheck(it->GetHolder<JSObject>());
4577 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
4578 return isolate->factory()->undefined_value();
4589 DCHECK(getter->IsCallable() || getter->IsUndefined(isolate) ||
4590 getter->IsNull(isolate) || getter->IsFunctionTemplateInfo());
4591 DCHECK(setter->IsCallable() || setter->IsUndefined(isolate) ||
4592 setter->IsNull(isolate) || setter->IsFunctionTemplateInfo());
4595 return isolate->factory()->undefined_value();
4602 Isolate* isolate = object->GetIsolate();
4604 PropertyKey key(isolate, name);
4605 LookupIterator it(isolate, object, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
4614 isolate->ReportFailedAccessCheck(object);
4615 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
4692 Isolate* isolate) {
4694 for (PrototypeIterator iter(isolate, Handle<JSReceiver>::cast(receiver),
4705 Handle<Map> map(current_map, isolate);
4706 Map::SetShouldBeFastPrototypeMap(map, true, isolate);
4726 Isolate* isolate = object->GetIsolate();
4730 JSObject::NormalizeProperties(isolate, object, KEEP_INOBJECT_PROPERTIES, 0,
4741 Map::Copy(isolate, handle(object->map(), isolate), "CopyAsPrototype");
4756 JSObject::MigrateToMap(isolate, object, new_map);
4759 ReadOnlyRoots roots(isolate);
4795 void JSObject::LazyRegisterPrototypeUser(Handle<Map> user, Isolate* isolate) {
4802 Map::GetOrCreatePrototypeInfo(user, isolate);
4803 for (PrototypeIterator iter(isolate, user); !iter.IsAtEnd(); iter.Advance()) {
4814 Map::GetOrCreatePrototypeInfo(proto, isolate);
4815 Handle<Object> maybe_registry(proto_info->prototype_users(), isolate);
4818 ? handle(ReadOnlyRoots(isolate->heap()).empty_weak_array_list(),
4819 isolate)
4823 PrototypeUsers::Add(isolate, registry, current_user, &slot);
4835 current_user = handle(proto->map(), isolate);
4843 bool JSObject::UnregisterPrototypeUser(Handle<Map> user, Isolate* isolate) {
4854 Handle<JSObject> prototype(JSObject::cast(user->prototype()), isolate);
4856 Map::GetOrCreatePrototypeInfo(user, isolate);
4864 isolate);
4866 WeakArrayList::cast(proto_info->prototype_users()), isolate);
4913 Isolate* isolate = GetIsolateFromWritableObject(map);
4915 isolate, DependentCode::kPrototypeCheckGroup);
4976 Maybe<bool> JSObject::SetPrototype(Isolate* isolate, Handle<JSObject> object,
4985 !isolate->MayAccess(handle(isolate->context(), isolate), object)) {
4986 isolate->ReportFailedAccessCheck(object);
4987 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
4988 RETURN_FAILURE(isolate, should_throw,
4997 if (!value->IsJSReceiver() && !value->IsNull(isolate)) return Just(true);
5004 PrototypeIterator iter(isolate, real_receiver, kStartAtPrototype,
5014 Handle<Map> map(real_receiver->map(), isolate);
5022 isolate, should_throw,
5034 RETURN_FAILURE(isolate, should_throw,
5042 for (PrototypeIterator iter(isolate, JSReceiver::cast(*value),
5047 RETURN_FAILURE(isolate, should_throw,
5055 isolate->UpdateNoElementsProtectorOnSetPrototype(real_receiver);
5058 Map::TransitionToPrototype(isolate, map, Handle<HeapObject>::cast(value));
5060 JSObject::MigrateToMap(isolate, real_receiver, new_map);
5160 Isolate* isolate = object->GetIsolate();
5162 DCHECK(object->map(isolate).is_extensible());
5167 if (object->IsJSArray(isolate)) {
5171 ElementsKind kind = object->GetElementsKind(isolate);
5172 FixedArrayBase elements = object->elements(isolate);
5175 elements = SloppyArgumentsElements::cast(elements).arguments(isolate);
5183 } else if (elements.IsNumberDictionary(isolate)) {
5194 ElementsKind to = value->OptimalElementsKind(isolate);
5195 if (IsHoleyElementsKind(kind) || !object->IsJSArray(isolate) ||
5205 if (object->IsJSArray(isolate) && index >= old_length) {
5207 isolate->factory()->NewNumberFromUint(index + 1);
5232 site = handle(memento.GetAllocationSite(), heap->isolate());
5262 Isolate* isolate = object->GetIsolate();
5263 if (object->elements() == ReadOnlyRoots(isolate).empty_fixed_array() ||
5268 JSObject::MigrateToMap(isolate, object, new_map);
5270 Handle<FixedArrayBase> elms(object->elements(), isolate);
5293 Isolate* isolate = object.GetIsolate();
5298 if (!store.is_the_hole(isolate, i)) ++used;
5349 Maybe<bool> JSObject::HasRealNamedProperty(Isolate* isolate,
5352 PropertyKey key(isolate, name);
5353 LookupIterator it(isolate, object, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
5357 Maybe<bool> JSObject::HasRealElementProperty(Isolate* isolate,
5360 LookupIterator it(isolate, object, index, object,
5365 Maybe<bool> JSObject::HasRealNamedCallbackProperty(Isolate* isolate,
5368 PropertyKey key(isolate, name);
5369 LookupIterator it(isolate, object, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
5381 Isolate* isolate = global->GetIsolate();
5386 auto dictionary = handle(global->global_dictionary(kAcquireLoad), isolate);
5387 InternalIndex entry = dictionary->FindEntry(isolate, name);
5390 Handle<PropertyCell> cell(dictionary->CellAt(entry), isolate);
5391 Handle<Object> value(cell->value(), isolate);
5394 PropertyCell::InvalidateAndReplaceEntry(isolate, dictionary, entry, details,
5401 Isolate* const isolate = constructor->GetIsolate();
5404 isolate, result,
5412 Handle<Object> value = isolate->factory()->NewNumber(tv);
5418 double JSDate::CurrentTimeValue(Isolate* isolate) {
5419 if (FLAG_log_internal_timer_events) LOG(isolate, CurrentTimeEvent());
5430 Address JSDate::GetField(Isolate* isolate, Address raw_object,
5435 DisallowJavascriptExecution no_js(isolate);
5440 .DoGetField(isolate, static_cast<FieldIndex>(index.value()))
5444 Object JSDate::DoGetField(Isolate* isolate, FieldIndex index) {
5447 DateCache* date_cache = isolate->date_cache();
5543 Isolate* const isolate = date->GetIsolate();
5544 Handle<Object> value = isolate->factory()->NewNumber(v);
5588 Isolate* isolate, Handle<JSMessageObject> message) {
5593 SharedFunctionInfo::cast(message->shared_info()), isolate);
5596 isolate, shared_info, &is_compiled_scope, CreateSourcePositions::kYes);
5597 SharedFunctionInfo::EnsureSourcePositionsAvailable(isolate, shared_info);
5599 int position = shared_info->abstract_code(isolate).SourcePosition(
5604 message->set_shared_info(ReadOnlyRoots(isolate).undefined_value());
5650 Isolate* isolate = GetIsolate();
5651 Handle<Script> the_script(script(), isolate);
5655 return isolate->factory()->empty_string();
5664 return isolate->factory()->empty_string();
5667 Handle<String> src = handle(String::cast(the_script->source()), isolate);
5668 return isolate->factory()->NewSubString(src, info.line_start, info.line_end);