From a14ab3ed6d687e62fb7f277372d3486b0c6b93d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Fl=C3=BCckiger?= Date: Wed, 19 Aug 2026 13:24:07 +0000 Subject: [PATCH 1/2] deps: V8: backport e11c1ad83914 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message: [cleanup] Remove --js-regexp-escape Remove the --js-regexp-escape flag and install RegExp.escape unconditionally into the baseline snapshot. RegExp.escape has been enabled by default since M136. Bug: 548385945 TAG=agy CONV=052f499d-4ee5-4a10-8afd-900ba4a338db Change-Id: I8d820f28dc061d0e338ecf196c34f919c9c3f223 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8267346 Auto-Submit: Olivier Flückiger Reviewed-by: Nikolaos Papaspyrou Commit-Queue: Olivier Flückiger Cr-Commit-Position: refs/heads/main@{#109360} Refs: https://github.com/v8/v8/commit/e11c1ad839144f2b68213df6b81efa51c5816814 Co-authored-by: Antoine du Hamel --- common.gypi | 2 +- deps/v8/src/builtins/builtins.cc | 4 ---- deps/v8/src/flags/flag-definitions.h | 1 - deps/v8/src/init/bootstrapper.cc | 10 +++------- deps/v8/test/test262/testcfg.py | 1 - 5 files changed, 4 insertions(+), 14 deletions(-) diff --git a/common.gypi b/common.gypi index a83523286a91..a982da03f78b 100644 --- a/common.gypi +++ b/common.gypi @@ -42,7 +42,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.28', + 'v8_embedder_string': '-node.29', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/builtins/builtins.cc b/deps/v8/src/builtins/builtins.cc index 34424db08dc0..0faa675d4dc3 100644 --- a/deps/v8/src/builtins/builtins.cc +++ b/deps/v8/src/builtins/builtins.cc @@ -838,10 +838,6 @@ Builtins::JSBuiltinStateFlags Builtins::GetJSBuiltinState(Builtin builtin) { case Builtin::kErrorIsError: RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.js_error_iserror); - // --js-regexp-escape - case Builtin::kRegExpEscape: - RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.js_regexp_escape); - // --js-explicit-resource-management case Builtin::kSuppressedErrorConstructor: case Builtin::kDisposableStackConstructor: diff --git a/deps/v8/src/flags/flag-definitions.h b/deps/v8/src/flags/flag-definitions.h index aab9435dbb53..fb1bae236111 100644 --- a/deps/v8/src/flags/flag-definitions.h +++ b/deps/v8/src/flags/flag-definitions.h @@ -342,7 +342,6 @@ DEFINE_BOOL(js_shipping, true, "enable all shipped JavaScript features") V(js_promise_try, "Promise.try") \ V(js_atomics_pause, "Atomics.pause") \ V(js_error_iserror, "Error.isError") \ - V(js_regexp_escape, "RegExp.escape") \ V(js_explicit_resource_management, "explicit resource management") \ V(js_float16array, \ "Float16Array, Math.f16round, DataView.getFloat16, DataView.setFloat16") \ diff --git a/deps/v8/src/init/bootstrapper.cc b/deps/v8/src/init/bootstrapper.cc index ba75a3a17df2..cab17a763ab8 100644 --- a/deps/v8/src/init/bootstrapper.cc +++ b/deps/v8/src/init/bootstrapper.cc @@ -3320,6 +3320,9 @@ void Genesis::InitializeGlobal(DirectHandle global_object, INSTALL_CAPTURE_GETTER(8); INSTALL_CAPTURE_GETTER(9); #undef INSTALL_CAPTURE_GETTER + + SimpleInstallFunction(isolate_, regexp_fun, "escape", + Builtin::kRegExpEscape, 1, kAdapt); } SetConstructorInstanceType(isolate_, regexp_fun, JS_REG_EXP_CONSTRUCTOR_TYPE); @@ -5897,14 +5900,7 @@ void Genesis::InitializeGlobal_js_float16array() { Context::FLOAT16_ARRAY_FUN_INDEX); } -void Genesis::InitializeGlobal_js_regexp_escape() { - if (!v8_flags.js_regexp_escape) return; - DirectHandle regexp_fun(native_context()->regexp_function(), - isolate()); - SimpleInstallFunction(isolate(), regexp_fun, "escape", Builtin::kRegExpEscape, - 1, kAdapt); -} void Genesis::InitializeGlobal_js_defer_import_eval() {} diff --git a/deps/v8/test/test262/testcfg.py b/deps/v8/test/test262/testcfg.py index aa93daaef0cd..e04ab5fd0311 100644 --- a/deps/v8/test/test262/testcfg.py +++ b/deps/v8/test/test262/testcfg.py @@ -67,7 +67,6 @@ 'source-phase-imports': '--js-source-phase-imports --allow-natives-syntax', 'Error.isError': '--js-error-iserror', 'uint8array-base64': '--js-base-64', - 'RegExp.escape': '--js-regexp-escape', 'upsert': '--js-upsert', 'Intl.Locale': '--js-intl-locale-variants', 'nonextensible-applies-to-private': '--js-nonextensible-applies-to-private', From d1698cb767873b01a5a967e6ac2b2b0e2998dedd Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Tue, 1 Sep 2026 11:58:36 +0200 Subject: [PATCH 2/2] util: use `RegExpEscape` instead of custom escaping Signed-off-by: Antoine du Hamel --- lib/internal/util/debuglog.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/internal/util/debuglog.js b/lib/internal/util/debuglog.js index 1cb3ba4df520..f7b50f1956e2 100644 --- a/lib/internal/util/debuglog.js +++ b/lib/internal/util/debuglog.js @@ -6,6 +6,7 @@ const { NumberPrototypeToFixed, ObjectDefineProperty, RegExp, + RegExpEscape, RegExpPrototypeExec, SafeArrayIterator, SafeMap, @@ -34,11 +35,7 @@ let testEnabled; function initializeDebugEnv(debugEnv) { debugImpls = { __proto__: null }; if (debugEnv) { - // This is run before any user code, it's OK not to use primordials. - debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&') - .replaceAll('*', '.*') - .replaceAll(',', '$|^'); - const debugEnvRegex = new RegExp(`^${debugEnv}$`, 'i'); + const debugEnvRegex = new RegExp(`^${RegExpEscape(debugEnv)}$`, 'i'); testEnabled = (str) => RegExpPrototypeExec(debugEnvRegex, str) !== null; } else { testEnabled = () => false;