Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 59031d658c698ebf76ac8b4d5fcafc7b9b111cdb..d0f0f20660d7dccb2876806645fd357ce6d63cd2 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -8131,11 +8131,13 @@ void JSArray::set_length(Smi* length) { |
bool JSArray::SetLengthWouldNormalize(Heap* heap, uint32_t new_length) { |
+ // This constant is somewhat arbitrary. Any large enough value would work. |
+ const uint32_t kMaxFastArrayLength = 32 * 1024 * 1024; |
// If the new array won't fit in a some non-trivial fraction of the max old |
// space size, then force it to go dictionary mode. |
- uint32_t max_fast_array_size = |
+ uint32_t heap_based_upper_bound = |
static_cast<uint32_t>((heap->MaxOldGenerationSize() / kDoubleSize) / 4); |
- return new_length >= max_fast_array_size; |
+ return new_length >= Min(kMaxFastArrayLength, heap_based_upper_bound); |
} |