Title: [295660] trunk/Source
Revision
295660
Author
[email protected]
Date
2022-06-18 21:07:37 -0700 (Sat, 18 Jun 2022)

Log 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/_javascript_Core/bytecode/BytecodeDumper.cpp:
(JSC::Wasm::BytecodeDumper::formatConstant const):
* Source/_javascript_Core/interpreter/StackVisitor.cpp:
(JSC::StackVisitor::Frame::dump const):
* Source/_javascript_Core/runtime/ExecutableBase.cpp:
(JSC::ExecutableBase::dump const):
* Source/_javascript_Core/runtime/LazyPropertyInlines.h:
(JSC::ElementType>::dump const):
* Source/_javascript_Core/runtime/SamplingProfiler.cpp:
(JSC::SamplingProfiler::reportTopBytecodes):
* Source/_javascript_Core/tools/Integrity.cpp:
(JSC::Integrity::Random::reloadAndCheckShouldAuditSlow):
* Source/_javascript_Core/wasm/WasmFunctionParser.h:
(JSC::Wasm::FunctionParser<Context>::parseBody):
* Source/_javascript_Core/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

Modified Paths

Added Paths

Diff

Modified: trunk/Source/_javascript_Core/bytecode/BytecodeDumper.cpp (295659 => 295660)


--- trunk/Source/_javascript_Core/bytecode/BytecodeDumper.cpp	2022-06-18 10:00:32 UTC (rev 295659)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeDumper.cpp	2022-06-19 04:07:37 UTC (rev 295660)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2017 Yusuke Suzuki <[email protected]>
- * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -413,7 +413,7 @@
         if (isFuncref(type) || isExternref(type)) {
             if (JSValue::decode(constant) == jsNull())
                 return "null";
-            return toCString(RawPointer(bitwise_cast<void*>(static_cast<uintptr_t>(constant))));
+            return toCString(RawHex(constant));
         }
 
         RELEASE_ASSERT_NOT_REACHED();

Modified: trunk/Source/_javascript_Core/interpreter/StackVisitor.cpp (295659 => 295660)


--- trunk/Source/_javascript_Core/interpreter/StackVisitor.cpp	2022-06-18 10:00:32 UTC (rev 295659)
+++ trunk/Source/_javascript_Core/interpreter/StackVisitor.cpp	2022-06-19 04:07:37 UTC (rev 295660)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -462,7 +462,7 @@
         out.print(indent, "callerFrame: ", RawPointer(callerFrame), "\n");
         uintptr_t locationRawBits = callFrame->callSiteAsRawBits();
         out.print(indent, "rawLocationBits: ", locationRawBits,
-            " ", RawPointer(reinterpret_cast<void*>(locationRawBits)), "\n");
+            " ", RawHex(locationRawBits), "\n");
         out.print(indent, "codeBlock: ", RawPointer(codeBlock));
         if (codeBlock)
             out.print(" ", *codeBlock);

Modified: trunk/Source/_javascript_Core/runtime/ExecutableBase.cpp (295659 => 295660)


--- trunk/Source/_javascript_Core/runtime/ExecutableBase.cpp	2022-06-18 10:00:32 UTC (rev 295659)
+++ trunk/Source/_javascript_Core/runtime/ExecutableBase.cpp	2022-06-19 04:07:37 UTC (rev 295660)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2009-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -49,7 +49,7 @@
     switch (type()) {
     case NativeExecutableType: {
         NativeExecutable* native = jsCast<NativeExecutable*>(realThis);
-        out.print("NativeExecutable:", RawPointer(bitwise_cast<void*>(native->function())), "/", RawPointer(bitwise_cast<void*>(native->constructor())));
+        out.print("NativeExecutable:", RawPointer(native->function().rawPointer()), "/", RawPointer(native->constructor().rawPointer()));
         return;
     }
     case EvalExecutableType: {

Modified: trunk/Source/_javascript_Core/runtime/LazyPropertyInlines.h (295659 => 295660)


--- trunk/Source/_javascript_Core/runtime/LazyPropertyInlines.h	2022-06-18 10:00:32 UTC (rev 295659)
+++ trunk/Source/_javascript_Core/runtime/LazyPropertyInlines.h	2022-06-19 04:07:37 UTC (rev 295660)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -83,12 +83,12 @@
         return;
     }
     if (m_pointer & lazyTag) {
-        out.print("Lazy:", RawPointer(bitwise_cast<void*>(m_pointer & ~lazyTag)));
+        out.print("Lazy:", RawHex(m_pointer & ~lazyTag));
         if (m_pointer & initializingTag)
             out.print("(Initializing)");
         return;
     }
-    out.print(RawPointer(bitwise_cast<void*>(m_pointer)));
+    out.print(RawHex(m_pointer));
 }
 
 template<typename OwnerType, typename ElementType>

Modified: trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp (295659 => 295660)


--- trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp	2022-06-18 10:00:32 UTC (rev 295659)
+++ trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp	2022-06-19 04:07:37 UTC (rev 295660)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -1196,7 +1196,7 @@
                 description.print(":");
                 if (wasmOffset) {
                     uintptr_t offset = wasmOffset.offset();
-                    description.print(RawPointer(bitwise_cast<void*>(offset)));
+                    description.print(RawHex(offset));
                 } else
                     description.print("nil");
                 return description.toString();

Modified: trunk/Source/_javascript_Core/tools/Integrity.cpp (295659 => 295660)


--- trunk/Source/_javascript_Core/tools/Integrity.cpp	2022-06-18 10:00:32 UTC (rev 295659)
+++ trunk/Source/_javascript_Core/tools/Integrity.cpp	2022-06-19 04:07:37 UTC (rev 295660)
@@ -54,7 +54,7 @@
     if (!Options::randomIntegrityAuditRate()) {
         m_triggerBits = 0; // Never trigger, and don't bother reloading.
         if (IntegrityInternal::verbose)
-            dataLogLn("disabled Integrity audits: trigger bits ", RawPointer(reinterpret_cast<void*>(m_triggerBits)));
+            dataLogLn("disabled Integrity audits: trigger bits ", RawHex(m_triggerBits));
         return false;
     }
 
@@ -67,7 +67,7 @@
         m_triggerBits = m_triggerBits | (static_cast<uint64_t>(trigger) << i);
     }
     if (IntegrityInternal::verbose)
-        dataLogLn("reloaded Integrity trigger bits ", RawPointer(reinterpret_cast<void*>(m_triggerBits)));
+        dataLogLn("reloaded Integrity trigger bits ", RawHex(m_triggerBits));
     ASSERT(m_triggerBits >= (1ull << 63));
     return vm.random().getUint32() <= threshold;
 }

Modified: trunk/Source/_javascript_Core/wasm/WasmFunctionParser.h (295659 => 295660)


--- trunk/Source/_javascript_Core/wasm/WasmFunctionParser.h	2022-06-18 10:00:32 UTC (rev 295659)
+++ trunk/Source/_javascript_Core/wasm/WasmFunctionParser.h	2022-06-19 04:07:37 UTC (rev 295660)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -288,7 +288,7 @@
         m_currentOpcode = static_cast<OpType>(op);
 
         if (verbose) {
-            dataLogLn("processing op (", m_unreachableBlocks, "): ",  RawPointer(reinterpret_cast<void*>(op)), ", ", makeString(static_cast<OpType>(op)), " at offset: ", RawPointer(reinterpret_cast<void*>(m_offset)));
+            dataLogLn("processing op (", m_unreachableBlocks, "): ",  RawHex(op), ", ", makeString(static_cast<OpType>(op)), " at offset: ", RawHex(m_offset));
             m_context.dump(m_controlStack, &m_expressionStack);
         }
 

Modified: trunk/Source/_javascript_Core/wasm/WasmOpcodeOrigin.cpp (295659 => 295660)


--- trunk/Source/_javascript_Core/wasm/WasmOpcodeOrigin.cpp	2022-06-18 10:00:32 UTC (rev 295659)
+++ trunk/Source/_javascript_Core/wasm/WasmOpcodeOrigin.cpp	2022-06-19 04:07:37 UTC (rev 295660)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,7 +32,7 @@
 
 void OpcodeOrigin::dump(PrintStream& out) const
 {
-    out.print("{opcode: ", makeString(opcode()), ", location: ", RawPointer(reinterpret_cast<void*>(location())), "}");
+    out.print("{opcode: ", makeString(opcode()), ", location: ", RawHex(location()), "}");
 }
 
 } } // namespace JSC::Wasm

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (295659 => 295660)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2022-06-18 10:00:32 UTC (rev 295659)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2022-06-19 04:07:37 UTC (rev 295660)
@@ -810,6 +810,7 @@
 		FE1E2C3B2240C06600F6B729 /* PtrTag.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE1E2C392240C05400F6B729 /* PtrTag.cpp */; };
 		FE1E2C42224187C600F6B729 /* PlatformRegisters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE1E2C41224187C600F6B729 /* PlatformRegisters.cpp */; };
 		FE35D09227DC5ECC009DFA5B /* StackCheck.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE35D09127DC5ECC009DFA5B /* StackCheck.cpp */; };
+		FE7ACFEF285DC2F9007FC8E9 /* RawHex.h in Headers */ = {isa = PBXBuildFile; fileRef = FE7ACFEE285DC2F8007FC8E9 /* RawHex.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		FEDACD3D1630F83F00C69634 /* StackStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDACD3B1630F83F00C69634 /* StackStats.cpp */; };
 		FEEA4DF9216D7BE400AC0602 /* StackPointer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEEA4DF8216D7BE400AC0602 /* StackPointer.cpp */; };
 		FF895F11282AB96400E7BAE8 /* CompactRefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = FF895F10282AB96400E7BAE8 /* CompactRefPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -1706,6 +1707,7 @@
 		FE3842342325CC80009DD445 /* ResourceUsage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceUsage.h; sourceTree = "<group>"; };
 		FE7497E4208FFCAA0003565B /* PtrTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PtrTag.h; sourceTree = "<group>"; };
 		FE7497ED209163060003565B /* MetaAllocatorPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MetaAllocatorPtr.h; sourceTree = "<group>"; };
+		FE7ACFEE285DC2F8007FC8E9 /* RawHex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RawHex.h; sourceTree = "<group>"; };
 		FE8225301B2A1E5B00BA68FD /* NakedPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NakedPtr.h; sourceTree = "<group>"; };
 		FE86A8741E59440200111BBF /* ForbidHeapAllocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ForbidHeapAllocation.h; sourceTree = "<group>"; };
 		FE8925AF1D00DAEC0046907E /* Indenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Indenter.h; sourceTree = "<group>"; };
@@ -2175,6 +2177,7 @@
 				A8A472FD151A825B004123FF /* RandomNumberSeed.h */,
 				0F2AC5601E89F70C0001EE3F /* Range.h */,
 				0F725CAB1C50461600AD943A /* RangeSet.h */,
+				FE7ACFEE285DC2F8007FC8E9 /* RawHex.h */,
 				0F87105916643F190090B0AD /* RawPointer.h */,
 				FE05FAE61FDB214300093230 /* RawPtrTraits.h */,
 				AD653DA82006B6C200D820D7 /* RawValueTraits.h */,
@@ -3219,6 +3222,7 @@
 				DD4901E627B4748A00D7E50D /* UniStdExtras.h in Headers */,
 				DD3DC97027A4BF8E007E5B61 /* UnsafePointer.h in Headers */,
 				DD3DC90327A4BF8E007E5B61 /* URL.h in Headers */,
+				FE7ACFEF285DC2F9007FC8E9 /* RawHex.h in Headers */,
 				DD3DC8ED27A4BF8E007E5B61 /* URLHash.h in Headers */,
 				DD3DC99A27A4BF8E007E5B61 /* URLHelpers.h in Headers */,
 				DD3DC8BD27A4BF8E007E5B61 /* URLParser.h in Headers */,

Modified: trunk/Source/WTF/wtf/CMakeLists.txt (295659 => 295660)


--- trunk/Source/WTF/wtf/CMakeLists.txt	2022-06-18 10:00:32 UTC (rev 295659)
+++ trunk/Source/WTF/wtf/CMakeLists.txt	2022-06-19 04:07:37 UTC (rev 295660)
@@ -218,6 +218,7 @@
     RandomNumberSeed.h
     Range.h
     RangeSet.h
+    RawHex.h
     RawPointer.h
     RawPtrTraits.h
     RawValueTraits.h

Modified: trunk/Source/WTF/wtf/PrintStream.cpp (295659 => 295660)


--- trunk/Source/WTF/wtf/PrintStream.cpp	2022-06-18 10:00:32 UTC (rev 295659)
+++ trunk/Source/WTF/wtf/PrintStream.cpp	2022-06-19 04:07:37 UTC (rev 295660)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -184,6 +184,17 @@
     out.printf("%lf", value);
 }
 
+void printInternal(PrintStream& out, RawHex value)
+{
+#if !CPU(ADDRESS64)
+    if (value.is64Bit()) {
+        out.printf("0x%" PRIx64, value.u64());
+        return;
+    }
+#endif
+    out.printf("%p", value.ptr());
+}
+
 void printInternal(PrintStream& out, RawPointer value)
 {
     out.printf("%p", value.value());

Modified: trunk/Source/WTF/wtf/PrintStream.h (295659 => 295660)


--- trunk/Source/WTF/wtf/PrintStream.h	2022-06-18 10:00:32 UTC (rev 295659)
+++ trunk/Source/WTF/wtf/PrintStream.h	2022-06-19 04:07:37 UTC (rev 295660)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -33,6 +33,7 @@
 #include <wtf/FastMalloc.h>
 #include <wtf/FixedWidthDouble.h>
 #include <wtf/Noncopyable.h>
+#include <wtf/RawHex.h>
 #include <wtf/RawPointer.h>
 #include <wtf/RefPtr.h>
 #include <wtf/StdLibExtras.h>
@@ -123,6 +124,7 @@
 WTF_EXPORT_PRIVATE void printInternal(PrintStream&, unsigned long long);
 WTF_EXPORT_PRIVATE void printInternal(PrintStream&, float);
 WTF_EXPORT_PRIVATE void printInternal(PrintStream&, double);
+WTF_EXPORT_PRIVATE void printInternal(PrintStream&, RawHex);
 WTF_EXPORT_PRIVATE void printInternal(PrintStream&, RawPointer);
 WTF_EXPORT_PRIVATE void printInternal(PrintStream&, FixedWidthDouble);
 

Added: trunk/Source/WTF/wtf/RawHex.h (0 => 295660)


--- trunk/Source/WTF/wtf/RawHex.h	                        (rev 0)
+++ trunk/Source/WTF/wtf/RawHex.h	2022-06-19 04:07:37 UTC (rev 295660)
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WTF {
+
+// For printing integral values in hex.
+// See also the printInternal function for RaswHex in PrintStream.cpp.
+
+class RawHex {
+public:
+    RawHex() = default;
+
+    explicit RawHex(int8_t value)
+        : RawHex(static_cast<uint8_t>(value))
+    { }
+    explicit RawHex(uint8_t value)
+        : RawHex(static_cast<uintptr_t>(value))
+    { }
+
+    explicit RawHex(int16_t value)
+        : RawHex(static_cast<uint16_t>(value))
+    { }
+    explicit RawHex(uint16_t value)
+        : RawHex(static_cast<uintptr_t>(value))
+    { }
+
+#if CPU(ADDRESS64) || OS(DARWIN)
+    // These causes build errors for CPU(ADDRESS32) on some ports because int32_t
+    // is already handled by intptr_t, and uint32_t is handled by uintptr_t.
+    explicit RawHex(int32_t value)
+        : RawHex(static_cast<uint32_t>(value))
+    { }
+    explicit RawHex(uint32_t value)
+        : RawHex(static_cast<uintptr_t>(value))
+    { }
+#endif
+
+#if CPU(ADDRESS32) || OS(DARWIN)
+    // These causes build errors for CPU(ADDRESS64) on some ports because int64_t
+    // is already handled by intptr_t, and uint64_t is handled by uintptr_t.
+    explicit RawHex(int64_t value)
+        : RawHex(static_cast<uint64_t>(value))
+    { }
+#if CPU(ADDRESS64) // on OS(DARWIN)
+    explicit RawHex(uint64_t value)
+        : RawHex(static_cast<uintptr_t>(value))
+    { }
+#else
+    explicit RawHex(uint64_t value)
+        : m_is64Bit(true)
+        , m_u64(value)
+    { }
+#endif
+#endif // CPU(ADDRESS64)
+
+    explicit RawHex(intptr_t value)
+        : RawHex(static_cast<uintptr_t>(value))
+    { }
+    explicit RawHex(uintptr_t value)
+        : m_ptr(reinterpret_cast<void*>(value))
+    { }
+
+    const void* ptr() const { return m_ptr; }
+
+#if !CPU(ADDRESS64)
+    bool is64Bit() const { return m_is64Bit; }
+    uint64_t u64() const { return m_u64; }
+#endif
+
+private:
+#if !CPU(ADDRESS64)
+    bool m_is64Bit { false };
+#endif
+    union {
+        const void* m_ptr { nullptr };
+#if !CPU(ADDRESS64)
+        uint64_t m_u64;
+#endif
+    };
+};
+
+} // namespace WTF
+
+using WTF::RawHex;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to