From e89f7027a5a31768523f9e6e9f6e7fa179166def Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vin=C3=ADcius=20Louren=C3=A7o?= <contact@viniciusl.com.br>
Date: Tue, 17 Oct 2023 21:26:40 -0300
Subject: [PATCH] test: avoid v8 deadcode on performance function

PR-URL: https://github.com/nodejs/node/pull/50074
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>

Backport-PR-URL: https://github.com/nodejs/node/pull/50074
---
 test/parallel/test-performance-function.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/test/parallel/test-performance-function.js b/test/parallel/test-performance-function.js
index 5f774d6c2adcf5..b69a21308cf048 100644
--- a/test/parallel/test-performance-function.js
+++ b/test/parallel/test-performance-function.js
@@ -90,14 +90,20 @@ const {
 }
 
 (async () => {
+  let _deadCode;
+
   const histogram = createHistogram();
-  const m = (a, b = 1) => {};
+  const m = (a, b = 1) => {
+    for (let i = 0; i < 1e3; i++)
+      _deadCode = i;
+  };
   const n = performance.timerify(m, { histogram });
   assert.strictEqual(histogram.max, 0);
   for (let i = 0; i < 10; i++) {
     n();
     await sleep(10);
   }
+  assert.ok(_deadCode >= 0);
   assert.notStrictEqual(histogram.max, 0);
   [1, '', {}, [], false].forEach((histogram) => {
     assert.throws(() => performance.timerify(m, { histogram }), {