Upstream version 11.40.277.0
[platform/framework/web/crosswalk.git] / src / v8 / test / mjsunit / array-push3.js
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.
4
5 // Flags: --allow-natives-syntax
6
7 var array = [];
8
9 function push(array, value) {
10   array.push(value);
11 }
12
13 push(array, 0);
14 push(array, 1);
15 push(array, 2);
16 %OptimizeFunctionOnNextCall(push);
17 push(array, 3);
18
19 var v = 0;
20 Object.defineProperty(Array.prototype, "4", {
21   get: function() { return 100; },
22   set: function(value) { v = value; }
23 });
24
25 push(array, 4);
26
27 assertEquals(5, array.length);
28 assertEquals(100, array[4]);
29 assertEquals(4, v);