Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 9edbdc9623475e24b2cfbc622a8f12a40c9eccde..f83e90db1db0f4b7c5c638c419b1ad21bbbc5944 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -1269,8 +1269,8 @@ void JSObject::PrintInstanceMigration(FILE* file, |
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).type() == CONSTANT && |
- n->GetDetails(i).type() == FIELD) { |
+ } else if (o->GetDetails(i).type() == DATA_CONSTANT && |
+ n->GetDetails(i).type() == DATA) { |
Name* name = o->GetKey(i); |
if (name->IsString()) { |
String::cast(name)->PrintOn(file); |
@@ -1648,7 +1648,7 @@ MaybeHandle<Map> Map::CopyWithField(Handle<Map> map, |
type = HeapType::Any(isolate); |
} |
- FieldDescriptor new_field_desc(name, index, type, attributes, representation); |
+ DataDescriptor new_field_desc(name, index, type, attributes, representation); |
Handle<Map> new_map = Map::CopyAddDescriptor(map, &new_field_desc, flag); |
int unused_property_fields = new_map->unused_property_fields() - 1; |
if (unused_property_fields < 0) { |
@@ -1670,7 +1670,7 @@ MaybeHandle<Map> Map::CopyWithConstant(Handle<Map> map, |
} |
// Allocate new instance descriptors with (name, constant) added. |
- ConstantDescriptor new_constant_desc(name, constant, attributes); |
+ DataConstantDescriptor new_constant_desc(name, constant, attributes); |
return Map::CopyAddDescriptor(map, &new_constant_desc, flag); |
} |
@@ -1691,7 +1691,7 @@ void JSObject::AddSlowProperty(Handle<JSObject> object, |
// Assign an enumeration index to the property and update |
// SetNextEnumerationIndex. |
int index = dict->NextEnumerationIndex(); |
- PropertyDetails details(attributes, FIELD, index); |
+ PropertyDetails details(attributes, DATA, index); |
dict->SetNextEnumerationIndex(index + 1); |
dict->SetEntry(entry, name, cell, details); |
return; |
@@ -1700,7 +1700,7 @@ void JSObject::AddSlowProperty(Handle<JSObject> object, |
PropertyCell::SetValueInferType(cell, value); |
value = cell; |
} |
- PropertyDetails details(attributes, FIELD, 0); |
+ PropertyDetails details(attributes, DATA, 0); |
Handle<NameDictionary> result = |
NameDictionary::Add(dict, name, value, details); |
if (*dict != *result) object->set_properties(*result); |
@@ -1895,7 +1895,7 @@ void JSObject::MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map) { |
} else { |
value = isolate->factory()->uninitialized_value(); |
} |
- DCHECK(details.type() == FIELD); |
+ DCHECK(details.type() == DATA); |
int target_index = details.field_index() - inobject; |
DCHECK(target_index >= 0); // Must be a backing store index. |
new_storage->set(target_index, *value); |
@@ -1921,18 +1921,17 @@ void JSObject::MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map) { |
for (int i = 0; i < old_nof; i++) { |
PropertyDetails details = new_descriptors->GetDetails(i); |
- if (details.type() != FIELD) continue; |
+ if (details.type() != DATA) continue; |
PropertyDetails old_details = old_descriptors->GetDetails(i); |
- if (old_details.type() == CALLBACKS) { |
+ if (old_details.type() == ACCESSOR_CONSTANT) { |
DCHECK(details.representation().IsTagged()); |
continue; |
} |
Representation old_representation = old_details.representation(); |
Representation representation = details.representation(); |
- DCHECK(old_details.type() == CONSTANT || |
- old_details.type() == FIELD); |
+ DCHECK(old_details.type() == DATA_CONSTANT || old_details.type() == DATA); |
Handle<Object> value; |
- if (old_details.type() == CONSTANT) { |
+ if (old_details.type() == DATA_CONSTANT) { |
value = handle(old_descriptors->GetValue(i), isolate); |
DCHECK(!old_representation.IsDouble() && !representation.IsDouble()); |
} else { |
@@ -1963,7 +1962,7 @@ void JSObject::MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map) { |
for (int i = old_nof; i < new_nof; i++) { |
PropertyDetails details = new_descriptors->GetDetails(i); |
- if (details.type() != FIELD) continue; |
+ if (details.type() != DATA) continue; |
Handle<Object> value; |
if (details.representation().IsDouble()) { |
value = isolate->factory()->NewHeapNumber(0, MUTABLE); |
@@ -2026,7 +2025,7 @@ int Map::NumberOfFields() { |
DescriptorArray* descriptors = instance_descriptors(); |
int result = 0; |
for (int i = 0; i < NumberOfOwnDescriptors(); i++) { |
- if (descriptors->GetDetails(i).type() == FIELD) result++; |
+ if (descriptors->GetDetails(i).type() == DATA) result++; |
} |
return result; |
} |
@@ -2045,7 +2044,7 @@ Handle<Map> Map::CopyGeneralizeAllRepresentations(Handle<Map> map, |
for (int i = 0; i < number_of_own_descriptors; i++) { |
descriptors->SetRepresentation(i, Representation::Tagged()); |
- if (descriptors->GetDetails(i).type() == FIELD) { |
+ if (descriptors->GetDetails(i).type() == DATA) { |
descriptors->SetValue(i, HeapType::Any()); |
} |
} |
@@ -2058,14 +2057,14 @@ Handle<Map> Map::CopyGeneralizeAllRepresentations(Handle<Map> map, |
// Unless the instance is being migrated, ensure that modify_index is a field. |
PropertyDetails details = descriptors->GetDetails(modify_index); |
- if (store_mode == FORCE_IN_OBJECT && |
- (details.type() != FIELD || details.attributes() != attributes)) { |
- int field_index = details.type() == FIELD ? details.field_index() |
- : new_map->NumberOfFields(); |
- FieldDescriptor d(handle(descriptors->GetKey(modify_index), isolate), |
- field_index, attributes, Representation::Tagged()); |
+ if (store_mode == FORCE_FIELD && |
+ (details.type() != DATA || details.attributes() != attributes)) { |
+ int field_index = details.type() == DATA ? details.field_index() |
+ : new_map->NumberOfFields(); |
+ DataDescriptor d(handle(descriptors->GetKey(modify_index), isolate), |
+ field_index, attributes, Representation::Tagged()); |
descriptors->Replace(modify_index, &d); |
- if (details.type() != FIELD) { |
+ if (details.type() != DATA) { |
int unused_property_fields = new_map->unused_property_fields() - 1; |
if (unused_property_fields < 0) { |
unused_property_fields += JSObject::kFieldsAdded; |
@@ -2077,13 +2076,14 @@ Handle<Map> Map::CopyGeneralizeAllRepresentations(Handle<Map> map, |
} |
if (FLAG_trace_generalization) { |
- HeapType* field_type = (details.type() == FIELD) |
- ? map->instance_descriptors()->GetFieldType(modify_index) |
- : NULL; |
+ HeapType* field_type = |
+ (details.type() == DATA) |
+ ? map->instance_descriptors()->GetFieldType(modify_index) |
+ : NULL; |
map->PrintGeneralization( |
stdout, reason, modify_index, new_map->NumberOfOwnDescriptors(), |
new_map->NumberOfOwnDescriptors(), |
- details.type() == CONSTANT && store_mode == FORCE_IN_OBJECT, |
+ details.type() == DATA_CONSTANT && store_mode == FORCE_FIELD, |
details.representation(), Representation::Tagged(), field_type, |
HeapType::Any()); |
} |
@@ -2191,7 +2191,7 @@ Map* Map::FindLastMatchMap(int verbatim, |
if (details.type() != next_details.type()) break; |
if (details.attributes() != next_details.attributes()) break; |
if (!details.representation().Equals(next_details.representation())) break; |
- if (next_details.type() == FIELD) { |
+ if (next_details.type() == DATA) { |
if (!descriptors->GetFieldType(i)->NowIs( |
next_descriptors->GetFieldType(i))) break; |
} else { |
@@ -2206,7 +2206,7 @@ Map* Map::FindLastMatchMap(int verbatim, |
Map* Map::FindFieldOwner(int descriptor) { |
DisallowHeapAllocation no_allocation; |
- DCHECK_EQ(FIELD, instance_descriptors()->GetDetails(descriptor).type()); |
+ DCHECK_EQ(DATA, instance_descriptors()->GetDetails(descriptor).type()); |
Map* result = this; |
while (true) { |
Object* back = result->GetBackPointer(); |
@@ -2224,7 +2224,7 @@ void Map::UpdateFieldType(int descriptor, Handle<Name> name, |
Handle<HeapType> new_type) { |
DisallowHeapAllocation no_allocation; |
PropertyDetails details = instance_descriptors()->GetDetails(descriptor); |
- if (details.type() != FIELD) return; |
+ if (details.type() != DATA) return; |
if (HasTransitionArray()) { |
TransitionArray* transitions = this->transitions(); |
for (int i = 0; i < transitions->number_of_transitions(); ++i) { |
@@ -2238,8 +2238,8 @@ void Map::UpdateFieldType(int descriptor, Handle<Name> name, |
// Skip if already updated the shared descriptor. |
if (instance_descriptors()->GetFieldType(descriptor) == *new_type) return; |
- FieldDescriptor d(name, instance_descriptors()->GetFieldIndex(descriptor), |
- new_type, details.attributes(), new_representation); |
+ DataDescriptor d(name, instance_descriptors()->GetFieldIndex(descriptor), |
+ new_type, details.attributes(), new_representation); |
instance_descriptors()->Replace(descriptor, &d); |
} |
@@ -2351,7 +2351,7 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map, |
// Doubles, however, would require a box allocation. |
if (old_representation.IsNone() && !new_representation.IsNone() && |
!new_representation.IsDouble()) { |
- DCHECK(old_details.type() == FIELD); |
+ DCHECK(old_details.type() == DATA); |
if (FLAG_trace_generalization) { |
old_map->PrintGeneralization( |
stdout, "uninitialized field", |
@@ -2379,8 +2379,8 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map, |
int root_nof = root_map->NumberOfOwnDescriptors(); |
if (modify_index < root_nof) { |
PropertyDetails old_details = old_descriptors->GetDetails(modify_index); |
- if ((old_details.type() != FIELD && store_mode == FORCE_IN_OBJECT) || |
- (old_details.type() == FIELD && |
+ if ((old_details.type() != DATA && store_mode == FORCE_FIELD) || |
+ (old_details.type() == DATA && |
(!new_field_type->NowIs(old_descriptors->GetFieldType(modify_index)) || |
!new_representation.fits_into(old_details.representation())))) { |
return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, |
@@ -2404,7 +2404,7 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map, |
PropertyType old_type = old_details.type(); |
PropertyType tmp_type = tmp_details.type(); |
DCHECK_EQ(old_details.attributes(), tmp_details.attributes()); |
- if ((tmp_type == CALLBACKS || old_type == CALLBACKS) && |
+ if ((tmp_type == ACCESSOR_CONSTANT || old_type == ACCESSOR_CONSTANT) && |
(tmp_type != old_type || |
tmp_descriptors->GetValue(i) != old_descriptors->GetValue(i))) { |
return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, |
@@ -2417,19 +2417,19 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map, |
modify_index == i)) { |
break; |
} |
- if (tmp_type == FIELD) { |
+ if (tmp_type == DATA) { |
// Generalize the field type as necessary. |
- Handle<HeapType> old_field_type = (old_type == FIELD) |
- ? handle(old_descriptors->GetFieldType(i), isolate) |
- : old_descriptors->GetValue(i)->OptimalType( |
- isolate, tmp_representation); |
+ Handle<HeapType> old_field_type = |
+ (old_type == DATA) ? handle(old_descriptors->GetFieldType(i), isolate) |
+ : old_descriptors->GetValue(i) |
+ ->OptimalType(isolate, tmp_representation); |
if (modify_index == i) { |
old_field_type = GeneralizeFieldType( |
new_field_type, old_field_type, isolate); |
} |
GeneralizeFieldType(tmp_map, i, tmp_representation, old_field_type); |
- } else if (tmp_type == CONSTANT) { |
- if (old_type != CONSTANT || |
+ } else if (tmp_type == DATA_CONSTANT) { |
+ if (old_type != DATA_CONSTANT || |
old_descriptors->GetConstant(i) != tmp_descriptors->GetConstant(i)) { |
break; |
} |
@@ -2445,14 +2445,14 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map, |
target_map->instance_descriptors(), isolate); |
int target_nof = target_map->NumberOfOwnDescriptors(); |
if (target_nof == old_nof && |
- (store_mode != FORCE_IN_OBJECT || |
- target_descriptors->GetDetails(modify_index).type() == FIELD)) { |
+ (store_mode != FORCE_FIELD || |
+ target_descriptors->GetDetails(modify_index).type() == DATA)) { |
DCHECK(modify_index < target_nof); |
DCHECK(new_representation.fits_into( |
target_descriptors->GetDetails(modify_index).representation())); |
- DCHECK(target_descriptors->GetDetails(modify_index).type() != FIELD || |
- new_field_type->NowIs( |
- target_descriptors->GetFieldType(modify_index))); |
+ DCHECK( |
+ target_descriptors->GetDetails(modify_index).type() != DATA || |
+ new_field_type->NowIs(target_descriptors->GetFieldType(modify_index))); |
return target_map; |
} |
@@ -2470,7 +2470,8 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map, |
// Check if target map is compatible. |
PropertyDetails tmp_details = tmp_descriptors->GetDetails(i); |
DCHECK_EQ(old_details.attributes(), tmp_details.attributes()); |
- if ((tmp_details.type() == CALLBACKS || old_details.type() == CALLBACKS) && |
+ if ((tmp_details.type() == ACCESSOR_CONSTANT || |
+ old_details.type() == ACCESSOR_CONSTANT) && |
(tmp_details.type() != old_details.type() || |
tmp_descriptors->GetValue(i) != old_descriptors->GetValue(i))) { |
return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, |
@@ -2498,7 +2499,7 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map, |
int current_offset = 0; |
for (int i = 0; i < root_nof; ++i) { |
PropertyDetails old_details = old_descriptors->GetDetails(i); |
- if (old_details.type() == FIELD) { |
+ if (old_details.type() == DATA) { |
current_offset += old_details.field_width_in_words(); |
} |
Descriptor d(handle(old_descriptors->GetKey(i), isolate), |
@@ -2520,30 +2521,32 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map, |
new_representation.generalize(target_details.representation())); |
} |
DCHECK_EQ(old_details.attributes(), target_details.attributes()); |
- if (old_details.type() == FIELD || target_details.type() == FIELD || |
- (modify_index == i && store_mode == FORCE_IN_OBJECT) || |
+ if (old_details.type() == DATA || target_details.type() == DATA || |
+ (modify_index == i && store_mode == FORCE_FIELD) || |
(target_descriptors->GetValue(i) != old_descriptors->GetValue(i))) { |
- Handle<HeapType> old_field_type = (old_details.type() == FIELD) |
- ? handle(old_descriptors->GetFieldType(i), isolate) |
- : old_descriptors->GetValue(i)->OptimalType( |
- isolate, target_details.representation()); |
- Handle<HeapType> target_field_type = (target_details.type() == FIELD) |
- ? handle(target_descriptors->GetFieldType(i), isolate) |
- : target_descriptors->GetValue(i)->OptimalType( |
- isolate, target_details.representation()); |
+ Handle<HeapType> old_field_type = |
+ (old_details.type() == DATA) |
+ ? handle(old_descriptors->GetFieldType(i), isolate) |
+ : old_descriptors->GetValue(i) |
+ ->OptimalType(isolate, target_details.representation()); |
+ Handle<HeapType> target_field_type = |
+ (target_details.type() == DATA) |
+ ? handle(target_descriptors->GetFieldType(i), isolate) |
+ : target_descriptors->GetValue(i) |
+ ->OptimalType(isolate, target_details.representation()); |
target_field_type = GeneralizeFieldType( |
target_field_type, old_field_type, isolate); |
if (modify_index == i) { |
target_field_type = GeneralizeFieldType( |
target_field_type, new_field_type, isolate); |
} |
- FieldDescriptor d(target_key, current_offset, target_field_type, |
- target_details.attributes(), |
- target_details.representation()); |
+ DataDescriptor d(target_key, current_offset, target_field_type, |
+ target_details.attributes(), |
+ target_details.representation()); |
current_offset += d.GetDetails().field_width_in_words(); |
new_descriptors->Set(i, &d); |
} else { |
- DCHECK_NE(FIELD, target_details.type()); |
+ DCHECK_NE(DATA, target_details.type()); |
Descriptor d(target_key, |
handle(target_descriptors->GetValue(i), isolate), |
target_details); |
@@ -2559,21 +2562,22 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map, |
old_details = old_details.CopyWithRepresentation( |
new_representation.generalize(old_details.representation())); |
} |
- if (old_details.type() == FIELD) { |
+ if (old_details.type() == DATA) { |
Handle<HeapType> old_field_type( |
old_descriptors->GetFieldType(i), isolate); |
if (modify_index == i) { |
old_field_type = GeneralizeFieldType( |
old_field_type, new_field_type, isolate); |
} |
- FieldDescriptor d(old_key, current_offset, old_field_type, |
- old_details.attributes(), old_details.representation()); |
+ DataDescriptor d(old_key, current_offset, old_field_type, |
+ old_details.attributes(), old_details.representation()); |
current_offset += d.GetDetails().field_width_in_words(); |
new_descriptors->Set(i, &d); |
} else { |
- DCHECK(old_details.type() == CONSTANT || old_details.type() == CALLBACKS); |
- if (modify_index == i && store_mode == FORCE_IN_OBJECT) { |
- FieldDescriptor d( |
+ DCHECK(old_details.type() == DATA_CONSTANT || |
+ old_details.type() == ACCESSOR_CONSTANT); |
+ if (modify_index == i && store_mode == FORCE_FIELD) { |
+ DataDescriptor d( |
old_key, current_offset, |
GeneralizeFieldType(old_descriptors->GetValue(i)->OptimalType( |
isolate, old_details.representation()), |
@@ -2582,7 +2586,7 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map, |
current_offset += d.GetDetails().field_width_in_words(); |
new_descriptors->Set(i, &d); |
} else { |
- DCHECK_NE(FIELD, old_details.type()); |
+ DCHECK_NE(DATA, old_details.type()); |
Descriptor d(old_key, |
handle(old_descriptors->GetValue(i), isolate), |
old_details); |
@@ -2593,8 +2597,8 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map, |
new_descriptors->Sort(); |
- DCHECK(store_mode != FORCE_IN_OBJECT || |
- new_descriptors->GetDetails(modify_index).type() == FIELD); |
+ DCHECK(store_mode != FORCE_FIELD || |
+ new_descriptors->GetDetails(modify_index).type() == DATA); |
Handle<Map> split_map(root_map->FindLastMatchMap( |
root_nof, old_nof, *new_descriptors), isolate); |
@@ -2620,17 +2624,21 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map, |
if (FLAG_trace_generalization) { |
PropertyDetails old_details = old_descriptors->GetDetails(modify_index); |
PropertyDetails new_details = new_descriptors->GetDetails(modify_index); |
- Handle<HeapType> old_field_type = (old_details.type() == FIELD) |
- ? handle(old_descriptors->GetFieldType(modify_index), isolate) |
- : HeapType::Constant(handle(old_descriptors->GetValue(modify_index), |
- isolate), isolate); |
- Handle<HeapType> new_field_type = (new_details.type() == FIELD) |
- ? handle(new_descriptors->GetFieldType(modify_index), isolate) |
- : HeapType::Constant(handle(new_descriptors->GetValue(modify_index), |
- isolate), isolate); |
+ Handle<HeapType> old_field_type = |
+ (old_details.type() == DATA) |
+ ? handle(old_descriptors->GetFieldType(modify_index), isolate) |
+ : HeapType::Constant( |
+ handle(old_descriptors->GetValue(modify_index), isolate), |
+ isolate); |
+ Handle<HeapType> new_field_type = |
+ (new_details.type() == DATA) |
+ ? handle(new_descriptors->GetFieldType(modify_index), isolate) |
+ : HeapType::Constant( |
+ handle(new_descriptors->GetValue(modify_index), isolate), |
+ isolate); |
old_map->PrintGeneralization( |
stdout, "", modify_index, split_nof, old_nof, |
- old_details.type() == CONSTANT && store_mode == FORCE_IN_OBJECT, |
+ old_details.type() == DATA_CONSTANT && store_mode == FORCE_FIELD, |
old_details.representation(), new_details.representation(), |
*old_field_type, *new_field_type); |
} |
@@ -2646,15 +2654,15 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map, |
} |
-// Generalize the representation of all FIELD descriptors. |
+// Generalize the representation of all DATA descriptors. |
Handle<Map> Map::GeneralizeAllFieldRepresentations( |
Handle<Map> map) { |
Handle<DescriptorArray> descriptors(map->instance_descriptors()); |
for (int i = 0; i < map->NumberOfOwnDescriptors(); ++i) { |
- if (descriptors->GetDetails(i).type() == FIELD) { |
+ if (descriptors->GetDetails(i).type() == DATA) { |
map = GeneralizeRepresentation(map, i, Representation::Tagged(), |
HeapType::Any(map->GetIsolate()), |
- FORCE_IN_OBJECT); |
+ FORCE_FIELD); |
} |
} |
return map; |
@@ -2718,27 +2726,27 @@ MaybeHandle<Map> Map::TryUpdateInternal(Handle<Map> old_map) { |
Object* new_value = new_descriptors->GetValue(i); |
Object* old_value = old_descriptors->GetValue(i); |
switch (new_details.type()) { |
- case FIELD: { |
+ case DATA: { |
PropertyType old_type = old_details.type(); |
- if (old_type == FIELD) { |
+ if (old_type == DATA) { |
if (!HeapType::cast(old_value)->NowIs(HeapType::cast(new_value))) { |
return MaybeHandle<Map>(); |
} |
} else { |
- DCHECK(old_type == CONSTANT); |
+ DCHECK(old_type == DATA_CONSTANT); |
if (!HeapType::cast(new_value)->NowContains(old_value)) { |
return MaybeHandle<Map>(); |
} |
} |
break; |
} |
- case ACCESSOR_FIELD: |
+ case ACCESSOR: |
DCHECK(HeapType::Any()->Is(HeapType::cast(new_value))); |
break; |
- case CONSTANT: |
- case CALLBACKS: |
- if (old_details.location() == IN_OBJECT || old_value != new_value) { |
+ case DATA_CONSTANT: |
+ case ACCESSOR_CONSTANT: |
+ if (old_details.location() == kField || old_value != new_value) { |
return MaybeHandle<Map>(); |
} |
break; |
@@ -3036,7 +3044,7 @@ MaybeHandle<Object> JSObject::SetElementWithCallbackSetterInPrototypes( |
int entry = dictionary->FindEntry(index); |
if (entry != SeededNumberDictionary::kNotFound) { |
PropertyDetails details = dictionary->DetailsAt(entry); |
- if (details.type() == CALLBACKS) { |
+ if (details.type() == ACCESSOR_CONSTANT) { |
*found = true; |
Handle<Object> structure(dictionary->ValueAt(entry), isolate); |
return SetElementWithCallback(object, structure, index, value, js_proto, |
@@ -3143,7 +3151,7 @@ struct DescriptorArrayAppender { |
int valid_descriptors, |
Handle<DescriptorArray> array) { |
DisallowHeapAllocation no_gc; |
- CallbacksDescriptor desc(key, entry, entry->property_attributes()); |
+ AccessorConstantDescriptor desc(key, entry, entry->property_attributes()); |
array->Append(&desc); |
} |
}; |
@@ -3773,7 +3781,7 @@ void JSObject::WriteToField(int descriptor, Object* value) { |
DescriptorArray* desc = map()->instance_descriptors(); |
PropertyDetails details = desc->GetDetails(descriptor); |
- DCHECK(details.type() == FIELD); |
+ DCHECK(details.type() == DATA); |
FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor); |
if (details.representation().IsDouble()) { |
@@ -4211,13 +4219,13 @@ void JSObject::MigrateFastToSlow(Handle<JSObject> object, |
PropertyDetails details = descs->GetDetails(i); |
Handle<Name> key(descs->GetKey(i)); |
switch (details.type()) { |
- case CONSTANT: { |
+ case DATA_CONSTANT: { |
Handle<Object> value(descs->GetConstant(i), isolate); |
- PropertyDetails d(details.attributes(), FIELD, i + 1); |
+ PropertyDetails d(details.attributes(), DATA, i + 1); |
dictionary = NameDictionary::Add(dictionary, key, value, d); |
break; |
} |
- case FIELD: { |
+ case DATA: { |
FieldIndex index = FieldIndex::ForDescriptor(*map, i); |
Handle<Object> value; |
if (object->IsUnboxedDoubleField(index)) { |
@@ -4231,20 +4239,20 @@ void JSObject::MigrateFastToSlow(Handle<JSObject> object, |
value = isolate->factory()->NewHeapNumber(old->value()); |
} |
} |
- PropertyDetails d(details.attributes(), FIELD, i + 1); |
+ PropertyDetails d(details.attributes(), DATA, i + 1); |
dictionary = NameDictionary::Add(dictionary, key, value, d); |
break; |
} |
- case ACCESSOR_FIELD: { |
+ case ACCESSOR: { |
FieldIndex index = FieldIndex::ForDescriptor(*map, i); |
Handle<Object> value(object->RawFastPropertyAt(index), isolate); |
- PropertyDetails d(details.attributes(), CALLBACKS, i + 1); |
+ PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1); |
dictionary = NameDictionary::Add(dictionary, key, value, d); |
break; |
} |
- case CALLBACKS: { |
+ case ACCESSOR_CONSTANT: { |
Handle<Object> value(descs->GetCallbacksObject(i), isolate); |
- PropertyDetails d(details.attributes(), CALLBACKS, i + 1); |
+ PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1); |
dictionary = NameDictionary::Add(dictionary, key, value, d); |
break; |
} |
@@ -4328,7 +4336,7 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object, |
Object* value = dictionary->ValueAt(index); |
PropertyType type = dictionary->DetailsAt(index).type(); |
- if (type == FIELD && !value->IsJSFunction()) { |
+ if (type == DATA && !value->IsJSFunction()) { |
number_of_fields += 1; |
} |
} |
@@ -4397,9 +4405,10 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object, |
PropertyType type = details.type(); |
if (value->IsJSFunction()) { |
- ConstantDescriptor d(key, handle(value, isolate), details.attributes()); |
+ DataConstantDescriptor d(key, handle(value, isolate), |
+ details.attributes()); |
descriptors->Set(enumeration_index - 1, &d); |
- } else if (type == FIELD) { |
+ } else if (type == DATA) { |
if (current_offset < inobject_props) { |
object->InObjectPropertyAtPut(current_offset, value, |
UPDATE_WRITE_BARRIER); |
@@ -4407,13 +4416,14 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object, |
int offset = current_offset - inobject_props; |
fields->set(offset, value); |
} |
- FieldDescriptor d(key, current_offset, details.attributes(), |
- // TODO(verwaest): value->OptimalRepresentation(); |
- Representation::Tagged()); |
+ DataDescriptor d(key, current_offset, details.attributes(), |
+ // TODO(verwaest): value->OptimalRepresentation(); |
+ Representation::Tagged()); |
current_offset += d.GetDetails().field_width_in_words(); |
descriptors->Set(enumeration_index - 1, &d); |
- } else if (type == CALLBACKS) { |
- CallbacksDescriptor d(key, handle(value, isolate), details.attributes()); |
+ } else if (type == ACCESSOR_CONSTANT) { |
+ AccessorConstantDescriptor d(key, handle(value, isolate), |
+ details.attributes()); |
descriptors->Set(enumeration_index - 1, &d); |
} else { |
UNREACHABLE(); |
@@ -4475,7 +4485,7 @@ static Handle<SeededNumberDictionary> CopyFastElementsToDictionary( |
value = handle(Handle<FixedArray>::cast(array)->get(i), isolate); |
} |
if (!value->IsTheHole()) { |
- PropertyDetails details(NONE, FIELD, 0); |
+ PropertyDetails details(NONE, DATA, 0); |
dictionary = |
SeededNumberDictionary::AddNumberEntry(dictionary, i, value, details); |
} |
@@ -4744,7 +4754,7 @@ Object* JSObject::GetHiddenPropertiesHashTable() { |
int sorted_index = descriptors->GetSortedKeyIndex(0); |
if (descriptors->GetKey(sorted_index) == GetHeap()->hidden_string() && |
sorted_index < map()->NumberOfOwnDescriptors()) { |
- DCHECK(descriptors->GetType(sorted_index) == FIELD); |
+ DCHECK(descriptors->GetType(sorted_index) == DATA); |
DCHECK(descriptors->GetDetails(sorted_index).representation(). |
IsCompatibleForLoad(Representation::Tagged())); |
FieldIndex index = FieldIndex::ForDescriptor(this->map(), |
@@ -5285,7 +5295,7 @@ static void ApplyAttributesToDictionary(Dictionary* dictionary, |
PropertyDetails details = dictionary->DetailsAt(i); |
int attrs = attributes; |
// READ_ONLY is an invalid attribute for JS setters/getters. |
- if ((attributes & READ_ONLY) && details.type() == CALLBACKS) { |
+ if ((attributes & READ_ONLY) && details.type() == ACCESSOR_CONSTANT) { |
Object* v = dictionary->ValueAt(i); |
if (v->IsPropertyCell()) v = PropertyCell::cast(v)->value(); |
if (v->IsAccessorPair()) attrs &= ~READ_ONLY; |
@@ -5525,7 +5535,7 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk( |
int limit = copy->map()->NumberOfOwnDescriptors(); |
for (int i = 0; i < limit; i++) { |
PropertyDetails details = descriptors->GetDetails(i); |
- if (details.type() != FIELD) continue; |
+ if (details.type() != DATA) continue; |
FieldIndex index = FieldIndex::ForDescriptor(copy->map(), i); |
if (object->IsUnboxedDoubleField(index)) { |
if (copying) { |
@@ -5750,7 +5760,7 @@ int Map::NextFreePropertyIndex() { |
DescriptorArray* descs = instance_descriptors(); |
for (int i = 0; i < number_of_own_descriptors; i++) { |
PropertyDetails details = descs->GetDetails(i); |
- if (details.type() == FIELD) { |
+ if (details.type() == DATA) { |
int candidate = details.field_index() + details.field_width_in_words(); |
if (candidate > free_index) free_index = candidate; |
} |
@@ -5841,7 +5851,7 @@ static Handle<FixedArray> GetEnumPropertyKeys(Handle<JSObject> object, |
if (!(details.IsDontEnum() || key->IsSymbol())) { |
storage->set(index, key); |
if (!indices.is_null()) { |
- if (details.type() != FIELD) { |
+ if (details.type() != DATA) { |
indices = Handle<FixedArray>(); |
} else { |
FieldIndex field_index = FieldIndex::ForDescriptor(*map, i); |
@@ -6004,12 +6014,11 @@ static bool UpdateGetterSetterInDictionary( |
if (entry != SeededNumberDictionary::kNotFound) { |
Object* result = dictionary->ValueAt(entry); |
PropertyDetails details = dictionary->DetailsAt(entry); |
- if (details.type() == CALLBACKS && result->IsAccessorPair()) { |
+ if (details.type() == ACCESSOR_CONSTANT && result->IsAccessorPair()) { |
DCHECK(details.IsConfigurable()); |
if (details.attributes() != attributes) { |
dictionary->DetailsAtPut( |
- entry, |
- PropertyDetails(attributes, CALLBACKS, index)); |
+ entry, PropertyDetails(attributes, ACCESSOR_CONSTANT, index)); |
} |
AccessorPair::cast(result)->SetComponents(getter, setter); |
return true; |
@@ -6111,14 +6120,14 @@ void JSObject::SetElementCallback(Handle<JSObject> object, |
Handle<Object> structure, |
PropertyAttributes attributes) { |
Heap* heap = object->GetHeap(); |
- PropertyDetails details = PropertyDetails(attributes, CALLBACKS, 0); |
+ PropertyDetails details = PropertyDetails(attributes, ACCESSOR_CONSTANT, 0); |
// Normalize elements to make this operation simple. |
bool had_dictionary_elements = object->HasDictionaryElements(); |
Handle<SeededNumberDictionary> dictionary = NormalizeElements(object); |
DCHECK(object->HasDictionaryElements() || |
object->HasDictionaryArgumentsElements()); |
- // Update the dictionary with the new CALLBACKS property. |
+ // Update the dictionary with the new ACCESSOR_CONSTANT property. |
dictionary = SeededNumberDictionary::Set(dictionary, index, structure, |
details); |
dictionary->set_requires_slow_elements(); |
@@ -6176,8 +6185,8 @@ void JSObject::SetPropertyCallback(Handle<JSObject> object, |
Deoptimizer::DeoptimizeGlobalObject(*object); |
} |
- // Update the dictionary with the new CALLBACKS property. |
- PropertyDetails details = PropertyDetails(attributes, CALLBACKS, 0); |
+ // Update the dictionary with the new ACCESSOR_CONSTANT property. |
+ PropertyDetails details = PropertyDetails(attributes, ACCESSOR_CONSTANT, 0); |
SetNormalizedProperty(object, name, structure, details); |
ReoptimizeIfPrototype(object); |
@@ -6391,7 +6400,7 @@ MaybeHandle<Object> JSObject::GetAccessor(Handle<JSObject> object, |
int entry = dictionary->FindEntry(index); |
if (entry != SeededNumberDictionary::kNotFound) { |
Object* element = dictionary->ValueAt(entry); |
- if (dictionary->DetailsAt(entry).type() == CALLBACKS && |
+ if (dictionary->DetailsAt(entry).type() == ACCESSOR_CONSTANT && |
element->IsAccessorPair()) { |
return handle(AccessorPair::cast(element)->GetComponent(component), |
isolate); |
@@ -6442,7 +6451,7 @@ Object* JSObject::SlowReverseLookup(Object* value) { |
DescriptorArray* descs = map()->instance_descriptors(); |
bool value_is_number = value->IsNumber(); |
for (int i = 0; i < number_of_own_descriptors; i++) { |
- if (descs->GetType(i) == FIELD) { |
+ if (descs->GetType(i) == DATA) { |
FieldIndex field_index = FieldIndex::ForDescriptor(map(), i); |
if (IsUnboxedDoubleField(field_index)) { |
if (value_is_number) { |
@@ -6462,7 +6471,7 @@ Object* JSObject::SlowReverseLookup(Object* value) { |
return descs->GetKey(i); |
} |
} |
- } else if (descs->GetType(i) == CONSTANT) { |
+ } else if (descs->GetType(i) == DATA_CONSTANT) { |
if (descs->GetConstant(i) == value) { |
return descs->GetKey(i); |
} |
@@ -6707,7 +6716,7 @@ Handle<Map> Map::CopyReplaceDescriptors( |
int length = descriptors->number_of_descriptors(); |
for (int i = 0; i < length; i++) { |
descriptors->SetRepresentation(i, Representation::Tagged()); |
- if (descriptors->GetDetails(i).type() == FIELD) { |
+ if (descriptors->GetDetails(i).type() == DATA) { |
descriptors->SetValue(i, HeapType::Any()); |
} |
} |
@@ -6746,7 +6755,7 @@ Handle<Map> Map::CopyInstallDescriptors( |
int unused_property_fields = map->unused_property_fields(); |
PropertyDetails details = descriptors->GetDetails(new_descriptor); |
- if (details.type() == FIELD) { |
+ if (details.type() == DATA) { |
unused_property_fields = map->unused_property_fields() - 1; |
if (unused_property_fields < 0) { |
unused_property_fields += JSObject::kFieldsAdded; |
@@ -6910,17 +6919,17 @@ Handle<Map> Map::CopyForPreventExtensions(Handle<Map> map, |
bool DescriptorArray::CanHoldValue(int descriptor, Object* value) { |
PropertyDetails details = GetDetails(descriptor); |
switch (details.type()) { |
- case FIELD: |
+ case DATA: |
return value->FitsRepresentation(details.representation()) && |
GetFieldType(descriptor)->NowContains(value); |
- case CONSTANT: |
+ case DATA_CONSTANT: |
DCHECK(GetConstant(descriptor) != value || |
value->FitsRepresentation(details.representation())); |
return GetConstant(descriptor) == value; |
- case ACCESSOR_FIELD: |
- case CALLBACKS: |
+ case ACCESSOR: |
+ case ACCESSOR_CONSTANT: |
return false; |
} |
@@ -6946,7 +6955,7 @@ Handle<Map> Map::PrepareForDataProperty(Handle<Map> map, int descriptor, |
Handle<HeapType> type = value->OptimalType(isolate, representation); |
return GeneralizeRepresentation(map, descriptor, representation, type, |
- FORCE_IN_OBJECT); |
+ FORCE_FIELD); |
} |
@@ -6960,7 +6969,7 @@ Handle<Map> Map::TransitionToDataProperty(Handle<Map> map, Handle<Name> name, |
// Migrate to the newest map before storing the property. |
map = Update(map); |
- int index = map->SearchTransition(DATA, *name, attributes); |
+ int index = map->SearchTransition(kData, *name, attributes); |
if (index != TransitionArray::kNotFound) { |
Handle<Map> transition(map->GetTransition(index)); |
int descriptor = transition->LastAdded(); |
@@ -7010,9 +7019,8 @@ Handle<Map> Map::ReconfigureDataProperty(Handle<Map> map, int descriptor, |
// For now, give up on transitioning and just create a unique map. |
// TODO(verwaest/ishell): Cache transitions with different attributes. |
- return CopyGeneralizeAllRepresentations(map, descriptor, FORCE_IN_OBJECT, |
- attributes, |
- "GenAll_AttributesMismatch"); |
+ return CopyGeneralizeAllRepresentations( |
+ map, descriptor, FORCE_FIELD, attributes, "GenAll_AttributesMismatch"); |
} |
@@ -7038,14 +7046,14 @@ Handle<Map> Map::TransitionToAccessorProperty(Handle<Map> map, |
? KEEP_INOBJECT_PROPERTIES |
: CLEAR_INOBJECT_PROPERTIES; |
- int index = map->SearchTransition(ACCESSOR, *name, attributes); |
+ int index = map->SearchTransition(kAccessor, *name, attributes); |
if (index != TransitionArray::kNotFound) { |
Handle<Map> transition(map->GetTransition(index)); |
DescriptorArray* descriptors = transition->instance_descriptors(); |
int descriptor = transition->LastAdded(); |
DCHECK(descriptors->GetKey(descriptor)->Equals(*name)); |
- DCHECK_EQ(ACCESSOR, descriptors->GetDetails(descriptor).kind()); |
+ DCHECK_EQ(kAccessor, descriptors->GetDetails(descriptor).kind()); |
DCHECK_EQ(attributes, descriptors->GetDetails(descriptor).attributes()); |
Handle<Object> maybe_pair(descriptors->GetValue(descriptor), isolate); |
@@ -7069,7 +7077,7 @@ Handle<Map> Map::TransitionToAccessorProperty(Handle<Map> map, |
return Map::Normalize(map, mode, "AccessorsOverwritingNonLast"); |
} |
PropertyDetails old_details = old_descriptors->GetDetails(descriptor); |
- if (old_details.type() != CALLBACKS) { |
+ if (old_details.type() != ACCESSOR_CONSTANT) { |
return Map::Normalize(map, mode, "AccessorsOverwritingNonAccessors"); |
} |
@@ -7099,7 +7107,7 @@ Handle<Map> Map::TransitionToAccessorProperty(Handle<Map> map, |
pair->set(component, *accessor); |
TransitionFlag flag = INSERT_TRANSITION; |
- CallbacksDescriptor new_desc(name, pair, attributes); |
+ AccessorConstantDescriptor new_desc(name, pair, attributes); |
return Map::CopyInsertDescriptor(map, &new_desc, flag); |
} |
@@ -7183,7 +7191,7 @@ Handle<DescriptorArray> DescriptorArray::CopyUpToAddAttributes( |
if (!key->IsSymbol() || !Symbol::cast(key)->is_private()) { |
int mask = DONT_DELETE | DONT_ENUM; |
// READ_ONLY is an invalid attribute for JS setters/getters. |
- if (details.type() != CALLBACKS || !value->IsAccessorPair()) { |
+ if (details.type() != ACCESSOR_CONSTANT || !value->IsAccessorPair()) { |
mask |= READ_ONLY; |
} |
details = details.CopyAddAttributes( |
@@ -9653,7 +9661,7 @@ void JSObject::OptimizeAsPrototype(Handle<JSObject> object, |
if (object->IsGlobalObject()) return; |
if (object->IsJSGlobalProxy()) return; |
if (mode == FAST_PROTOTYPE && !object->map()->is_prototype_map()) { |
- // First normalize to ensure all JSFunctions are CONSTANT. |
+ // First normalize to ensure all JSFunctions are DATA_CONSTANT. |
JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, 0, |
"NormalizeAsPrototype"); |
} |
@@ -12432,7 +12440,7 @@ MaybeHandle<Object> JSObject::SetDictionaryElement( |
if (entry != SeededNumberDictionary::kNotFound) { |
Handle<Object> element(dictionary->ValueAt(entry), isolate); |
PropertyDetails details = dictionary->DetailsAt(entry); |
- if (details.type() == CALLBACKS && set_mode == SET_PROPERTY) { |
+ if (details.type() == ACCESSOR_CONSTANT && set_mode == SET_PROPERTY) { |
return SetElementWithCallback(object, element, index, value, object, |
strict_mode); |
} else { |
@@ -12441,8 +12449,7 @@ MaybeHandle<Object> JSObject::SetDictionaryElement( |
// is read-only (a declared const that has not been initialized). If a |
// value is being defined we skip attribute checks completely. |
if (set_mode == DEFINE_PROPERTY) { |
- details = |
- PropertyDetails(attributes, FIELD, details.dictionary_index()); |
+ details = PropertyDetails(attributes, DATA, details.dictionary_index()); |
dictionary->DetailsAtPut(entry, details); |
} else if (details.IsReadOnly() && !element->IsTheHole()) { |
if (strict_mode == SLOPPY) { |
@@ -12493,7 +12500,7 @@ MaybeHandle<Object> JSObject::SetDictionaryElement( |
} |
} |
- PropertyDetails details(attributes, FIELD, 0); |
+ PropertyDetails details(attributes, DATA, 0); |
Handle<SeededNumberDictionary> new_dictionary = |
SeededNumberDictionary::AddNumberEntry(dictionary, index, value, |
details); |
@@ -14586,7 +14593,7 @@ Handle<Object> JSObject::PrepareSlowElementsForSort( |
HandleScope scope(isolate); |
Handle<Object> value(dict->ValueAt(i), isolate); |
PropertyDetails details = dict->DetailsAt(i); |
- if (details.type() == CALLBACKS || details.IsReadOnly()) { |
+ if (details.type() == ACCESSOR_CONSTANT || details.IsReadOnly()) { |
// Bail out and do the sorting of undefineds and array holes in JS. |
// Also bail out if the element is not supposed to be moved. |
return bailout; |
@@ -14620,7 +14627,7 @@ Handle<Object> JSObject::PrepareSlowElementsForSort( |
} |
uint32_t result = pos; |
- PropertyDetails no_details(NONE, FIELD, 0); |
+ PropertyDetails no_details(NONE, DATA, 0); |
while (undefs > 0) { |
if (pos > static_cast<uint32_t>(Smi::kMaxValue)) { |
// Adding an entry with the key beyond smi-range requires |
@@ -15006,7 +15013,7 @@ Handle<PropertyCell> JSGlobalObject::EnsurePropertyCell( |
Isolate* isolate = global->GetIsolate(); |
Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell( |
isolate->factory()->the_hole_value()); |
- PropertyDetails details(NONE, FIELD, 0); |
+ PropertyDetails details(NONE, DATA, 0); |
details = details.AsDeleted(); |
Handle<NameDictionary> dictionary = NameDictionary::Add( |
handle(global->property_dictionary()), name, cell, details); |
@@ -15486,7 +15493,7 @@ Handle<Derived> Dictionary<Derived, Shape, Key>::AtPut( |
#ifdef DEBUG |
USE(Shape::AsHandle(dictionary->GetIsolate(), key)); |
#endif |
- PropertyDetails details(NONE, FIELD, 0); |
+ PropertyDetails details(NONE, DATA, 0); |
AddEntry(dictionary, key, value, details, dictionary->Hash(key)); |
return dictionary; |
@@ -15574,7 +15581,7 @@ Handle<UnseededNumberDictionary> UnseededNumberDictionary::AddNumberEntry( |
uint32_t key, |
Handle<Object> value) { |
SLOW_DCHECK(dictionary->FindEntry(key) == kNotFound); |
- return Add(dictionary, key, value, PropertyDetails(NONE, FIELD, 0)); |
+ return Add(dictionary, key, value, PropertyDetails(NONE, DATA, 0)); |
} |
@@ -15662,7 +15669,7 @@ bool Dictionary<Derived, Shape, Key>::HasComplexElements() { |
if (DerivedHashTable::IsKey(k) && !FilterKey(k, NONE)) { |
PropertyDetails details = DetailsAt(i); |
if (details.IsDeleted()) continue; |
- if (details.type() == CALLBACKS) return true; |
+ if (details.type() == ACCESSOR_CONSTANT) return true; |
PropertyAttributes attr = details.attributes(); |
if (attr & (READ_ONLY | DONT_DELETE | DONT_ENUM)) return true; |
} |