| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index 99113f6fcfe08f43907cbb5d284931592af230c1..d9a730e069869bcaf36ffe40147340efa6102d3a 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -11720,6 +11720,17 @@ static void EndPerformSplice(Handle<JSArray> object) {
|
| MaybeHandle<Object> JSArray::SetElementsLength(
|
| Handle<JSArray> array,
|
| Handle<Object> new_length_handle) {
|
| + if (array->HasFastElements()) {
|
| + // 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.
|
| + int max_fast_array_size = static_cast<int>(
|
| + (array->GetHeap()->MaxOldGenerationSize() / kDoubleSize) / 4);
|
| + if (new_length_handle->IsNumber() &&
|
| + NumberToInt32(*new_length_handle) >= max_fast_array_size) {
|
| + NormalizeElements(array);
|
| + }
|
| + }
|
| +
|
| // We should never end in here with a pixel or external array.
|
| ASSERT(array->AllowsSetElementsLength());
|
| if (!array->map()->is_observed()) {
|
|
|