Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: test/mjsunit/es6/indexed-integer-exotics.js

Issue 1159433003: Use GetProperty for getting elements. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/enumeration-order.js ('k') | test/mjsunit/regress/regress-581.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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";
11 Object.prototype["4294967296"] = "unreachable"; 11 Object.prototype["4294967295"] = "unreachable";
12 12
13 var array = new Int32Array(10); 13 var array = new Int32Array(10);
14 14
15 function check() { 15 function check() {
16 for (var i = 0; i < 4; i++) { 16 for (var i = 0; i < 4; i++) {
17 assertEquals(undefined, array["-1"]); 17 assertEquals(undefined, array["-1"]);
18 assertEquals(undefined, array["-0"]); 18 assertEquals(undefined, array["-0"]);
19 assertEquals(undefined, array["10"]); 19 assertEquals(undefined, array["10"]);
20 assertEquals(undefined, array["4294967296"]); 20 assertEquals(undefined, array["4294967295"]);
21 } 21 }
22 assertEquals("unreachable", array.__proto__["-1"]); 22 assertEquals("unreachable", array.__proto__["-1"]);
23 assertEquals("unreachable", array.__proto__["-0"]); 23 assertEquals("unreachable", array.__proto__["-0"]);
24 assertEquals("unreachable", array.__proto__["10"]); 24 assertEquals("unreachable", array.__proto__["10"]);
25 assertEquals("unreachable", array.__proto__["4294967296"]); 25 assertEquals("unreachable", array.__proto__["4294967295"]);
26 } 26 }
27 27
28 check(); 28 check();
29 29
30 array["-1"] = "unreachable"; 30 array["-1"] = "unreachable";
31 array["-0"] = "unreachable"; 31 array["-0"] = "unreachable";
32 array["10"] = "unreachable"; 32 array["10"] = "unreachable";
33 array["4294967296"] = "unreachable"; 33 array["4294967295"] = "unreachable";
34 34
35 check(); 35 check();
36 36
37 delete array["-0"]; 37 delete array["-0"];
38 delete array["-1"]; 38 delete array["-1"];
39 delete array["10"]; 39 delete array["10"];
40 delete array["4294967296"]; 40 delete array["4294967295"];
41 41
42 assertEquals(undefined, Object.getOwnPropertyDescriptor(array, "-1")); 42 assertEquals(undefined, Object.getOwnPropertyDescriptor(array, "-1"));
43 assertEquals(undefined, Object.getOwnPropertyDescriptor(array, "-0")); 43 assertEquals(undefined, Object.getOwnPropertyDescriptor(array, "-0"));
44 assertEquals(undefined, Object.getOwnPropertyDescriptor(array, "10")); 44 assertEquals(undefined, Object.getOwnPropertyDescriptor(array, "10"));
45 assertEquals(undefined, Object.getOwnPropertyDescriptor(array, "4294967296")); 45 assertEquals(undefined, Object.getOwnPropertyDescriptor(array, "4294967295"));
46 assertEquals(10, Object.keys(array).length); 46 assertEquals(10, Object.keys(array).length);
47 47
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 Object.defineProperty(new Int32Array(), "-1", {'value': 1});
59 Object.defineProperty(new Int32Array(), "-0", {'value': 1}); 59 Object.defineProperty(new Int32Array(), "-0", {'value': 1});
60 Object.defineProperty(new Int32Array(), "-10", {'value': 1}); 60 Object.defineProperty(new Int32Array(), "-10", {'value': 1});
61 Object.defineProperty(new Int32Array(), "4294967296", {'value': 1}); 61 Object.defineProperty(new Int32Array(), "4294967295", {'value': 1});
62 62
63 check(); 63 check();
OLDNEW
« no previous file with comments | « test/mjsunit/enumeration-order.js ('k') | test/mjsunit/regress/regress-581.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698