v8/test/mjsunit/es6/array-spread-large-holey.js
Leszek Swirski eb66765125 [heap] Add base class for LargeObjectSpaces
Both LO_SPACE and NEW_LO_SPACE use the basic page management system of
LargeObjectSpace, but implement different AllocateRaw methods (with
the NEW_LO_SPACE version shadowing the LO_SPACE version).

To clean this up, and allow other future LargeObjectSpace implementations
(in particular, an off-thread variant), refactored the current
LargeObjectSpace into a base class, and make both LargeObjectSpace
(renamed to OldLargeObjectSpace) and NewLargeObjectSpace extend this
class.

Bug: chromium:1011762
Change-Id: I41b45b97f2611611dcfde677213131396df03a5e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1876824
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64560}
2019-10-25 09:22:57 +00:00

18 lines
503 B
JavaScript

// 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
// OldLargeObjectSpace. Holes should be replaced with undefined.
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]);