Ignore:
Timestamp:
Jun 18, 2022, 9:07:37 PM (3 years ago)
Author:
[email protected]
Message:

Introducing RawHex, a counterpart to RawPointer
https://bugs.webkit.org/show_bug.cgi?id=241743

Reviewed by Saam Barati.

RawHex is for dumping integral values in hex just like RawPointer is for dumping
pointers. And similarly, RawHex is meant to be used with PrintStream.

For example:

dataLog(RawHex(42)); prints 0x2a
dataLog(RawHex(0x42);
prints 0x42
dataLog(RawHex(256)); prints 0x100
dataLog(RawHex(65536);
prints 0x10000
dataLog(RawHex(4294967295); prints 0xffffffff
dataLog(RawHex(4294967296);
prints 0x100000000
dataLog(RawHex(INT8_MIN); prints 0x80
dataLog(RawHex(INT16_MIN);
prints 0x8000
dataLog(RawHex(INT32_MIN); prints 0x80000000
dataLog(RawHex(-1);
prints 0xffffffff
dataLog(RawHex(INT64_MIN); prints 0x8000000000000000
dataLog(RawHex(INT64_MAX);
prints 0x7fffffffffffffff
dataLog(RawHex(UINT64_MAX); prints 0xffffffffffffffff

Also fixed up places where we were casting integral values into pointers, and
then using RawPointer to dump them in hex.

  • Source/JavaScriptCore/bytecode/BytecodeDumper.cpp:

(JSC::Wasm::BytecodeDumper::formatConstant const):

  • Source/JavaScriptCore/interpreter/StackVisitor.cpp:

(JSC::StackVisitor::Frame::dump const):

  • Source/JavaScriptCore/runtime/ExecutableBase.cpp:

(JSC::ExecutableBase::dump const):

  • Source/JavaScriptCore/runtime/LazyPropertyInlines.h:

(JSC::ElementType>::dump const):

  • Source/JavaScriptCore/runtime/SamplingProfiler.cpp:

(JSC::SamplingProfiler::reportTopBytecodes):

  • Source/JavaScriptCore/tools/Integrity.cpp:

(JSC::Integrity::Random::reloadAndCheckShouldAuditSlow):

  • Source/JavaScriptCore/wasm/WasmFunctionParser.h:

(JSC::Wasm::FunctionParser<Context>::parseBody):

  • Source/JavaScriptCore/wasm/WasmOpcodeOrigin.cpp:

(JSC::Wasm::OpcodeOrigin::dump const):

  • Source/WTF/WTF.xcodeproj/project.pbxproj:
  • Source/WTF/wtf/CMakeLists.txt:
  • Source/WTF/wtf/PrintStream.cpp:

(WTF::printInternal):

  • Source/WTF/wtf/PrintStream.h:
  • Source/WTF/wtf/RawHex.h: Added.

(WTF::RawHex::RawHex):
(WTF::RawHex::ptr const):
(WTF::RawHex::is64Bit const):
(WTF::RawHex::u64 const):

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/tools/Integrity.cpp

    r294017 r295660  
    5555        m_triggerBits = 0; // Never trigger, and don't bother reloading.
    5656        if (IntegrityInternal::verbose)
    57             dataLogLn("disabled Integrity audits: trigger bits ", RawPointer(reinterpret_cast<void*>(m_triggerBits)));
     57            dataLogLn("disabled Integrity audits: trigger bits ", RawHex(m_triggerBits));
    5858        return false;
    5959    }
     
    6868    }
    6969    if (IntegrityInternal::verbose)
    70         dataLogLn("reloaded Integrity trigger bits ", RawPointer(reinterpret_cast<void*>(m_triggerBits)));
     70        dataLogLn("reloaded Integrity trigger bits ", RawHex(m_triggerBits));
    7171    ASSERT(m_triggerBits >= (1ull << 63));
    7272    return vm.random().getUint32() <= threshold;
Note: See TracChangeset for help on using the changeset viewer.