Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1094)

Unified Diff: src/objects-inl.h

Issue 793453004: Reland of "TransitionArray now uses <is_data_property, name, attributes> tuple as a key, which allo… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Post-rebase fixes Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 8362bcd913633ff5dcae96e4cec92b8cfa35c7e1..0823e6694040c35e78098774736295348ccb26b3 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1898,11 +1898,11 @@ Handle<Map> Map::FindTransitionToField(Handle<Map> map, Handle<Name> key) {
DisallowHeapAllocation no_allocation;
if (!map->HasTransitionArray()) return Handle<Map>::null();
TransitionArray* transitions = map->transitions();
- int transition = transitions->Search(*key);
+ int transition = transitions->Search(FIELD, *key, NONE);
if (transition == TransitionArray::kNotFound) return Handle<Map>::null();
- PropertyDetails target_details = transitions->GetTargetDetails(transition);
- if (target_details.type() != FIELD) return Handle<Map>::null();
- if (target_details.attributes() != NONE) return Handle<Map>::null();
+ PropertyDetails details = transitions->GetTargetDetails(transition);
+ if (details.type() != FIELD) return Handle<Map>::null();
+ DCHECK_EQ(NONE, details.attributes());
return Handle<Map>(transitions->GetTarget(transition));
}
@@ -3003,8 +3003,10 @@ void Map::LookupDescriptor(JSObject* holder,
}
-void Map::LookupTransition(JSObject* holder, Name* name, LookupResult* result) {
- int transition_index = this->SearchTransition(name);
+void Map::LookupTransition(JSObject* holder, Name* name,
+ PropertyAttributes attributes,
+ LookupResult* result) {
+ int transition_index = this->SearchTransition(FIELD, name, attributes);
if (transition_index == TransitionArray::kNotFound) return result->NotFound();
result->TransitionResult(holder, this->GetTransition(transition_index));
}
@@ -5351,7 +5353,8 @@ bool Map::HasTransitionArray() const {
Map* Map::elements_transition_map() {
- int index = transitions()->Search(GetHeap()->elements_transition_symbol());
+ int index =
+ transitions()->SearchSpecial(GetHeap()->elements_transition_symbol());
return transitions()->GetTarget(index);
}
@@ -5368,8 +5371,19 @@ Map* Map::GetTransition(int transition_index) {
}
-int Map::SearchTransition(Name* name) {
- if (HasTransitionArray()) return transitions()->Search(name);
+int Map::SearchSpecialTransition(Symbol* name) {
+ if (HasTransitionArray()) {
+ return transitions()->SearchSpecial(name);
+ }
+ return TransitionArray::kNotFound;
+}
+
+
+int Map::SearchTransition(PropertyType type, Name* name,
+ PropertyAttributes attributes) {
+ if (HasTransitionArray()) {
+ return transitions()->Search(type, name, attributes);
+ }
return TransitionArray::kNotFound;
}
@@ -5420,9 +5434,17 @@ void Map::set_transitions(TransitionArray* transition_array,
Map* target = transitions()->GetTarget(i);
if (target->instance_descriptors() == instance_descriptors()) {
Name* key = transitions()->GetKey(i);
- int new_target_index = transition_array->Search(key);
- DCHECK(new_target_index != TransitionArray::kNotFound);
- DCHECK(transition_array->GetTarget(new_target_index) == target);
+ int new_target_index;
+ if (TransitionArray::IsSpecialTransition(key)) {
+ new_target_index = transition_array->SearchSpecial(Symbol::cast(key));
+ } else {
+ PropertyDetails details =
+ TransitionArray::GetTargetDetails(key, target);
+ new_target_index = transition_array->Search(details.type(), key,
+ details.attributes());
+ }
+ DCHECK_NE(TransitionArray::kNotFound, new_target_index);
+ DCHECK_EQ(target, transition_array->GetTarget(new_target_index));
}
}
#endif
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698