| 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 --deopt-every-n-times=5 --nodead-code-eliminati
on |
| 6 | 6 |
| 7 var array = []; | 7 var array = []; |
| 8 | 8 |
| 9 function push(array, value) { | 9 function push(array, value) { |
| 10 array.push(value); | 10 array.push(value); |
| 11 } | 11 } |
| 12 | 12 |
| 13 push(array, 0); | 13 push(array, 0); |
| 14 push(array, 1); | 14 push(array, 1); |
| 15 push(array, 2); | 15 push(array, 2); |
| 16 %OptimizeFunctionOnNextCall(push); | 16 %OptimizeFunctionOnNextCall(push); |
| 17 push(array, 3); | 17 push(array, 3); |
| 18 | 18 |
| 19 var v = 0; | 19 var v = 0; |
| 20 Object.defineProperty(Array.prototype, "4", { | 20 Object.defineProperty(Array.prototype, "4", { |
| 21 get: function() { return 100; }, | 21 get: function() { return 100; }, |
| 22 set: function(value) { v = value; } | 22 set: function(value) { v = value; } |
| 23 }); | 23 }); |
| 24 | 24 |
| 25 push(array, 4); | 25 push(array, 4); |
| 26 | 26 |
| 27 assertEquals(5, array.length); | 27 assertEquals(5, array.length); |
| 28 assertEquals(100, array[4]); | 28 assertEquals(100, array[4]); |
| 29 assertEquals(4, v); | 29 assertEquals(4, v); |
| OLD | NEW |