Reviewers: Igor Sheludko,

Message:
PTAL

Description:
Migrate to current map if deprecated in SetProperty

BUG=

Please review this at https://codereview.chromium.org/404963002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+14, -2 lines):
  M src/objects.cc


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));


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to