Changeset 231027 in webkit


Ignore:
Timestamp:
Apr 25, 2018 3:31:13 PM (6 years ago)
Author:
mark.lam@apple.com
Message:

Push the definition of PtrTag down to the WTF layer.
https://bugs.webkit.org/show_bug.cgi?id=184976
<rdar://problem/39723901>

Reviewed by Saam Barati.

Source/JavaScriptCore:

  • CMakeLists.txt:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • assembler/ARM64Assembler.h:
  • assembler/AbstractMacroAssembler.h:
  • assembler/MacroAssemblerCodeRef.cpp:
  • assembler/MacroAssemblerCodeRef.h:
  • b3/B3MathExtras.cpp:
  • bytecode/LLIntCallLinkInfo.h:
  • disassembler/Disassembler.h:
  • ftl/FTLJITCode.cpp:
  • interpreter/InterpreterInlines.h:
  • jit/ExecutableAllocator.h:
  • jit/JITOperations.cpp:
  • jit/ThunkGenerator.h:
  • jit/ThunkGenerators.h:
  • llint/LLIntOffsetsExtractor.cpp:
  • llint/LLIntPCRanges.h:
  • runtime/JSCPtrTag.h: Added.
  • runtime/NativeFunction.h:
  • runtime/PtrTag.h: Removed.
  • runtime/VMTraps.cpp:

Source/WebCore:

No new tests needed. This is covered by existing tests.

  • cssjit/CSSPtrTag.h:
  • cssjit/SelectorCompiler.h:

(WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction):
(WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction):
(WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext):
(WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext):

Source/WTF:

This is in preparation for doing pointer profiling at the WTF layer as well.
Also deleted an unused ptrTag() function.

  • WTF.xcodeproj/project.pbxproj:
  • wtf/CMakeLists.txt:
  • wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h.

(WTF::makePtrTagHash):
(JSC::ptrTagName): Deleted.
(JSC::tagForPtr): Deleted.
(JSC::ptrTag): Deleted.
(JSC::tagCodePtr): Deleted.
(JSC::untagCodePtr): Deleted.
(JSC::retagCodePtr): Deleted.
(JSC::removeCodePtrTag): Deleted.
(JSC::tagCFunctionPtr): Deleted.
(JSC::untagCFunctionPtr): Deleted.
(JSC::assertIsCFunctionPtr): Deleted.
(JSC::assertIsNullOrCFunctionPtr): Deleted.
(JSC::assertIsNotTagged): Deleted.
(JSC::assertIsTagged): Deleted.
(JSC::assertIsNullOrTagged): Deleted.
(JSC::assertIsTaggedWith): Deleted.
(JSC::assertIsNullOrTaggedWith): Deleted.

Location:
trunk/Source
Files:
1 added
26 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r230900 r231027  
    771771    runtime/JSCJSValueInlines.h
    772772    runtime/JSCPoison.h
     773    runtime/JSCPtrTag.h
    773774    runtime/JSCallee.h
    774775    runtime/JSCast.h
     
    839840    runtime/Options.h
    840841    runtime/ParseInt.h
    841     runtime/PtrTag.h
    842842    runtime/PrivateName.h
    843843    runtime/ProgramExecutable.h
  • trunk/Source/JavaScriptCore/ChangeLog

    r231018 r231027  
     12018-04-25  Mark Lam  <mark.lam@apple.com>
     2
     3        Push the definition of PtrTag down to the WTF layer.
     4        https://bugs.webkit.org/show_bug.cgi?id=184976
     5        <rdar://problem/39723901>
     6
     7        Reviewed by Saam Barati.
     8
     9        * CMakeLists.txt:
     10        * JavaScriptCore.xcodeproj/project.pbxproj:
     11        * assembler/ARM64Assembler.h:
     12        * assembler/AbstractMacroAssembler.h:
     13        * assembler/MacroAssemblerCodeRef.cpp:
     14        * assembler/MacroAssemblerCodeRef.h:
     15        * b3/B3MathExtras.cpp:
     16        * bytecode/LLIntCallLinkInfo.h:
     17        * disassembler/Disassembler.h:
     18        * ftl/FTLJITCode.cpp:
     19        * interpreter/InterpreterInlines.h:
     20        * jit/ExecutableAllocator.h:
     21        * jit/JITOperations.cpp:
     22        * jit/ThunkGenerator.h:
     23        * jit/ThunkGenerators.h:
     24        * llint/LLIntOffsetsExtractor.cpp:
     25        * llint/LLIntPCRanges.h:
     26        * runtime/JSCPtrTag.h: Added.
     27        * runtime/NativeFunction.h:
     28        * runtime/PtrTag.h: Removed.
     29        * runtime/VMTraps.cpp:
     30
    1312018-04-25  Keith Miller  <keith_miller@apple.com>
    232
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r230900 r231027  
    17721772                FE6491371D78F01D00A694D4 /* ExceptionScope.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6491361D78F01300A694D4 /* ExceptionScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
    17731773                FE68C6371B90DE040042BCB3 /* MacroAssemblerPrinter.h in Headers */ = {isa = PBXBuildFile; fileRef = FE68C6361B90DDD90042BCB3 /* MacroAssemblerPrinter.h */; settings = {ATTRIBUTES = (Private, ); }; };
    1774                 FE6C1E4A20366F0100BDC2B7 /* PtrTag.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9AE1C82032C887002B6934 /* PtrTag.h */; settings = {ATTRIBUTES = (Private, ); }; };
    17751774                FE6F56DE1E64EAD600D17801 /* VMTraps.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6F56DD1E64E92000D17801 /* VMTraps.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1775                FE7497E6209001B10003565B /* JSCPtrTag.h in Headers */ = {isa = PBXBuildFile; fileRef = FE7497E5209001B00003565B /* JSCPtrTag.h */; settings = {ATTRIBUTES = (Private, ); }; };
    17761776                FE7C41961B97FC4B00F4D598 /* PingPongStackOverflowTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDA50D41B97F442009A3B4F /* PingPongStackOverflowTest.cpp */; };
    17771777                FE80C1971D775CDD008510C0 /* CatchScope.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80C1961D775B27008510C0 /* CatchScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    47084708                FE6F56DC1E64E92000D17801 /* VMTraps.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VMTraps.cpp; sourceTree = "<group>"; };
    47094709                FE6F56DD1E64E92000D17801 /* VMTraps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMTraps.h; sourceTree = "<group>"; };
     4710                FE7497E5209001B00003565B /* JSCPtrTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCPtrTag.h; sourceTree = "<group>"; };
    47104711                FE80C1961D775B27008510C0 /* CatchScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CatchScope.h; sourceTree = "<group>"; };
    47114712                FE80C1981D775FB4008510C0 /* CatchScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CatchScope.cpp; sourceTree = "<group>"; };
     
    47154716                FE99B2471C24B6D300C82159 /* JITNegGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITNegGenerator.cpp; sourceTree = "<group>"; };
    47164717                FE99B2481C24B6D300C82159 /* JITNegGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITNegGenerator.h; sourceTree = "<group>"; };
    4717                 FE9AE1C82032C887002B6934 /* PtrTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PtrTag.h; sourceTree = "<group>"; };
    47184718                FEA0861E182B7A0400F6D851 /* Breakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Breakpoint.h; sourceTree = "<group>"; };
    47194719                FEA0861F182B7A0400F6D851 /* DebuggerPrimitives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebuggerPrimitives.h; sourceTree = "<group>"; };
     
    67446744                                862553CE16136AA5009F17D0 /* JSProxy.cpp */,
    67456745                                862553CF16136AA5009F17D0 /* JSProxy.h */,
     6746                                FE7497E5209001B00003565B /* JSCPtrTag.h */,
    67466747                                534638721E70D01500F12AC1 /* JSRunLoopTimer.cpp */,
    67476748                                534638701E70CF3D00F12AC1 /* JSRunLoopTimer.h */,
     
    68826883                                79160DBB1C8E3EC8008C085A /* ProxyRevoke.cpp */,
    68836884                                79160DBC1C8E3EC8008C085A /* ProxyRevoke.h */,
    6884                                 FE9AE1C82032C887002B6934 /* PtrTag.h */,
    68856885                                0F5780A118FE1E98001E72D9 /* PureNaN.h */,
    68866886                                0F0CD4C015F1A6040032F1C0 /* PutDirectIndexMode.h */,
     
    90629062                                7C184E1F17BEE22E007CB63A /* JSPromisePrototype.h in Headers */,
    90639063                                996B731F1BDA08EF00331B84 /* JSPromisePrototype.lut.h in Headers */,
     9064                                FE7497E6209001B10003565B /* JSCPtrTag.h in Headers */,
    90649065                                2A05ABD61961DF2400341750 /* JSPropertyNameEnumerator.h in Headers */,
    90659066                                862553D216136E1A009F17D0 /* JSProxy.h in Headers */,
     
    92889289                                79B00CBF1C6AB07E0088C65D /* ProxyObject.h in Headers */,
    92899290                                79160DBE1C8E3EC8008C085A /* ProxyRevoke.h in Headers */,
    9290                                 FE6C1E4A20366F0100BDC2B7 /* PtrTag.h in Headers */,
    92919291                                0F5780A218FE1E98001E72D9 /* PureNaN.h in Headers */,
    92929292                                0F15CD231BA5F9860031FFD3 /* PutByIdFlags.h in Headers */,
  • trunk/Source/JavaScriptCore/assembler/ARM64Assembler.h

    r229911 r231027  
    3030#include "AssemblerBuffer.h"
    3131#include "AssemblerCommon.h"
    32 #include "PtrTag.h"
     32#include "JSCPtrTag.h"
    3333#include <limits.h>
    3434#include <wtf/Assertions.h>
  • trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h

    r230748 r231027  
    3232#include "CodeLocation.h"
    3333#include "JSCJSValue.h"
     34#include "JSCPtrTag.h"
    3435#include "MacroAssemblerCodeRef.h"
    3536#include "MacroAssemblerHelpers.h"
    3637#include "Options.h"
    37 #include "PtrTag.h"
    3838#include <wtf/CryptographicallyRandomNumber.h>
    3939#include <wtf/Noncopyable.h>
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.cpp

    r230748 r231027  
    2929#include "Disassembler.h"
    3030#include "JSCInlines.h"
    31 #include "PtrTag.h"
     31#include "JSCPtrTag.h"
    3232#include <mutex>
    3333
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h

    r230765 r231027  
    2828#include "ExecutableAllocator.h"
    2929#include "JSCPoison.h"
    30 #include "PtrTag.h"
     30#include "JSCPtrTag.h"
    3131#include <wtf/DataLog.h>
    3232#include <wtf/PrintStream.h>
  • trunk/Source/JavaScriptCore/b3/B3MathExtras.cpp

    r230098 r231027  
    3636#include "B3UpsilonValue.h"
    3737#include "B3ValueInlines.h"
     38#include "JSCPtrTag.h"
    3839#include "MathCommon.h"
    39 #include "PtrTag.h"
    4040
    4141namespace JSC { namespace B3 {
  • trunk/Source/JavaScriptCore/bytecode/LLIntCallLinkInfo.h

    r230748 r231027  
    2626#pragma once
    2727
     28#include "JSCPtrTag.h"
    2829#include "JSFunction.h"
    2930#include "MacroAssemblerCodeRef.h"
    30 #include "PtrTag.h"
    3131#include <wtf/SentinelLinkedList.h>
    3232
  • trunk/Source/JavaScriptCore/disassembler/Disassembler.h

    r230748 r231027  
    2626#pragma once
    2727
     28#include "JSCPtrTag.h"
    2829#include "JSExportMacros.h"
    29 #include "PtrTag.h"
    3030#include <functional>
    3131#include <wtf/PrintStream.h>
  • trunk/Source/JavaScriptCore/ftl/FTLJITCode.cpp

    r230748 r231027  
    3030
    3131#include "FTLState.h"
    32 #include "PtrTag.h"
     32#include "JSCPtrTag.h"
    3333
    3434namespace JSC { namespace FTL {
  • trunk/Source/JavaScriptCore/interpreter/InterpreterInlines.h

    r230748 r231027  
    2929#include "Instruction.h"
    3030#include "Interpreter.h"
     31#include "JSCPtrTag.h"
    3132#include "LLIntData.h"
    32 #include "PtrTag.h"
    3333#include "UnlinkedCodeBlock.h"
    3434
  • trunk/Source/JavaScriptCore/jit/ExecutableAllocator.h

    r230748 r231027  
    2727
    2828#include "JITCompilationEffort.h"
    29 #include "PtrTag.h"
     29#include "JSCPtrTag.h"
    3030#include <stddef.h> // for ptrdiff_t
    3131#include <limits>
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r230748 r231027  
    5656#include "JSAsyncGeneratorFunction.h"
    5757#include "JSCInlines.h"
     58#include "JSCPtrTag.h"
    5859#include "JSGeneratorFunction.h"
    5960#include "JSGlobalObjectFunctions.h"
     
    6566#include "ProgramCodeBlock.h"
    6667#include "PropertyName.h"
    67 #include "PtrTag.h"
    6868#include "RegExpObject.h"
    6969#include "Repatch.h"
  • trunk/Source/JavaScriptCore/jit/ThunkGenerator.h

    r230748 r231027  
    2828#if ENABLE(JIT)
    2929
    30 #include "PtrTag.h"
     30#include "JSCPtrTag.h"
    3131
    3232namespace JSC {
  • trunk/Source/JavaScriptCore/jit/ThunkGenerators.h

    r230748 r231027  
    2727
    2828#include "CodeSpecializationKind.h"
    29 #include "PtrTag.h"
     29#include "JSCPtrTag.h"
    3030
    3131#if ENABLE(JIT)
  • trunk/Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp

    r229481 r231027  
    3939#include "JSArray.h"
    4040#include "JSArrayBufferView.h"
     41#include "JSCPtrTag.h"
    4142#include "JSCast.h"
    4243#include "JSFunction.h"
     
    5253#include "NativeExecutable.h"
    5354#include "ProtoCallFrame.h"
    54 #include "PtrTag.h"
    5555#include "ShadowChicken.h"
    5656#include "Structure.h"
  • trunk/Source/JavaScriptCore/llint/LLIntPCRanges.h

    r229481 r231027  
    2626#pragma once
    2727
    28 #include "PtrTag.h"
     28#include "JSCPtrTag.h"
    2929
    3030namespace JSC {
  • trunk/Source/JavaScriptCore/runtime/NativeFunction.h

    r230748 r231027  
    2727
    2828#include "JSCJSValue.h"
    29 #include "PtrTag.h"
     29#include "JSCPtrTag.h"
    3030
    3131namespace JSC {
  • trunk/Source/JavaScriptCore/runtime/VMTraps.cpp

    r230826 r231027  
    3333#include "ExceptionHelpers.h"
    3434#include "HeapInlines.h"
     35#include "JSCPtrTag.h"
    3536#include "LLIntPCRanges.h"
    3637#include "MachineContext.h"
     
    3839#include "MacroAssembler.h"
    3940#include "MacroAssemblerCodeRef.h"
    40 #include "PtrTag.h"
    4141#include "VM.h"
    4242#include "VMInspector.h"
  • trunk/Source/WTF/ChangeLog

    r230994 r231027  
     12018-04-25  Mark Lam  <mark.lam@apple.com>
     2
     3        Push the definition of PtrTag down to the WTF layer.
     4        https://bugs.webkit.org/show_bug.cgi?id=184976
     5        <rdar://problem/39723901>
     6
     7        Reviewed by Saam Barati.
     8
     9        This is in preparation for doing pointer profiling at the WTF layer as well.
     10        Also deleted an unused ptrTag() function.
     11
     12        * WTF.xcodeproj/project.pbxproj:
     13        * wtf/CMakeLists.txt:
     14        * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h.
     15        (WTF::makePtrTagHash):
     16        (JSC::ptrTagName): Deleted.
     17        (JSC::tagForPtr): Deleted.
     18        (JSC::ptrTag): Deleted.
     19        (JSC::tagCodePtr): Deleted.
     20        (JSC::untagCodePtr): Deleted.
     21        (JSC::retagCodePtr): Deleted.
     22        (JSC::removeCodePtrTag): Deleted.
     23        (JSC::tagCFunctionPtr): Deleted.
     24        (JSC::untagCFunctionPtr): Deleted.
     25        (JSC::assertIsCFunctionPtr): Deleted.
     26        (JSC::assertIsNullOrCFunctionPtr): Deleted.
     27        (JSC::assertIsNotTagged): Deleted.
     28        (JSC::assertIsTagged): Deleted.
     29        (JSC::assertIsNullOrTagged): Deleted.
     30        (JSC::assertIsTaggedWith): Deleted.
     31        (JSC::assertIsNullOrTaggedWith): Deleted.
     32
    1332018-04-25  Dean Jackson  <dino@apple.com>
    234
  • trunk/Source/WTF/WTF.xcodeproj/project.pbxproj

    r230269 r231027  
    634634                FE05FAFE1FE5007500093230 /* WTFAssertions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WTFAssertions.cpp; sourceTree = "<group>"; };
    635635                FE05FB041FE8453200093230 /* PoisonedUniquePtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PoisonedUniquePtr.h; sourceTree = "<group>"; };
     636                FE7497E4208FFCAA0003565B /* PtrTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PtrTag.h; sourceTree = "<group>"; };
    636637                FE8225301B2A1E5B00BA68FD /* NakedPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NakedPtr.h; sourceTree = "<group>"; };
    637638                FE85416C1FBE285B008DA5DA /* Poisoned.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Poisoned.cpp; sourceTree = "<group>"; };
     
    10111012                                7AF023B42061E16F00A8EFD6 /* ProcessPrivilege.cpp */,
    10121013                                7AF023B32061E16C00A8EFD6 /* ProcessPrivilege.h */,
     1014                                FE7497E4208FFCAA0003565B /* PtrTag.h */,
    10131015                                143F611D1565F0F900DB514A /* RAMSize.cpp */,
    10141016                                143F611E1565F0F900DB514A /* RAMSize.h */,
  • trunk/Source/WTF/wtf/CMakeLists.txt

    r230269 r231027  
    168168    ProcessID.h
    169169    ProcessPrivilege.h
     170    PtrTag.h
    170171    RAMSize.h
    171172    RandomDevice.h
  • trunk/Source/WTF/wtf/PtrTag.h

    r231026 r231027  
    2828#include <wtf/PointerPreparations.h>
    2929
    30 namespace JSC {
     30namespace WTF {
    3131
    32 #define FOR_EACH_BASE_PTRTAG_ENUM(v) \
     32#define FOR_EACH_BASE_WTF_PTRTAG(v) \
    3333    v(NoPtrTag) \
    3434    v(CFunctionPtrTag) \
    3535
    36 #define FOR_EACH_ADDITIONAL_PTRTAG_ENUM(v) \
    37     v(B3CCallPtrTag) \
    38     v(B3CompilationPtrTag) \
    39     v(BytecodePtrTag) \
    40     v(DisassemblyPtrTag) \
    41     v(ExceptionHandlerPtrTag) \
    42     v(JITThunkPtrTag) \
    43     v(JITStubRoutinePtrTag) \
    44     v(JSEntryPtrTag) \
    45     v(JSInternalPtrTag) \
    46     v(JSSwitchPtrTag) \
    47     v(LinkBufferPtrTag) \
    48     v(OperationPtrTag) \
    49     v(OSRExitPtrTag) \
    50     v(SlowPathPtrTag) \
    51     v(WasmEntryPtrTag) \
    52     v(Yarr8BitPtrTag) \
    53     v(Yarr16BitPtrTag) \
    54     v(YarrMatchOnly8BitPtrTag) \
    55     v(YarrMatchOnly16BitPtrTag) \
    56     v(YarrBacktrackPtrTag) \
     36#define FOR_EACH_ADDITIONAL_WTF_PTRTAG(v) \
    5737
    58 #define FOR_EACH_PTRTAG_ENUM(v) \
    59     FOR_EACH_BASE_PTRTAG_ENUM(v) \
    60     FOR_EACH_ADDITIONAL_PTRTAG_ENUM(v) \
     38#define FOR_EACH_WTF_PTRTAG(v) \
     39    FOR_EACH_BASE_WTF_PTRTAG(v) \
     40    FOR_EACH_ADDITIONAL_WTF_PTRTAG(v) \
    6141
    6242enum PtrTag : uintptr_t {
    6343    NoPtrTag,
    6444    CFunctionPtrTag,
     45};
    6546
    66 #ifndef PTRTAG_ENUM_HASH
    67 #define DECLARE_PTRTAG_ENUM(tag)  tag,
    68 #else
    69 #define DECLARE_PTRTAG_ENUM(tag)  tag = PTRTAG_ENUM_HASH(tag),
     47#ifndef WTF_PTRTAG_HASH
     48template<size_t N>
     49constexpr uintptr_t makePtrTagHash(const char (&str)[N])
     50{
     51    uintptr_t result = 134775813;
     52    for (size_t i = 0; i < N; ++i)
     53        result += ((result * str[i]) ^ (result >> 16));
     54    return result & 0xffff;
     55}
     56
     57#define WTF_PTRTAG_HASH(tag) WTF::makePtrTagHash(#tag)
    7058#endif
    71     FOR_EACH_ADDITIONAL_PTRTAG_ENUM(DECLARE_PTRTAG_ENUM)
    72 #undef DECLARE_PTRTAG_ENUM
    73 };
     59
     60#define WTF_DECLARE_PTRTAG(tag) \
     61    constexpr PtrTag tag = static_cast<PtrTag>(WTF_PTRTAG_HASH(#tag)); \
     62    static_assert(tag != NoPtrTag && tag != CFunctionPtrTag, "");
    7463
    7564static_assert(static_cast<uintptr_t>(NoPtrTag) == static_cast<uintptr_t>(0), "");
    7665static_assert(static_cast<uintptr_t>(CFunctionPtrTag) == static_cast<uintptr_t>(1), "");
    7766
    78 inline const char* ptrTagName(PtrTag tag)
    79 {
    80 #define RETURN_PTRTAG_NAME(_tagName) case _tagName: return #_tagName;
    81     switch (tag) {
    82         FOR_EACH_PTRTAG_ENUM(RETURN_PTRTAG_NAME)
    83     default: return "<unknown>";
    84     }
    85 #undef RETURN_PTRTAG_NAME
    86 }
     67FOR_EACH_ADDITIONAL_WTF_PTRTAG(WTF_DECLARE_PTRTAG)
    8768
    8869#if !USE(POINTER_PROFILING)
    8970
    9071inline const char* tagForPtr(const void*) { return "<no tag>"; }
    91 
    92 template<typename... Arguments>
    93 inline constexpr PtrTag ptrTag(Arguments&&...) { return NoPtrTag; }
    9472
    9573template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
     
    174152#endif // !USE(POINTER_PROFILING)
    175153
    176 } // namespace JSC
     154} // namespace WTF
     155
     156using WTF::CFunctionPtrTag;
     157using WTF::NoPtrTag;
     158using WTF::PtrTag;
    177159
    178160#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/PtrTagSupport.h>)
    179161#include <WebKitAdditions/PtrTagSupport.h>
    180162#endif
     163
     164using WTF::tagForPtr;
     165
     166using WTF::tagCodePtr;
     167using WTF::untagCodePtr;
     168using WTF::retagCodePtr;
     169using WTF::removeCodePtrTag;
     170using WTF::tagCFunctionPtr;
     171using WTF::untagCFunctionPtr;
     172
     173using WTF::assertIsCFunctionPtr;
     174using WTF::assertIsNullOrCFunctionPtr;
     175using WTF::assertIsNotTagged;
     176using WTF::assertIsTagged;
     177using WTF::assertIsNullOrTagged;
     178using WTF::assertIsTaggedWith;
     179using WTF::assertIsNullOrTaggedWith;
  • trunk/Source/WebCore/ChangeLog

    r231025 r231027  
     12018-04-25  Mark Lam  <mark.lam@apple.com>
     2
     3        Push the definition of PtrTag down to the WTF layer.
     4        https://bugs.webkit.org/show_bug.cgi?id=184976
     5        <rdar://problem/39723901>
     6
     7        Reviewed by Saam Barati.
     8
     9        No new tests needed.  This is covered by existing tests.
     10
     11        * cssjit/CSSPtrTag.h:
     12        * cssjit/SelectorCompiler.h:
     13        (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction):
     14        (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction):
     15        (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext):
     16        (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext):
     17
    1182018-04-25  Eric Carlson  <eric.carlson@apple.com>
    219
  • trunk/Source/WebCore/cssjit/CSSPtrTag.h

    r230748 r231027  
    2828#if ENABLE(CSS_SELECTOR_JIT)
    2929
    30 #include <JavaScriptCore/PtrTag.h>
     30#include <JavaScriptCore/JSCPtrTag.h>
    3131
    3232namespace WebCore {
    3333
    34 static constexpr JSC::PtrTag CSSSelectorPtrTag = static_cast<JSC::PtrTag>(0xc551);
    35 static constexpr JSC::PtrTag CSSOperationPtrTag = static_cast<JSC::PtrTag>(0xc552);
     34#define FOR_EACH_CSS_PTRTAG(v) \
     35    v(CSSSelectorPtrTag) \
     36    v(CSSOperationPtrTag) \
     37
     38FOR_EACH_CSS_PTRTAG(WTF_DECLARE_PTRTAG)
    3639
    3740} // namespace WebCore
  • trunk/Source/WebCore/cssjit/SelectorCompiler.h

    r230748 r231027  
    5959{
    6060    ASSERT_UNUSED(compilationStatus, compilationStatus == SelectorCompilationStatus::SimpleSelectorChecker);
    61     return JSC::untagCFunctionPtr<RuleCollectorSimpleSelectorChecker, CSSSelectorPtrTag>(executableAddress);
     61    return WTF::untagCFunctionPtr<RuleCollectorSimpleSelectorChecker, CSSSelectorPtrTag>(executableAddress);
    6262}
    6363
     
    6565{
    6666    ASSERT_UNUSED(compilationStatus, compilationStatus == SelectorCompilationStatus::SimpleSelectorChecker);
    67     return JSC::untagCFunctionPtr<QuerySelectorSimpleSelectorChecker, CSSSelectorPtrTag>(executableAddress);
     67    return WTF::untagCFunctionPtr<QuerySelectorSimpleSelectorChecker, CSSSelectorPtrTag>(executableAddress);
    6868}
    6969
     
    7171{
    7272    ASSERT_UNUSED(compilationStatus, compilationStatus == SelectorCompilationStatus::SelectorCheckerWithCheckingContext);
    73     return JSC::untagCFunctionPtr<RuleCollectorSelectorCheckerWithCheckingContext, CSSSelectorPtrTag>(executableAddress);
     73    return WTF::untagCFunctionPtr<RuleCollectorSelectorCheckerWithCheckingContext, CSSSelectorPtrTag>(executableAddress);
    7474}
    7575
     
    7777{
    7878    ASSERT_UNUSED(compilationStatus, compilationStatus == SelectorCompilationStatus::SelectorCheckerWithCheckingContext);
    79     return JSC::untagCFunctionPtr<QuerySelectorSelectorCheckerWithCheckingContext, CSSSelectorPtrTag>(executableAddress);
     79    return WTF::untagCFunctionPtr<QuerySelectorSelectorCheckerWithCheckingContext, CSSSelectorPtrTag>(executableAddress);
    8080}
    8181
Note: See TracChangeset for help on using the changeset viewer.