Reviewers: Toon Verwaest,

Description:
Version 3.30.33.5 (cherry-pick)

Merged 40d4674d611928314d7471b03a651b179481550b

Removed unnecessary generalization of all fields in
Map::GeneralizeRepresentation() (introduced in r25082).

BUG=chromium:431807
LOG=N
[email protected]

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

Base URL: https://chromium.googlesource.com/v8/[email protected]

Affected files (+18, -10 lines):
  M src/objects.h
  M src/objects.cc
  M src/version.cc


Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 9933e9c61497c8d3307ea4643cc96b65bc0eca07..a4c3beac0e8c94491982e4f995c696487cf8c9f8 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2228,17 +2228,20 @@ void Map::DeprecateTransitionTree() {
// Invalidates a transition target at |key|, and installs | new_descriptors| over
 // the current instance_descriptors to ensure proper sharing of descriptor
 // arrays.
-void Map::DeprecateTarget(Name* key, DescriptorArray* new_descriptors) {
+// Returns true if the transition target at given key was deprecated.
+bool Map::DeprecateTarget(Name* key, DescriptorArray* new_descriptors) {
+  bool transition_target_deprecated = false;
   if (HasTransitionArray()) {
     TransitionArray* transitions = this->transitions();
     int transition = transitions->Search(key);
     if (transition != TransitionArray::kNotFound) {
       transitions->GetTarget(transition)->DeprecateTransitionTree();
+      transition_target_deprecated = true;
     }
   }

   // Don't overwrite the empty descriptor array.
-  if (NumberOfOwnDescriptors() == 0) return;
+  if (NumberOfOwnDescriptors() == 0) return transition_target_deprecated;

   DescriptorArray* to_replace = instance_descriptors();
   Map* current = this;
@@ -2252,6 +2255,7 @@ void Map::DeprecateTarget(Name* key, DescriptorArray* new_descriptors) {
   }

   set_owns_descriptors(false);
+  return transition_target_deprecated;
 }


@@ -2685,9 +2689,17 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map,
   int split_nof = split_map->NumberOfOwnDescriptors();
   DCHECK_NE(old_nof, split_nof);

-  split_map->DeprecateTarget(
-      old_descriptors->GetKey(split_nof), *new_descriptors);
+  bool transition_target_deprecated =
+      split_map->DeprecateTarget(old_descriptors->GetKey(split_nof),
+                                 *new_descriptors);

+  // If |transition_target_deprecated| is true then the transition array
+ // already contains entry for given descriptor. This means that the transition + // could be inserted regardless of whether transitions array is full or not. + if (!transition_target_deprecated && !split_map->CanHaveMoreTransitions()) { + return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode,
+                                            "can't have more transitions");
+  }
   if (FLAG_trace_generalization) {
PropertyDetails old_details = old_descriptors->GetDetails(modify_index); PropertyDetails new_details = new_descriptors->GetDetails(modify_index); @@ -2709,10 +2721,6 @@ Handle<Map> Map::GeneralizeRepresentation(Handle<Map> old_map,
   // Add missing transitions.
   Handle<Map> new_map = split_map;
   for (int i = split_nof; i < old_nof; ++i) {
-    if (!new_map->CanHaveMoreTransitions()) {
- return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, - "can't have more transitions");
-    }
     new_map = CopyInstallDescriptors(new_map, i, new_descriptors);
   }
   new_map->set_owns_descriptors(true);
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index d12896fb94d8d1aa2b0dce522c819f59dd3905e3..3ae21cbb947958f02405fa9284e8b5cbe220cccb 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -6362,7 +6362,7 @@ class Map: public HeapObject {
   void ZapTransitions();

   void DeprecateTransitionTree();
-  void DeprecateTarget(Name* key, DescriptorArray* new_descriptors);
+  bool DeprecateTarget(Name* key, DescriptorArray* new_descriptors);

Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors);

Index: src/version.cc
diff --git a/src/version.cc b/src/version.cc
index c67199a750ee0c9c4eaf8fbc364c1192a1e24324..86ce69cab9c413af008cef6764dc356f92f650bb 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     30
 #define BUILD_NUMBER      33
-#define PATCH_LEVEL       4
+#define PATCH_LEVEL       5
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0


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