Title: [231027] trunk/Source
Revision
231027
Author
[email protected]
Date
2018-04-25 15:31:13 -0700 (Wed, 25 Apr 2018)

Log 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/_javascript_Core:

* CMakeLists.txt:
* _javascript_Core.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/_javascript_Core/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.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/_javascript_Core/CMakeLists.txt (231026 => 231027)


--- trunk/Source/_javascript_Core/CMakeLists.txt	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/CMakeLists.txt	2018-04-25 22:31:13 UTC (rev 231027)
@@ -770,6 +770,7 @@
     runtime/JSCJSValue.h
     runtime/JSCJSValueInlines.h
     runtime/JSCPoison.h
+    runtime/JSCPtrTag.h
     runtime/JSCallee.h
     runtime/JSCast.h
     runtime/JSCell.h
@@ -838,7 +839,6 @@
     runtime/Operations.h
     runtime/Options.h
     runtime/ParseInt.h
-    runtime/PtrTag.h
     runtime/PrivateName.h
     runtime/ProgramExecutable.h
     runtime/PromiseDeferredTimer.h

Modified: trunk/Source/_javascript_Core/ChangeLog (231026 => 231027)


--- trunk/Source/_javascript_Core/ChangeLog	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-04-25 22:31:13 UTC (rev 231027)
@@ -1,3 +1,33 @@
+2018-04-25  Mark Lam  <[email protected]>
+
+        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.
+
+        * CMakeLists.txt:
+        * _javascript_Core.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:
+
 2018-04-25  Keith Miller  <[email protected]>
 
         getUnlinkedGlobalFunctionExecutable should only save things to the code cache if the option is set

Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (231026 => 231027)


--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2018-04-25 22:31:13 UTC (rev 231027)
@@ -1771,8 +1771,8 @@
 		FE63DD541EA9B61E00103A69 /* Printer.h in Headers */ = {isa = PBXBuildFile; fileRef = FE63DD531EA9B60E00103A69 /* Printer.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		FE6491371D78F01D00A694D4 /* ExceptionScope.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6491361D78F01300A694D4 /* ExceptionScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		FE68C6371B90DE040042BCB3 /* MacroAssemblerPrinter.h in Headers */ = {isa = PBXBuildFile; fileRef = FE68C6361B90DDD90042BCB3 /* MacroAssemblerPrinter.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		FE6C1E4A20366F0100BDC2B7 /* PtrTag.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9AE1C82032C887002B6934 /* PtrTag.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		FE6F56DE1E64EAD600D17801 /* VMTraps.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6F56DD1E64E92000D17801 /* VMTraps.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		FE7497E6209001B10003565B /* JSCPtrTag.h in Headers */ = {isa = PBXBuildFile; fileRef = FE7497E5209001B00003565B /* JSCPtrTag.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		FE7C41961B97FC4B00F4D598 /* PingPongStackOverflowTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDA50D41B97F442009A3B4F /* PingPongStackOverflowTest.cpp */; };
 		FE80C1971D775CDD008510C0 /* CatchScope.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80C1961D775B27008510C0 /* CatchScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		FE99B2491C24C3D300C82159 /* JITNegGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FE99B2481C24B6D300C82159 /* JITNegGenerator.h */; };
@@ -4707,6 +4707,7 @@
 		FE68C6361B90DDD90042BCB3 /* MacroAssemblerPrinter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerPrinter.h; sourceTree = "<group>"; };
 		FE6F56DC1E64E92000D17801 /* VMTraps.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VMTraps.cpp; sourceTree = "<group>"; };
 		FE6F56DD1E64E92000D17801 /* VMTraps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMTraps.h; sourceTree = "<group>"; };
+		FE7497E5209001B00003565B /* JSCPtrTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCPtrTag.h; sourceTree = "<group>"; };
 		FE80C1961D775B27008510C0 /* CatchScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CatchScope.h; sourceTree = "<group>"; };
 		FE80C1981D775FB4008510C0 /* CatchScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CatchScope.cpp; sourceTree = "<group>"; };
 		FE80C19A1D7768FD008510C0 /* ExceptionEventLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExceptionEventLocation.cpp; sourceTree = "<group>"; };
@@ -4714,7 +4715,6 @@
 		FE98B5B61BB9AE110073E7A6 /* JITSubGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITSubGenerator.h; sourceTree = "<group>"; };
 		FE99B2471C24B6D300C82159 /* JITNegGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITNegGenerator.cpp; sourceTree = "<group>"; };
 		FE99B2481C24B6D300C82159 /* JITNegGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITNegGenerator.h; sourceTree = "<group>"; };
-		FE9AE1C82032C887002B6934 /* PtrTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PtrTag.h; sourceTree = "<group>"; };
 		FEA0861E182B7A0400F6D851 /* Breakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Breakpoint.h; sourceTree = "<group>"; };
 		FEA0861F182B7A0400F6D851 /* DebuggerPrimitives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebuggerPrimitives.h; sourceTree = "<group>"; };
 		FEA0C4001CDD7D0E00481991 /* FunctionWhitelist.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FunctionWhitelist.cpp; sourceTree = "<group>"; };
@@ -6743,6 +6743,7 @@
 				2A05ABD41961DF2400341750 /* JSPropertyNameEnumerator.h */,
 				862553CE16136AA5009F17D0 /* JSProxy.cpp */,
 				862553CF16136AA5009F17D0 /* JSProxy.h */,
+				FE7497E5209001B00003565B /* JSCPtrTag.h */,
 				534638721E70D01500F12AC1 /* JSRunLoopTimer.cpp */,
 				534638701E70CF3D00F12AC1 /* JSRunLoopTimer.h */,
 				14874AE115EBDE4A002E3587 /* JSScope.cpp */,
@@ -6881,7 +6882,6 @@
 				79B00CBB1C6AB07E0088C65D /* ProxyObject.h */,
 				79160DBB1C8E3EC8008C085A /* ProxyRevoke.cpp */,
 				79160DBC1C8E3EC8008C085A /* ProxyRevoke.h */,
-				FE9AE1C82032C887002B6934 /* PtrTag.h */,
 				0F5780A118FE1E98001E72D9 /* PureNaN.h */,
 				0F0CD4C015F1A6040032F1C0 /* PutDirectIndexMode.h */,
 				147B84620E6DE6B1004775A4 /* PutPropertySlot.h */,
@@ -9061,6 +9061,7 @@
 				7C008CDB187124BB00955C24 /* JSPromiseDeferred.h in Headers */,
 				7C184E1F17BEE22E007CB63A /* JSPromisePrototype.h in Headers */,
 				996B731F1BDA08EF00331B84 /* JSPromisePrototype.lut.h in Headers */,
+				FE7497E6209001B10003565B /* JSCPtrTag.h in Headers */,
 				2A05ABD61961DF2400341750 /* JSPropertyNameEnumerator.h in Headers */,
 				862553D216136E1A009F17D0 /* JSProxy.h in Headers */,
 				A552C3801ADDB8FE00139726 /* JSRemoteInspector.h in Headers */,
@@ -9287,7 +9288,6 @@
 				79B00CBD1C6AB07E0088C65D /* ProxyConstructor.h in Headers */,
 				79B00CBF1C6AB07E0088C65D /* ProxyObject.h in Headers */,
 				79160DBE1C8E3EC8008C085A /* ProxyRevoke.h in Headers */,
-				FE6C1E4A20366F0100BDC2B7 /* PtrTag.h in Headers */,
 				0F5780A218FE1E98001E72D9 /* PureNaN.h in Headers */,
 				0F15CD231BA5F9860031FFD3 /* PutByIdFlags.h in Headers */,
 				0F9332A414CA7DD90085F3C6 /* PutByIdStatus.h in Headers */,

Modified: trunk/Source/_javascript_Core/assembler/ARM64Assembler.h (231026 => 231027)


--- trunk/Source/_javascript_Core/assembler/ARM64Assembler.h	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/assembler/ARM64Assembler.h	2018-04-25 22:31:13 UTC (rev 231027)
@@ -29,7 +29,7 @@
 
 #include "AssemblerBuffer.h"
 #include "AssemblerCommon.h"
-#include "PtrTag.h"
+#include "JSCPtrTag.h"
 #include <limits.h>
 #include <wtf/Assertions.h>
 #include <wtf/Vector.h>

Modified: trunk/Source/_javascript_Core/assembler/AbstractMacroAssembler.h (231026 => 231027)


--- trunk/Source/_javascript_Core/assembler/AbstractMacroAssembler.h	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/assembler/AbstractMacroAssembler.h	2018-04-25 22:31:13 UTC (rev 231027)
@@ -31,10 +31,10 @@
 #include "CPU.h"
 #include "CodeLocation.h"
 #include "JSCJSValue.h"
+#include "JSCPtrTag.h"
 #include "MacroAssemblerCodeRef.h"
 #include "MacroAssemblerHelpers.h"
 #include "Options.h"
-#include "PtrTag.h"
 #include <wtf/CryptographicallyRandomNumber.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/SharedTask.h>

Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.cpp (231026 => 231027)


--- trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.cpp	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.cpp	2018-04-25 22:31:13 UTC (rev 231027)
@@ -28,7 +28,7 @@
 
 #include "Disassembler.h"
 #include "JSCInlines.h"
-#include "PtrTag.h"
+#include "JSCPtrTag.h"
 #include <mutex>
 
 namespace JSC {

Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.h (231026 => 231027)


--- trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.h	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.h	2018-04-25 22:31:13 UTC (rev 231027)
@@ -27,7 +27,7 @@
 
 #include "ExecutableAllocator.h"
 #include "JSCPoison.h"
-#include "PtrTag.h"
+#include "JSCPtrTag.h"
 #include <wtf/DataLog.h>
 #include <wtf/PrintStream.h>
 #include <wtf/RefPtr.h>

Modified: trunk/Source/_javascript_Core/b3/B3MathExtras.cpp (231026 => 231027)


--- trunk/Source/_javascript_Core/b3/B3MathExtras.cpp	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/b3/B3MathExtras.cpp	2018-04-25 22:31:13 UTC (rev 231027)
@@ -35,8 +35,8 @@
 #include "B3ConstPtrValue.h"
 #include "B3UpsilonValue.h"
 #include "B3ValueInlines.h"
+#include "JSCPtrTag.h"
 #include "MathCommon.h"
-#include "PtrTag.h"
 
 namespace JSC { namespace B3 {
 

Modified: trunk/Source/_javascript_Core/bytecode/LLIntCallLinkInfo.h (231026 => 231027)


--- trunk/Source/_javascript_Core/bytecode/LLIntCallLinkInfo.h	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/bytecode/LLIntCallLinkInfo.h	2018-04-25 22:31:13 UTC (rev 231027)
@@ -25,9 +25,9 @@
 
 #pragma once
 
+#include "JSCPtrTag.h"
 #include "JSFunction.h"
 #include "MacroAssemblerCodeRef.h"
-#include "PtrTag.h"
 #include <wtf/SentinelLinkedList.h>
 
 namespace JSC {

Modified: trunk/Source/_javascript_Core/disassembler/Disassembler.h (231026 => 231027)


--- trunk/Source/_javascript_Core/disassembler/Disassembler.h	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/disassembler/Disassembler.h	2018-04-25 22:31:13 UTC (rev 231027)
@@ -25,8 +25,8 @@
 
 #pragma once
 
+#include "JSCPtrTag.h"
 #include "JSExportMacros.h"
-#include "PtrTag.h"
 #include <functional>
 #include <wtf/PrintStream.h>
 #include <wtf/text/CString.h>

Modified: trunk/Source/_javascript_Core/ftl/FTLJITCode.cpp (231026 => 231027)


--- trunk/Source/_javascript_Core/ftl/FTLJITCode.cpp	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/ftl/FTLJITCode.cpp	2018-04-25 22:31:13 UTC (rev 231027)
@@ -29,7 +29,7 @@
 #if ENABLE(FTL_JIT)
 
 #include "FTLState.h"
-#include "PtrTag.h"
+#include "JSCPtrTag.h"
 
 namespace JSC { namespace FTL {
 

Modified: trunk/Source/_javascript_Core/interpreter/InterpreterInlines.h (231026 => 231027)


--- trunk/Source/_javascript_Core/interpreter/InterpreterInlines.h	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/interpreter/InterpreterInlines.h	2018-04-25 22:31:13 UTC (rev 231027)
@@ -28,8 +28,8 @@
 
 #include "Instruction.h"
 #include "Interpreter.h"
+#include "JSCPtrTag.h"
 #include "LLIntData.h"
-#include "PtrTag.h"
 #include "UnlinkedCodeBlock.h"
 
 namespace JSC {

Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.h (231026 => 231027)


--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.h	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.h	2018-04-25 22:31:13 UTC (rev 231027)
@@ -26,7 +26,7 @@
 #pragma once
 
 #include "JITCompilationEffort.h"
-#include "PtrTag.h"
+#include "JSCPtrTag.h"
 #include <stddef.h> // for ptrdiff_t
 #include <limits>
 #include <wtf/Assertions.h>

Modified: trunk/Source/_javascript_Core/jit/JITOperations.cpp (231026 => 231027)


--- trunk/Source/_javascript_Core/jit/JITOperations.cpp	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/jit/JITOperations.cpp	2018-04-25 22:31:13 UTC (rev 231027)
@@ -55,6 +55,7 @@
 #include "JSAsyncFunction.h"
 #include "JSAsyncGeneratorFunction.h"
 #include "JSCInlines.h"
+#include "JSCPtrTag.h"
 #include "JSGeneratorFunction.h"
 #include "JSGlobalObjectFunctions.h"
 #include "JSLexicalEnvironment.h"
@@ -64,7 +65,6 @@
 #include "PolymorphicAccess.h"
 #include "ProgramCodeBlock.h"
 #include "PropertyName.h"
-#include "PtrTag.h"
 #include "RegExpObject.h"
 #include "Repatch.h"
 #include "ScopedArguments.h"

Modified: trunk/Source/_javascript_Core/jit/ThunkGenerator.h (231026 => 231027)


--- trunk/Source/_javascript_Core/jit/ThunkGenerator.h	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/jit/ThunkGenerator.h	2018-04-25 22:31:13 UTC (rev 231027)
@@ -27,7 +27,7 @@
 
 #if ENABLE(JIT)
 
-#include "PtrTag.h"
+#include "JSCPtrTag.h"
 
 namespace JSC {
 class VM;

Modified: trunk/Source/_javascript_Core/jit/ThunkGenerators.h (231026 => 231027)


--- trunk/Source/_javascript_Core/jit/ThunkGenerators.h	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/jit/ThunkGenerators.h	2018-04-25 22:31:13 UTC (rev 231027)
@@ -26,7 +26,7 @@
 #pragma once
 
 #include "CodeSpecializationKind.h"
-#include "PtrTag.h"
+#include "JSCPtrTag.h"
 
 #if ENABLE(JIT)
 namespace JSC {

Modified: trunk/Source/_javascript_Core/llint/LLIntOffsetsExtractor.cpp (231026 => 231027)


--- trunk/Source/_javascript_Core/llint/LLIntOffsetsExtractor.cpp	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/llint/LLIntOffsetsExtractor.cpp	2018-04-25 22:31:13 UTC (rev 231027)
@@ -38,6 +38,7 @@
 #include "Interpreter.h"
 #include "JSArray.h"
 #include "JSArrayBufferView.h"
+#include "JSCPtrTag.h"
 #include "JSCast.h"
 #include "JSFunction.h"
 #include "JSGlobalObject.h"
@@ -51,7 +52,6 @@
 #include "MarkedSpace.h"
 #include "NativeExecutable.h"
 #include "ProtoCallFrame.h"
-#include "PtrTag.h"
 #include "ShadowChicken.h"
 #include "Structure.h"
 #include "StructureChain.h"

Modified: trunk/Source/_javascript_Core/llint/LLIntPCRanges.h (231026 => 231027)


--- trunk/Source/_javascript_Core/llint/LLIntPCRanges.h	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/llint/LLIntPCRanges.h	2018-04-25 22:31:13 UTC (rev 231027)
@@ -25,7 +25,7 @@
 
 #pragma once
 
-#include "PtrTag.h"
+#include "JSCPtrTag.h"
 
 namespace JSC {
 

Added: trunk/Source/_javascript_Core/runtime/JSCPtrTag.h (0 => 231027)


--- trunk/Source/_javascript_Core/runtime/JSCPtrTag.h	                        (rev 0)
+++ trunk/Source/_javascript_Core/runtime/JSCPtrTag.h	2018-04-25 22:31:13 UTC (rev 231027)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2018 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
+
+#include <wtf/PtrTag.h>
+
+namespace JSC {
+
+using PtrTag = WTF::PtrTag;
+
+#define FOR_EACH_JSC_PTRTAG(v) \
+    v(B3CCallPtrTag) \
+    v(B3CompilationPtrTag) \
+    v(BytecodePtrTag) \
+    v(DisassemblyPtrTag) \
+    v(ExceptionHandlerPtrTag) \
+    v(JITThunkPtrTag) \
+    v(JITStubRoutinePtrTag) \
+    v(JSEntryPtrTag) \
+    v(JSInternalPtrTag) \
+    v(JSSwitchPtrTag) \
+    v(LinkBufferPtrTag) \
+    v(OperationPtrTag) \
+    v(OSRExitPtrTag) \
+    v(SlowPathPtrTag) \
+    v(WasmEntryPtrTag) \
+    v(Yarr8BitPtrTag) \
+    v(Yarr16BitPtrTag) \
+    v(YarrMatchOnly8BitPtrTag) \
+    v(YarrMatchOnly16BitPtrTag) \
+    v(YarrBacktrackPtrTag) \
+
+FOR_EACH_JSC_PTRTAG(WTF_DECLARE_PTRTAG)
+
+} // namespace JSC
+

Modified: trunk/Source/_javascript_Core/runtime/NativeFunction.h (231026 => 231027)


--- trunk/Source/_javascript_Core/runtime/NativeFunction.h	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/runtime/NativeFunction.h	2018-04-25 22:31:13 UTC (rev 231027)
@@ -26,7 +26,7 @@
 #pragma once
 
 #include "JSCJSValue.h"
-#include "PtrTag.h"
+#include "JSCPtrTag.h"
 
 namespace JSC {
 

Deleted: trunk/Source/_javascript_Core/runtime/PtrTag.h (231026 => 231027)


--- trunk/Source/_javascript_Core/runtime/PtrTag.h	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/runtime/PtrTag.h	2018-04-25 22:31:13 UTC (rev 231027)
@@ -1,180 +0,0 @@
-/*
- * Copyright (C) 2018 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
-
-#include <wtf/PointerPreparations.h>
-
-namespace JSC {
-
-#define FOR_EACH_BASE_PTRTAG_ENUM(v) \
-    v(NoPtrTag) \
-    v(CFunctionPtrTag) \
-
-#define FOR_EACH_ADDITIONAL_PTRTAG_ENUM(v) \
-    v(B3CCallPtrTag) \
-    v(B3CompilationPtrTag) \
-    v(BytecodePtrTag) \
-    v(DisassemblyPtrTag) \
-    v(ExceptionHandlerPtrTag) \
-    v(JITThunkPtrTag) \
-    v(JITStubRoutinePtrTag) \
-    v(JSEntryPtrTag) \
-    v(JSInternalPtrTag) \
-    v(JSSwitchPtrTag) \
-    v(LinkBufferPtrTag) \
-    v(OperationPtrTag) \
-    v(OSRExitPtrTag) \
-    v(SlowPathPtrTag) \
-    v(WasmEntryPtrTag) \
-    v(Yarr8BitPtrTag) \
-    v(Yarr16BitPtrTag) \
-    v(YarrMatchOnly8BitPtrTag) \
-    v(YarrMatchOnly16BitPtrTag) \
-    v(YarrBacktrackPtrTag) \
-
-#define FOR_EACH_PTRTAG_ENUM(v) \
-    FOR_EACH_BASE_PTRTAG_ENUM(v) \
-    FOR_EACH_ADDITIONAL_PTRTAG_ENUM(v) \
-
-enum PtrTag : uintptr_t {
-    NoPtrTag,
-    CFunctionPtrTag,
-
-#ifndef PTRTAG_ENUM_HASH
-#define DECLARE_PTRTAG_ENUM(tag)  tag,
-#else
-#define DECLARE_PTRTAG_ENUM(tag)  tag = PTRTAG_ENUM_HASH(tag),
-#endif
-    FOR_EACH_ADDITIONAL_PTRTAG_ENUM(DECLARE_PTRTAG_ENUM)
-#undef DECLARE_PTRTAG_ENUM
-};
-
-static_assert(static_cast<uintptr_t>(NoPtrTag) == static_cast<uintptr_t>(0), "");
-static_assert(static_cast<uintptr_t>(CFunctionPtrTag) == static_cast<uintptr_t>(1), "");
-
-inline const char* ptrTagName(PtrTag tag)
-{
-#define RETURN_PTRTAG_NAME(_tagName) case _tagName: return #_tagName;
-    switch (tag) {
-        FOR_EACH_PTRTAG_ENUM(RETURN_PTRTAG_NAME)
-    default: return "<unknown>";
-    }
-#undef RETURN_PTRTAG_NAME
-}
-
-#if !USE(POINTER_PROFILING)
-
-inline const char* tagForPtr(const void*) { return "<no tag>"; }
-
-template<typename... Arguments>
-inline constexpr PtrTag ptrTag(Arguments&&...) { return NoPtrTag; }
-
-template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
-inline constexpr T tagCodePtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); }
-
-template<typename T, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
-inline T tagCodePtr(PtrType ptr) { return bitwise_cast<T>(ptr); }
-
-template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
-inline constexpr PtrType tagCodePtr(PtrType ptr, PtrTag) { return ptr; }
-
-template<PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
-inline PtrType tagCodePtr(PtrType ptr) { return ptr; }
-
-template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
-inline constexpr T untagCodePtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); }
-
-template<typename T, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
-inline T untagCodePtr(PtrType ptr)  { return bitwise_cast<T>(ptr); }
-
-template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
-inline constexpr PtrType untagCodePtr(PtrType ptr, PtrTag) { return ptr; }
-
-template<PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
-inline PtrType untagCodePtr(PtrType ptr) { return ptr; }
-
-template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
-inline constexpr T retagCodePtr(PtrType ptr, PtrTag, PtrTag) { return bitwise_cast<T>(ptr); }
-
-template<typename T, PtrTag, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
-inline T retagCodePtr(PtrType ptr) { return bitwise_cast<T>(ptr); }
-
-template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
-inline constexpr PtrType retagCodePtr(PtrType ptr, PtrTag, PtrTag) { return ptr; }
-
-template<PtrTag, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
-inline PtrType retagCodePtr(PtrType ptr) { return ptr; }
-
-template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
-inline constexpr T removeCodePtrTag(PtrType ptr) { return bitwise_cast<T>(ptr); }
-
-template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
-inline constexpr PtrType removeCodePtrTag(PtrType ptr) { return ptr; }
-
-template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
-inline T tagCFunctionPtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); }
-
-template<typename T, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
-inline T tagCFunctionPtr(PtrType ptr) { return bitwise_cast<T>(ptr); }
-
-template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
-inline PtrType tagCFunctionPtr(PtrType ptr, PtrTag) { return ptr; }
-
-template<PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
-inline PtrType tagCFunctionPtr(PtrType ptr) { return ptr; }
-
-template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
-inline T untagCFunctionPtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); }
-
-template<typename T, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
-inline T untagCFunctionPtr(PtrType ptr) { return bitwise_cast<T>(ptr); }
-
-template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
-inline PtrType untagCFunctionPtr(PtrType ptr, PtrTag) { return ptr; }
-
-template<PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
-inline PtrType untagCFunctionPtr(PtrType ptr) { return ptr; }
-
-template<typename PtrType> void assertIsCFunctionPtr(PtrType) { }
-template<typename PtrType> void assertIsNullOrCFunctionPtr(PtrType) { }
-
-template<typename PtrType> void assertIsNotTagged(PtrType) { }
-template<typename PtrType> void assertIsTagged(PtrType) { }
-template<typename PtrType> void assertIsNullOrTagged(PtrType) { }
-
-template<typename PtrType> void assertIsTaggedWith(PtrType, PtrTag) { }
-template<typename PtrType> void assertIsNullOrTaggedWith(PtrType, PtrTag) { }
-
-#define CALL_WITH_PTRTAG(callInstructionString, targetRegisterString, tag) \
-    callInstructionString " " targetRegisterString "\n"
-
-#endif // !USE(POINTER_PROFILING)
-
-} // namespace JSC
-
-#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/PtrTagSupport.h>)
-#include <WebKitAdditions/PtrTagSupport.h>
-#endif

Modified: trunk/Source/_javascript_Core/runtime/VMTraps.cpp (231026 => 231027)


--- trunk/Source/_javascript_Core/runtime/VMTraps.cpp	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/_javascript_Core/runtime/VMTraps.cpp	2018-04-25 22:31:13 UTC (rev 231027)
@@ -32,12 +32,12 @@
 #include "DFGCommonData.h"
 #include "ExceptionHelpers.h"
 #include "HeapInlines.h"
+#include "JSCPtrTag.h"
 #include "LLIntPCRanges.h"
 #include "MachineContext.h"
 #include "MachineStackMarker.h"
 #include "MacroAssembler.h"
 #include "MacroAssemblerCodeRef.h"
-#include "PtrTag.h"
 #include "VM.h"
 #include "VMInspector.h"
 #include "Watchdog.h"

Modified: trunk/Source/WTF/ChangeLog (231026 => 231027)


--- trunk/Source/WTF/ChangeLog	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/WTF/ChangeLog	2018-04-25 22:31:13 UTC (rev 231027)
@@ -1,3 +1,35 @@
+2018-04-25  Mark Lam  <[email protected]>
+
+        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.
+
+        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/_javascript_Core/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.
+
 2018-04-25  Dean Jackson  <[email protected]>
 
         Make a better flag for system preview, and disable it where necessary

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (231026 => 231027)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2018-04-25 22:31:13 UTC (rev 231027)
@@ -633,6 +633,7 @@
 		FE05FAE61FDB214300093230 /* DumbPtrTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DumbPtrTraits.h; sourceTree = "<group>"; };
 		FE05FAFE1FE5007500093230 /* WTFAssertions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WTFAssertions.cpp; sourceTree = "<group>"; };
 		FE05FB041FE8453200093230 /* PoisonedUniquePtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PoisonedUniquePtr.h; sourceTree = "<group>"; };
+		FE7497E4208FFCAA0003565B /* PtrTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PtrTag.h; sourceTree = "<group>"; };
 		FE8225301B2A1E5B00BA68FD /* NakedPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NakedPtr.h; sourceTree = "<group>"; };
 		FE85416C1FBE285B008DA5DA /* Poisoned.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Poisoned.cpp; sourceTree = "<group>"; };
 		FE85416D1FBE285C008DA5DA /* Poisoned.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Poisoned.h; sourceTree = "<group>"; };
@@ -1010,6 +1011,7 @@
 				0FC4488216FE9FE100844BE9 /* ProcessID.h */,
 				7AF023B42061E16F00A8EFD6 /* ProcessPrivilege.cpp */,
 				7AF023B32061E16C00A8EFD6 /* ProcessPrivilege.h */,
+				FE7497E4208FFCAA0003565B /* PtrTag.h */,
 				143F611D1565F0F900DB514A /* RAMSize.cpp */,
 				143F611E1565F0F900DB514A /* RAMSize.h */,
 				C8F597CA2A57417FBAB92FD6 /* RandomDevice.cpp */,

Modified: trunk/Source/WTF/wtf/CMakeLists.txt (231026 => 231027)


--- trunk/Source/WTF/wtf/CMakeLists.txt	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/WTF/wtf/CMakeLists.txt	2018-04-25 22:31:13 UTC (rev 231027)
@@ -167,6 +167,7 @@
     PriorityQueue.h
     ProcessID.h
     ProcessPrivilege.h
+    PtrTag.h
     RAMSize.h
     RandomDevice.h
     RandomNumber.h

Copied: trunk/Source/WTF/wtf/PtrTag.h (from rev 231026, trunk/Source/_javascript_Core/runtime/PtrTag.h) (0 => 231027)


--- trunk/Source/WTF/wtf/PtrTag.h	                        (rev 0)
+++ trunk/Source/WTF/wtf/PtrTag.h	2018-04-25 22:31:13 UTC (rev 231027)
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2018 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
+
+#include <wtf/PointerPreparations.h>
+
+namespace WTF {
+
+#define FOR_EACH_BASE_WTF_PTRTAG(v) \
+    v(NoPtrTag) \
+    v(CFunctionPtrTag) \
+
+#define FOR_EACH_ADDITIONAL_WTF_PTRTAG(v) \
+
+#define FOR_EACH_WTF_PTRTAG(v) \
+    FOR_EACH_BASE_WTF_PTRTAG(v) \
+    FOR_EACH_ADDITIONAL_WTF_PTRTAG(v) \
+
+enum PtrTag : uintptr_t {
+    NoPtrTag,
+    CFunctionPtrTag,
+};
+
+#ifndef WTF_PTRTAG_HASH
+template<size_t N>
+constexpr uintptr_t makePtrTagHash(const char (&str)[N])
+{
+    uintptr_t result = 134775813;
+    for (size_t i = 0; i < N; ++i)
+        result += ((result * str[i]) ^ (result >> 16));
+    return result & 0xffff;
+}
+
+#define WTF_PTRTAG_HASH(tag) WTF::makePtrTagHash(#tag)
+#endif
+
+#define WTF_DECLARE_PTRTAG(tag) \
+    constexpr PtrTag tag = static_cast<PtrTag>(WTF_PTRTAG_HASH(#tag)); \
+    static_assert(tag != NoPtrTag && tag != CFunctionPtrTag, "");
+
+static_assert(static_cast<uintptr_t>(NoPtrTag) == static_cast<uintptr_t>(0), "");
+static_assert(static_cast<uintptr_t>(CFunctionPtrTag) == static_cast<uintptr_t>(1), "");
+
+FOR_EACH_ADDITIONAL_WTF_PTRTAG(WTF_DECLARE_PTRTAG)
+
+#if !USE(POINTER_PROFILING)
+
+inline const char* tagForPtr(const void*) { return "<no tag>"; }
+
+template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
+inline constexpr T tagCodePtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); }
+
+template<typename T, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
+inline T tagCodePtr(PtrType ptr) { return bitwise_cast<T>(ptr); }
+
+template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
+inline constexpr PtrType tagCodePtr(PtrType ptr, PtrTag) { return ptr; }
+
+template<PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
+inline PtrType tagCodePtr(PtrType ptr) { return ptr; }
+
+template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
+inline constexpr T untagCodePtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); }
+
+template<typename T, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
+inline T untagCodePtr(PtrType ptr)  { return bitwise_cast<T>(ptr); }
+
+template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
+inline constexpr PtrType untagCodePtr(PtrType ptr, PtrTag) { return ptr; }
+
+template<PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
+inline PtrType untagCodePtr(PtrType ptr) { return ptr; }
+
+template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
+inline constexpr T retagCodePtr(PtrType ptr, PtrTag, PtrTag) { return bitwise_cast<T>(ptr); }
+
+template<typename T, PtrTag, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
+inline T retagCodePtr(PtrType ptr) { return bitwise_cast<T>(ptr); }
+
+template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
+inline constexpr PtrType retagCodePtr(PtrType ptr, PtrTag, PtrTag) { return ptr; }
+
+template<PtrTag, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
+inline PtrType retagCodePtr(PtrType ptr) { return ptr; }
+
+template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
+inline constexpr T removeCodePtrTag(PtrType ptr) { return bitwise_cast<T>(ptr); }
+
+template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
+inline constexpr PtrType removeCodePtrTag(PtrType ptr) { return ptr; }
+
+template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
+inline T tagCFunctionPtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); }
+
+template<typename T, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
+inline T tagCFunctionPtr(PtrType ptr) { return bitwise_cast<T>(ptr); }
+
+template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
+inline PtrType tagCFunctionPtr(PtrType ptr, PtrTag) { return ptr; }
+
+template<PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
+inline PtrType tagCFunctionPtr(PtrType ptr) { return ptr; }
+
+template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
+inline T untagCFunctionPtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); }
+
+template<typename T, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
+inline T untagCFunctionPtr(PtrType ptr) { return bitwise_cast<T>(ptr); }
+
+template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
+inline PtrType untagCFunctionPtr(PtrType ptr, PtrTag) { return ptr; }
+
+template<PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
+inline PtrType untagCFunctionPtr(PtrType ptr) { return ptr; }
+
+template<typename PtrType> void assertIsCFunctionPtr(PtrType) { }
+template<typename PtrType> void assertIsNullOrCFunctionPtr(PtrType) { }
+
+template<typename PtrType> void assertIsNotTagged(PtrType) { }
+template<typename PtrType> void assertIsTagged(PtrType) { }
+template<typename PtrType> void assertIsNullOrTagged(PtrType) { }
+
+template<typename PtrType> void assertIsTaggedWith(PtrType, PtrTag) { }
+template<typename PtrType> void assertIsNullOrTaggedWith(PtrType, PtrTag) { }
+
+#define CALL_WITH_PTRTAG(callInstructionString, targetRegisterString, tag) \
+    callInstructionString " " targetRegisterString "\n"
+
+#endif // !USE(POINTER_PROFILING)
+
+} // namespace WTF
+
+using WTF::CFunctionPtrTag;
+using WTF::NoPtrTag;
+using WTF::PtrTag;
+
+#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/PtrTagSupport.h>)
+#include <WebKitAdditions/PtrTagSupport.h>
+#endif
+
+using WTF::tagForPtr;
+
+using WTF::tagCodePtr;
+using WTF::untagCodePtr;
+using WTF::retagCodePtr;
+using WTF::removeCodePtrTag;
+using WTF::tagCFunctionPtr;
+using WTF::untagCFunctionPtr;
+
+using WTF::assertIsCFunctionPtr;
+using WTF::assertIsNullOrCFunctionPtr;
+using WTF::assertIsNotTagged;
+using WTF::assertIsTagged;
+using WTF::assertIsNullOrTagged;
+using WTF::assertIsTaggedWith;
+using WTF::assertIsNullOrTaggedWith;

Modified: trunk/Source/WebCore/ChangeLog (231026 => 231027)


--- trunk/Source/WebCore/ChangeLog	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/WebCore/ChangeLog	2018-04-25 22:31:13 UTC (rev 231027)
@@ -1,3 +1,20 @@
+2018-04-25  Mark Lam  <[email protected]>
+
+        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.
+
+        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):
+
 2018-04-25  Eric Carlson  <[email protected]>
 
         [iOS] remove media element parameter from MediaElementSession methods

Modified: trunk/Source/WebCore/cssjit/CSSPtrTag.h (231026 => 231027)


--- trunk/Source/WebCore/cssjit/CSSPtrTag.h	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/WebCore/cssjit/CSSPtrTag.h	2018-04-25 22:31:13 UTC (rev 231027)
@@ -27,13 +27,16 @@
 
 #if ENABLE(CSS_SELECTOR_JIT)
 
-#include <_javascript_Core/PtrTag.h>
+#include <_javascript_Core/JSCPtrTag.h>
 
 namespace WebCore {
 
-static constexpr JSC::PtrTag CSSSelectorPtrTag = static_cast<JSC::PtrTag>(0xc551);
-static constexpr JSC::PtrTag CSSOperationPtrTag = static_cast<JSC::PtrTag>(0xc552);
+#define FOR_EACH_CSS_PTRTAG(v) \
+    v(CSSSelectorPtrTag) \
+    v(CSSOperationPtrTag) \
 
+FOR_EACH_CSS_PTRTAG(WTF_DECLARE_PTRTAG)
+
 } // namespace WebCore
 
 #endif // ENABLE(CSS_SELECTOR_JIT)

Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.h (231026 => 231027)


--- trunk/Source/WebCore/cssjit/SelectorCompiler.h	2018-04-25 22:27:49 UTC (rev 231026)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.h	2018-04-25 22:31:13 UTC (rev 231027)
@@ -58,25 +58,25 @@
 inline RuleCollectorSimpleSelectorChecker ruleCollectorSimpleSelectorCheckerFunction(void* executableAddress, SelectorCompilationStatus compilationStatus)
 {
     ASSERT_UNUSED(compilationStatus, compilationStatus == SelectorCompilationStatus::SimpleSelectorChecker);
-    return JSC::untagCFunctionPtr<RuleCollectorSimpleSelectorChecker, CSSSelectorPtrTag>(executableAddress);
+    return WTF::untagCFunctionPtr<RuleCollectorSimpleSelectorChecker, CSSSelectorPtrTag>(executableAddress);
 }
 
 inline QuerySelectorSimpleSelectorChecker querySelectorSimpleSelectorCheckerFunction(void* executableAddress, SelectorCompilationStatus compilationStatus)
 {
     ASSERT_UNUSED(compilationStatus, compilationStatus == SelectorCompilationStatus::SimpleSelectorChecker);
-    return JSC::untagCFunctionPtr<QuerySelectorSimpleSelectorChecker, CSSSelectorPtrTag>(executableAddress);
+    return WTF::untagCFunctionPtr<QuerySelectorSimpleSelectorChecker, CSSSelectorPtrTag>(executableAddress);
 }
 
 inline RuleCollectorSelectorCheckerWithCheckingContext ruleCollectorSelectorCheckerFunctionWithCheckingContext(void* executableAddress, SelectorCompilationStatus compilationStatus)
 {
     ASSERT_UNUSED(compilationStatus, compilationStatus == SelectorCompilationStatus::SelectorCheckerWithCheckingContext);
-    return JSC::untagCFunctionPtr<RuleCollectorSelectorCheckerWithCheckingContext, CSSSelectorPtrTag>(executableAddress);
+    return WTF::untagCFunctionPtr<RuleCollectorSelectorCheckerWithCheckingContext, CSSSelectorPtrTag>(executableAddress);
 }
 
 inline QuerySelectorSelectorCheckerWithCheckingContext querySelectorSelectorCheckerFunctionWithCheckingContext(void* executableAddress, SelectorCompilationStatus compilationStatus)
 {
     ASSERT_UNUSED(compilationStatus, compilationStatus == SelectorCompilationStatus::SelectorCheckerWithCheckingContext);
-    return JSC::untagCFunctionPtr<QuerySelectorSelectorCheckerWithCheckingContext, CSSSelectorPtrTag>(executableAddress);
+    return WTF::untagCFunctionPtr<QuerySelectorSelectorCheckerWithCheckingContext, CSSSelectorPtrTag>(executableAddress);
 }
 
 } // namespace SelectorCompiler
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to