blob: a104d8d39ed09a5f5bcd1b9092a1828f811ea249 [file] [log] [blame]
Ben Murdoch61f157c2016-09-16 13:49:30 +01001// Copyright 2016 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Slice and splice both try to set the length property of their return
6// value. Add a bogus setter to allow that.
7Object.defineProperty(Int32Array.prototype, 'length', { set(v) { } });
8
9(function testSlice() {
10 var a = new Array();
11 a.constructor = Int32Array;
12 a.length = 1000; // Make the length >= 1000 so UseSparseVariant returns true.
13 assertTrue(a.slice() instanceof Int32Array);
14})();
15
16(function testSplice() {
17 var a = new Array();
18 a.constructor = Int32Array;
19 a.length = 1000; // Make the length >= 1000 so UseSparseVariant returns true.
20 assertTrue(a.splice(1) instanceof Int32Array);
21})();