[cleanup] Make PropertyLocation a scoped enum

Bug: v8:12244
Change-Id: I7ea68dd74a376221631d7f56b4a012207f68a1ec
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3182899
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77129}
This commit is contained in:
Ng Zhi An 2021-09-24 15:31:55 -07:00 committed by V8 LUCI CQ
parent d68e5181ce
commit 043fb91b42
37 changed files with 169 additions and 147 deletions

View File

@ -9347,8 +9347,9 @@ void CodeStubAssembler::LoadPropertyFromFastObject(
DecodeWord32<PropertyDetails::LocationField>(details);
Label if_in_field(this), if_in_descriptor(this), done(this);
Branch(Word32Equal(location, Int32Constant(kField)), &if_in_field,
&if_in_descriptor);
Branch(Word32Equal(location, Int32Constant(static_cast<int32_t>(
PropertyLocation::kField))),
&if_in_field, &if_in_descriptor);
BIND(&if_in_field);
{
TNode<IntPtrT> field_index =

View File

@ -836,7 +836,7 @@ PropertyAccessInfo AccessInfoFactory::ComputePropertyAccessInfo(
// occuring before a fast mode holder on the chain.
return Invalid();
}
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
if (details.kind() == kData) {
return ComputeDataFieldAccessInfo(receiver_map, map, holder, index,
access_mode);
@ -846,7 +846,7 @@ PropertyAccessInfo AccessInfoFactory::ComputePropertyAccessInfo(
return Invalid();
}
} else {
DCHECK_EQ(kDescriptor, details.location());
DCHECK_EQ(PropertyLocation::kDescriptor, details.location());
DCHECK_EQ(kAccessor, details.kind());
return ComputeAccessorDescriptorAccessInfo(receiver_map, name, map,
holder, index, access_mode);
@ -1130,7 +1130,7 @@ PropertyAccessInfo AccessInfoFactory::LookupTransition(
if (details.IsReadOnly()) return Invalid();
// TODO(bmeurer): Handle transition to data constant?
if (details.location() != kField) return Invalid();
if (details.location() != PropertyLocation::kField) return Invalid();
int const index = details.field_index();
Representation details_representation = details.representation();

View File

@ -1272,7 +1272,7 @@ bool JSObjectData::SerializeAsBoilerplateRecursive(JSHeapBroker* broker,
boilerplate->map().instance_descriptors(isolate), isolate);
for (InternalIndex i : boilerplate->map().IterateOwnDescriptors()) {
PropertyDetails details = descriptors->GetDetails(i);
if (details.location() != kField) continue;
if (details.location() != PropertyLocation::kField) continue;
DCHECK_EQ(kData, details.kind());
FieldIndex field_index = FieldIndex::ForDescriptor(boilerplate->map(), i);

View File

@ -1711,7 +1711,7 @@ base::Optional<Node*> JSCreateLowering::TryAllocateFastLiteral(
for (InternalIndex i : InternalIndex::Range(boilerplate_nof)) {
PropertyDetails const property_details =
boilerplate_map.GetPropertyDetails(i);
if (property_details.location() != kField) continue;
if (property_details.location() != PropertyLocation::kField) continue;
DCHECK_EQ(kData, property_details.kind());
if ((*max_properties)-- == 0) return {};

View File

@ -417,7 +417,7 @@ void JSObject::JSObjectVerify(Isolate* isolate) {
for (InternalIndex i : map().IterateOwnDescriptors()) {
PropertyDetails details = descriptors.GetDetails(i);
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
DCHECK_EQ(kData, details.kind());
Representation r = details.representation();
FieldIndex index = FieldIndex::ForDescriptor(map(), i);
@ -652,7 +652,7 @@ void DescriptorArray::DescriptorArrayVerify(Isolate* isolate) {
}
MaybeObject value = GetValue(descriptor);
HeapObject heap_object;
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
CHECK_EQ(details.field_index(), expected_field_index);
CHECK(
value == MaybeObject::FromObject(FieldType::None()) ||

View File

@ -295,18 +295,18 @@ bool JSObject::PrintProperties(std::ostream& os) {
os << ": ";
PropertyDetails details = descs.GetDetails(i);
switch (details.location()) {
case kField: {
case PropertyLocation::kField: {
FieldIndex field_index = FieldIndex::ForDescriptor(map(), i);
os << Brief(RawFastPropertyAt(field_index));
break;
}
case kDescriptor:
case PropertyLocation::kDescriptor:
os << Brief(descs.GetStrongValue(i));
break;
}
os << " ";
details.PrintAsFastTo(os, PropertyDetails::kForProperties);
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
int field_index = details.field_index();
if (field_index < nof_inobject_properties) {
os << ", location: in-object";
@ -2665,12 +2665,12 @@ void DescriptorArray::PrintDescriptorDetails(std::ostream& os,
details.PrintAsFastTo(os, mode);
os << " @ ";
switch (details.location()) {
case kField: {
case PropertyLocation::kField: {
FieldType field_type = GetFieldType(descriptor);
field_type.PrintTo(os);
break;
}
case kDescriptor:
case PropertyLocation::kDescriptor:
Object value = GetStrongValue(descriptor);
os << Brief(value);
if (value.IsAccessorPair()) {

View File

@ -145,7 +145,7 @@ FieldStatsCollector::GetInobjectFieldStats(Map map) {
DescriptorArray descriptors = map.instance_descriptors();
for (InternalIndex descriptor : map.IterateOwnDescriptors()) {
PropertyDetails details = descriptors.GetDetails(descriptor);
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
FieldIndex index = FieldIndex::ForDescriptor(map, descriptor);
// Stop on first out-of-object field.
if (!index.is_inobject()) break;

View File

@ -1481,8 +1481,9 @@ void AccessorAssembler::OverwriteExistingFastDataProperty(
Word32Equal(DecodeWord32<PropertyDetails::KindField>(details),
Int32Constant(kData)));
Branch(Word32Equal(DecodeWord32<PropertyDetails::LocationField>(details),
Int32Constant(kField)),
Branch(Word32Equal(
DecodeWord32<PropertyDetails::LocationField>(details),
Int32Constant(static_cast<int32_t>(PropertyLocation::kField))),
&if_field, &if_descriptor);
BIND(&if_field);

View File

@ -1134,7 +1134,8 @@ Handle<Object> LoadIC::ComputeHandler(LookupIterator* lookup) {
TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub);
return LoadHandler::LoadSlow(isolate());
} else {
DCHECK_EQ(kField, lookup->property_details().location());
DCHECK_EQ(PropertyLocation::kField,
lookup->property_details().location());
#if V8_ENABLE_WEBASSEMBLY
if (V8_UNLIKELY(holder->IsWasmObject(isolate()))) {
smi_handler =
@ -1993,7 +1994,7 @@ MaybeObjectHandle StoreIC::ComputeHandler(LookupIterator* lookup) {
}
// -------------- Fields --------------
if (lookup->property_details().location() == kField) {
if (lookup->property_details().location() == PropertyLocation::kField) {
TRACE_HANDLER_STATS(isolate(), StoreIC_StoreFieldDH);
int descriptor = lookup->GetFieldDescriptorIndex();
FieldIndex index = lookup->GetFieldIndex();
@ -2010,7 +2011,8 @@ MaybeObjectHandle StoreIC::ComputeHandler(LookupIterator* lookup) {
}
// -------------- Constant properties --------------
DCHECK_EQ(kDescriptor, lookup->property_details().location());
DCHECK_EQ(PropertyLocation::kDescriptor,
lookup->property_details().location());
set_slow_stub_reason("constant property");
TRACE_HANDLER_STATS(isolate(), StoreIC_SlowStub);
return MaybeObjectHandle(StoreHandler::StoreSlow(isolate()));

View File

@ -5238,7 +5238,7 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
from->map().instance_descriptors(isolate()), isolate());
for (InternalIndex i : from->map().IterateOwnDescriptors()) {
PropertyDetails details = descs->GetDetails(i);
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
if (details.kind() == kData) {
HandleScope inner(isolate());
Handle<Name> key = Handle<Name>(descs->GetKey(i), isolate());
@ -5255,7 +5255,7 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
}
} else {
DCHECK_EQ(kDescriptor, details.location());
DCHECK_EQ(PropertyLocation::kDescriptor, details.location());
DCHECK_EQ(kAccessor, details.kind());
Handle<Name> key(descs->GetKey(i), isolate());
// If the property is already there we skip it.

View File

@ -782,7 +782,8 @@ JsonStringifier::Result JsonStringifier::SerializeJSObject(
map->instance_descriptors(isolate_).GetDetails(i);
if (details.IsDontEnum()) continue;
Handle<Object> property;
if (details.location() == kField && *map == object->map()) {
if (details.location() == PropertyLocation::kField &&
*map == object->map()) {
DCHECK_EQ(kData, details.kind());
FieldIndex field_index = FieldIndex::ForDescriptor(*map, i);
property = JSObject::FastPropertyAt(object, details.representation(),

View File

@ -189,7 +189,7 @@ void DescriptorArray::SetDetails(InternalIndex descriptor_number,
}
int DescriptorArray::GetFieldIndex(InternalIndex descriptor_number) {
DCHECK_EQ(GetDetails(descriptor_number).location(), kField);
DCHECK_EQ(GetDetails(descriptor_number).location(), PropertyLocation::kField);
return GetDetails(descriptor_number).field_index();
}
@ -200,7 +200,7 @@ FieldType DescriptorArray::GetFieldType(InternalIndex descriptor_number) {
FieldType DescriptorArray::GetFieldType(PtrComprCageBase cage_base,
InternalIndex descriptor_number) {
DCHECK_EQ(GetDetails(descriptor_number).location(), kField);
DCHECK_EQ(GetDetails(descriptor_number).location(), PropertyLocation::kField);
MaybeObject wrapped_type = GetValue(cage_base, descriptor_number);
return Map::UnwrapFieldType(wrapped_type);
}

View File

@ -397,7 +397,7 @@ void JSObject::FastPropertyAtPut(FieldIndex index, Object value,
void JSObject::WriteToField(InternalIndex descriptor, PropertyDetails details,
Object value) {
DCHECK_EQ(kField, details.location());
DCHECK_EQ(PropertyLocation::kField, details.location());
DCHECK_EQ(kData, details.kind());
DisallowGarbageCollection no_gc;
FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor);

View File

@ -260,7 +260,7 @@ V8_WARN_UNUSED_RESULT Maybe<bool> FastAssign(
PropertyDetails details = descriptors->GetDetails(i);
if (!details.IsEnumerable()) continue;
if (details.kind() == kData) {
if (details.location() == kDescriptor) {
if (details.location() == PropertyLocation::kDescriptor) {
prop_value = handle(descriptors->GetStrongValue(i), isolate);
} else {
Representation representation = details.representation();
@ -2001,7 +2001,7 @@ V8_WARN_UNUSED_RESULT Maybe<bool> FastGetOwnValuesOrEntries(
PropertyDetails details = descriptors->GetDetails(index);
if (!details.IsEnumerable()) continue;
if (details.kind() == kData) {
if (details.location() == kDescriptor) {
if (details.location() == PropertyLocation::kDescriptor) {
prop_value = handle(descriptors->GetStrongValue(index), isolate);
} else {
Representation representation = details.representation();
@ -2715,8 +2715,8 @@ void JSObject::PrintInstanceMigration(FILE* file, Map original_map,
if (!o_r.Equals(n_r)) {
String::cast(o.GetKey(i)).PrintOn(file);
PrintF(file, ":%s->%s ", o_r.Mnemonic(), n_r.Mnemonic());
} else if (o.GetDetails(i).location() == kDescriptor &&
n.GetDetails(i).location() == kField) {
} else if (o.GetDetails(i).location() == PropertyLocation::kDescriptor &&
n.GetDetails(i).location() == PropertyLocation::kField) {
Name name = o.GetKey(i);
if (name.IsString()) {
String::cast(name).PrintOn(file);
@ -2822,7 +2822,7 @@ void MigrateFastToFast(Isolate* isolate, Handle<JSObject> object,
// If the map adds a new kDescriptor property, simply set the map.
PropertyDetails details = new_map->GetLastDescriptorDetails(isolate);
if (details.location() == kDescriptor) {
if (details.location() == PropertyLocation::kDescriptor) {
object->set_map(*new_map, kReleaseStore);
return;
}
@ -2857,7 +2857,7 @@ void MigrateFastToFast(Isolate* isolate, Handle<JSObject> object,
} else {
value = isolate->factory()->uninitialized_value();
}
DCHECK_EQ(kField, details.location());
DCHECK_EQ(PropertyLocation::kField, details.location());
DCHECK_EQ(kData, details.kind());
DCHECK(!index.is_inobject()); // Must be a backing store index.
new_storage->set(index.outobject_array_index(), *value);
@ -2907,13 +2907,13 @@ void MigrateFastToFast(Isolate* isolate, Handle<JSObject> object,
for (InternalIndex i : InternalIndex::Range(old_nof)) {
PropertyDetails details = new_descriptors->GetDetails(i);
if (details.location() != kField) continue;
if (details.location() != PropertyLocation::kField) continue;
DCHECK_EQ(kData, details.kind());
PropertyDetails old_details = old_descriptors->GetDetails(i);
Representation old_representation = old_details.representation();
Representation representation = details.representation();
Handle<Object> value;
if (old_details.location() == kDescriptor) {
if (old_details.location() == PropertyLocation::kDescriptor) {
if (old_details.kind() == kAccessor) {
// In case of kAccessor -> kData property reconfiguration, the property
// must already be prepared for data of certain type.
@ -2929,7 +2929,7 @@ void MigrateFastToFast(Isolate* isolate, Handle<JSObject> object,
DCHECK(!old_representation.IsDouble() && !representation.IsDouble());
}
} else {
DCHECK_EQ(kField, old_details.location());
DCHECK_EQ(PropertyLocation::kField, old_details.location());
FieldIndex index = FieldIndex::ForDescriptor(isolate, *old_map, i);
value = handle(object->RawFastPropertyAt(isolate, index), isolate);
if (!old_representation.IsDouble() && representation.IsDouble()) {
@ -2951,7 +2951,7 @@ void MigrateFastToFast(Isolate* isolate, Handle<JSObject> object,
for (InternalIndex i : InternalIndex::Range(old_nof, new_nof)) {
PropertyDetails details = new_descriptors->GetDetails(i);
if (details.location() != kField) continue;
if (details.location() != PropertyLocation::kField) continue;
DCHECK_EQ(kData, details.kind());
Handle<Object> value;
if (details.representation().IsDouble()) {
@ -3040,7 +3040,7 @@ void MigrateFastToSlow(Isolate* isolate, Handle<JSObject> object,
PropertyDetails details = descs->GetDetails(i);
Handle<Name> key(descs->GetKey(isolate, i), isolate);
Handle<Object> value;
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
FieldIndex index = FieldIndex::ForDescriptor(isolate, *map, i);
if (details.kind() == kData) {
value = handle(object->RawFastPropertyAt(isolate, index), isolate);
@ -3055,7 +3055,7 @@ void MigrateFastToSlow(Isolate* isolate, Handle<JSObject> object,
}
} else {
DCHECK_EQ(kDescriptor, details.location());
DCHECK_EQ(PropertyLocation::kDescriptor, details.location());
value = handle(descs->GetStrongValue(isolate, i), isolate);
}
DCHECK(!value.is_null());
@ -3597,7 +3597,7 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
new_map->set_may_have_interesting_symbols(true);
}
DCHECK_EQ(kField, details.location());
DCHECK_EQ(PropertyLocation::kField, details.location());
DCHECK_IMPLIES(!V8_DICT_PROPERTY_CONST_TRACKING_BOOL,
details.constness() == PropertyConstness::kMutable);
@ -3622,7 +3622,7 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
details.attributes());
}
details = d.GetDetails();
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
if (current_offset < inobject_props) {
object->InObjectPropertyAtPut(current_offset, value,
UPDATE_WRITE_BARRIER);
@ -4422,7 +4422,7 @@ Object JSObject::SlowReverseLookup(Object value) {
bool value_is_number = value.IsNumber();
for (InternalIndex i : map().IterateOwnDescriptors()) {
PropertyDetails details = descs.GetDetails(i);
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
DCHECK_EQ(kData, details.kind());
FieldIndex field_index = FieldIndex::ForDescriptor(map(), i);
Object property = RawFastPropertyAt(field_index);
@ -4435,7 +4435,7 @@ Object JSObject::SlowReverseLookup(Object value) {
return descs.GetKey(i);
}
} else {
DCHECK_EQ(kDescriptor, details.location());
DCHECK_EQ(PropertyLocation::kDescriptor, details.location());
if (details.kind() == kData) {
if (descs.GetStrongValue(i) == value) {
return descs.GetKey(i);

View File

@ -405,7 +405,7 @@ Handle<FixedArray> GetFastEnumPropertyKeys(Isolate* isolate,
Object key = descriptors->GetKey(i);
if (key.IsSymbol()) continue;
keys->set(index, key);
if (details.location() != kField) fields_only = false;
if (details.location() != PropertyLocation::kField) fields_only = false;
index++;
}
DCHECK_EQ(index, keys->length());
@ -422,7 +422,7 @@ Handle<FixedArray> GetFastEnumPropertyKeys(Isolate* isolate,
Object key = descriptors->GetKey(i);
if (key.IsSymbol()) continue;
DCHECK_EQ(kData, details.kind());
DCHECK_EQ(kField, details.location());
DCHECK_EQ(PropertyLocation::kField, details.location());
FieldIndex field_index = FieldIndex::ForDescriptor(*map, i);
indices->set(index, Smi::FromInt(field_index.GetLoadByFieldIndex()));
index++;

View File

@ -889,7 +889,7 @@ Handle<Object> LookupIterator::FetchValue(
result = holder_->property_dictionary(isolate_).ValueAt(
isolate_, dictionary_entry());
}
} else if (property_details_.location() == kField) {
} else if (property_details_.location() == PropertyLocation::kField) {
DCHECK_EQ(kData, property_details_.kind());
#if V8_ENABLE_WEBASSEMBLY
if (V8_UNLIKELY(holder_->IsWasmObject(isolate_))) {
@ -932,7 +932,7 @@ Handle<Object> LookupIterator::FetchValue(
bool LookupIterator::IsConstFieldValueEqualTo(Object value) const {
DCHECK(!IsElement(*holder_));
DCHECK(holder_->HasFastProperties(isolate_));
DCHECK_EQ(kField, property_details_.location());
DCHECK_EQ(PropertyLocation::kField, property_details_.location());
DCHECK_EQ(PropertyConstness::kConst, property_details_.constness());
if (value.IsUninitialized(isolate())) {
// Storing uninitialized value means that we are preparing for a computed
@ -1004,7 +1004,7 @@ bool LookupIterator::IsConstDictValueEqualTo(Object value) const {
int LookupIterator::GetFieldDescriptorIndex() const {
DCHECK(has_property_);
DCHECK(holder_->HasFastProperties());
DCHECK_EQ(kField, property_details_.location());
DCHECK_EQ(PropertyLocation::kField, property_details_.location());
DCHECK_EQ(kData, property_details_.kind());
// TODO(jkummerow): Propagate InternalIndex further.
return descriptor_number().as_int();
@ -1013,7 +1013,7 @@ int LookupIterator::GetFieldDescriptorIndex() const {
int LookupIterator::GetAccessorIndex() const {
DCHECK(has_property_);
DCHECK(holder_->HasFastProperties(isolate_));
DCHECK_EQ(kDescriptor, property_details_.location());
DCHECK_EQ(PropertyLocation::kDescriptor, property_details_.location());
DCHECK_EQ(kAccessor, property_details_.kind());
return descriptor_number().as_int();
}
@ -1021,7 +1021,7 @@ int LookupIterator::GetAccessorIndex() const {
FieldIndex LookupIterator::GetFieldIndex() const {
DCHECK(has_property_);
DCHECK(holder_->HasFastProperties(isolate_));
DCHECK_EQ(kField, property_details_.location());
DCHECK_EQ(PropertyLocation::kField, property_details_.location());
DCHECK(!IsElement(*holder_));
return FieldIndex::ForDescriptor(holder_->map(isolate_), descriptor_number());
}
@ -1062,7 +1062,7 @@ void LookupIterator::WriteDataValue(Handle<Object> value,
accessor->Set(object, number_, *value);
} else if (holder->HasFastProperties(isolate_)) {
DCHECK(holder->IsJSObject(isolate_));
if (property_details_.location() == kField) {
if (property_details_.location() == PropertyLocation::kField) {
// Check that in case of VariableMode::kConst field the existing value is
// equal to |value|.
DCHECK_IMPLIES(!initializing_store && property_details_.constness() ==
@ -1071,7 +1071,7 @@ void LookupIterator::WriteDataValue(Handle<Object> value,
JSObject::cast(*holder).WriteToField(descriptor_number(),
property_details_, *value);
} else {
DCHECK_EQ(kDescriptor, property_details_.location());
DCHECK_EQ(PropertyLocation::kDescriptor, property_details_.location());
DCHECK_EQ(PropertyConstness::kConst, property_details_.constness());
}
} else if (holder->IsJSGlobalObject(isolate_)) {

View File

@ -654,7 +654,8 @@ bool Map::CanBeDeprecated() const {
for (InternalIndex i : IterateOwnDescriptors()) {
PropertyDetails details = instance_descriptors(kRelaxedLoad).GetDetails(i);
if (details.representation().MightCauseMapDeprecation()) return true;
if (details.kind() == kData && details.location() == kDescriptor) {
if (details.kind() == kData &&
details.location() == PropertyLocation::kDescriptor) {
return true;
}
}
@ -729,7 +730,7 @@ void Map::AppendDescriptor(Isolate* isolate, Descriptor* desc) {
set_may_have_interesting_symbols(true);
}
PropertyDetails details = desc->GetDetails();
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
DCHECK_GT(UnusedPropertyFields(), 0);
AccountAddedPropertyField();
}
@ -737,7 +738,8 @@ void Map::AppendDescriptor(Isolate* isolate, Descriptor* desc) {
// This function does not support appending double field descriptors and
// it should never try to (otherwise, layout descriptor must be updated too).
#ifdef DEBUG
DCHECK(details.location() != kField || !details.representation().IsDouble());
DCHECK(details.location() != PropertyLocation::kField ||
!details.representation().IsDouble());
#endif
}

View File

@ -130,20 +130,20 @@ PropertyDetails MapUpdater::GetDetails(InternalIndex descriptor) const {
Object MapUpdater::GetValue(InternalIndex descriptor) const {
DCHECK(descriptor.is_found());
if (descriptor == modified_descriptor_) {
DCHECK_EQ(kDescriptor, new_location_);
DCHECK_EQ(PropertyLocation::kDescriptor, new_location_);
return *new_value_;
}
DCHECK_EQ(kDescriptor, GetDetails(descriptor).location());
DCHECK_EQ(PropertyLocation::kDescriptor, GetDetails(descriptor).location());
return old_descriptors_->GetStrongValue(descriptor);
}
FieldType MapUpdater::GetFieldType(InternalIndex descriptor) const {
DCHECK(descriptor.is_found());
if (descriptor == modified_descriptor_) {
DCHECK_EQ(kField, new_location_);
DCHECK_EQ(PropertyLocation::kField, new_location_);
return *new_field_type_;
}
DCHECK_EQ(kField, GetDetails(descriptor).location());
DCHECK_EQ(PropertyLocation::kField, GetDetails(descriptor).location());
return old_descriptors_->GetFieldType(descriptor);
}
@ -153,7 +153,7 @@ Handle<FieldType> MapUpdater::GetOrComputeFieldType(
DCHECK(descriptor.is_found());
// |location| is just a pre-fetched GetDetails(descriptor).location().
DCHECK_EQ(location, GetDetails(descriptor).location());
if (location == kField) {
if (location == PropertyLocation::kField) {
return handle(GetFieldType(descriptor), isolate_);
} else {
return GetValue(descriptor).OptimalType(isolate_, representation);
@ -165,7 +165,7 @@ Handle<FieldType> MapUpdater::GetOrComputeFieldType(
PropertyLocation location, Representation representation) {
// |location| is just a pre-fetched GetDetails(descriptor).location().
DCHECK_EQ(descriptors->GetDetails(descriptor).location(), location);
if (location == kField) {
if (location == PropertyLocation::kField) {
return handle(descriptors->GetFieldType(descriptor), isolate_);
} else {
return descriptors->GetStrongValue(descriptor)
@ -188,7 +188,7 @@ Handle<Map> MapUpdater::ReconfigureToDataField(InternalIndex descriptor,
modified_descriptor_ = descriptor;
new_kind_ = kData;
new_attributes_ = attributes;
new_location_ = kField;
new_location_ = PropertyLocation::kField;
PropertyDetails old_details =
old_descriptors_->GetDetails(modified_descriptor_);
@ -460,7 +460,7 @@ MapUpdater::State MapUpdater::TryReconfigureToDataFieldInplace() {
DCHECK_EQ(new_kind_, old_details.kind());
DCHECK_EQ(new_attributes_, old_details.attributes());
DCHECK_EQ(kField, old_details.location());
DCHECK_EQ(PropertyLocation::kField, old_details.location());
if (FLAG_trace_generalization) {
PrintGeneralization(
isolate_, old_map_, stdout, "uninitialized field", modified_descriptor_,
@ -581,7 +581,7 @@ MapUpdater::State MapUpdater::FindRootMap() {
old_details.attributes() != new_attributes_) {
return Normalize("Normalize_RootModification1");
}
if (old_details.location() != kField) {
if (old_details.location() != PropertyLocation::kField) {
return Normalize("Normalize_RootModification2");
}
if (!new_representation_.fits_into(old_details.representation())) {
@ -590,7 +590,7 @@ MapUpdater::State MapUpdater::FindRootMap() {
DCHECK_EQ(kData, old_details.kind());
DCHECK_EQ(kData, new_kind_);
DCHECK_EQ(kField, new_location_);
DCHECK_EQ(PropertyLocation::kField, new_location_);
// Modify root map in-place. The GeneralizeField method is a no-op
// if the {old_map_} is already general enough to hold the requested
@ -645,7 +645,7 @@ MapUpdater::State MapUpdater::FindTargetMap() {
tmp_representation = generalized;
}
if (tmp_details.location() == kField) {
if (tmp_details.location() == PropertyLocation::kField) {
Handle<FieldType> old_field_type =
GetOrComputeFieldType(i, old_details.location(), tmp_representation);
GeneralizeField(tmp_map, i, old_details.constness(), tmp_representation,
@ -676,12 +676,12 @@ MapUpdater::State MapUpdater::FindTargetMap() {
DCHECK(IsGeneralizableTo(new_constness_, details.constness()));
DCHECK_EQ(new_location_, details.location());
DCHECK(new_representation_.fits_into(details.representation()));
if (new_location_ == kField) {
DCHECK_EQ(kField, details.location());
if (new_location_ == PropertyLocation::kField) {
DCHECK_EQ(PropertyLocation::kField, details.location());
DCHECK(new_field_type_->NowIs(
target_descriptors.GetFieldType(modified_descriptor_)));
} else {
DCHECK(details.location() == kField ||
DCHECK(details.location() == PropertyLocation::kField ||
EqualImmutableValues(
*new_value_,
target_descriptors.GetStrongValue(modified_descriptor_)));
@ -766,7 +766,7 @@ Handle<DescriptorArray> MapUpdater::BuildDescriptorArray() {
int current_offset = 0;
for (InternalIndex i : InternalIndex::Range(root_nof)) {
PropertyDetails old_details = old_descriptors_->GetDetails(i);
if (old_details.location() == kField) {
if (old_details.location() == PropertyLocation::kField) {
current_offset += old_details.field_width_in_words();
}
Descriptor d(handle(GetKey(i), isolate_),
@ -793,22 +793,22 @@ Handle<DescriptorArray> MapUpdater::BuildDescriptorArray() {
// Note: failed values equality check does not invalidate per-object
// property constness.
PropertyLocation next_location =
old_details.location() == kField ||
target_details.location() == kField ||
old_details.location() == PropertyLocation::kField ||
target_details.location() == PropertyLocation::kField ||
!EqualImmutableValues(target_descriptors->GetStrongValue(i),
GetValue(i))
? kField
: kDescriptor;
? PropertyLocation::kField
: PropertyLocation::kDescriptor;
// Ensure that mutable values are stored in fields.
DCHECK_IMPLIES(next_constness == PropertyConstness::kMutable,
next_location == kField);
next_location == PropertyLocation::kField);
Representation next_representation =
old_details.representation().generalize(
target_details.representation());
if (next_location == kField) {
if (next_location == PropertyLocation::kField) {
Handle<FieldType> old_field_type =
GetOrComputeFieldType(i, old_details.location(), next_representation);
@ -837,7 +837,7 @@ Handle<DescriptorArray> MapUpdater::BuildDescriptorArray() {
current_offset += d.GetDetails().field_width_in_words();
new_descriptors->Set(i, &d);
} else {
DCHECK_EQ(kDescriptor, next_location);
DCHECK_EQ(PropertyLocation::kDescriptor, next_location);
DCHECK_EQ(PropertyConstness::kConst, next_constness);
Handle<Object> value(GetValue(i), isolate_);
@ -860,7 +860,7 @@ Handle<DescriptorArray> MapUpdater::BuildDescriptorArray() {
Representation next_representation = old_details.representation();
Descriptor d;
if (next_location == kField) {
if (next_location == PropertyLocation::kField) {
Handle<FieldType> next_field_type =
GetOrComputeFieldType(i, old_details.location(), next_representation);
@ -885,7 +885,7 @@ Handle<DescriptorArray> MapUpdater::BuildDescriptorArray() {
current_offset += d.GetDetails().field_width_in_words();
new_descriptors->Set(i, &d);
} else {
DCHECK_EQ(kDescriptor, next_location);
DCHECK_EQ(PropertyLocation::kDescriptor, next_location);
DCHECK_EQ(PropertyConstness::kConst, next_constness);
Handle<Object> value(GetValue(i), isolate_);
@ -924,7 +924,7 @@ Handle<Map> MapUpdater::FindSplitMap(Handle<DescriptorArray> descriptors) {
if (details.location() != next_details.location()) break;
if (!details.representation().Equals(next_details.representation())) break;
if (next_details.location() == kField) {
if (next_details.location() == PropertyLocation::kField) {
FieldType next_field_type = next_descriptors.GetFieldType(i);
if (!descriptors->GetFieldType(i).NowIs(next_field_type)) {
break;
@ -981,14 +981,14 @@ MapUpdater::State MapUpdater::ConstructNewMap() {
MaybeHandle<FieldType> new_field_type;
MaybeHandle<Object> old_value;
MaybeHandle<Object> new_value;
if (old_details.location() == kField) {
if (old_details.location() == PropertyLocation::kField) {
old_field_type = handle(
old_descriptors_->GetFieldType(modified_descriptor_), isolate_);
} else {
old_value = handle(old_descriptors_->GetStrongValue(modified_descriptor_),
isolate_);
}
if (new_details.location() == kField) {
if (new_details.location() == PropertyLocation::kField) {
new_field_type =
handle(new_descriptors->GetFieldType(modified_descriptor_), isolate_);
} else {
@ -999,7 +999,8 @@ MapUpdater::State MapUpdater::ConstructNewMap() {
PrintGeneralization(
isolate_, old_map_, stdout, "", modified_descriptor_, split_nof,
old_nof_,
old_details.location() == kDescriptor && new_location_ == kField,
old_details.location() == PropertyLocation::kDescriptor &&
new_location_ == PropertyLocation::kField,
old_details.representation(), new_details.representation(),
old_details.constness(), new_details.constness(), old_field_type,
old_value, new_field_type, new_value);
@ -1099,7 +1100,7 @@ void MapUpdater::UpdateFieldType(Isolate* isolate, Handle<Map> map,
DisallowGarbageCollection no_gc;
PropertyDetails details =
map->instance_descriptors(isolate).GetDetails(descriptor);
if (details.location() != kField) return;
if (details.location() != PropertyLocation::kField) return;
DCHECK_EQ(kData, details.kind());
if (new_constness != details.constness() && map->is_prototype_map()) {

View File

@ -230,7 +230,7 @@ class V8_EXPORT_PRIVATE MapUpdater {
PropertyKind new_kind_ = kData;
PropertyAttributes new_attributes_ = NONE;
PropertyConstness new_constness_ = PropertyConstness::kMutable;
PropertyLocation new_location_ = kField;
PropertyLocation new_location_ = PropertyLocation::kField;
Representation new_representation_ = Representation::None();
// Data specific to kField location.

View File

@ -502,7 +502,8 @@ int Map::NumberOfFields(ConcurrencyMode cmode) const {
: instance_descriptors();
int result = 0;
for (InternalIndex i : IterateOwnDescriptors()) {
if (descriptors.GetDetails(i).location() == kField) result++;
if (descriptors.GetDetails(i).location() == PropertyLocation::kField)
result++;
}
return result;
}
@ -513,7 +514,7 @@ Map::FieldCounts Map::GetFieldCounts() const {
int const_count = 0;
for (InternalIndex i : IterateOwnDescriptors()) {
PropertyDetails details = descriptors.GetDetails(i);
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
switch (details.constness()) {
case PropertyConstness::kMutable:
mutable_count++;
@ -599,9 +600,10 @@ Map Map::FindRootMap(Isolate* isolate) const {
Map Map::FindFieldOwner(Isolate* isolate, InternalIndex descriptor) const {
DisallowGarbageCollection no_gc;
DCHECK_EQ(kField, instance_descriptors(isolate, kRelaxedLoad)
.GetDetails(descriptor)
.location());
DCHECK_EQ(PropertyLocation::kField,
instance_descriptors(isolate, kRelaxedLoad)
.GetDetails(descriptor)
.location());
Map result = *this;
while (true) {
Object back = result.GetBackPointer(isolate);
@ -635,7 +637,8 @@ Map SearchMigrationTarget(Isolate* isolate, Map old_map) {
DescriptorArray old_descriptors = old_map.instance_descriptors(isolate);
for (InternalIndex i : old_map.IterateOwnDescriptors()) {
PropertyDetails old_details = old_descriptors.GetDetails(i);
if (old_details.location() == kField && old_details.kind() == kData) {
if (old_details.location() == PropertyLocation::kField &&
old_details.kind() == kData) {
FieldType old_type = old_descriptors.GetFieldType(i);
if (Map::FieldTypeIsCleared(old_details.representation(), old_type)) {
return Map();
@ -708,7 +711,7 @@ Map Map::TryReplayPropertyTransitions(Isolate* isolate, Map old_map,
if (!old_details.representation().fits_into(new_details.representation())) {
return Map();
}
if (new_details.location() == kField) {
if (new_details.location() == PropertyLocation::kField) {
if (new_details.kind() == kData) {
FieldType new_type = new_descriptors.GetFieldType(i);
// Cleared field types need special treatment. They represent lost
@ -717,7 +720,7 @@ Map Map::TryReplayPropertyTransitions(Isolate* isolate, Map old_map,
return Map();
}
DCHECK_EQ(kData, old_details.kind());
DCHECK_EQ(kField, old_details.location());
DCHECK_EQ(PropertyLocation::kField, old_details.location());
FieldType old_type = old_descriptors.GetFieldType(i);
if (FieldTypeIsCleared(old_details.representation(), old_type) ||
!old_type.NowIs(new_type)) {
@ -732,8 +735,8 @@ Map Map::TryReplayPropertyTransitions(Isolate* isolate, Map old_map,
UNREACHABLE();
}
} else {
DCHECK_EQ(kDescriptor, new_details.location());
if (old_details.location() == kField ||
DCHECK_EQ(PropertyLocation::kDescriptor, new_details.location());
if (old_details.location() == PropertyLocation::kField ||
old_descriptors.GetStrongValue(i) !=
new_descriptors.GetStrongValue(i)) {
return Map();
@ -1061,7 +1064,7 @@ int Map::NextFreePropertyIndex() const {
// Search properties backwards to find the last field.
for (int i = number_of_own_descriptors - 1; i >= 0; --i) {
PropertyDetails details = descs.GetDetails(InternalIndex(i));
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
return details.field_index() + details.field_width_in_words();
}
}
@ -1479,7 +1482,7 @@ void Map::InstallDescriptors(Isolate* isolate, Handle<Map> parent,
new_descriptor.as_int() + 1);
child->CopyUnusedPropertyFields(*parent);
PropertyDetails details = descriptors->GetDetails(new_descriptor);
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
child->AccountAddedPropertyField();
}
@ -1712,7 +1715,7 @@ namespace {
bool CanHoldValue(DescriptorArray descriptors, InternalIndex descriptor,
PropertyConstness constness, Object value) {
PropertyDetails details = descriptors.GetDetails(descriptor);
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
if (details.kind() == kData) {
return IsGeneralizableTo(constness, details.constness()) &&
value.FitsRepresentation(details.representation()) &&
@ -1723,7 +1726,7 @@ bool CanHoldValue(DescriptorArray descriptors, InternalIndex descriptor,
}
} else {
DCHECK_EQ(kDescriptor, details.location());
DCHECK_EQ(PropertyLocation::kDescriptor, details.location());
DCHECK_EQ(PropertyConstness::kConst, details.constness());
DCHECK_EQ(kAccessor, details.kind());
return false;
@ -2009,8 +2012,9 @@ Handle<Map> Map::CopyReplaceDescriptor(Isolate* isolate, Handle<Map> map,
DCHECK_EQ(*key, descriptors->GetKey(insertion_index));
// This function does not support replacing property fields as
// that would break property field counters.
DCHECK_NE(kField, descriptor->GetDetails().location());
DCHECK_NE(kField, descriptors->GetDetails(insertion_index).location());
DCHECK_NE(PropertyLocation::kField, descriptor->GetDetails().location());
DCHECK_NE(PropertyLocation::kField,
descriptors->GetDetails(insertion_index).location());
Handle<DescriptorArray> new_descriptors = DescriptorArray::CopyUpTo(
isolate, descriptors, map->NumberOfOwnDescriptors());
@ -2089,7 +2093,7 @@ bool Map::EquivalentToForElementsKindTransition(const Map other,
: instance_descriptors();
for (InternalIndex i : IterateOwnDescriptors()) {
PropertyDetails details = descriptors.GetDetails(i);
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
DCHECK(IsMostGeneralFieldType(details.representation(),
descriptors.GetFieldType(i)));
}

View File

@ -59,7 +59,7 @@ Smi PropertyDetails::AsSmi() const {
}
int PropertyDetails::field_width_in_words() const {
DCHECK_EQ(location(), kField);
DCHECK_EQ(location(), PropertyLocation::kField);
return 1;
}

View File

@ -2435,7 +2435,7 @@ void DescriptorArray::GeneralizeAllFields() {
for (InternalIndex i : InternalIndex::Range(length)) {
PropertyDetails details = GetDetails(i);
details = details.CopyWithRepresentation(Representation::Tagged());
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
DCHECK_EQ(kData, details.kind());
details = details.CopyWithConstness(PropertyConstness::kMutable);
SetValue(i, MaybeObject::FromObject(FieldType::Any()));

View File

@ -61,7 +61,7 @@ bool ToPropertyDescriptorFastPath(Isolate* isolate, Handle<JSReceiver> obj,
for (InternalIndex i : map->IterateOwnDescriptors()) {
PropertyDetails details = descs->GetDetails(i);
Handle<Object> value;
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
if (details.kind() == kData) {
value = JSObject::FastPropertyAt(Handle<JSObject>::cast(obj),
details.representation(),
@ -73,7 +73,7 @@ bool ToPropertyDescriptorFastPath(Isolate* isolate, Handle<JSReceiver> obj,
}
} else {
DCHECK_EQ(kDescriptor, details.location());
DCHECK_EQ(PropertyLocation::kDescriptor, details.location());
if (details.kind() == kData) {
value = handle(descs->GetStrongValue(i), isolate);
} else {

View File

@ -83,7 +83,7 @@ enum PropertyKind { kData = 0, kAccessor = 1 };
// Order of modes is significant.
// Must fit in the BitField PropertyDetails::LocationField.
enum PropertyLocation { kField = 0, kDescriptor = 1 };
enum class PropertyLocation { kField = 0, kDescriptor = 1 };
// Order of modes is significant.
// Must fit in the BitField PropertyDetails::ConstnessField.
@ -256,7 +256,8 @@ class PropertyDetails {
// Property details for global dictionary properties.
PropertyDetails(PropertyKind kind, PropertyAttributes attributes,
PropertyCellType cell_type, int dictionary_index = 0) {
value_ = KindField::encode(kind) | LocationField::encode(kField) |
value_ = KindField::encode(kind) |
LocationField::encode(PropertyLocation::kField) |
AttributesField::encode(attributes) |
// We track PropertyCell constness via PropertyCellTypeField,
// so we set ConstnessField to kMutable to simplify DCHECKs related
@ -269,7 +270,8 @@ class PropertyDetails {
// Property details for dictionary mode properties/elements.
PropertyDetails(PropertyKind kind, PropertyAttributes attributes,
PropertyConstness constness, int dictionary_index = 0) {
value_ = KindField::encode(kind) | LocationField::encode(kField) |
value_ = KindField::encode(kind) |
LocationField::encode(PropertyLocation::kField) |
AttributesField::encode(attributes) |
ConstnessField::encode(constness) |
DictionaryStorageField::encode(dictionary_index) |
@ -499,7 +501,7 @@ class PropertyDetails {
// kField location is more general than kDescriptor, kDescriptor generalizes
// only to itself.
inline bool IsGeneralizableTo(PropertyLocation a, PropertyLocation b) {
return b == kField || a == kDescriptor;
return b == PropertyLocation::kField || a == PropertyLocation::kDescriptor;
}
// PropertyConstness::kMutable constness is more general than

View File

@ -89,8 +89,8 @@ Descriptor Descriptor::DataField(Handle<Name> key, int field_index,
Representation representation,
const MaybeObjectHandle& wrapped_field_type) {
DCHECK(wrapped_field_type->IsSmi() || wrapped_field_type->IsWeak());
PropertyDetails details(kData, attributes, kField, constness, representation,
field_index);
PropertyDetails details(kData, attributes, PropertyLocation::kField,
constness, representation, field_index);
return Descriptor(key, wrapped_field_type, details);
}
@ -98,7 +98,7 @@ Descriptor Descriptor::DataConstant(Handle<Name> key, Handle<Object> value,
PropertyAttributes attributes) {
PtrComprCageBase cage_base = GetPtrComprCageBase(*key);
return Descriptor(key, MaybeObjectHandle(value), kData, attributes,
kDescriptor, PropertyConstness::kConst,
PropertyLocation::kDescriptor, PropertyConstness::kConst,
value->OptimalRepresentation(cage_base), 0);
}
@ -114,7 +114,7 @@ Descriptor Descriptor::AccessorConstant(Handle<Name> key,
Handle<Object> foreign,
PropertyAttributes attributes) {
return Descriptor(key, MaybeObjectHandle(foreign), kAccessor, attributes,
kDescriptor, PropertyConstness::kConst,
PropertyLocation::kDescriptor, PropertyConstness::kConst,
Representation::Tagged(), 0);
}
@ -134,7 +134,7 @@ void PropertyDetails::PrintAsFastTo(std::ostream& os, PrintMode mode) {
os << "(";
if (constness() == PropertyConstness::kConst) os << "const ";
os << (kind() == kData ? "data" : "accessor");
if (location() == kField) {
if (location() == PropertyLocation::kField) {
os << " field";
if (mode & kPrintFieldIndex) {
os << " " << field_index();

View File

@ -292,7 +292,7 @@ PrimitiveHeapObject InferMethodNameFromFastObject(Isolate* isolate,
auto details = descriptors.GetDetails(i);
if (details.IsDontEnum()) continue;
Object value;
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
auto field_index = FieldIndex::ForPropertyIndex(
map, details.field_index(), details.representation());
if (field_index.is_double()) continue;

View File

@ -326,7 +326,8 @@ Handle<String> TransitionsAccessor::ExpectedTransitionKey() {
case kWeakRef: {
Map target = Map::cast(raw_transitions_->GetHeapObjectAssumeWeak());
PropertyDetails details = GetSimpleTargetDetails(target);
if (details.location() != kField) return Handle<String>::null();
if (details.location() != PropertyLocation::kField)
return Handle<String>::null();
DCHECK_EQ(kData, details.kind());
if (details.attributes() != NONE) return Handle<String>::null();
Name name = GetSimpleTransitionKey(target);

View File

@ -270,7 +270,8 @@ MaybeHandle<Map> TransitionsAccessor::FindTransitionToDataProperty(
PropertyDetails details = target.GetLastDescriptorDetails(isolate_);
DCHECK_EQ(attributes, details.attributes());
DCHECK_EQ(kData, details.kind());
if (requested_location == kFieldOnly && details.location() != kField) {
if (requested_location == kFieldOnly &&
details.location() != PropertyLocation::kField) {
return MaybeHandle<Map>();
}
return Handle<Map>(target, isolate_);

View File

@ -621,7 +621,8 @@ Maybe<bool> ValueSerializer::WriteJSObject(Handle<JSObject> object) {
Handle<Object> value;
if (V8_LIKELY(!map_changed)) map_changed = *map != object->map();
if (V8_LIKELY(!map_changed && details.location() == kField)) {
if (V8_LIKELY(!map_changed &&
details.location() == PropertyLocation::kField)) {
DCHECK_EQ(kData, details.kind());
FieldIndex field_index = FieldIndex::ForDescriptor(*map, i);
value = JSObject::FastPropertyAt(object, details.representation(),

View File

@ -1423,7 +1423,7 @@ void V8HeapExplorer::ExtractPropertyReferences(JSObject js_obj,
for (InternalIndex i : js_obj.map().IterateOwnDescriptors()) {
PropertyDetails details = descs.GetDetails(i);
switch (details.location()) {
case kField: {
case PropertyLocation::kField: {
if (!snapshot_->capture_numeric_value()) {
Representation r = details.representation();
if (r.IsSmi() || r.IsDouble()) break;
@ -1439,7 +1439,7 @@ void V8HeapExplorer::ExtractPropertyReferences(JSObject js_obj,
nullptr, field_offset);
break;
}
case kDescriptor:
case PropertyLocation::kDescriptor:
SetDataOrAccessorPropertyReference(
details.kind(), entry, descs.GetKey(i), descs.GetStrongValue(i));
break;

View File

@ -298,7 +298,8 @@ bool AddDescriptorsByTemplate(
int count = 0;
for (InternalIndex i : InternalIndex::Range(nof_descriptors)) {
PropertyDetails details = descriptors_template->GetDetails(i);
if (details.location() == kDescriptor && details.kind() == kData) {
if (details.location() == PropertyLocation::kDescriptor &&
details.kind() == kData) {
count++;
}
}
@ -319,7 +320,7 @@ bool AddDescriptorsByTemplate(
Name name = descriptors_template->GetKey(i);
DCHECK(name.IsUniqueName());
PropertyDetails details = descriptors_template->GetDetails(i);
if (details.location() == kDescriptor) {
if (details.location() == PropertyLocation::kDescriptor) {
if (details.kind() == kData) {
if (value.IsSmi()) {
value = GetMethodWithSharedName(isolate, args, value);
@ -344,11 +345,13 @@ bool AddDescriptorsByTemplate(
UNREACHABLE();
}
DCHECK(value.FitsRepresentation(details.representation()));
if (details.location() == kDescriptor && details.kind() == kData) {
details = PropertyDetails(details.kind(), details.attributes(), kField,
PropertyConstness::kConst,
details.representation(), field_index)
.set_pointer(details.pointer());
if (details.location() == PropertyLocation::kDescriptor &&
details.kind() == kData) {
details =
PropertyDetails(details.kind(), details.attributes(),
PropertyLocation::kField, PropertyConstness::kConst,
details.representation(), field_index)
.set_pointer(details.pointer());
property_array->set(field_index, value);
field_index++;

View File

@ -110,7 +110,7 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
copy->map(isolate).instance_descriptors(isolate), isolate);
for (InternalIndex i : copy->map(isolate).IterateOwnDescriptors()) {
PropertyDetails details = descriptors->GetDetails(i);
DCHECK_EQ(kField, details.location());
DCHECK_EQ(PropertyLocation::kField, details.location());
DCHECK_EQ(kData, details.kind());
FieldIndex index = FieldIndex::ForPropertyIndex(
copy->map(isolate), details.field_index(),

View File

@ -186,7 +186,7 @@ bool DeleteObjectPropertyFast(Isolate* isolate, Handle<JSReceiver> receiver,
// Zap the property to avoid keeping objects alive. Zapping is not necessary
// for properties stored in the descriptor array.
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
DisallowGarbageCollection no_gc;
// Invalidate slots manually later in case we delete an in-object tagged

View File

@ -302,7 +302,7 @@ void StringStream::PrintUsingMap(JSObject js_object) {
DescriptorArray descs = map.instance_descriptors(js_object.GetIsolate());
for (InternalIndex i : map.IterateOwnDescriptors()) {
PropertyDetails details = descs.GetDetails(i);
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
DCHECK_EQ(kData, details.kind());
Object key = descs.GetKey(i);
if (key.IsString() || key.IsNumber()) {

View File

@ -392,7 +392,7 @@ void WebSnapshotSerializer::SerializeMap(Handle<Map> map, uint32_t& id) {
PropertyDetails details =
map->instance_descriptors(kRelaxedLoad).GetDetails(i);
if (details.location() != kField) {
if (details.location() != PropertyLocation::kField) {
Throw("Web snapshot: Properties which are not fields not supported");
return;
}
@ -1285,7 +1285,7 @@ void WebSnapshotDeserializer::DeserializeObjects() {
ReadValue(value, wanted_representation, property_array, i);
// Read the representation from the map.
PropertyDetails details = descriptors->GetDetails(InternalIndex(i));
CHECK_EQ(details.location(), kField);
CHECK_EQ(details.location(), PropertyLocation::kField);
CHECK_EQ(kData, details.kind());
Representation r = details.representation();
if (r.IsNone()) {

View File

@ -108,7 +108,7 @@ class Expectations {
CHECK(index < MAX_PROPERTIES);
kinds_[index] = kind;
locations_[index] = location;
if (kind == kData && location == kField &&
if (kind == kData && location == PropertyLocation::kField &&
IsTransitionableFastElementsKind(elements_kind_)) {
// Maps with transitionable elements kinds must have the most general
// field type.
@ -139,7 +139,7 @@ class Expectations {
os << " (";
if (constnesses_[i] == PropertyConstness::kConst) os << "const ";
os << (kinds_[i] == kData ? "data " : "accessor ");
if (locations_[i] == kField) {
if (locations_[i] == PropertyLocation::kField) {
os << "field"
<< ": " << representations_[i].Mnemonic();
} else {
@ -156,14 +156,15 @@ class Expectations {
Handle<FieldType> GetFieldType(int index) {
CHECK(index < MAX_PROPERTIES);
CHECK_EQ(kField, locations_[index]);
CHECK_EQ(PropertyLocation::kField, locations_[index]);
return Handle<FieldType>::cast(values_[index]);
}
void SetDataField(int index, PropertyAttributes attrs,
PropertyConstness constness, Representation representation,
Handle<FieldType> field_type) {
Init(index, kData, attrs, constness, kField, representation, field_type);
Init(index, kData, attrs, constness, PropertyLocation::kField,
representation, field_type);
}
void SetDataField(int index, PropertyConstness constness,
@ -174,8 +175,9 @@ class Expectations {
}
void SetAccessorField(int index, PropertyAttributes attrs) {
Init(index, kAccessor, attrs, PropertyConstness::kConst, kDescriptor,
Representation::Tagged(), FieldType::Any(isolate_));
Init(index, kAccessor, attrs, PropertyConstness::kConst,
PropertyLocation::kDescriptor, Representation::Tagged(),
FieldType::Any(isolate_));
}
void SetAccessorField(int index) {
@ -185,8 +187,8 @@ class Expectations {
void SetDataConstant(int index, PropertyAttributes attrs,
Handle<JSFunction> value) {
Handle<FieldType> field_type(FieldType::Class(value->map()), isolate_);
Init(index, kData, attrs, PropertyConstness::kConst, kField,
Representation::HeapObject(), field_type);
Init(index, kData, attrs, PropertyConstness::kConst,
PropertyLocation::kField, Representation::HeapObject(), field_type);
}
void SetDataConstant(int index, Handle<JSFunction> value) {
@ -195,8 +197,8 @@ class Expectations {
void SetAccessorConstant(int index, PropertyAttributes attrs,
Handle<Object> getter, Handle<Object> setter) {
Init(index, kAccessor, attrs, PropertyConstness::kConst, kDescriptor,
Representation::Tagged(), getter);
Init(index, kAccessor, attrs, PropertyConstness::kConst,
PropertyLocation::kDescriptor, Representation::Tagged(), getter);
setter_values_[index] = setter;
}
@ -204,7 +206,7 @@ class Expectations {
AccessorComponent component,
Handle<Object> accessor) {
CHECK_EQ(kAccessor, kinds_[index]);
CHECK_EQ(kDescriptor, locations_[index]);
CHECK_EQ(PropertyLocation::kDescriptor, locations_[index]);
CHECK(index < number_of_properties_);
if (component == ACCESSOR_GETTER) {
values_[index] = accessor;
@ -234,7 +236,7 @@ class Expectations {
void GeneralizeField(int index) {
CHECK(index < number_of_properties_);
representations_[index] = Representation::Tagged();
if (locations_[index] == kField) {
if (locations_[index] == PropertyLocation::kField) {
values_[index] = FieldType::Any(isolate_);
}
}
@ -255,7 +257,7 @@ class Expectations {
if (!details.representation().Equals(expected_representation)) return false;
Object expected_value = *values_[descriptor.as_int()];
if (details.location() == kField) {
if (details.location() == PropertyLocation::kField) {
if (details.kind() == kData) {
FieldType type = descriptors.GetFieldType(descriptor);
return FieldType::cast(expected_value) == type;

View File

@ -128,9 +128,9 @@ consts_misc = [
{ 'name': 'prop_kind_mask',
'value': 'PropertyDetails::KindField::kMask' },
{ 'name': 'prop_location_Descriptor',
'value': 'kDescriptor' },
'value': 'static_cast<int>(PropertyLocation::kDescriptor)' },
{ 'name': 'prop_location_Field',
'value': 'kField' },
'value': 'static_cast<int>(PropertyLocation::kField)' },
{ 'name': 'prop_location_mask',
'value': 'PropertyDetails::LocationField::kMask' },
{ 'name': 'prop_location_shift',