mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 10:01:49 +00:00

PR-URL: https://github.com/nodejs/node/pull/28016 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
31 lines
645 B
JavaScript
31 lines
645 B
JavaScript
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
var array = [];
|
|
|
|
function push(array, value) {
|
|
array.push(value);
|
|
};
|
|
|
|
%PrepareFunctionForOptimization(push);
|
|
push(array, 0);
|
|
push(array, 1);
|
|
push(array, 2);
|
|
%OptimizeFunctionOnNextCall(push);
|
|
push(array, 3);
|
|
|
|
var v = 0;
|
|
Object.defineProperty(Array.prototype, "4", {
|
|
get: function() { return 100; },
|
|
set: function(value) { v = value; }
|
|
});
|
|
|
|
push(array, 4);
|
|
|
|
assertEquals(5, array.length);
|
|
assertEquals(100, array[4]);
|
|
assertEquals(4, v);
|