OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --allow-natives-syntax | 5 // Flags: --allow-natives-syntax |
6 | 6 |
7 Object.prototype["10"] = "unreachable"; | 7 Object.prototype["10"] = "unreachable"; |
8 Object.prototype["7"] = "unreachable"; | 8 Object.prototype["7"] = "unreachable"; |
9 Object.prototype["-1"] = "unreachable"; | 9 Object.prototype["-1"] = "unreachable"; |
10 Object.prototype["-0"] = "unreachable"; | 10 Object.prototype["-0"] = "unreachable"; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 check(); | 48 check(); |
49 | 49 |
50 function f() { return array["-1"]; } | 50 function f() { return array["-1"]; } |
51 | 51 |
52 for (var i = 0; i < 3; i++) { | 52 for (var i = 0; i < 3; i++) { |
53 assertEquals(undefined, f()); | 53 assertEquals(undefined, f()); |
54 } | 54 } |
55 %OptimizeFunctionOnNextCall(f); | 55 %OptimizeFunctionOnNextCall(f); |
56 assertEquals(undefined, f()); | 56 assertEquals(undefined, f()); |
57 | 57 |
58 Object.defineProperty(new Int32Array(), "-1", {'value': 1}); | 58 assertThrows('Object.defineProperty(new Int32Array(100), -1, {value: 1})'); |
59 Object.defineProperty(new Int32Array(), "-0", {'value': 1}); | 59 // -0 gets converted to the string "0", so use "-0" instead. |
60 Object.defineProperty(new Int32Array(), "-10", {'value': 1}); | 60 assertThrows('Object.defineProperty(new Int32Array(100), "-0", {value: 1})'); |
61 Object.defineProperty(new Int32Array(), "4294967295", {'value': 1}); | 61 assertThrows('Object.defineProperty(new Int32Array(100), -10, {value: 1})'); |
| 62 assertThrows('Object.defineProperty(new Int32Array(), 4294967295, {value: 1})'); |
62 | 63 |
63 check(); | 64 check(); |
OLD | NEW |