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

Unified Diff: src/objects.cc

Issue 404963002: Migrate to current map if deprecated in SetProperty (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | « no previous file | no next file » | 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 083f6e0a0b5267c6768587fc430cb5cc60e71dd7..cea2b2e3369d4d2e4c12d123788a980b6c6cdc90 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -7325,6 +7325,13 @@ Handle<Map> Map::PrepareForDataProperty(Handle<Map> map, int descriptor,
// Dictionaries can store any property value.
if (map->is_dictionary_map()) return map;
+ // Migrate to the newest map before storing the property.
+ if (map->is_deprecated()) {
+ map = GeneralizeRepresentation(map, 0, Representation::None(),
+ HeapType::None(map->GetIsolate()),
+ ALLOW_AS_CONSTANT);
+ }
+
Handle<DescriptorArray> descriptors(map->instance_descriptors());
if (descriptors->CanHoldValue(descriptor, *value)) return map;
@@ -7342,11 +7349,16 @@ Handle<Map> Map::TransitionToDataProperty(Handle<Map> map, Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StoreFromKeyed store_mode) {
- // Cannot currently handle deprecated maps.
- ASSERT(!map->is_deprecated());
// Dictionary maps can always have additional data properties.
if (map->is_dictionary_map()) return map;
+ // Migrate to the newest map before transitioning to the new property.
+ if (map->is_deprecated()) {
+ map = GeneralizeRepresentation(map, 0, Representation::None(),
+ HeapType::None(map->GetIsolate()),
+ ALLOW_AS_CONSTANT);
+ }
+
int index = map->SearchTransition(*name);
if (index != TransitionArray::kNotFound) {
Handle<Map> transition(map->GetTransition(index));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698