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

Unified Diff: src/objects.cc

Issue 10694155: Renamed ConvertDescriptorToFieldAndMapTransition to ConvertTransitionToMapTransition, and let it re… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 5 months 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.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 7cf21a1a7a9755cf86d47b1c1c0cda8e43f1296a..27fc3069dfea00cb779825ea8d61da358483df2e 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -1779,12 +1779,12 @@ MaybeObject* JSObject::ReplaceSlowProperty(String* name,
}
-MaybeObject* JSObject::ConvertDescriptorToFieldAndMapTransition(
+MaybeObject* JSObject::ConvertTransitionToMapTransition(
+ int transition_index,
String* name,
Object* new_value,
PropertyAttributes attributes) {
Map* old_map = map();
- FixedArray* old_properties = properties();
Object* result;
MaybeObject* maybe_result =
@@ -1797,23 +1797,10 @@ MaybeObject* JSObject::ConvertDescriptorToFieldAndMapTransition(
// with the map of "new Object()" cannot have transitions in the first place.
ASSERT(map() != GetIsolate()->empty_object_map());
- TransitionArray* new_transitions;
- MaybeObject* maybe_new_transitions = old_map->AddTransition(name, map());
- if (!maybe_new_transitions->To(&new_transitions)) {
- // Undo changes and return failure.
- set_map(old_map);
- set_properties(old_properties);
- return maybe_new_transitions;
- }
-
- MaybeObject* transition_added = old_map->set_transitions(new_transitions);
- if (transition_added->IsFailure()) {
- // Undo changes and return failure.
- set_map(old_map);
- set_properties(old_properties);
- return transition_added;
- }
-
+ // TODO(verwaest): From here on we lose existing map transitions, causing
+ // invalid back pointers. This will change once we can store multiple
+ // transitions with the same key.
+ old_map->SetTransition(transition_index, map());
map()->SetBackPointer(old_map);
return result;
}
@@ -2914,9 +2901,8 @@ MaybeObject* JSObject::SetPropertyForResult(LookupResult* result,
}
// Otherwise, replace with a map transition to a new map with a FIELD,
// even if the value is a constant function.
- return self->ConvertDescriptorToFieldAndMapTransition(*name,
- *value,
- attributes);
+ return ConvertTransitionToMapTransition(
+ result->GetTransitionIndex(), *name, *value, attributes);
}
case HANDLER:
case NONEXISTENT:
@@ -3030,7 +3016,8 @@ MaybeObject* JSObject::SetLocalPropertyIgnoreAttributes(
// Was transition to CONSTANT_FUNCTION. Replace with a map transition to a
// new map with a FIELD, even if the value is a function.
- return ConvertDescriptorToFieldAndMapTransition(name, value, attributes);
+ return ConvertTransitionToMapTransition(
+ result.GetTransitionIndex(), name, value, attributes);
}
case HANDLER:
case NONEXISTENT:
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698