27900 {
27901 ASSERT(!field_names.IsNull());
27902 ASSERT(field_names.IsImmutable());
27903 ASSERT(field_names.ptr() == Object::empty_array().ptr() ||
27904 field_names.Length() > 0);
27905
27906 Zone* zone = thread->zone();
27907 IsolateGroup* isolate_group = thread->isolate_group();
27908 ObjectStore* object_store = isolate_group->object_store();
27909
27910 if (object_store->record_field_names<std::memory_order_acquire>() ==
27912
27913 SafepointWriteRwLocker ml(thread, isolate_group->program_lock());
27914 if (object_store->record_field_names() ==
Array::null()) {
27915
27917 HashTables::New<RecordFieldNamesMap>(16,
Heap::kOld));
27918 map.InsertOrGetValue(Object::empty_array(),
27921 object_store->set_record_field_names_map(
map.Release());
27923 table.SetAt(0, Object::empty_array());
27924 object_store->set_record_field_names<std::memory_order_release>(
table);
27925 }
27926 }
27927
27928#if defined(DART_PRECOMPILER)
27932#else
27935#endif
27936
27938 FATAL(
"Too many record fields");
27939 }
27940 if (field_names.ptr() == Object::empty_array().ptr()) {
27942 }
27943
27944 {
27945 SafepointReadRwLocker ml(thread, isolate_group->program_lock());
27948 index ^=
map.GetOrNull(field_names);
27949 ASSERT(
map.Release().ptr() == object_store->record_field_names_map());
27950 if (!index.IsNull()) {
27952 }
27953 }
27954
27955 SafepointWriteRwLocker ml(thread, isolate_group->program_lock());
27957 const intptr_t new_index =
map.NumOccupied();
27959 FATAL(
"Too many record shapes");
27960 }
27961
27965
27966 if (index == new_index) {
27967 ASSERT(
map.NumOccupied() == (new_index + 1));
27969 intptr_t capacity =
table.Length();
27970 if (index >=
table.Length()) {
27971 capacity = capacity + (capacity >> 2);
27973 object_store->set_record_field_names(
table);
27974 }
27975 table.SetAt(index, field_names);
27976 } else {
27977 ASSERT(index < new_index);
27978 }
27979 object_store->set_record_field_names_map(
map.Release());
27980
27982 ASSERT(shape.GetFieldNames(thread) == field_names.ptr());
27984 return shape;
27985}
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
static ArrayPtr Grow(const Array &source, intptr_t new_length, Heap::Space space=Heap::kNew)
static RecordShape ForUnnamed(intptr_t num_fields)
static constexpr intptr_t kMaxFieldNamesIndex
static constexpr intptr_t kMaxNumFields
static const word kMaxNumFields
static const word kMaxFieldNamesIndex
UnorderedHashMap< RecordFieldNamesMapTraits > RecordFieldNamesMap
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>