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

Unified Diff: src/objects-inl.h

Issue 661133002: TransitionArray now uses <is_data_property, name, attributes> tuple as a key, which allows to have … (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 6 years, 1 month 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 6d0f8d4e61110b55e641ad0b02dcf5dab36e2853..ebc95b7cac016f2e496967ad6960b9f633c0582d 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1884,11 +1884,10 @@ 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();
+ DCHECK_EQ(FIELD, transitions->GetTargetDetails(transition).type());
+ DCHECK_EQ(NONE, transitions->GetTargetDetails(transition).attributes());
return Handle<Map>(transitions->GetTarget(transition));
}
@@ -2943,10 +2942,10 @@ void Map::LookupDescriptor(JSObject* holder,
}
-void Map::LookupTransition(JSObject* holder,
- Name* name,
+void Map::LookupTransition(JSObject* holder, Name* name,
+ PropertyAttributes attributes,
LookupResult* result) {
- int transition_index = this->SearchTransition(name);
+ int transition_index = this->SearchTransition(FIELD, name, attributes);
if (transition_index == TransitionArray::kNotFound) return result->NotFound();
result->TransitionResult(holder, this->GetTransition(transition_index));
}
@@ -5217,7 +5216,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);
}
@@ -5234,8 +5234,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;
}
@@ -5288,9 +5299,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