Commit 6837ef99 authored by verwaest's avatar verwaest Committed by Commit bot

Partially revert r29468

BUG=chromium:507767
LOG=n

Review URL: https://codereview.chromium.org/1224853003

Cr-Commit-Position: refs/heads/master@{#29528}
parent 4b38c158
......@@ -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);
}
......
......@@ -6762,8 +6762,7 @@ Handle<Map> Map::ShareDescriptor(Handle<Map> 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());
}
......
......@@ -6027,8 +6027,7 @@ class Map: public HeapObject {
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);
......
......@@ -106,10 +106,9 @@ void TransitionArray::Insert(Handle<Map> map, Handle<Name> name,
}
// 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment