Commit 175a6b5bde1 for nodejs

commit 175a6b5bde183ef731338eb60e17e9370c7d108f
Author: Roberto Bianchi <roberto.bianchi@spendesk.com>
Date:   Fri Dec 4 00:48:13 2026 +0100

    lib: avoid mutable push on private arrays

    The junit reporter, the test runner's watch-mode stdio list and
    coverage line ranges, the REPL import transform, the startup snapshot
    callback lists, and Blob's arrayBuffer() used .push() on private
    arrays, which looks up Array.prototype.push at call time. Replacing
    that method from user code changed how these paths ran. Use indexed
    assignments instead.

    Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
    PR-URL: https://github.com/nodejs/node/pull/67887
    Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
    Reviewed-By: Jordan Harband <ljharb@gmail.com>
    Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>

diff --git a/lib/internal/blob.js b/lib/internal/blob.js
index aea19d6e747..c99a554a594 100644
--- a/lib/internal/blob.js
+++ b/lib/internal/blob.js
@@ -493,7 +493,7 @@ function arrayBuffer(blob) {
         return;
       }
       if (buffer !== undefined)
-        buffers.push(buffer);
+        buffers[buffers.length] = buffer;
       queueMicrotask(() => readNext());
     });
   };
diff --git a/lib/internal/repl/transform.js b/lib/internal/repl/transform.js
index 1c246bb219f..2acb2e66253 100644
--- a/lib/internal/repl/transform.js
+++ b/lib/internal/repl/transform.js
@@ -65,9 +65,9 @@ function importDeclarationToScript(node) {
         // `imported` is an Identifier or, for arbitrary module export names,
         // a string Literal (`import { "a-b" as c }`).
         const imported = spec.imported.name ?? spec.imported.value;
-        named.push(imported === spec.local.name ?
+        named[named.length] = imported === spec.local.name ?
           imported :
-          `${JSONStringify(imported)}: ${spec.local.name}`);
+          `${JSONStringify(imported)}: ${spec.local.name}`;
       }
     }
   }
diff --git a/lib/internal/test_runner/reporter/junit.js b/lib/internal/test_runner/reporter/junit.js
index 940fd92a72e..c9f6a707013 100644
--- a/lib/internal/test_runner/reporter/junit.js
+++ b/lib/internal/test_runner/reporter/junit.js
@@ -188,7 +188,7 @@ module.exports = async function* junitReporter(source) {
           }
           if (event.type === 'test:fail') {
             const error = event.data.details?.error;
-            currentTest.children.push({
+            currentTest.children[currentTest.children.length] = {
               __proto__: kEmptyObject,
               nesting: event.data.nesting + 1,
               tag: 'failure',
@@ -198,7 +198,7 @@ module.exports = async function* junitReporter(source) {
                 message: error?.message.trim() ?? '',
               },
               children: [inspectWithNoCustomRetry(error, inspectOptions)],
-            });
+            };
             currentTest.failures = 1;
           }
         }
diff --git a/lib/internal/test_runner/runner.js b/lib/internal/test_runner/runner.js
index 09c820eb911..49ce0e7d3e6 100644
--- a/lib/internal/test_runner/runner.js
+++ b/lib/internal/test_runner/runner.js
@@ -574,7 +574,7 @@ function runTestFile(path, filesWatcher, opts) {

     try {
       if (watchMode) {
-        stdio.push('ipc');
+        stdio[stdio.length] = 'ipc';
         env.WATCH_REPORT_DEPENDENCIES = '1';
       }
       if (opts.root.harness.shouldColorizeTestFiles) {
diff --git a/lib/internal/test_runner/utils.js b/lib/internal/test_runner/utils.js
index 1624a357b4a..e057ce2d868 100644
--- a/lib/internal/test_runner/utils.js
+++ b/lib/internal/test_runner/utils.js
@@ -522,7 +522,7 @@ function formatLinesToRanges(values) {
     if ((index > 0) && ((current - array[index - 1]) === 1)) {
       prev[prev.length - 1][1] = current;
     } else {
-      prev.push([current]);
+      prev[prev.length] = [current];
     }
     return prev;
   }, []), (range) => ArrayPrototypeJoin(range, '-'));
diff --git a/lib/internal/v8/startup_snapshot.js b/lib/internal/v8/startup_snapshot.js
index 8b57d324506..4bed0273ef4 100644
--- a/lib/internal/v8/startup_snapshot.js
+++ b/lib/internal/v8/startup_snapshot.js
@@ -69,7 +69,7 @@ function addDeserializeCallbackImpl(callbacks, callback, data) {
     setDeserializeCallback(runDeserializeCallbacks);
     deserializeCallbackIsSet = true;
   }
-  callbacks.push([callback, data]);
+  callbacks[callbacks.length] = [callback, data];
 }

 const serializeCallbacks = [];
@@ -90,11 +90,11 @@ function runSerializeCallbacks() {
 function addSerializeCallback(callback, data) {
   throwIfNotBuildingSnapshot();
   validateFunction(callback, 'callback');
-  serializeCallbacks.push([callback, data]);
+  serializeCallbacks[serializeCallbacks.length] = [callback, data];
 }

 function addAfterUserSerializeCallback(callback, data) {
-  afterUserSerializeCallbacks.push([callback, data]);
+  afterUserSerializeCallbacks[afterUserSerializeCallbacks.length] = [callback, data];
 }

 function initializeCallbacks() {