Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9b5592466bc12a1cd0f0ec9d9ea59e53d1b5c603
      
https://github.com/WebKit/WebKit/commit/9b5592466bc12a1cd0f0ec9d9ea59e53d1b5c603
  Author: Chris Dumez <[email protected]>
  Date:   2026-09-20 (Sun, 20 Sep 2026)

  Changed paths:
    M Source/JavaScriptCore/API/JSMarkingConstraintPrivate.cpp
    M Source/JavaScriptCore/heap/AbstractSlotVisitor.h
    M Source/JavaScriptCore/heap/AbstractSlotVisitorInlines.h
    M Source/JavaScriptCore/heap/CompleteSubspace.cpp
    M Source/JavaScriptCore/heap/CompleteSubspace.h
    M Source/JavaScriptCore/heap/Heap.cpp
    M Source/JavaScriptCore/heap/IsoSubspace.cpp
    M Source/JavaScriptCore/heap/IsoSubspace.h
    M Source/JavaScriptCore/heap/MarkingConstraint.cpp
    M Source/JavaScriptCore/heap/MarkingConstraint.h
    M Source/JavaScriptCore/heap/MarkingConstraintSet.cpp
    M Source/JavaScriptCore/heap/MarkingConstraintSet.h
    M Source/JavaScriptCore/heap/PreciseSubspace.cpp
    M Source/JavaScriptCore/heap/PreciseSubspace.h
    M Source/JavaScriptCore/heap/SimpleMarkingConstraint.cpp
    M Source/JavaScriptCore/heap/SimpleMarkingConstraint.h
    M Source/JavaScriptCore/heap/SlotVisitor.cpp
    M Source/JavaScriptCore/heap/SlotVisitor.h
    M Source/JavaScriptCore/heap/Subspace.cpp
    M Source/JavaScriptCore/heap/Subspace.h
    M Source/JavaScriptCore/jit/JITPlan.cpp
    M Source/JavaScriptCore/runtime/JSCell.cpp
    M Source/JavaScriptCore/runtime/JSGlobalObject.cpp
    M Source/JavaScriptCore/runtime/ProfilerSupport.cpp
    M Source/JavaScriptCore/runtime/ProfilerSupport.h
    M Source/JavaScriptCore/tools/VMInspector.cpp
    M Source/WTF/wtf/StringPrintStream.cpp
    M Source/WTF/wtf/StringPrintStream.h
    M Tools/TestWebKitAPI/Tests/WTF/CString.cpp

  Log Message:
  -----------
  Type the JSC heap names as ASCIICString and the profiler marker messages as 
UTF8CString
https://bugs.webkit.org/show_bug.cgi?id=324651

Reviewed by Yusuke Suzuki.

Follow-up to 320652@main, typing JSC's own diagnostic strings. The two halves 
reach opposite
conclusions, which is the point of typing them. Subspace, MarkingConstraint and 
AbstractSlotVisitor
names are ASCII by construction - every producer already passed an ASCIILiteral 
- so they become
ASCIICString, whose data() is already a const char* and needs no 
legacyCStringPointer() at the
Mach-O, ELF and perf-map interfaces that consume them. ProfilerSupport's 
message cannot be ASCII: its
untyped parameter was hiding a disagreement between callers, since the JSC 
paths passed
String::ascii() while Performance::measure() passed String::utf8(). The message 
is written to a text
marker file verbatim, so UTF-8 is what that file wants and ASCII is a subset of 
it; requiring ASCII
would instead mangle web-controlled performance.measure() names, because 
String::ascii() replaces
anything outside 0x20..0x7f with '?'.

That makes this a behaviour change as well as a retyping: non-ASCII messages, 
such as JS function
names and measure labels, previously reached the marker file and the signposts 
as '?' and now
survive. JITPlan was round-tripping its own data to get there, since 
m_signpostMessage is already a
UTF8CString that makeString() decoded and .ascii().data() then mangled back 
down and laundered into a
fresh CString. Performance::measure() needed no change; it was only being 
sliced to the base class.

name(), abbreviatedName() and codeName() returned const char* off 
CString::data(), leaking the
untyped pointer into consumers: reportZappedCellAndCrash() and 
dumpSubspaceHashes() re-hashed it with
SuperFastHash::computeHash() instead of calling Subspace::nameHash(), which is 
the same computation,
so the hashes in crash diagnostics and in the // Hash: comments are unchanged. 
runFixpointPhase()
keyed its logGC dump on const char* and sorted with strcmp() inside a 
WTF_ALLOW_UNSAFE_BUFFER_USAGE
block, which is now an ASCIICString key with std::less<>; compareSpans() is 
byte-wise, so the
ordering does not change.

StringPrintStream gains toASCIICString() alongside toUTF8CString(), for the two 
heap producers that
built a UTF8CString only to hand it to an untyped parameter and cannot use 
makeString(...).ascii()
because they format a RawPointer. The nine name pairs in addCoreConstraints() 
become ASCIILiterals,
since CStringWithEncoding's const char* constructor is explicit, and
INIT_SERVER_STRUCTURE_ISO_SUBSPACE stringifies with #name ""_s to match its 
sibling
ISO_SUBSPACE_INIT.

Test: Tools/TestWebKitAPI/Tests/WTF/CString.cpp

* Source/JavaScriptCore/API/JSMarkingConstraintPrivate.cpp:
(JSContextGroupAddMarkingConstraint):
* Source/JavaScriptCore/heap/AbstractSlotVisitor.h:
* Source/JavaScriptCore/heap/AbstractSlotVisitorInlines.h:
(JSC::AbstractSlotVisitor::AbstractSlotVisitor):
* Source/JavaScriptCore/heap/CompleteSubspace.cpp:
(JSC::CompleteSubspace::CompleteSubspace):
* Source/JavaScriptCore/heap/CompleteSubspace.h:
* Source/JavaScriptCore/heap/Heap.cpp:
(JSC::Heap::Heap):
(JSC::Heap::clearConcurrentRetainedDataIfPossible):
* Source/JavaScriptCore/heap/IsoSubspace.cpp:
(JSC::IsoSubspace::IsoSubspace):
* Source/JavaScriptCore/heap/IsoSubspace.h:
* Source/JavaScriptCore/heap/MarkingConstraint.cpp:
(JSC::MarkingConstraint::MarkingConstraint):
* Source/JavaScriptCore/heap/MarkingConstraint.h:
* Source/JavaScriptCore/heap/MarkingConstraintSet.cpp:
(JSC::MarkingConstraintSet::add):
* Source/JavaScriptCore/heap/MarkingConstraintSet.h:
(JSC::MarkingConstraintSet::add):
* Source/JavaScriptCore/heap/PreciseSubspace.cpp:
(JSC::PreciseSubspace::PreciseSubspace):
* Source/JavaScriptCore/heap/PreciseSubspace.h:
* Source/JavaScriptCore/heap/SimpleMarkingConstraint.cpp:
(JSC::SimpleMarkingConstraint::SimpleMarkingConstraint):
* Source/JavaScriptCore/heap/SimpleMarkingConstraint.h:
* Source/JavaScriptCore/heap/SlotVisitor.cpp:
(JSC::SlotVisitor::SlotVisitor):
* Source/JavaScriptCore/heap/SlotVisitor.h:
* Source/JavaScriptCore/heap/Subspace.cpp:
(JSC::Subspace::Subspace):
* Source/JavaScriptCore/heap/Subspace.h:
* Source/JavaScriptCore/jit/JITPlan.cpp:
(JSC::JITPlan::beginSignpostImpl):
(JSC::JITPlan::endSignpostImpl):
* Source/JavaScriptCore/runtime/JSCell.cpp:
(JSC::reportZappedCellAndCrash):
* Source/JavaScriptCore/runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::startSignpost):
(JSC::JSGlobalObject::stopSignpost):
* Source/JavaScriptCore/runtime/ProfilerSupport.cpp:
(JSC::ProfilerSupport::write):
(JSC::ProfilerSupport::markStart):
(JSC::ProfilerSupport::markEnd):
(JSC::ProfilerSupport::mark):
(JSC::ProfilerSupport::markInterval):
* Source/JavaScriptCore/runtime/ProfilerSupport.h:
* Source/JavaScriptCore/tools/VMInspector.cpp:
(JSC::VMInspector::dumpSubspaceHashes):
* Source/WTF/wtf/StringPrintStream.cpp:
(WTF::StringPrintStream::toASCIICString const):
* Source/WTF/wtf/StringPrintStream.h:
(WTF::toASCIICString):
* Tools/TestWebKitAPI/Tests/WTF/CString.cpp:
(TEST(WTF, CStringWithEncodingFromPrintStream)):

Canonical link: https://commits.webkit.org/321483@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to