Commit b53e7a597ee for nodejs

commit b53e7a597ee3dd5630cbb1ed4de70ed5a1ef36e7
Author: Joyee Cheung <joyeec9h3@gmail.com>
Date:   Wed Dec 2 16:20:26 2026 +0100

    test: remove test-buffer-bytelength-safe-fast.js

    This test makes too many assumptions about how strings in
    V8 is represented and optimized, which can easily get
    broken by V8 updates.

    Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
    PR-URL: https://github.com/nodejs/node/pull/67897
    Refs: https://github.com/v8/node/pull/266
    Refs: https://chromium-review.googlesource.com/c/v8/v8/+/8803935
    Reviewed-By: Robert Nagy <ronagy@icloud.com>
    Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
    Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>

diff --git a/test/parallel/test-buffer-bytelength-safe-fast.js b/test/parallel/test-buffer-bytelength-safe-fast.js
deleted file mode 100644
index 1665a9e99d2..00000000000
--- a/test/parallel/test-buffer-bytelength-safe-fast.js
+++ /dev/null
@@ -1,77 +0,0 @@
-// Flags: --expose-internals --no-warnings --allow-natives-syntax --expose_externalize_string
-'use strict';
-
-const common = require('../common');
-const assert = require('assert');
-const { internalBinding } = require('internal/test/binding');
-const { byteLengthUtf8Fast } = internalBinding('buffer');
-
-const {
-  createExternalizableString,
-  createExternalizableTwoByteString,
-  externalizeString,
-  isOneByteString,
-} = globalThis;
-common.allowGlobals(
-  createExternalizableString,
-  createExternalizableTwoByteString,
-  externalizeString,
-  isOneByteString,
-  globalThis.x,
-);
-
-const flat = ['', 'hello', '\xe9', '\x00\x01\x7f\x80\xff'];
-for (const length of [1, 7, 8, 9, 127, 128, 129, 1024]) {
-  flat.push(Buffer.alloc(length, 0xe9).toString('latin1'));
-}
-const latin1 = flat[flat.length - 1];
-const externalOneByte = createExternalizableString('external é'.repeat(20));
-const externalTwoByte = createExternalizableTwoByteString('external €'.repeat(20));
-externalizeString(externalOneByte);
-externalizeString(externalTwoByte);
-const fallback = [
-  'x'.repeat(1000) + latin1,
-  latin1.slice(1, 1000),
-  '€',
-  '\ud83d',
-  'a€ðŸ˜€'.repeat(200),
-  externalOneByte,
-  externalTwoByte,
-];
-
-function fastLength(string) {
-  return byteLengthUtf8Fast(string);
-}
-
-eval('%PrepareFunctionForOptimization(fastLength)');
-for (const string of [...flat, ...fallback]) {
-  // Before optimization the callback only returns the rejection sentinel.
-  assert.strictEqual(fastLength(string), -1);
-}
-eval('%OptimizeFunctionOnNextCall(fastLength)');
-for (const string of flat) {
-  assert.strictEqual(fastLength(string), Buffer.from(string).length);
-}
-for (const string of fallback) {
-  assert.strictEqual(fastLength(string), -1);
-}
-assert.strictEqual(fastLength('hello'), 5);
-
-if (common.isDebug) {
-  const { getV8FastApiCallCount } = internalBinding('debug');
-  assert.strictEqual(
-    getV8FastApiCallCount('Buffer::FastByteLengthUtf8'), flat.length + 1);
-}
-
-const { byteLength } = Buffer;
-function test() {
-  for (const string of [...flat, ...fallback]) {
-    assert.strictEqual(byteLength(string), Buffer.from(string).length);
-    assert.strictEqual(byteLength(string, 'UTF-8'), Buffer.from(string).length);
-    assert.strictEqual(byteLength(string, 'unknown'), Buffer.from(string).length);
-  }
-}
-eval('%PrepareFunctionForOptimization(byteLength)');
-test();
-eval('%OptimizeFunctionOnNextCall(byteLength)');
-test();