Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 5d85b13614ca6c2c64592cf769e2b7a88d5a5936..5473e690eb2a852b34f2269bdf1c3b563d7cfb62 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -6594,7 +6594,8 @@ Handle<Map> Map::ShareDescriptor(Handle<Map> map, |
if (old_size == 0) { |
descriptors = DescriptorArray::Allocate(map->GetIsolate(), 0, 1); |
} else { |
- EnsureDescriptorSlack(map, old_size < 4 ? 1 : old_size / 2); |
+ EnsureDescriptorSlack( |
+ map, SlackForArraySize(old_size, kMaxNumberOfDescriptors)); |
descriptors = handle(map->instance_descriptors()); |
} |
} |
@@ -6619,8 +6620,11 @@ void Map::ConnectTransition(Handle<Map> parent, Handle<Map> child, |
DCHECK(child->is_prototype_map()); |
} else { |
Handle<TransitionArray> transitions = |
- TransitionArray::CopyInsert(parent, name, child, flag); |
- parent->set_transitions(*transitions); |
+ TransitionArray::Insert(parent, name, child, flag); |
+ if (!parent->HasTransitionArray() || |
+ *transitions != parent->transitions()) { |
+ parent->set_transitions(*transitions); |
+ } |
child->SetBackPointer(*parent); |
} |
} |