Commit d4363986 authored by ishell's avatar ishell Committed by Commit bot

[runtime] Remove further usages of PropertyType in favor of PropertyKind/PropertyLocation.

BUG=v8:5495

Review-Url: https://codereview.chromium.org/2622413004
Cr-Commit-Position: refs/heads/master@{#42328}
parent 391f1ac3
......@@ -550,7 +550,7 @@ MaybeHandle<JSObject> ApiNatives::InstantiateRemoteObject(
void ApiNatives::AddDataProperty(Isolate* isolate, Handle<TemplateInfo> info,
Handle<Name> name, Handle<Object> value,
PropertyAttributes attributes) {
PropertyDetails details(attributes, DATA, 0, PropertyCellType::kNoCell);
PropertyDetails details(kData, attributes, 0, PropertyCellType::kNoCell);
auto details_handle = handle(details.AsSmi(), isolate);
Handle<Object> data[] = {name, details_handle, value};
AddPropertyToPropertyList(isolate, info, arraysize(data), data);
......@@ -562,7 +562,7 @@ void ApiNatives::AddDataProperty(Isolate* isolate, Handle<TemplateInfo> info,
PropertyAttributes attributes) {
auto value = handle(Smi::FromInt(intrinsic), isolate);
auto intrinsic_marker = isolate->factory()->true_value();
PropertyDetails details(attributes, DATA, 0, PropertyCellType::kNoCell);
PropertyDetails details(kData, attributes, 0, PropertyCellType::kNoCell);
auto details_handle = handle(details.AsSmi(), isolate);
Handle<Object> data[] = {name, intrinsic_marker, details_handle, value};
AddPropertyToPropertyList(isolate, info, arraysize(data), data);
......@@ -575,7 +575,7 @@ void ApiNatives::AddAccessorProperty(Isolate* isolate,
Handle<FunctionTemplateInfo> getter,
Handle<FunctionTemplateInfo> setter,
PropertyAttributes attributes) {
PropertyDetails details(attributes, ACCESSOR, 0, PropertyCellType::kNoCell);
PropertyDetails details(kAccessor, attributes, 0, PropertyCellType::kNoCell);
auto details_handle = handle(details.AsSmi(), isolate);
Handle<Object> data[] = {name, details_handle, getter, setter};
AddPropertyToPropertyList(isolate, info, arraysize(data), data);
......
......@@ -4414,7 +4414,7 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
DCHECK(!to->HasFastProperties());
// Add to dictionary.
Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate());
PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1,
PropertyDetails d(kAccessor, details.attributes(), i + 1,
PropertyCellType::kMutable);
JSObject::SetNormalizedProperty(to, key, callbacks, d);
}
......
......@@ -4617,7 +4617,7 @@ void CodeStubAssembler::InsertEntry<NameDictionary>(Node* dictionary,
// Prepare details of the new property.
Variable var_details(this, MachineRepresentation::kTaggedSigned);
const int kInitialIndex = 0;
PropertyDetails d(NONE, DATA, kInitialIndex, PropertyCellType::kNoCell);
PropertyDetails d(kData, NONE, kInitialIndex, PropertyCellType::kNoCell);
enum_index =
SmiShl(enum_index, PropertyDetails::DictionaryStorageField::kShift);
STATIC_ASSERT(kInitialIndex == 0);
......
......@@ -2456,7 +2456,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder,
field_type_(HType::Tagged()),
access_(HObjectAccess::ForMap()),
lookup_type_(NOT_FOUND),
details_(NONE, DATA, Representation::None()) {}
details_(PropertyDetails::Empty()) {}
// Checkes whether this PropertyAccessInfo can be handled as a monomorphic
// load named. It additionally fills in the fields necessary to generate the
......
......@@ -1247,11 +1247,11 @@ class ElementsAccessorBase : public ElementsAccessor {
static PropertyDetails GetDetailsImpl(FixedArrayBase* backing_store,
uint32_t entry) {
return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell);
return PropertyDetails(kData, NONE, 0, PropertyCellType::kNoCell);
}
static PropertyDetails GetDetailsImpl(JSObject* holder, uint32_t entry) {
return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell);
return PropertyDetails(kData, NONE, 0, PropertyCellType::kNoCell);
}
PropertyDetails GetDetails(JSObject* holder, uint32_t entry) final {
......@@ -1417,7 +1417,7 @@ class DictionaryElementsAccessor
if (attributes != NONE) object->RequireSlowElements(dictionary);
dictionary->ValueAtPut(entry, *value);
PropertyDetails details = dictionary->DetailsAt(entry);
details = PropertyDetails(attributes, DATA, details.dictionary_index(),
details = PropertyDetails(kData, attributes, details.dictionary_index(),
PropertyCellType::kNoCell);
dictionary->DetailsAtPut(entry, details);
}
......@@ -1425,7 +1425,7 @@ class DictionaryElementsAccessor
static void AddImpl(Handle<JSObject> object, uint32_t index,
Handle<Object> value, PropertyAttributes attributes,
uint32_t new_capacity) {
PropertyDetails details(attributes, DATA, 0, PropertyCellType::kNoCell);
PropertyDetails details(kData, attributes, 0, PropertyCellType::kNoCell);
Handle<SeededNumberDictionary> dictionary =
object->HasFastElements() || object->HasFastStringWrapperElements()
? JSObject::NormalizeElements(object)
......@@ -2721,12 +2721,12 @@ class TypedElementsAccessor
}
static PropertyDetails GetDetailsImpl(JSObject* holder, uint32_t entry) {
return PropertyDetails(DONT_DELETE, DATA, 0, PropertyCellType::kNoCell);
return PropertyDetails(kData, DONT_DELETE, 0, PropertyCellType::kNoCell);
}
static PropertyDetails GetDetailsImpl(FixedArrayBase* backing_store,
uint32_t entry) {
return PropertyDetails(DONT_DELETE, DATA, 0, PropertyCellType::kNoCell);
return PropertyDetails(kData, DONT_DELETE, 0, PropertyCellType::kNoCell);
}
static bool HasElementImpl(Isolate* isolate, Handle<JSObject> holder,
......@@ -3085,7 +3085,7 @@ class SloppyArgumentsElementsAccessor
FixedArray* parameter_map = FixedArray::cast(holder->elements());
uint32_t length = parameter_map->length() - 2;
if (entry < length) {
return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell);
return PropertyDetails(kData, NONE, 0, PropertyCellType::kNoCell);
}
FixedArray* arguments = FixedArray::cast(parameter_map->get(1));
return ArgumentsAccessor::GetDetailsImpl(arguments, entry - length);
......@@ -3272,7 +3272,7 @@ class SlowSloppyArgumentsElementsAccessor
old_elements->IsSeededNumberDictionary()
? Handle<SeededNumberDictionary>::cast(old_elements)
: JSObject::NormalizeElements(object);
PropertyDetails details(attributes, DATA, 0, PropertyCellType::kNoCell);
PropertyDetails details(kData, attributes, 0, PropertyCellType::kNoCell);
Handle<SeededNumberDictionary> new_dictionary =
SeededNumberDictionary::AddNumberEntry(dictionary, index, value,
details, object);
......@@ -3304,7 +3304,7 @@ class SlowSloppyArgumentsElementsAccessor
value = isolate->factory()->NewAliasedArgumentsEntry(context_entry);
}
PropertyDetails details(attributes, DATA, 0, PropertyCellType::kNoCell);
PropertyDetails details(kData, attributes, 0, PropertyCellType::kNoCell);
Handle<SeededNumberDictionary> arguments(
SeededNumberDictionary::cast(parameter_map->get(1)), isolate);
arguments = SeededNumberDictionary::AddNumberEntry(
......@@ -3483,8 +3483,7 @@ class StringWrapperElementsAccessor
if (entry < length) {
PropertyAttributes attributes =
static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
return PropertyDetails(attributes, v8::internal::DATA, 0,
PropertyCellType::kNoCell);
return PropertyDetails(kData, attributes, 0, PropertyCellType::kNoCell);
}
return BackingStoreAccessor::GetDetailsImpl(holder, entry - length);
}
......
......@@ -1737,7 +1737,7 @@ Handle<JSGlobalObject> Factory::NewJSGlobalObject(
PropertyDetails details = descs->GetDetails(i);
// Only accessors are expected.
DCHECK_EQ(kAccessor, details.kind());
PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1,
PropertyDetails d(kAccessor, details.attributes(), i + 1,
PropertyCellType::kMutable);
Handle<Name> name(descs->GetKey(i));
Handle<PropertyCell> cell = NewPropertyCell();
......
......@@ -275,8 +275,7 @@ void LookupIterator::ReconfigureDataProperty(Handle<Object> value,
JSObject::MigrateToMap(holder, new_map);
ReloadPropertyInformation<false>();
} else {
PropertyDetails details(attributes, v8::internal::DATA, 0,
PropertyCellType::kMutable);
PropertyDetails details(kData, attributes, 0, PropertyCellType::kMutable);
if (holder->IsJSGlobalObject()) {
Handle<GlobalDictionary> dictionary(holder->global_dictionary());
......@@ -344,7 +343,7 @@ void LookupIterator::PrepareTransitionToDataProperty(
// SetNextEnumerationIndex.
int index = dictionary->NextEnumerationIndex();
dictionary->SetNextEnumerationIndex(index + 1);
property_details_ = PropertyDetails(attributes, i::DATA, index,
property_details_ = PropertyDetails(kData, attributes, index,
PropertyCellType::kUninitialized);
PropertyCellType new_type =
PropertyCell::UpdatedType(cell, value, property_details_);
......@@ -355,7 +354,7 @@ void LookupIterator::PrepareTransitionToDataProperty(
} else {
// Don't set enumeration index (it will be set during value store).
property_details_ =
PropertyDetails(attributes, i::DATA, 0, PropertyCellType::kNoCell);
PropertyDetails(kData, attributes, 0, PropertyCellType::kNoCell);
transition_ = map;
}
return;
......@@ -369,7 +368,7 @@ void LookupIterator::PrepareTransitionToDataProperty(
if (transition->is_dictionary_map()) {
// Don't set enumeration index (it will be set during value store).
property_details_ =
PropertyDetails(attributes, i::DATA, 0, PropertyCellType::kNoCell);
PropertyDetails(kData, attributes, 0, PropertyCellType::kNoCell);
} else {
property_details_ = transition->GetLastDescriptorDetails();
has_property_ = true;
......@@ -518,8 +517,7 @@ void LookupIterator::TransitionToAccessorPair(Handle<Object> pair,
Handle<JSObject> receiver = GetStoreTarget();
holder_ = receiver;
PropertyDetails details(attributes, ACCESSOR_CONSTANT, 0,
PropertyCellType::kMutable);
PropertyDetails details(kAccessor, attributes, 0, PropertyCellType::kMutable);
if (IsElement()) {
// TODO(verwaest): Move code into the element accessor.
......
......@@ -3754,14 +3754,14 @@ void MigrateFastToSlow(Handle<JSObject> object, Handle<Map> new_map,
value = isolate->factory()->NewHeapNumber(old->value());
}
}
PropertyDetails d(details.attributes(), DATA, i + 1,
PropertyDetails d(kData, details.attributes(), i + 1,
PropertyCellType::kNoCell);
dictionary = NameDictionary::Add(dictionary, key, value, d);
} else {
DCHECK_EQ(kAccessor, details.kind());
Handle<Object> value(object->RawFastPropertyAt(index), isolate);
PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1,
PropertyDetails d(kAccessor, details.attributes(), i + 1,
PropertyCellType::kNoCell);
dictionary = NameDictionary::Add(dictionary, key, value, d);
}
......@@ -3770,14 +3770,14 @@ void MigrateFastToSlow(Handle<JSObject> object, Handle<Map> new_map,
DCHECK_EQ(kDescriptor, details.location());
if (details.kind() == kData) {
Handle<Object> value(descs->GetConstant(i), isolate);
PropertyDetails d(details.attributes(), DATA, i + 1,
PropertyDetails d(kData, details.attributes(), i + 1,
PropertyCellType::kNoCell);
dictionary = NameDictionary::Add(dictionary, key, value, d);
} else {
DCHECK_EQ(kAccessor, details.kind());
Handle<Object> value(descs->GetCallbacksObject(i), isolate);
PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1,
PropertyDetails d(kAccessor, details.attributes(), i + 1,
PropertyCellType::kNoCell);
dictionary = NameDictionary::Add(dictionary, key, value, d);
}
......@@ -5753,7 +5753,7 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
Representation::Tagged());
}
} else {
DCHECK_EQ(kDescriptor, details.location());
DCHECK_EQ(kAccessor, details.kind());
d = Descriptor::AccessorConstant(key, handle(value, isolate),
details.attributes());
}
......@@ -6967,7 +6967,7 @@ Maybe<bool> JSProxy::SetPrivateProperty(Isolate* isolate, Handle<JSProxy> proxy,
}
Handle<NameDictionary> dict(proxy->property_dictionary());
PropertyDetails details(DONT_ENUM, DATA, 0, PropertyCellType::kNoCell);
PropertyDetails details(kData, DONT_ENUM, 0, PropertyCellType::kNoCell);
Handle<NameDictionary> result =
NameDictionary::Add(dict, private_name, value, details);
if (!dict.is_identical_to(result)) proxy->set_properties(*result);
......@@ -17100,12 +17100,12 @@ Handle<PropertyCell> JSGlobalObject::EnsureEmptyPropertyCell(
if (original_cell_type == PropertyCellType::kInvalidated) {
cell = PropertyCell::InvalidateEntry(dictionary, entry);
}
PropertyDetails details(NONE, DATA, 0, cell_type);
PropertyDetails details(kData, NONE, 0, cell_type);
cell->set_property_details(details);
return cell;
}
cell = isolate->factory()->NewPropertyCell();
PropertyDetails details(NONE, DATA, 0, cell_type);
PropertyDetails details(kData, NONE, 0, cell_type);
dictionary =
GlobalDictionary::Add(dictionary, name, cell, details, entry_out);
// {*entry_out} is initialized inside GlobalDictionary::Add().
......
......@@ -232,26 +232,16 @@ enum class PropertyCellConstantType {
// They are used both in property dictionaries and instance descriptors.
class PropertyDetails BASE_EMBEDDED {
public:
PropertyDetails(PropertyAttributes attributes, PropertyType type, int index,
// Property details for dictionary mode properties/elements.
PropertyDetails(PropertyKind kind, PropertyAttributes attributes, int index,
PropertyCellType cell_type) {
value_ = TypeField::encode(type) | AttributesField::encode(attributes) |
value_ = KindField::encode(kind) | LocationField::encode(kField) |
AttributesField::encode(attributes) |
DictionaryStorageField::encode(index) |
PropertyCellTypeField::encode(cell_type);
DCHECK(type == this->type());
DCHECK(attributes == this->attributes());
}
PropertyDetails(PropertyAttributes attributes,
PropertyType type,
Representation representation,
int field_index = 0) {
value_ = TypeField::encode(type)
| AttributesField::encode(attributes)
| RepresentationField::encode(EncodeRepresentation(representation))
| FieldIndexField::encode(field_index);
}
// Property details for fast mode properties.
PropertyDetails(PropertyKind kind, PropertyAttributes attributes,
PropertyLocation location, Representation representation,
int field_index = 0) {
......@@ -263,7 +253,7 @@ class PropertyDetails BASE_EMBEDDED {
static PropertyDetails Empty(
PropertyCellType cell_type = PropertyCellType::kNoCell) {
return PropertyDetails(NONE, DATA, 0, cell_type);
return PropertyDetails(kData, NONE, 0, cell_type);
}
int pointer() const { return DescriptorPointer::decode(value_); }
......
......@@ -25,8 +25,8 @@ std::ostream& operator<<(std::ostream& os,
Descriptor Descriptor::DataField(Handle<Name> key, int field_index,
PropertyAttributes attributes,
Representation representation) {
return Descriptor(key, FieldType::Any(key->GetIsolate()), attributes, DATA,
representation, field_index);
return DataField(key, field_index, FieldType::Any(key->GetIsolate()),
attributes, representation);
}
// Outputs PropertyDetails as a dictionary details.
......
......@@ -37,19 +37,19 @@ class Descriptor final BASE_EMBEDDED {
PropertyAttributes attributes,
Representation representation) {
DCHECK(wrapped_field_type->IsSmi() || wrapped_field_type->IsWeakCell());
return Descriptor(key, wrapped_field_type, attributes, DATA, representation,
field_index);
return Descriptor(key, wrapped_field_type, kData, attributes, kField,
representation, field_index);
}
static Descriptor DataConstant(Handle<Name> key, Handle<Object> value,
PropertyAttributes attributes) {
return Descriptor(key, value, attributes, DATA_CONSTANT,
return Descriptor(key, value, kData, attributes, kDescriptor,
value->OptimalRepresentation());
}
static Descriptor AccessorConstant(Handle<Name> key, Handle<Object> foreign,
PropertyAttributes attributes) {
return Descriptor(key, foreign, attributes, ACCESSOR_CONSTANT,
return Descriptor(key, foreign, kAccessor, attributes, kDescriptor,
Representation::Tagged());
}
......@@ -73,12 +73,12 @@ class Descriptor final BASE_EMBEDDED {
DCHECK_IMPLIES(key->IsPrivate(), !details_.IsEnumerable());
}
Descriptor(Handle<Name> key, Handle<Object> value,
PropertyAttributes attributes, PropertyType type,
Descriptor(Handle<Name> key, Handle<Object> value, PropertyKind kind,
PropertyAttributes attributes, PropertyLocation location,
Representation representation, int field_index = 0)
: key_(key),
value_(value),
details_(attributes, type, representation, field_index) {
details_(kind, attributes, location, representation, field_index) {
DCHECK(key->IsUniqueName());
DCHECK_IMPLIES(key->IsPrivate(), !details_.IsEnumerable());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment