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.
5 // Flags: --allow-natives-syntax
7 Object.prototype["10"] = "unreachable";
8 Object.prototype["7"] = "unreachable";
9 Object.prototype["-1"] = "unreachable";
10 Object.prototype["-0"] = "unreachable";
11 Object.prototype["4294967296"] = "unreachable";
13 var array = new Int32Array(10);
16 for (var i = 0; i < 4; i++) {
17 assertEquals(undefined, array["-1"]);
18 assertEquals(undefined, array["-0"]);
19 assertEquals(undefined, array["10"]);
20 assertEquals(undefined, array["4294967296"]);
22 assertEquals("unreachable", array.__proto__["-1"]);
23 assertEquals("unreachable", array.__proto__["-0"]);
24 assertEquals("unreachable", array.__proto__["10"]);
25 assertEquals("unreachable", array.__proto__["4294967296"]);
30 array["-1"] = "unreachable";
31 array["-0"] = "unreachable";
32 array["10"] = "unreachable";
33 array["4294967296"] = "unreachable";
40 delete array["4294967296"];
42 assertEquals(undefined, Object.getOwnPropertyDescriptor(array, "-1"));
43 assertEquals(undefined, Object.getOwnPropertyDescriptor(array, "-0"));
44 assertEquals(undefined, Object.getOwnPropertyDescriptor(array, "10"));
45 assertEquals(undefined, Object.getOwnPropertyDescriptor(array, "4294967296"));
46 assertEquals(10, Object.keys(array).length);
50 function f() { return array["-1"]; }
52 for (var i = 0; i < 3; i++) {
53 assertEquals(undefined, f());
55 %OptimizeFunctionOnNextCall(f);
56 assertEquals(undefined, f());
58 Object.defineProperty(new Int32Array(), "-1", {'value': 1});
59 Object.defineProperty(new Int32Array(), "-0", {'value': 1});
60 Object.defineProperty(new Int32Array(), "-10", {'value': 1});
61 Object.defineProperty(new Int32Array(), "4294967296", {'value': 1});