array-spread-large-holey.js 503 Bytes
Newer Older
1 2 3 4 5
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Test spreading of large holey arrays, which are supposedly allocated in
6
// OldLargeObjectSpace. Holes should be replaced with undefined.
7 8 9 10 11 12 13 14 15 16 17

var arr = new Array(2e5);

for (var i = 0; i < 10; i++) {
  arr[i] = i;
}

var arr2 = [...arr];
assertTrue(arr2.hasOwnProperty(10));
assertEquals(undefined, arr2[10]);
assertEquals(9, arr2[9]);