From: verwaest Date: Wed, 8 Jul 2015 10:01:47 +0000 (-0700) Subject: Partially revert r29468 X-Git-Tag: upstream/4.7.83~1512 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6837ef99710fb9cf8e179101b52a23e9d0af20a4;p=platform%2Fupstream%2Fv8.git Partially revert r29468 BUG=chromium:507767 LOG=n Review URL: https://codereview.chromium.org/1224853003 Cr-Commit-Position: refs/heads/master@{#29528} --- diff --git a/src/objects-inl.h b/src/objects-inl.h index 0e43e1d..120ca98 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -6946,12 +6946,13 @@ void Map::ClearCodeCache(Heap* heap) { } -int Map::SlackForArraySize(bool is_prototype_map, int old_size, - int size_limit) { +int Map::SlackForArraySize(int old_size, int size_limit) { const int max_slack = size_limit - old_size; CHECK_LE(0, max_slack); - if (old_size < 4) return Min(max_slack, 1); - if (is_prototype_map) return Min(max_slack, 4); + if (old_size < 4) { + DCHECK_LE(1, max_slack); + return 1; + } return Min(max_slack, old_size / 4); } diff --git a/src/objects.cc b/src/objects.cc index b14281a..3734361 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -6762,8 +6762,7 @@ Handle Map::ShareDescriptor(Handle map, if (old_size == 0) { descriptors = DescriptorArray::Allocate(map->GetIsolate(), 0, 1); } else { - int slack = SlackForArraySize(map->is_prototype_map(), old_size, - kMaxNumberOfDescriptors); + int slack = SlackForArraySize(old_size, kMaxNumberOfDescriptors); EnsureDescriptorSlack(map, slack); descriptors = handle(map->instance_descriptors()); } diff --git a/src/objects.h b/src/objects.h index dc96725..12eba2b 100644 --- a/src/objects.h +++ b/src/objects.h @@ -6027,8 +6027,7 @@ class Map: public HeapObject { static void AppendCallbackDescriptors(Handle map, Handle descriptors); - static inline int SlackForArraySize(bool is_prototype_map, int old_size, - int size_limit); + static inline int SlackForArraySize(int old_size, int size_limit); static void EnsureDescriptorSlack(Handle map, int slack); diff --git a/src/transitions.cc b/src/transitions.cc index 09884d5..f00f331 100644 --- a/src/transitions.cc +++ b/src/transitions.cc @@ -106,10 +106,9 @@ void TransitionArray::Insert(Handle map, Handle name, } // We're gonna need a bigger TransitionArray. - Handle result = - Allocate(map->GetIsolate(), new_nof, - Map::SlackForArraySize(false, number_of_transitions, - kMaxNumberOfTransitions)); + Handle result = Allocate( + map->GetIsolate(), new_nof, + Map::SlackForArraySize(number_of_transitions, kMaxNumberOfTransitions)); // The map's transition array may have shrunk during the allocation above as // it was weakly traversed, though it is guaranteed not to disappear. Trim the