Michaël Zasso 918fe04351
deps: update V8 to 13.6.233.8
PR-URL: https://github.com/nodejs/node/pull/58070
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-05-02 15:06:53 +02:00

23 lines
699 B
JavaScript

// Copyright 2024 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 --turbolev --turbofan
function array_push_grow_once(arr, x, y) {
// The 1st push will have to grow the array.
arr.push(x);
arr.push(y);
return arr.at(-1) + arr.at(-2) + arr.at(-3);
}
arr = [0, 1, 2, 3, 4, 5];
%PrepareFunctionForOptimization(array_push_grow_once);
assertEquals(29, array_push_grow_once(arr, 11, 13));
arr = [0, 1, 2, 3, 4, 5];
%OptimizeFunctionOnNextCall(array_push_grow_once);
assertEquals(29, array_push_grow_once(arr, 11, 13));
assertOptimized(array_push_grow_once);