}
-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);
}
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());
}
static void AppendCallbackDescriptors(Handle<Map> map,
Handle<Object> 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> map, int slack);
}
// We're gonna need a bigger TransitionArray.
- Handle<TransitionArray> result =
- Allocate(map->GetIsolate(), new_nof,
- Map::SlackForArraySize(false, number_of_transitions,
- kMaxNumberOfTransitions));
+ Handle<TransitionArray> 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