deps: fix --no-string_slices flag being read-only#63652
Closed
professional-slacker wants to merge 1 commit into
Closed
deps: fix --no-string_slices flag being read-only#63652professional-slacker wants to merge 1 commit into
professional-slacker wants to merge 1 commit into
Conversation
Change DEFINE_BOOL_READONLY to DEFINE_BOOL so that the --no-string_slices V8 flag can be set at runtime. The flag was defined as read-only, making it impossible to disable string slices even though the code already contains fallback paths for when string_slices is false (factory.cc, builtins-string-gen.cc, code-stub-assembler.cc). The default value remains true, so there is no change in behavior for users who do not explicitly pass --no-string_slices. Refs: https://github.com/nicolo-ribaudo/v8/commit/1e2a395
Collaborator
|
Review requested:
|
Author
|
Closing β this should target v8/v8, not nodejs/node. Will reopen against the correct upstream. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Change
DEFINE_BOOL_READONLYtoDEFINE_BOOLfor thestring_slicesV8 flag so that--no-string_slicescan be set at runtime.The flag was defined as read-only, making it impossible to disable string slices even though the code already contains fallback paths for when
string_slicesis false.Motivation
Long-running Node.js applications can experience memory issues caused by SlicedString retaining references to large parent strings. With this fix, users can pass
--no-string_slicesto force V8 to use copied substrings instead, avoiding the retention problem.Changes
deps/v8/src/flags/flag-definitions.h:1088βDEFINE_BOOL_READONLYβDEFINE_BOOLExisting fallback paths (already in codebase)
deps/v8/src/heap/factory.cc:1143βif (!v8_flags.string_slices || ...)βNewCopiedSubstringdeps/v8/src/builtins/builtins-string-gen.cc:2096βif (v8_flags.string_slices)β skip SlicedStringdeps/v8/src/codegen/code-stub-assembler.cc:9328βif (!v8_flags.string_slices || ...)β expand SlicedStringImpact
trueβ no behavior change unless--no-string_slicesis explicitly passedRefs: https://github.com/nicolo-ribaudo/v8/commit/1e2a395