node/deps/v8/test/mjsunit/compiler/regress-crbug-1464516.js
Michaël Zasso 17a74ddd3d
deps: update V8 to 11.8.172.13
PR-URL: https://github.com/nodejs/node/pull/49639
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-10-10 08:25:41 +02:00

32 lines
1012 B
JavaScript

// Copyright 2023 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: --no-turbo-escape --no-turbo-allocation-folding
function f() {
// Allocating an array that will be initialized with holes.
let arr = new Array(5);
// Doing a bunch more allocations in the hope of triggering a GC.
[arr, 5, 6, 7, [8], [9]];
[2, 5, 6, 7, [8], [9]];
[2, 5, 6, 7, [8], [9]];
[2, 5, 6, 7, [8], [9]];
[2, 5, 6, 7, [8], [9]];
[2, 5, 6, 7, [8], [9]];
[2, 5, 6, 7, [8], [9]];
[2, 5, 6, 7, [8], [9]];
[2, 5, 6, 7, [8], [9]];
// Setting arr[3]. Because previous allocations could trigger GCs, store-store
// elimination should not remove the initial hole-initialization of arr[3],
// otherwise the GC could see an undefined field.
arr[3] = 42;
return arr;
}
// Running `f` a few times, in the hope that a GC will eventually be scheduled
// inside it.
for (let i = 0; i < 5000; i++) {
f();
}