bool TransitionArray::IsSortedNoDuplicates(int valid_entries) {
DCHECK(valid_entries == -1);
Name* prev_key = NULL;
- bool prev_is_data_property = false;
+ PropertyKind prev_kind = DATA;
PropertyAttributes prev_attributes = NONE;
uint32_t prev_hash = 0;
for (int i = 0; i < number_of_transitions(); i++) {
Name* key = GetSortedKey(i);
uint32_t hash = key->Hash();
- bool is_data_property = false;
+ PropertyKind kind = DATA;
PropertyAttributes attributes = NONE;
if (!IsSpecialTransition(key)) {
Map* target = GetTarget(i);
PropertyDetails details = GetTargetDetails(key, target);
- is_data_property = details.type() == FIELD || details.type() == CONSTANT;
+ kind = details.kind();
attributes = details.attributes();
} else {
// Duplicate entries are not allowed for non-property transitions.
CHECK_NE(prev_key, key);
}
- int cmp =
- CompareKeys(prev_key, prev_hash, prev_is_data_property, prev_attributes,
- key, hash, is_data_property, attributes);
+ int cmp = CompareKeys(prev_key, prev_hash, prev_kind, prev_attributes, key,
+ hash, kind, attributes);
if (cmp >= 0) {
Print();
return false;
prev_key = key;
prev_hash = hash;
prev_attributes = attributes;
- prev_is_data_property = is_data_property;
+ prev_kind = kind;
}
return true;
}
DisallowHeapAllocation no_allocation;
if (!map->HasTransitionArray()) return Handle<Map>::null();
TransitionArray* transitions = map->transitions();
- int transition = transitions->Search(FIELD, *key, NONE);
+ int transition = transitions->Search(DATA, *key, NONE);
if (transition == TransitionArray::kNotFound) return Handle<Map>::null();
PropertyDetails details = transitions->GetTargetDetails(transition);
if (details.type() != FIELD) return Handle<Map>::null();
void Map::LookupTransition(JSObject* holder, Name* name,
PropertyAttributes attributes,
LookupResult* result) {
- int transition_index = this->SearchTransition(FIELD, name, attributes);
+ int transition_index = this->SearchTransition(DATA, name, attributes);
if (transition_index == TransitionArray::kNotFound) return result->NotFound();
result->TransitionResult(holder, this->GetTransition(transition_index));
}
}
-int Map::SearchTransition(PropertyType type, Name* name,
+int Map::SearchTransition(PropertyKind kind, Name* name,
PropertyAttributes attributes) {
if (HasTransitionArray()) {
- return transitions()->Search(type, name, attributes);
+ return transitions()->Search(kind, name, attributes);
}
return TransitionArray::kNotFound;
}
} else {
PropertyDetails details =
TransitionArray::GetTargetDetails(key, target);
- new_target_index = transition_array->Search(details.type(), key,
+ new_target_index = transition_array->Search(details.kind(), key,
details.attributes());
}
DCHECK_NE(TransitionArray::kNotFound, new_target_index);
// the current instance_descriptors to ensure proper sharing of descriptor
// arrays.
// Returns true if the transition target at given key was deprecated.
-bool Map::DeprecateTarget(PropertyType type, Name* key,
+bool Map::DeprecateTarget(PropertyKind kind, Name* key,
PropertyAttributes attributes,
DescriptorArray* new_descriptors,
LayoutDescriptor* new_layout_descriptor) {
bool transition_target_deprecated = false;
if (HasTransitionArray()) {
TransitionArray* transitions = this->transitions();
- int transition = transitions->Search(type, key, attributes);
+ int transition = transitions->Search(kind, key, attributes);
if (transition != TransitionArray::kNotFound) {
transitions->GetTarget(transition)->DeprecateTransitionTree();
transition_target_deprecated = true;
PropertyDetails details = descriptors->GetDetails(i);
TransitionArray* transitions = current->transitions();
int transition =
- transitions->Search(details.type(), name, details.attributes());
+ transitions->Search(details.kind(), name, details.attributes());
if (transition == TransitionArray::kNotFound) break;
Map* next = transitions->GetTarget(transition);
Handle<Map> target_map = root_map;
for (int i = root_nof; i < old_nof; ++i) {
PropertyDetails old_details = old_descriptors->GetDetails(i);
- int j = target_map->SearchTransition(old_details.type(),
+ int j = target_map->SearchTransition(old_details.kind(),
old_descriptors->GetKey(i),
old_details.attributes());
if (j == TransitionArray::kNotFound) break;
// Find the last compatible target map in the transition tree.
for (int i = target_nof; i < old_nof; ++i) {
PropertyDetails old_details = old_descriptors->GetDetails(i);
- int j = target_map->SearchTransition(old_details.type(),
+ int j = target_map->SearchTransition(old_details.kind(),
old_descriptors->GetKey(i),
old_details.attributes());
if (j == TransitionArray::kNotFound) break;
LayoutDescriptor::New(split_map, new_descriptors, old_nof);
PropertyDetails split_prop_details = old_descriptors->GetDetails(split_nof);
bool transition_target_deprecated = split_map->DeprecateTarget(
- split_prop_details.type(), old_descriptors->GetKey(split_nof),
+ split_prop_details.kind(), old_descriptors->GetKey(split_nof),
split_prop_details.attributes(), *new_descriptors,
*new_layout_descriptor);
Map* new_map = root_map;
for (int i = root_nof; i < old_nof; ++i) {
PropertyDetails old_details = old_descriptors->GetDetails(i);
- int j = new_map->SearchTransition(old_details.type(),
+ int j = new_map->SearchTransition(old_details.kind(),
old_descriptors->GetKey(i),
old_details.attributes());
if (j == TransitionArray::kNotFound) return MaybeHandle<Map>();
// Migrate to the newest map before storing the property.
map = Update(map);
- int index = map->SearchTransition(FIELD, *name, attributes);
+ int index = map->SearchTransition(DATA, *name, attributes);
if (index != TransitionArray::kNotFound) {
Handle<Map> transition(map->GetTransition(index));
int descriptor = transition->LastAdded();
? KEEP_INOBJECT_PROPERTIES
: CLEAR_INOBJECT_PROPERTIES;
- int index = map->SearchTransition(CALLBACKS, *name, attributes);
+ int index = map->SearchTransition(ACCESSOR, *name, attributes);
if (index != TransitionArray::kNotFound) {
Handle<Map> transition(map->GetTransition(index));
DescriptorArray* descriptors = transition->instance_descriptors();
inline Map* GetTransition(int transition_index);
inline int SearchSpecialTransition(Symbol* name);
- inline int SearchTransition(PropertyType type, Name* name,
+ inline int SearchTransition(PropertyKind kind, Name* name,
PropertyAttributes attributes);
inline FixedArrayBase* GetInitialElements();
void ZapTransitions();
void DeprecateTransitionTree();
- bool DeprecateTarget(PropertyType type, Name* key,
+ bool DeprecateTarget(PropertyKind kind, Name* key,
PropertyAttributes attributes,
DescriptorArray* new_descriptors,
LayoutDescriptor* new_layout_descriptor);
#endif
-int TransitionArray::CompareKeys(Name* key1, uint32_t hash1,
- bool is_data_property1,
+int TransitionArray::CompareKeys(Name* key1, uint32_t hash1, PropertyKind kind1,
PropertyAttributes attributes1, Name* key2,
- uint32_t hash2, bool is_data_property2,
+ uint32_t hash2, PropertyKind kind2,
PropertyAttributes attributes2) {
int cmp = CompareNames(key1, hash1, key2, hash2);
if (cmp != 0) return cmp;
- return CompareDetails(is_data_property1, attributes1, is_data_property2,
- attributes2);
+ return CompareDetails(kind1, attributes1, kind2, attributes2);
}
}
-int TransitionArray::CompareDetails(bool is_data_property1,
+int TransitionArray::CompareDetails(PropertyKind kind1,
PropertyAttributes attributes1,
- bool is_data_property2,
+ PropertyKind kind2,
PropertyAttributes attributes2) {
- if (is_data_property1 != is_data_property2) {
- return static_cast<int>(is_data_property1) <
- static_cast<int>(is_data_property2)
- ? -1
- : 1;
+ if (kind1 != kind2) {
+ return static_cast<int>(kind1) < static_cast<int>(kind2) ? -1 : 1;
}
if (attributes1 != attributes2) {
is_special_transition
? map->transitions()->SearchSpecial(Symbol::cast(*name),
&insertion_index)
- : map->transitions()->Search(details.type(), *name,
+ : map->transitions()->Search(details.kind(), *name,
details.attributes(), &insertion_index);
if (index == kNotFound) {
++new_nof;
index = is_special_transition ? map->transitions()->SearchSpecial(
Symbol::cast(*name), &insertion_index)
: map->transitions()->Search(
- details.type(), *name,
+ details.kind(), *name,
details.attributes(), &insertion_index);
if (index == kNotFound) {
++new_nof;
}
-int TransitionArray::SearchDetails(int transition, PropertyType type,
+int TransitionArray::SearchDetails(int transition, PropertyKind kind,
PropertyAttributes attributes,
int* out_insertion_index) {
int nof_transitions = number_of_transitions();
DCHECK(transition < nof_transitions);
Name* key = GetKey(transition);
- bool is_data = type == FIELD || type == CONSTANT;
for (; transition < nof_transitions && GetKey(transition) == key;
transition++) {
Map* target = GetTarget(transition);
PropertyDetails target_details = GetTargetDetails(key, target);
- bool target_is_data =
- target_details.type() == FIELD || target_details.type() == CONSTANT;
-
- int cmp = CompareDetails(is_data, attributes, target_is_data,
+ int cmp = CompareDetails(kind, attributes, target_details.kind(),
target_details.attributes());
if (cmp == 0) {
return transition;
}
-int TransitionArray::Search(PropertyType type, Name* name,
+int TransitionArray::Search(PropertyKind kind, Name* name,
PropertyAttributes attributes,
int* out_insertion_index) {
int transition = SearchName(name, out_insertion_index);
if (transition == kNotFound) {
return kNotFound;
}
- return SearchDetails(transition, type, attributes, out_insertion_index);
+ return SearchDetails(transition, kind, attributes, out_insertion_index);
}
} } // namespace v8::internal
static Handle<TransitionArray> Insert(Handle<Map> map, Handle<Name> name,
Handle<Map> target,
SimpleTransitionFlag flag);
- // Search a transition for a given type, property name and attributes.
- int Search(PropertyType type, Name* name, PropertyAttributes attributes,
+ // Search a transition for a given kind, property name and attributes.
+ int Search(PropertyKind kind, Name* name, PropertyAttributes attributes,
int* out_insertion_index = NULL);
// Search a non-property transition (like elements kind, observe or frozen
// Search a first transition for a given property name.
inline int SearchName(Name* name, int* out_insertion_index = NULL);
- int SearchDetails(int transition, PropertyType type,
+ int SearchDetails(int transition, PropertyKind kind,
PropertyAttributes attributes, int* out_insertion_index);
- // Compares two tuples <key, is_data_property, attributes>, returns -1 if
+ // Compares two tuples <key, kind, attributes>, returns -1 if
// tuple1 is "less" than tuple2, 0 if tuple1 equal to tuple2 and 1 otherwise.
- static inline int CompareKeys(Name* key1, uint32_t hash1,
- bool is_data_property1,
+ static inline int CompareKeys(Name* key1, uint32_t hash1, PropertyKind kind1,
PropertyAttributes attributes1, Name* key2,
- uint32_t hash2, bool is_data_property2,
+ uint32_t hash2, PropertyKind kind2,
PropertyAttributes attributes2);
// Compares keys, returns -1 if key1 is "less" than key2,
// Compares two details, returns -1 if details1 is "less" than details2,
// 0 if details1 equal to details2 and 1 otherwise.
- static inline int CompareDetails(bool is_data_property1,
+ static inline int CompareDetails(PropertyKind kind1,
PropertyAttributes attributes1,
- bool is_data_property2,
+ PropertyKind kind2,
PropertyAttributes attributes2);
inline void NoIncrementalWriteBarrierSet(int transition_number,
transitions->Insert(map0, name1, map1, SIMPLE_PROPERTY_TRANSITION);
ConnectTransition(map0, transitions, map1);
CHECK(transitions->IsSimpleTransition());
- transition = transitions->Search(FIELD, *name1, attributes);
+ transition = transitions->Search(DATA, *name1, attributes);
CHECK_EQ(TransitionArray::kSimpleTransitionIndex, transition);
CHECK_EQ(*name1, transitions->GetKey(transition));
CHECK_EQ(*map1, transitions->GetTarget(transition));
ConnectTransition(map0, transitions, map2);
CHECK(transitions->IsFullTransitionArray());
- transition = transitions->Search(FIELD, *name1, attributes);
+ transition = transitions->Search(DATA, *name1, attributes);
CHECK_EQ(*name1, transitions->GetKey(transition));
CHECK_EQ(*map1, transitions->GetTarget(transition));
- transition = transitions->Search(FIELD, *name2, attributes);
+ transition = transitions->Search(DATA, *name2, attributes);
CHECK_EQ(*name2, transitions->GetKey(transition));
CHECK_EQ(*map2, transitions->GetTarget(transition));
transitions = transitions->Insert(map0, name1, map1, PROPERTY_TRANSITION);
ConnectTransition(map0, transitions, map1);
CHECK(transitions->IsFullTransitionArray());
- transition = transitions->Search(FIELD, *name1, attributes);
+ transition = transitions->Search(DATA, *name1, attributes);
CHECK_EQ(*name1, transitions->GetKey(transition));
CHECK_EQ(*map1, transitions->GetTarget(transition));
ConnectTransition(map0, transitions, map2);
CHECK(transitions->IsFullTransitionArray());
- transition = transitions->Search(FIELD, *name1, attributes);
+ transition = transitions->Search(DATA, *name1, attributes);
CHECK_EQ(*name1, transitions->GetKey(transition));
CHECK_EQ(*map1, transitions->GetTarget(transition));
- transition = transitions->Search(FIELD, *name2, attributes);
+ transition = transitions->Search(DATA, *name2, attributes);
CHECK_EQ(*name2, transitions->GetKey(transition));
CHECK_EQ(*map2, transitions->GetTarget(transition));
}
for (int i = 0; i < PROPS_COUNT; i++) {
- int transition = transitions->Search(FIELD, *names[i], attributes);
+ int transition = transitions->Search(DATA, *names[i], attributes);
CHECK_EQ(*names[i], transitions->GetKey(transition));
CHECK_EQ(*maps[i], transitions->GetTarget(transition));
}
for (int i = 0; i < ATTRS_COUNT; i++) {
PropertyAttributes attributes = static_cast<PropertyAttributes>(i);
- int transition = transitions->Search(FIELD, *name, attributes);
+ int transition = transitions->Search(DATA, *name, attributes);
CHECK_EQ(*name, transitions->GetKey(transition));
CHECK_EQ(*attr_maps[i], transitions->GetTarget(transition));
}
for (int i = 0; i < ATTRS_COUNT; i++) {
PropertyAttributes attributes = static_cast<PropertyAttributes>(i);
- int transition = transitions->Search(FIELD, *name, attributes);
+ int transition = transitions->Search(DATA, *name, attributes);
CHECK_EQ(*name, transitions->GetKey(transition));
CHECK_EQ(*attr_maps[i], transitions->GetTarget(transition));
}
// Ensure that info about the other fields still valid.
for (int i = 0; i < PROPS_COUNT; i++) {
- int transition = transitions->Search(FIELD, *names[i], NONE);
+ int transition = transitions->Search(DATA, *names[i], NONE);
CHECK_EQ(*names[i], transitions->GetKey(transition));
CHECK_EQ(*maps[i], transitions->GetTarget(transition));
}