[webkit-changes] [WebKit/WebKit] f5716c: Add mechanism to automatically convert Enums to St...

Keith Miller noreply at github.com
Mon Aug 5 09:24:39 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f5716c3f9c9a8b19d82c02df456588ea62767c1e
      https://github.com/WebKit/WebKit/commit/f5716c3f9c9a8b19d82c02df456588ea62767c1e
  Author: Keith Miller <keith_miller at apple.com>
  Date:   2024-08-05 (Mon, 05 Aug 2024)

  Changed paths:
    M JSTests/wasm/wabt-wrapper.js
    M Source/JavaScriptCore/bytecode/ExitKind.cpp
    M Source/JavaScriptCore/bytecode/ExitKind.h
    M Source/JavaScriptCore/bytecode/ExpressionInfo.cpp
    M Source/JavaScriptCore/bytecode/ExpressionInfo.h
    M Source/JavaScriptCore/bytecode/Watchpoint.h
    M Source/JavaScriptCore/dfg/DFGArrayMode.cpp
    M Source/JavaScriptCore/dfg/DFGArrayMode.h
    M Source/JavaScriptCore/dfg/DFGBranchDirection.h
    M Source/JavaScriptCore/dfg/DFGOSRExit.cpp
    M Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp
    M Source/JavaScriptCore/heap/AbstractSlotVisitor.h
    M Source/JavaScriptCore/heap/AlignedMemoryAllocator.h
    M Source/JavaScriptCore/heap/GCLogging.cpp
    M Source/JavaScriptCore/heap/GCLogging.h
    M Source/JavaScriptCore/heap/GigacageAlignedMemoryAllocator.cpp
    M Source/JavaScriptCore/jit/JITOpaqueByproduct.h
    M Source/JavaScriptCore/jsc.cpp
    M Source/JavaScriptCore/profiler/ProfilerOSRExit.cpp
    M Source/JavaScriptCore/runtime/BufferMemoryHandle.cpp
    M Source/JavaScriptCore/runtime/BufferMemoryHandle.h
    M Source/JavaScriptCore/runtime/Options.cpp
    M Source/JavaScriptCore/wasm/WasmWorklist.cpp
    M Source/JavaScriptCore/wasm/WasmWorklist.h
    M Source/WTF/wtf/EnumTraits.h
    M Source/WTF/wtf/Gigacage.h
    M Source/WTF/wtf/PrintStream.h
    M Tools/TestWebKitAPI/Configurations/DebugRelease.xcconfig
    M Tools/TestWebKitAPI/Tests/WTF/EnumTraits.cpp

  Log Message:
  -----------
  Add mechanism to automatically convert Enums to Strings for printing
https://bugs.webkit.org/show_bug.cgi?id=271967
rdar://125723369

Reviewed by Yusuke Suzuki.

This patch adds support a set of new functions that return a `std::span<const char>`
with the stringification of an enum's type or members. Members are determined by
reflecting on the compiler's result for `__PRETTY_FUNCTION__`. This doesn't seem to
significantly increase compile times as a Debug build of JSC was 272.5s with this
change vs 268.8s without (~1% compile time increase).

In order to limit compile time overhead, the number of enum values stringified is
limited to 256 by default.

This patch also integrates this new name reflection into `dataLog` so it will
automatically print the enum's value strigified into the log. There's also a
`ScopedEnumDump` that includes the enum's name and `EnumDumpWithDefault` that
takes a default string if a stringification for the enum value can't be deduced.

* JSTests/wasm/wabt-wrapper.js:
* Source/JavaScriptCore/bytecode/ExitKind.cpp:
(JSC::exitKindToString): Deleted.
(WTF::printInternal): Deleted.
* Source/JavaScriptCore/bytecode/ExitKind.h:
* Source/JavaScriptCore/bytecode/ExpressionInfo.cpp:
(WTF::printInternal): Deleted.
* Source/JavaScriptCore/bytecode/ExpressionInfo.h:
* Source/JavaScriptCore/dfg/DFGArrayMode.cpp:
(WTF::printInternal):
(JSC::DFG::arrayActionToString): Deleted.
(JSC::DFG::arrayTypeToString): Deleted.
(JSC::DFG::arrayClassToString): Deleted.
(JSC::DFG::arraySpeculationToString): Deleted.
(JSC::DFG::arrayConversionToString): Deleted.
* Source/JavaScriptCore/dfg/DFGArrayMode.h:
* Source/JavaScriptCore/dfg/DFGBranchDirection.h:
(JSC::DFG::branchDirectionToString): Deleted.
(WTF::printInternal): Deleted.
* Source/JavaScriptCore/dfg/DFGOSRExit.cpp:
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp:
(JSC::FTL::compileStub):
* Source/JavaScriptCore/heap/GCLogging.cpp:
(JSC::GCLogging::levelAsString): Deleted.
* Source/JavaScriptCore/heap/GCLogging.h:
* Source/JavaScriptCore/jsc.cpp:
(CommandLine::parseArguments):
* Source/JavaScriptCore/profiler/ProfilerOSRExit.cpp:
(JSC::Profiler::OSRExit::toJSON const):
* Source/JavaScriptCore/runtime/BufferMemoryHandle.cpp:
(JSC::BufferMemoryResult::dump const):
(JSC::BufferMemoryManager::tryAllocatePhysicalBytes):
(JSC::BufferMemoryResult::toString): Deleted.
* Source/JavaScriptCore/runtime/BufferMemoryHandle.h:
* Source/JavaScriptCore/runtime/Options.cpp:
(JSC::OptionsHelper::Option::dump const):
* Source/JavaScriptCore/wasm/WasmWorklist.cpp:
(JSC::Wasm::Worklist::priorityString): Deleted.
* Source/JavaScriptCore/wasm/WasmWorklist.h:
* Source/WTF/wtf/EnumTraits.h:
(WTF::enumTypeNameImpl):
(WTF::enumTypeName):
(WTF::enumNameImpl):
(WTF::enumName):
(WTF::detail::for_constexpr):
(WTF::enumNames):
* Source/WTF/wtf/Gigacage.h:
(Gigacage::name): Deleted.
* Source/WTF/wtf/PrintStream.h:
(WTF::printInternal):
(WTF::ScopedEnumDump::ScopedEnumDump):
(WTF::ScopedEnumDump::dump const):
(WTF::EnumDumpMayBeUnknown::EnumDumpMayBeUnknown):
(WTF::EnumDumpMayBeUnknown::dump const):
(WTF::requires):

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



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


More information about the webkit-changes mailing list