Commit 941191ae58f for nodejs
commit 941191ae58fd68e62f93c094e1327b902c03c854
Author: dasunNimantha <dasun4@pm.me>
Date: Thu Nov 19 09:20:23 2026 +0530
url: explain the expected first-call deopt in canParse
Signed-off-by: dasunNimantha <dasun4@pm.me>
PR-URL: https://github.com/nodejs/node/pull/67536
Refs: https://github.com/nodejs/node/issues/66870
Refs: https://github.com/nodejs/node/pull/67136
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
diff --git a/lib/internal/url.js b/lib/internal/url.js
index 6c6706321db..baa531cc68b 100644
--- a/lib/internal/url.js
+++ b/lib/internal/url.js
@@ -1220,7 +1220,10 @@ class URL {
url = `${url}`;
}
- // canParseFast() returns -1 when the regular binding is needed.
+ // canParseFast() returns -1 when the regular binding is needed. The
+ // interpreter only ever sees that -1 (from the slow callback), so the
+ // first optimized call deopts once on the `result === 1` compare for
+ // lack of feedback, then re-optimizes. That deopt is expected.
if (base !== undefined) {
if (typeof base !== 'string') {
base = `${base}`;