From 108443db1db8d6487058647d2a59ca482a58b4e3 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 6 Dec 2026 08:40:35 +0800 Subject: [PATCH] refactor(v8): derive printable run length from scan offsets (#17327) --- src/v8/V8CodeCacheParser.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/v8/V8CodeCacheParser.ts b/src/v8/V8CodeCacheParser.ts index 6d79d51643..87d144f064 100644 --- a/src/v8/V8CodeCacheParser.ts +++ b/src/v8/V8CodeCacheParser.ts @@ -203,7 +203,6 @@ class V8CodeCachePayloadScanner { readonly #maxStrings: number; #cursor = 0; #runStart = -1; - #runLength = 0; // not-an-allowance: fixed scratch buffer write length capped at MAX_INSPECT_V8_CODE_CACHE_STRING_BYTES #retainedLength = 0; @@ -215,7 +214,7 @@ class V8CodeCachePayloadScanner { #flush(): void { if (this.#runStart < 0) return; - const runBytes = this.#runLength; + const runBytes = this.#cursor - this.#runStart; if (runBytes >= this.#minStringBytes) { if (this.#observations.length >= this.#maxStrings) // The message states the fact. Recovery advice belongs to the provider, which @@ -235,7 +234,6 @@ class V8CodeCachePayloadScanner { }); } this.#runStart = -1; - this.#runLength = 0; this.#retainedLength = 0; } @@ -251,7 +249,6 @@ class V8CodeCachePayloadScanner { this.#runBuffer[this.#retainedLength] = byte; this.#retainedLength += 1; } - this.#runLength += 1; } else { this.#flush(); }