Home | History | Annotate | Download | only in regress
      1 // Copyright 2014 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 function newArrayWithGetter() {
      6   var arr = [1, 2, 3];
      7   Object.defineProperty(arr, '1', {
      8     get: function() { delete this[1]; return undefined; },
      9     configurable: true
     10   });
     11   return arr;
     12 }
     13 
     14 var a = newArrayWithGetter();
     15 var s = a.slice(1);
     16 assertTrue('0' in s);
     17 
     18 // Sparse case should hit the same code as above due to presence of the getter.
     19 a = newArrayWithGetter();
     20 a[0xffff] = 4;
     21 s = a.slice(1);
     22 assertTrue('0' in s);
     23 
     24 a = newArrayWithGetter();
     25 a.shift();
     26 assertTrue('0' in a);
     27 
     28 a = newArrayWithGetter();
     29 a.unshift(0);
     30 assertTrue('2' in a);
     31