Changeset 215424 in webkit
- Timestamp:
- Apr 17, 2017, 1:22:24 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r215417 r215424 1 2017-04-17 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] Move isNullFunctionPointer down into WTF 4 https://bugs.webkit.org/show_bug.cgi?id=170892 5 6 Reviewed by Sam Weinig. 7 8 Test: TestWebKitAPI/Tests/WTF/darwin/WeakLinking.cpp 9 10 * WTF.xcodeproj/project.pbxproj: Added reference to new file. 11 * wtf/darwin: Added. 12 * wtf/darwin/WeakLinking.h: Added. 13 (WTF::isNullFunctionPointer): Copied from ResourceLoadStatisticsClassifierCocoa.cpp in 14 WebKit2 and changed into a function template that works with any function pointer. 15 1 16 2017-04-17 Ryan Haddad <ryanhaddad@apple.com> 2 17 -
trunk/Source/WTF/WTF.xcodeproj/project.pbxproj
r215354 r215424 141 141 2CDED0F318115C85004DBA70 /* RunLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CDED0F118115C85004DBA70 /* RunLoop.cpp */; }; 142 142 2CDED0F418115C85004DBA70 /* RunLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CDED0F218115C85004DBA70 /* RunLoop.h */; }; 143 37C7CC2A1EA40A73007BD956 /* WeakLinking.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C7CC291EA40A73007BD956 /* WeakLinking.h */; }; 143 144 430B47891AAAAC1A001223DA /* StringCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 430B47871AAAAC1A001223DA /* StringCommon.h */; }; 144 145 4B2680DD9B974402899ED572 /* IndexedContainerIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C67C542589348E285B49699 /* IndexedContainerIterator.h */; }; … … 540 541 2CDED0F218115C85004DBA70 /* RunLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunLoop.h; sourceTree = "<group>"; }; 541 542 3137E1D7DBD84AC38FAE4D34 /* IndexSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexSet.h; sourceTree = "<group>"; }; 543 37C7CC291EA40A73007BD956 /* WeakLinking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakLinking.h; sourceTree = "<group>"; }; 542 544 430B47871AAAAC1A001223DA /* StringCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringCommon.h; sourceTree = "<group>"; }; 543 545 513E170A1CD7D5BF00E3650B /* LoggingAccumulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoggingAccumulator.h; sourceTree = "<group>"; }; … … 863 865 sourceTree = "<group>"; 864 866 }; 867 37C7CC281EA40A54007BD956 /* darwin */ = { 868 isa = PBXGroup; 869 children = ( 870 37C7CC291EA40A73007BD956 /* WeakLinking.h */, 871 ); 872 path = darwin; 873 sourceTree = "<group>"; 874 }; 865 875 5D247B5714689B8600E78B76 = { 866 876 isa = PBXGroup; … … 933 943 2CDED0F018115C3F004DBA70 /* cf */, 934 944 E4A0AD3B1A96251900536DF6 /* cocoa */, 945 37C7CC281EA40A54007BD956 /* darwin */, 935 946 A8A47281151A825A004123FF /* dtoa */, 936 947 1FA47C87152502DA00568D1B /* ios */, … … 1467 1478 A8A473A6151A825B004123FF /* DisallowCType.h in Headers */, 1468 1479 A8A473AF151A825B004123FF /* diy-fp.h in Headers */, 1480 37C7CC2A1EA40A73007BD956 /* WeakLinking.h in Headers */, 1469 1481 0F4570431BE5B58F0062A629 /* Dominators.h in Headers */, 1470 1482 A8A473B1151A825B004123FF /* double-conversion.h in Headers */, -
trunk/Source/WebCore/ChangeLog
r215423 r215424 1 2017-04-17 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] Move isNullFunctionPointer down into WTF 4 https://bugs.webkit.org/show_bug.cgi?id=170892 5 6 Reviewed by Sam Weinig. 7 8 * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: 9 (WebCore::LibWebRTCProvider::webRTCAvailable): Changed to use WTF::isNullFunctionPointer, 10 and removed the static variable, so instead of loading from the initialization guard, 11 branching, then loading from the variable itself, we just load from the function pointer. 12 (WebCore::isNullFunctionPointer): Deleted. 13 1 14 2017-04-14 Jiewen Tan <jiewen_tan@apple.com> 2 15 -
trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp
r215411 r215424 39 39 #include <wtf/Function.h> 40 40 #include <wtf/NeverDestroyed.h> 41 #include <wtf/darwin/WeakLinking.h> 41 42 #endif 42 43 … … 205 206 } 206 207 207 static inline bool isNullFunctionPointer(void* functionPointer)208 {209 void* result;210 asm(211 "mov %1, %0"212 : "=r" (result)213 : "r" (functionPointer)214 );215 return !result;216 }217 218 208 #endif // USE(LIBWEBRTC) 219 209 … … 221 211 { 222 212 #if USE(LIBWEBRTC) 223 static bool available = [] { 224 return !isNullFunctionPointer(reinterpret_cast<void*>(rtc::LogMessage::LogToDebug)); 225 }(); 226 return available; 213 return !isNullFunctionPointer(rtc::LogMessage::LogToDebug); 227 214 #else 228 215 return true; -
trunk/Source/WebKit2/ChangeLog
r215421 r215424 1 2017-04-17 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] Move isNullFunctionPointer down into WTF 4 https://bugs.webkit.org/show_bug.cgi?id=170892 5 6 Reviewed by Sam Weinig. 7 8 * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp: 9 (WebKit::ResourceLoadStatisticsClassifierCocoa::canUseCorePrediction): Changed to use 10 WTF::isNullFunctionPointer. 11 (WebKit::isNullFunctionPointer): Deleted. 12 1 13 2017-04-17 Wenson Hsieh <wenson_hsieh@apple.com> 2 14 -
trunk/Source/WebKit2/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp
r215247 r215424 32 32 #include "Logging.h" 33 33 #include <wtf/NeverDestroyed.h> 34 #include <wtf/darwin/WeakLinking.h> 34 35 35 36 namespace WebKit { … … 73 74 } 74 75 75 static inline bool isNullFunctionPointer(void* functionPointer)76 {77 void* result;78 // The C compiler may take advantage of the fact that by definition, function pointers cannot be79 // null. When weak-linking a library, function pointers can be null. We use non-C code to80 // prevent the C compiler from using the definition to optimize out the null check.81 asm(82 "mov %1, %0"83 : "=r" (result)84 : "r" (functionPointer)85 );86 return !result;87 }88 89 76 bool ResourceLoadStatisticsClassifierCocoa::canUseCorePrediction() 90 77 { … … 95 82 return false; 96 83 97 if (isNullFunctionPointer( reinterpret_cast<void*>(svm_load_model))) {84 if (isNullFunctionPointer(svm_load_model)) { 98 85 m_useCorePrediction = false; 99 86 return false; -
trunk/Tools/ChangeLog
r215416 r215424 1 2017-04-17 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] Move isNullFunctionPointer down into WTF 4 https://bugs.webkit.org/show_bug.cgi?id=170892 5 6 Reviewed by Sam Weinig. 7 8 * TestWebKitAPI/Configurations/TestWTF.xcconfig: 9 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 10 * TestWebKitAPI/Tests/WTF/darwin/WeakLinking.cpp: Added. 11 (TestWebKitAPI::TEST): 12 * TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-iOS-v2.tbd: Added. 13 * TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-iOS.tbd: Added. 14 * TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-macOS-v2.tbd: Added. 15 * TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-macOS.tbd: Added. 16 1 17 2017-04-17 Jonathan Bedard <jbedard@apple.com> 2 18 -
trunk/Tools/TestWebKitAPI/Configurations/TestWTF.xcconfig
r201938 r215424 25 25 26 26 PRODUCT_NAME = TestWTF; 27 28 LIBRARY_SEARCH_PATHS = $(PROJECT_DIR)/Tests/WTF/darwin $(inhertied); 29 27 30 GCC_ENABLE_OBJC_EXCEPTIONS = YES; 28 31 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r215413 r215424 116 116 37B47E301D64E7CA005F4EFF /* WKObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37B47E2E1D64E7CA005F4EFF /* WKObject.mm */; }; 117 117 37BCA61C1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */; }; 118 37C7CC2D1EA4146B007BD956 /* WeakLinking.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37C7CC2B1EA4146B007BD956 /* WeakLinking.cpp */; }; 118 119 37D36ED71AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */; }; 119 120 37DC6791140D7D7600ABCCDB /* DOMRangeOfString.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 37DC678F140D7D3A00ABCCDB /* DOMRangeOfString.html */; }; … … 1018 1019 37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ShouldOpenExternalURLsInNewWindowActions.mm; sourceTree = "<group>"; }; 1019 1020 37C784DE197C8F2E0010A496 /* RenderedImageFromDOMNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMNode.mm; sourceTree = "<group>"; }; 1021 37C7CC2B1EA4146B007BD956 /* WeakLinking.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WeakLinking.cpp; sourceTree = "<group>"; }; 1022 37C7CC2E1EA41702007BD956 /* libTestWTFAlwaysMissing-macOS-v2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; path = "libTestWTFAlwaysMissing-macOS-v2.tbd"; sourceTree = "<group>"; }; 1023 37C7CC331EA41EC8007BD956 /* libTestWTFAlwaysMissing-iOS-v2.tbd */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.text-based-dylib-definition"; path = "libTestWTFAlwaysMissing-iOS-v2.tbd"; sourceTree = "<group>"; }; 1024 37C7CC341EA41EC8007BD956 /* libTestWTFAlwaysMissing-iOS.tbd */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.text-based-dylib-definition"; path = "libTestWTFAlwaysMissing-iOS.tbd"; sourceTree = "<group>"; }; 1025 37C7CC351EA41EC8007BD956 /* libTestWTFAlwaysMissing-macOS.tbd */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.text-based-dylib-definition"; path = "libTestWTFAlwaysMissing-macOS.tbd"; sourceTree = "<group>"; }; 1020 1026 37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LoadAlternateHTMLString.mm; sourceTree = "<group>"; }; 1021 1027 37DC678B140D7C5000ABCCDB /* DOMRangeOfString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMRangeOfString.mm; sourceTree = "<group>"; }; … … 1822 1828 isa = PBXGroup; 1823 1829 children = ( 1830 37C7CC331EA41EC8007BD956 /* libTestWTFAlwaysMissing-iOS-v2.tbd */, 1831 37C7CC341EA41EC8007BD956 /* libTestWTFAlwaysMissing-iOS.tbd */, 1832 37C7CC2E1EA41702007BD956 /* libTestWTFAlwaysMissing-macOS-v2.tbd */, 1833 37C7CC351EA41EC8007BD956 /* libTestWTFAlwaysMissing-macOS.tbd */, 1824 1834 7CBBA07619BB8A9100BBF025 /* OSObjectPtr.cpp */, 1835 37C7CC2B1EA4146B007BD956 /* WeakLinking.cpp */, 1825 1836 ); 1826 1837 path = darwin; … … 2697 2708 7C83DF121D0A590C00FEBCF3 /* ScopedLambda.cpp in Sources */, 2698 2709 7C83DF3D1D0A590C00FEBCF3 /* SetForScope.cpp in Sources */, 2710 37C7CC2D1EA4146B007BD956 /* WeakLinking.cpp in Sources */, 2699 2711 7C83DF2A1D0A590C00FEBCF3 /* SHA1.cpp in Sources */, 2700 2712 7C83DF321D0A590C00FEBCF3 /* StringBuilder.cpp in Sources */,
Note:
See TracChangeset
for help on using the changeset viewer.