Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7189f73167efc53070a0a61736981d79fef5dfea
https://github.com/WebKit/WebKit/commit/7189f73167efc53070a0a61736981d79fef5dfea
Author: Chris Dumez <[email protected]>
Date: 2026-09-11 (Fri, 11 Sep 2026)
Changed paths:
M Source/JavaScriptCore/API/JSMarkingConstraintPrivate.cpp
M Source/JavaScriptCore/assembler/LinkBuffer.cpp
M Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.cpp
M Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h
M Source/JavaScriptCore/assembler/PerfLog.cpp
M Source/JavaScriptCore/assembler/PerfLog.h
M Source/JavaScriptCore/b3/B3PhaseScope.cpp
M Source/JavaScriptCore/b3/B3PhaseScope.h
M Source/JavaScriptCore/b3/B3Procedure.cpp
M Source/JavaScriptCore/b3/B3Validate.cpp
M Source/JavaScriptCore/b3/B3Value.cpp
M Source/JavaScriptCore/b3/air/AirAllocateRegistersByGreedy.cpp
M Source/JavaScriptCore/b3/air/AirLogRegisterPressure.cpp
M Source/JavaScriptCore/b3/air/AirPhaseScope.cpp
M Source/JavaScriptCore/b3/air/AirPhaseScope.h
M Source/JavaScriptCore/b3/air/AirSpecial.cpp
M Source/JavaScriptCore/b3/air/AirSpecial.h
M Source/JavaScriptCore/b3/air/AirValidate.cpp
M Source/JavaScriptCore/b3/air/testair.cpp
M Source/JavaScriptCore/b3/testb3.h
M Source/JavaScriptCore/b3/testb3_4.cpp
M Source/JavaScriptCore/b3/testb3_7.cpp
M Source/JavaScriptCore/bytecode/ArrayProfile.cpp
M Source/JavaScriptCore/bytecode/ArrayProfile.h
M Source/JavaScriptCore/bytecode/BytecodeDumper.cpp
M Source/JavaScriptCore/bytecode/BytecodeDumper.h
M Source/JavaScriptCore/bytecode/CodeBlock.cpp
M Source/JavaScriptCore/bytecode/CodeBlock.h
M Source/JavaScriptCore/bytecode/InlineCacheCompiler.cpp
M Source/JavaScriptCore/bytecode/InlineCallFrame.cpp
M Source/JavaScriptCore/bytecode/InlineCallFrame.h
M Source/JavaScriptCore/bytecode/ReduceWhitespace.cpp
M Source/JavaScriptCore/bytecode/ReduceWhitespace.h
M Source/JavaScriptCore/bytecode/SpeculatedType.cpp
M Source/JavaScriptCore/bytecode/ValueProfile.h
M Source/JavaScriptCore/corpse/tests/CorpseProcessTest.cpp
M Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
M Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
M Source/JavaScriptCore/dfg/DFGAbstractValue.cpp
M Source/JavaScriptCore/dfg/DFGAvailabilityMap.cpp
M Source/JavaScriptCore/dfg/DFGCFAPhase.cpp
M Source/JavaScriptCore/dfg/DFGClobberize.h
M Source/JavaScriptCore/dfg/DFGDisassembler.cpp
M Source/JavaScriptCore/dfg/DFGDisassembler.h
M Source/JavaScriptCore/dfg/DFGGraph.cpp
M Source/JavaScriptCore/dfg/DFGNode.h
M Source/JavaScriptCore/dfg/DFGNodeFlags.cpp
M Source/JavaScriptCore/dfg/DFGOSRAvailabilityAnalysisPhase.cpp
M Source/JavaScriptCore/dfg/DFGOSRExit.cpp
M Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp
M Source/JavaScriptCore/dfg/DFGPhase.cpp
M Source/JavaScriptCore/dfg/DFGPhase.h
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
M Source/JavaScriptCore/dfg/DFGValidate.cpp
M Source/JavaScriptCore/dfg/DFGValidate.h
M Source/JavaScriptCore/ftl/FTLCompile.cpp
M Source/JavaScriptCore/ftl/FTLLink.cpp
M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
M Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp
M Source/JavaScriptCore/ftl/FTLThunks.cpp
M Source/JavaScriptCore/heap/CompleteSubspace.cpp
M Source/JavaScriptCore/heap/Heap.cpp
M Source/JavaScriptCore/heap/Heap.h
M Source/JavaScriptCore/heap/MarkedBlock.cpp
M Source/JavaScriptCore/heap/SlotVisitor.cpp
M Source/JavaScriptCore/interpreter/CallFrame.cpp
M Source/JavaScriptCore/jit/CallFrameShuffler.cpp
M Source/JavaScriptCore/jit/GdbJIT.cpp
M Source/JavaScriptCore/jit/GdbJIT.h
M Source/JavaScriptCore/jit/JIT.cpp
M Source/JavaScriptCore/jit/JITCompilation.h
M Source/JavaScriptCore/jit/JITDisassembler.cpp
M Source/JavaScriptCore/jit/JITDisassembler.h
M Source/JavaScriptCore/jit/JITPlan.cpp
M Source/JavaScriptCore/jit/JITPlan.h
M Source/JavaScriptCore/jit/ThunkGenerators.cpp
M Source/JavaScriptCore/jsc.cpp
M Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
M Source/JavaScriptCore/lol/LOLJIT.cpp
M Source/JavaScriptCore/parser/UnlinkedSourceCode.cpp
M Source/JavaScriptCore/parser/UnlinkedSourceCode.h
M Source/JavaScriptCore/profiler/ProfilerBytecode.h
M Source/JavaScriptCore/profiler/ProfilerBytecodeSequence.cpp
M Source/JavaScriptCore/profiler/ProfilerBytecodeSequence.h
M Source/JavaScriptCore/profiler/ProfilerBytecodes.cpp
M Source/JavaScriptCore/profiler/ProfilerBytecodes.h
M Source/JavaScriptCore/profiler/ProfilerCompilation.cpp
M Source/JavaScriptCore/profiler/ProfilerCompilation.h
M Source/JavaScriptCore/profiler/ProfilerCompiledBytecode.cpp
M Source/JavaScriptCore/profiler/ProfilerCompiledBytecode.h
M Source/JavaScriptCore/profiler/ProfilerDatabase.cpp
M Source/JavaScriptCore/profiler/ProfilerDatabase.h
M Source/JavaScriptCore/profiler/ProfilerEvent.h
M Source/JavaScriptCore/runtime/ExceptionScope.cpp
M Source/JavaScriptCore/runtime/ExceptionScope.h
M Source/JavaScriptCore/runtime/Identifier.h
M Source/JavaScriptCore/runtime/IntlCollator.cpp
M Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp
M Source/JavaScriptCore/runtime/IntlDateTimeFormat.h
M Source/JavaScriptCore/runtime/IntlDurationFormat.cpp
M Source/JavaScriptCore/runtime/IntlDurationFormat.h
M Source/JavaScriptCore/runtime/IntlNumberFormat.cpp
M Source/JavaScriptCore/runtime/IntlNumberFormat.h
M Source/JavaScriptCore/runtime/JSGlobalObject.cpp
M Source/JavaScriptCore/runtime/ProfilerSupport.cpp
M Source/JavaScriptCore/runtime/RegExp.cpp
M Source/JavaScriptCore/runtime/SamplingProfiler.cpp
M Source/JavaScriptCore/runtime/Structure.cpp
M Source/JavaScriptCore/runtime/Structure.h
M Source/JavaScriptCore/runtime/VM.cpp
M Source/JavaScriptCore/tools/VMInspector.cpp
M Source/JavaScriptCore/wasm/WasmBBQDisassembler.cpp
M Source/JavaScriptCore/wasm/WasmBBQDisassembler.h
M Source/JavaScriptCore/wasm/WasmPlan.cpp
M Source/JavaScriptCore/wasm/WasmPlan.h
M Source/JavaScriptCore/wasm/js/JSToWasm.cpp
M Source/JavaScriptCore/yarr/YarrDisassembler.cpp
M Source/JavaScriptCore/yarr/YarrDisassembler.h
M Source/WTF/wtf/BackwardsGraph.h
M Source/WTF/wtf/ListDump.h
M Source/WTF/wtf/LoggingHashMap.h
M Source/WTF/wtf/LoggingHashSet.h
M Source/WTF/wtf/PrintStream.cpp
M Source/WTF/wtf/PrintStream.h
M Source/WTF/wtf/ScopedPrintStream.h
M Source/WTF/wtf/SingleRootGraph.h
M Source/WTF/wtf/StringHashDumpContext.h
M Source/WTF/wtf/StringPrintStream.cpp
M Source/WTF/wtf/StringPrintStream.h
M Source/WTF/wtf/darwin/LibraryPathDiagnostics.mm
M Source/WebCore/html/HTMLAttachmentElement.cpp
M Tools/TestWebKitAPI/Tests/WTF/CString.cpp
M Tools/TestWebKitAPI/Tests/WTF/Time.cpp
Log Message:
-----------
Rename toCString() to toUTF8CString() and stop PrintStream from printing an
untyped CString
https://bugs.webkit.org/show_bug.cgi?id=323960
Reviewed by Yusuke Suzuki.
Follow-up to 320652@main, which introduced CStringWithEncoding, and to
320795@main, 320803@main
and 320905@main, which migrated the String conversions. Every String-shaped
producer is typed now;
the largest remaining cluster of bare CStrings is the dump machinery hanging
off StringPrintStream.
A StringPrintStream's buffer holds UTF-8. That is not a new claim: toString()
and tryToString()
already decode it with String::fromUTF8 unconditionally, and every
String-family printer reaches the
buffer through printExpectedCStringHelper, which takes the
std::expected<UTF8CString, ...> from
tryGetUTF8() and emits an ASCII diagnostic when the conversion fails.
toCString() was the one
accessor that handed those same bytes back as a CString, which by definition
does not know its
encoding, so makeString(toCString(...)) reinterpreted UTF-8 as Latin-1 -
exactly the mojibake
320652@main exists to prevent.
StringPrintStream::toCString() and WTF::toCString(...) therefore return a
UTF8CString, and are
renamed to toUTF8CString() to match: a name that says CString on a function
that returns UTF-8 is
the same mismatch in prose that this series is removing from the type system.
The two local
toCString() overloads in jsc.cpp, which already returned a UTF8CString, are
renamed with them.
The new return type propagates on its own through most of JSC, because nearly
every dump helper is
a wrapper around out.toUTF8CString(): CodeBlock::inferredName() and
sourceCodeForTools(),
MacroAssemblerCodeRef::disassembly(), BytecodeDumper::registerName(),
ArrayProfile::briefDescription(), the DumpedOp structs in the four
disassemblers,
Plan::signpostMessage(), sortedListDump() and the graph dump() helpers, and the
Profiler classes
that already had to call String::fromUTF8 on their own members to make sense of
them. Three call
sites were silently mojibaking non-ASCII function names and are fixed as a
consequence:
CodeBlock::inferredNameWithHash(), SamplingProfiler::reportTopBytecodes(), and
DebuggerCallFrame::functionName(), which decoded UTF-8 bytes with
String::fromLatin1.
The UTF-8 invariant was only an assumption while printInternal(PrintStream&,
const CString&)
existed, though, because it wrote its bytes straight into the stream with %s. A
Latin1CString sliced
to its base class and injected bytes that are not valid UTF-8, at which point
toString() returns a
null String and the message is lost rather than merely garbled - which is why
StringPrintStream::toStringWithLatin1Fallback() exists. Rather than reinterpret
those bytes, which
would only paper over the missing encoding for a type that is on its way out,
that overload is
deleted. Printing a CString no longer compiles; callers name an encoding
instead.
The three encoding-aware overloads that replace it follow the same split as
CStringWithEncoding::legacyCStringPointer(), which is offered for UTF-8 and
ASCII and withheld from
Latin-1: UTF-8 and ASCII bytes are written through unchanged, and Latin-1 is
transcoded, behind a
charactersAreAllASCII() fast path so the common case still does not allocate.
Printing keeps using
%s on the null-terminated buffer rather than the length-carrying span overload,
so that an embedded
null still truncates instead of being written into a stream whose length is
asserted against
strlenSpan(). The truncation path for very long strings now decodes with the
same rules as the
non-truncated one; previously it read the bytes as Latin-1 while its sibling
passed them through, so
one CString could produce two different results depending on its length.
* Source/*:
Canonical link: https://commits.webkit.org/320980@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications