Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 4e964f82310d48567a97577df574cd43db4204eb..0f5607277f499f27780ba00d6ef1ade0b67fcf3d 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -5208,9 +5208,8 @@ Map* Map::elements_transition_map() { |
bool Map::CanHaveMoreTransitions() { |
if (!HasTransitionArray()) return true; |
- return FixedArray::SizeFor(transitions()->length() + |
- TransitionArray::kTransitionSize) |
- <= Page::kMaxRegularHeapObjectSize; |
+ return transitions()->number_of_transitions() <= |
+ TransitionArray::kMaxNumberOfTransitions; |
} |
@@ -7000,6 +6999,14 @@ void Map::ClearCodeCache(Heap* heap) { |
} |
+int Map::SlackForArraySize(int old_size, int size_limit) { |
+ const int max_slack = size_limit - old_size; |
+ DCHECK(max_slack >= 0); |
+ if (old_size < 4) return Min(max_slack, 1); |
+ return Min(max_slack, old_size / 2); |
+} |
+ |
+ |
void JSArray::EnsureSize(Handle<JSArray> array, int required_size) { |
DCHECK(array->HasFastSmiOrObjectElements()); |
Handle<FixedArray> elts = handle(FixedArray::cast(array->elements())); |