From 427b679874aee6ba69ac3a59edf02bfec58fedfb Mon Sep 17 00:00:00 2001 From: ishabi Date: Thu, 24 Sep 2026 15:38:52 +0200 Subject: [PATCH] deps: V8: cherry-pick 8e374caa66ce MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message: [profiler] Internalize string script names directly Avoid converting script names to UTF-8 by internalizing String names directly. Keep the existing conversion for Symbol names and use the canonical empty string for unnamed scripts. This improved profile retrieval performance by ~30% in local benchmarks. Change-Id: I5eb6e8fa79517dc4902ddc1f26d75a9dd228ef39 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8449311 Reviewed-by: Camillo Bruni Reviewed-by: Dominik Inführ Commit-Queue: Dominik Inführ Cr-Commit-Position: refs/heads/main@{#110089} Refs: https://github.com/v8/v8/commit/8e374caa66ced7d6731433b5f9ea8cf07f1f1b28 --- common.gypi | 2 +- deps/v8/src/profiler/sampling-heap-profiler.cc | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/common.gypi b/common.gypi index 73f2702bbebc..9cc324610fdd 100644 --- a/common.gypi +++ b/common.gypi @@ -44,7 +44,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.22', + 'v8_embedder_string': '-node.23', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/profiler/sampling-heap-profiler.cc b/deps/v8/src/profiler/sampling-heap-profiler.cc index 7ea26d4064f8..7842066780ec 100644 --- a/deps/v8/src/profiler/sampling-heap-profiler.cc +++ b/deps/v8/src/profiler/sampling-heap-profiler.cc @@ -243,7 +243,7 @@ v8::AllocationProfile::Node* SamplingHeapProfiler::TranslateAllocationNode( // a GC kicks in during the tree retrieval. node->pinned_ = true; Local script_name = - ToApiHandle(isolate_->factory()->InternalizeUtf8String("")); + ToApiHandle(isolate_->factory()->empty_string()); int line = v8::AllocationProfile::kNoLineNumberInfo; int column = v8::AllocationProfile::kNoColumnNumberInfo; std::vector allocations; @@ -252,10 +252,15 @@ v8::AllocationProfile::Node* SamplingHeapProfiler::TranslateAllocationNode( auto script_iterator = scripts.find(node->script_id_); if (script_iterator != scripts.end()) { DirectHandle