| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 |
| 6 |
| 5 (function () { | 7 (function () { |
| 6 var o = []; | 8 var o = []; |
| 7 o.__proto__ = {}; | 9 o.__proto__ = {}; |
| 8 | 10 |
| 9 function store(o, i, v) { | 11 function store(o, i, v) { |
| 10 o[i] = v; | 12 o[i] = v; |
| 11 } | 13 } |
| 12 | 14 |
| 13 store(o, 0, 0); | 15 store(o, 0, 0); |
| 14 store(o, 1, 0); | 16 store(o, 1, 0); |
| 15 store(o, 2, 0); | 17 store(o, 2, 0); |
| 16 o.__proto__[10000000] = 1; | 18 o.__proto__[10000000] = 1; |
| 17 | 19 |
| 18 var set = 0; | 20 var set = 0; |
| 19 | 21 |
| 20 Object.defineProperty(o, "3", { | 22 Object.defineProperty(o, "3", { |
| 21 get:function() { return 100; }, | 23 get:function() { return 100; }, |
| 22 set:function(v) { set = v; }}); | 24 set:function(v) { set = v; }}); |
| 23 | 25 |
| 24 store(o, 3, 1000); | 26 store(o, 3, 1000); |
| 25 assertEquals(1000, set); | 27 assertEquals(1000, set); |
| 26 assertEquals(100, o[3]); | 28 assertEquals(100, o[3]); |
| 27 })(); | 29 })(); |
| 28 | 30 |
| 29 (function () { | 31 (function () { |
| 30 var o = new Int32Array(); | 32 var o = new Int32Array(); |
| 31 Object.defineProperty(o, "0", {get: function(){}}); | 33 Object.defineProperty(o, "0", {get: function(){}}); |
| 32 assertEquals(undefined, Object.getOwnPropertyDescriptor(o, "0")); | 34 assertEquals(undefined, Object.getOwnPropertyDescriptor(o, "0")); |
| 33 })(); | 35 })(); |
| 36 |
| 37 (function() { |
| 38 function f() { |
| 39 var a = new Array(); |
| 40 a[1] = 1.5; |
| 41 return a; |
| 42 } |
| 43 |
| 44 f(); |
| 45 f(); |
| 46 %OptimizeFunctionOnNextCall(f); |
| 47 var a = f(); |
| 48 a[2] = 2; |
| 49 assertEquals(3, a.length); |
| 50 })(); |
| OLD | NEW |