2020-04-16 Alan Coon Cherry-pick r259980. rdar://problem/61888315 Follow-up: WTF::Persistence::Coder and WTF::Persistence::Decoder should use WARN_UNUSED_RETURN Changes based on feedback from Alex Christensen and Darin Adler: - Remove WARN_UNUSED_RETURN from methods returning Optional<>. - Place WARN_UNUSED_RETURN consistently before the return type. * wtf/persistence/PersistentDecoder.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259980 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-04-12 David Kilzer Follow-up: WTF::Persistence::Coder and WTF::Persistence::Decoder should use WARN_UNUSED_RETURN Changes based on feedback from Alex Christensen and Darin Adler: - Remove WARN_UNUSED_RETURN from methods returning Optional<>. - Place WARN_UNUSED_RETURN consistently before the return type. * wtf/persistence/PersistentDecoder.h: 2020-04-16 Alan Coon Cherry-pick r259814. rdar://problem/61888315 WTF::Persistence::Coder and WTF::Persistence::Decoder should use WARN_UNUSED_RETURN Reviewed by Darin Adler. Source/WebKit: * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::decodeStorageRecord): - Add missing return value check for decode.decode(). Source/WTF: * wtf/persistence/PersistentCoders.cpp: (WTF::Persistence::decodeStringText): - Add WARN_UNUSED_RETURN. * wtf/persistence/PersistentCoders.h: (WTF::Persistence::Coder>::decode): (WTF::Persistence::Coder::decode): (WTF::Persistence::Coder::decode): - Add WARN_UNUSED_RETURN. - Add missing return value check for decode.decodeFixedLengthData(). * wtf/persistence/PersistentDecoder.h: (WTF::Persistence::Decoder::decode): (WTF::Persistence::Decoder::decodeEnum): (WTF::Persistence::Decoder::bufferIsLargeEnoughToContain const): - Add WARN_UNUSED_RETURN. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259814 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-04-09 David Kilzer WTF::Persistence::Coder and WTF::Persistence::Decoder should use WARN_UNUSED_RETURN Reviewed by Darin Adler. * wtf/persistence/PersistentCoders.cpp: (WTF::Persistence::decodeStringText): - Add WARN_UNUSED_RETURN. * wtf/persistence/PersistentCoders.h: (WTF::Persistence::Coder>::decode): (WTF::Persistence::Coder::decode): (WTF::Persistence::Coder::decode): - Add WARN_UNUSED_RETURN. - Add missing return value check for decode.decodeFixedLengthData(). * wtf/persistence/PersistentDecoder.h: (WTF::Persistence::Decoder::decode): (WTF::Persistence::Decoder::decodeEnum): (WTF::Persistence::Decoder::bufferIsLargeEnoughToContain const): - Add WARN_UNUSED_RETURN. 2020-04-12 Alan Coon Cherry-pick r259316. rdar://problem/61269751 IndexedDB: destroy WebIDBServer when session is removed in network process https://bugs.webkit.org/show_bug.cgi?id=209606 Reviewed by Geoffrey Garen. Source/WebCore: Rename immediateCloseForUserDelete to immediateClose as we now use it in destructor of IDBServer to make sure everything in database finishes correctly. * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::~IDBServer): (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince): (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesForOrigins): * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::immediateClose): (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete): Deleted. * Modules/indexeddb/server/UniqueIDBDatabase.h: Source/WebKit: Tested manually to verify WebIDBServer is removed and its thread ends when session is removed. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::~WebIDBServer): (WebKit::WebIDBServer::addConnection): (WebKit::WebIDBServer::removeConnection): (WebKit::WebIDBServer::close): * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::destroySession): (WebKit::NetworkProcess::connectionToWebProcessClosed): Source/WTF: Add function to kill CrossThreadTaskHandler and make thread finish. Also add a callback to be called before thread finishes. * wtf/CrossThreadTaskHandler.cpp: (WTF::CrossThreadTaskHandler::CrossThreadTaskHandler): (WTF::CrossThreadTaskHandler::setCompletionCallback): (WTF::CrossThreadTaskHandler::kill): * wtf/CrossThreadTaskHandler.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259316 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-03-31 Sihui Liu IndexedDB: destroy WebIDBServer when session is removed in network process https://bugs.webkit.org/show_bug.cgi?id=209606 Reviewed by Geoffrey Garen. Add function to kill CrossThreadTaskHandler and make thread finish. Also add a callback to be called before thread finishes. * wtf/CrossThreadTaskHandler.cpp: (WTF::CrossThreadTaskHandler::CrossThreadTaskHandler): (WTF::CrossThreadTaskHandler::setCompletionCallback): (WTF::CrossThreadTaskHandler::kill): * wtf/CrossThreadTaskHandler.h: 2020-04-09 Alan Coon Revert r259689. rdar://problem/61269751 2020-04-07 Russell Epstein Cherry-pick r259316. rdar://problem/61269751 IndexedDB: destroy WebIDBServer when session is removed in network process https://bugs.webkit.org/show_bug.cgi?id=209606 Reviewed by Geoffrey Garen. Source/WebCore: Rename immediateCloseForUserDelete to immediateClose as we now use it in destructor of IDBServer to make sure everything in database finishes correctly. * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::~IDBServer): (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince): (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesForOrigins): * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::immediateClose): (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete): Deleted. * Modules/indexeddb/server/UniqueIDBDatabase.h: Source/WebKit: Tested manually to verify WebIDBServer is removed and its thread ends when session is removed. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::~WebIDBServer): (WebKit::WebIDBServer::addConnection): (WebKit::WebIDBServer::removeConnection): (WebKit::WebIDBServer::close): * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::destroySession): (WebKit::NetworkProcess::connectionToWebProcessClosed): Source/WTF: Add function to kill CrossThreadTaskHandler and make thread finish. Also add a callback to be called before thread finishes. * wtf/CrossThreadTaskHandler.cpp: (WTF::CrossThreadTaskHandler::CrossThreadTaskHandler): (WTF::CrossThreadTaskHandler::setCompletionCallback): (WTF::CrossThreadTaskHandler::kill): * wtf/CrossThreadTaskHandler.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259316 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-03-31 Sihui Liu IndexedDB: destroy WebIDBServer when session is removed in network process https://bugs.webkit.org/show_bug.cgi?id=209606 Reviewed by Geoffrey Garen. Add function to kill CrossThreadTaskHandler and make thread finish. Also add a callback to be called before thread finishes. * wtf/CrossThreadTaskHandler.cpp: (WTF::CrossThreadTaskHandler::CrossThreadTaskHandler): (WTF::CrossThreadTaskHandler::setCompletionCallback): (WTF::CrossThreadTaskHandler::kill): * wtf/CrossThreadTaskHandler.h: 2020-02-20 Russell Epstein Cherry-pick r256806. rdar://problem/59576023 Add and adopt HAVE(LOOKUP_GESTURE_RECOGNIZER) https://bugs.webkit.org/show_bug.cgi?id=207876 Reviewed by Wenson Hsieh. * wtf/Platform.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setupInteraction]): (-[WKContentView cleanupInteraction]): (-[WKContentView _removeDefaultGestureRecognizers]): (-[WKContentView _addDefaultGestureRecognizers]): (-[WKContentView gestureRecognizer:shouldReceiveTouch:]): For symmetry's sake, introduce a HAVE for this gesture. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256806 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-17 Tim Horton Add and adopt HAVE(LOOKUP_GESTURE_RECOGNIZER) https://bugs.webkit.org/show_bug.cgi?id=207876 Reviewed by Wenson Hsieh. * wtf/Platform.h: For symmetry's sake, introduce a HAVE for this gesture. 2020-02-18 Alan Coon Cherry-pick r256191. rdar://problem/59447003 Disallow setting base URL to a data or JavaScript URL https://bugs.webkit.org/show_bug.cgi?id=207136 Source/WebCore: Reviewed by Brent Fulgham. Inspired by . Block setting the base URL to a data URL or JavaScript URL as such usage is questionable. This makes WebKit match the behavior of Chrome and Firefox and is in the spirit of the discussion in . On Mac and iOS, this restriction is applied only to apps linked against a future SDK to avoid breaking shipped apps. For all other ports, this restriction is enabled by default. Tests: fast/url/relative2.html fast/url/segments-from-data-url2.html http/tests/security/allowed-base-url-data-url-via-setting.html http/tests/security/denied-base-url-data-url.html http/tests/security/denied-base-url-javascript-url.html * dom/Document.cpp: (WebCore::Document::processBaseElement): Condition updating the parsed base URL on whether is has an allowed scheme, if restrictions are enabled. Otherwise, do what we do now. If the scheme is disallowed then log a message to the console to explain this to web developers. * html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::scan): Pass whether to apply restrictons to the base URL to updatePredictedBaseURL(). This depends on whether the setting is enabled or not. (WebCore::TokenPreloadScanner::updatePredictedBaseURL): Modifed to take a boolean as to whether to apply restrictions. If restrictions are not to be applied do what we do now. Otherwise, only do what we do now if the scheme for the predicated base URL is allowed. * html/parser/HTMLPreloadScanner.h: * page/SecurityPolicy.cpp: (WebCore::SecurityPolicy::isBaseURLSchemeAllowed): Added. * page/SecurityPolicy.h: * page/Settings.yaml: Add a setting to toggle restrictions on the base URL scheme. Source/WebKit: Reviewed by Brent Fulgham. Apply base URL restrictions to apps linked to a future WebKit to avoid breaking existing apps. * Shared/WebPreferences.yaml: * UIProcess/API/Cocoa/WKWebView.mm: (shouldRestrictBaseURLSchemes): Added. (-[WKWebView _setupPageConfiguration:]): Update settings. * UIProcess/Cocoa/VersionChecks.h: Source/WebKitLegacy/mac: Reviewed by Brent Fulgham. Apply base URL restrictions to apps linked to a future WebKit to avoid breaking existing apps. * Misc/WebKitVersionChecks.h: * WebView/WebView.mm: (shouldRestrictBaseURLSchemes): Added. (-[WebView _commonInitializationWithFrameName:groupName:]): Update settings. Source/WTF: Reviewed by Brent Fulgham. Add some more macro definitions. * wtf/spi/darwin/dyldSPI.h: LayoutTests: RReviewed by Brent Fulgham. Add some tests. Update others to toggle the setting to apply or unapply the new behavior. The test denied-base-url-javascript-url.html is derived from the test base-url-javascript.html, included in . * fast/url/relative-expected.txt: * fast/url/relative.html: * fast/url/relative2-expected.txt: Copied from LayoutTests/fast/url/relative-expected.txt. * fast/url/relative2.html: Copied from LayoutTests/fast/url/relative.html. * fast/url/resources/utilities.js: (setShouldEllipsizeFileURLPaths): Added. Toggles ellipsizing the path portion of a file URL to simplify matching. Otherwise, file URLs could be machine-specific. (canonicalizedPathname): Added. (segments): Modified to optionally call canonicalizedPathname. (canonicalize): Ditto. * fast/url/segments-from-data-url-expected.txt: * fast/url/segments-from-data-url.html: * fast/url/segments-from-data-url2-expected.txt: Copied from LayoutTests/fast/url/segments-from-data-url-expected.txt. * fast/url/segments-from-data-url2.html: Copied from LayoutTests/fast/url/segments-from-data-url.html. * fetch/fetch-url-serialization-expected.txt: * http/tests/plugins/navigation-during-load-embed.html: * http/tests/plugins/navigation-during-load.html: * http/tests/security/allowed-base-url-data-url-via-setting-expected.txt: Added. * http/tests/security/allowed-base-url-data-url-via-setting.html: Added. * http/tests/security/denied-base-url-data-url-expected.txt: Added. * http/tests/security/denied-base-url-data-url.html: Added. * http/tests/security/denied-base-url-javascript-url-expected.txt: Added. * http/tests/security/denied-base-url-javascript-url.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256191 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-10 Daniel Bates Disallow setting base URL to a data or JavaScript URL https://bugs.webkit.org/show_bug.cgi?id=207136 Reviewed by Brent Fulgham. Add some more macro definitions. * wtf/spi/darwin/dyldSPI.h: 2020-02-17 Alan Coon Apply patch. rdar://problem/59447004 Apply content from rdar://problem/59447004 2020-02-14 Russell Epstein Cherry-pick r256629. rdar://problem/59478949 [JSC] Introduce UnlinkedCodeBlockGenerator and reduce sizeof(UnlinkedCodeBlock https://bugs.webkit.org/show_bug.cgi?id=207087 Reviewed by Tadeu Zagallo. Add more useful methods for RefCountedArray. * wtf/RefCountedArray.h * (WTF::RefCountedArray::operator): * (WTF::RefCountedArray::isEmpty const * (WTF::RefCountedArray::front * (WTF::RefCountedArray::front const): * (WTF::RefCountedArray::last * (WTF::RefCountedArray::last const): 2020-02-14 Russell Epstein Cherry-pick r256629. rdar://problem/59478949 Allow UIDNAInfo.errors from uidna_nameToUnicode that would not cause URL parsing failures https://bugs.webkit.org/show_bug.cgi?id=207360 Patch by Alex Christensen on 2020-02-14 Reviewed by Ryosuke Niwa. Source/WTF: * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Tools: * TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm: (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256629 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-14 Alex Christensen Allow UIDNAInfo.errors from uidna_nameToUnicode that would not cause URL parsing failures https://bugs.webkit.org/show_bug.cgi?id=207360 Reviewed by Ryosuke Niwa. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): 2020-02-14 Russell Epstein Cherry-pick r256498. rdar://problem/59478929 [JSC] Compact JITCodeMap by storing BytecodeIndex and CodeLocation separately https://bugs.webkit.org/show_bug.cgi?id=207673 Reviewed by Mark Lam. Source/JavaScriptCore: While BytecodeIndex is 4 bytes, CodeLocation is 8 bytes. So the tuple of them "JITCodeMap::Entry" becomes 16 bytes because it adds 4 bytes padding. We should store BytecodeIndex and CodeLocation separately to avoid this padding. This patch introduces JITCodeMapBuilder. We use this to build JITCodeMap data structure as a immutable final result. * jit/JIT.cpp: (JSC::JIT::link): * jit/JITCodeMap.h: (JSC::JITCodeMap::JITCodeMap): (JSC::JITCodeMap::find const): (JSC::JITCodeMap::operator bool const): (JSC::JITCodeMap::codeLocations const): (JSC::JITCodeMap::indexes const): (JSC::JITCodeMapBuilder::append): (JSC::JITCodeMapBuilder::finalize): (JSC::JITCodeMap::Entry::Entry): Deleted. (JSC::JITCodeMap::Entry::bytecodeIndex const): Deleted. (JSC::JITCodeMap::Entry::codeLocation): Deleted. (JSC::JITCodeMap::append): Deleted. (JSC::JITCodeMap::finish): Deleted. Source/WTF: * wtf/MallocPtr.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256498 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-12 Yusuke Suzuki [JSC] Compact JITCodeMap by storing BytecodeIndex and CodeLocation separately https://bugs.webkit.org/show_bug.cgi?id=207673 Reviewed by Mark Lam. * wtf/MallocPtr.h: 2020-02-14 Russell Epstein Cherry-pick r256482. rdar://problem/59478881 Shrink CachedResource https://bugs.webkit.org/show_bug.cgi?id=207618 Reviewed by Mark Lam. Source/WebCore: This patch shrinks sizeof(CachedResource) by 80 bytes by aggressively using bit-fields and Markable<>. For each enum class, we define `bitsOfXXX` value, which indicates # of bits to represent it. And using this value for bit-field's width. No behavior change. * loader/FetchOptions.h: (WebCore::FetchOptions::encode const): * loader/ResourceLoaderOptions.h: (WebCore::ResourceLoaderOptions::ResourceLoaderOptions): (WebCore::ResourceLoaderOptions::loadedFromOpaqueSource): * loader/cache/CachedImage.cpp: (WebCore::CachedImage::CachedImage): (WebCore::CachedImage::shouldDeferUpdateImageData const): (WebCore::CachedImage::didUpdateImageData): * loader/cache/CachedImage.h: * loader/cache/CachedResource.cpp: (WebCore::CachedResource::CachedResource): (WebCore::CachedResource::load): (WebCore::CachedResource::finish): * loader/cache/CachedResource.h: (WebCore::CachedResource::setStatus): * page/csp/ContentSecurityPolicyResponseHeaders.h: (WebCore::ContentSecurityPolicyResponseHeaders::MarkableTraits::isEmptyValue): (WebCore::ContentSecurityPolicyResponseHeaders::MarkableTraits::emptyValue): (WebCore::ContentSecurityPolicyResponseHeaders::ContentSecurityPolicyResponseHeaders): * platform/network/NetworkLoadMetrics.h: (WebCore::NetworkLoadMetrics::isolatedCopy const): (WebCore::NetworkLoadMetrics::clearNonTimingData): (WebCore::NetworkLoadMetrics::operator== const): (WebCore::NetworkLoadMetrics::encode const): (WebCore::NetworkLoadMetrics::decode): * platform/network/ResourceLoadPriority.h: * platform/network/ResourceRequestBase.h: (WebCore::ResourceRequestBase::ResourceRequestBase): * platform/network/ResourceResponseBase.h: * platform/network/StoredCredentialsPolicy.h: Source/WTF: * wtf/Markable.h: (WTF::Markable::asOptional const): Add helper method to get Optional easily from Markable. * wtf/ObjectIdentifier.h: (WTF::ObjectIdentifier::MarkableTraits::isEmptyValue): (WTF::ObjectIdentifier::MarkableTraits::emptyValue): (WTF::ObjectIdentifier::ObjectIdentifier): Add MarkableTraits for ObjectIdentifier. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256482 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-12 Yusuke Suzuki Shrink CachedResource https://bugs.webkit.org/show_bug.cgi?id=207618 Reviewed by Mark Lam. * wtf/Markable.h: (WTF::Markable::asOptional const): Add helper method to get Optional easily from Markable. * wtf/ObjectIdentifier.h: (WTF::ObjectIdentifier::MarkableTraits::isEmptyValue): (WTF::ObjectIdentifier::MarkableTraits::emptyValue): (WTF::ObjectIdentifier::ObjectIdentifier): Add MarkableTraits for ObjectIdentifier. 2020-02-14 Russell Epstein Cherry-pick r254681. rdar://problem/59474790 [Win] Fix AppleWin build https://bugs.webkit.org/show_bug.cgi?id=206299 Reviewed by Brent Fulgham. .: This patch has been created by don.olmstead@sony.com and pvollan@apple.com. Add target files for WTF and JavaScriptCore. Also, to make sure headers are copied to the forwarding headers directory, add the CMake keywork ALL when adding custom target for copying files. * Source/cmake/TargetJavaScriptCore.cmake: Added. * Source/cmake/TargetWTF.cmake: Added. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: Include required target. Build internal builds with VS2019. * CMakeLists.txt: * JavaScriptCore.vcxproj/JavaScriptCore.proj: Source/WebCore: Include required targets. Build internal builds with VS2019. * CMakeLists.txt: * WebCore.vcxproj/WebCore.proj: Source/WebKitLegacy: Include required targets. Build internal builds with VS2019. * CMakeLists.txt: * WebKitLegacy.vcxproj/WebKitLegacy.proj: Source/WTF: Build internal builds with VS2019. * WTF.vcxproj/WTF.proj: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254681 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-16 Per Arne Vollan [Win] Fix AppleWin build https://bugs.webkit.org/show_bug.cgi?id=206299 Reviewed by Brent Fulgham. Build internal builds with VS2019. * WTF.vcxproj/WTF.proj: 2020-02-14 Russell Epstein Cherry-pick r256203. rdar://problem/59446995 Unreviewed, speculative build fix on watchOS simulator https://bugs.webkit.org/show_bug.cgi?id=207183 * wtf/HashTable.h: (WTF::HashTableCapacityForSize::capacityForSize): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256203 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-10 Yusuke Suzuki Unreviewed, speculative build fix on watchOS simulator https://bugs.webkit.org/show_bug.cgi?id=207183 * wtf/HashTable.h: (WTF::HashTableCapacityForSize::capacityForSize): 2020-02-14 Russell Epstein Cherry-pick r256194. rdar://problem/59446995 Unreviewed, fix build failure on watchOS simulator https://bugs.webkit.org/show_bug.cgi?id=207183 * wtf/HashTable.h: (WTF::HashTableCapacityForSize::capacityForSize): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256194 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-10 Yusuke Suzuki Unreviewed, fix build failure on watchOS simulator https://bugs.webkit.org/show_bug.cgi?id=207183 * wtf/HashTable.h: (WTF::HashTableCapacityForSize::capacityForSize): 2020-02-14 Russell Epstein Cherry-pick r256093. rdar://problem/59446995 [WTF] Try using 75% load factor for HashTable https://bugs.webkit.org/show_bug.cgi?id=207183 Reviewed by Mark Lam. Source/WTF: We know that hash-table is one of the most memory consuming part in WebKit. By analyzing many production hash-table implementations[1], I found that many of them are using 75% load-factor while our one is 50%. This patch changes the load-factor from 50% to 75%. But we pick 75% only for small tables which capacity is <= 1024 based on collected data by micro-benchmarking. The collected data is telling that longer probe-length affects on performance if table size gets larger. [1]: LLVM DenseMap, Abseil's, rust's, and so on. * wtf/HashTable.h: (WTF::HashTableCapacityForSize::shouldExpand): (WTF::HashTableCapacityForSize::capacityForSize): (WTF::HashTable::shouldExpand const): (WTF::KeyTraits>::computeBestTableSize): Tools: * TestWebKitAPI/Tests/WTF/HashSet.cpp: (TestWebKitAPI::testInitialCapacity): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256093 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-08 Yusuke Suzuki [WTF] Try using 75% load factor for HashTable https://bugs.webkit.org/show_bug.cgi?id=207183 Reviewed by Mark Lam. We know that hash-table is one of the most memory consuming part in WebKit. By analyzing many production hash-table implementations[1], I found that many of them are using 75% load-factor while our one is 50%. This patch changes the load-factor from 50% to 75%. But we pick 75% only for small tables which capacity is <= 1024 based on collected data by micro-benchmarking. The collected data is telling that longer probe-length affects on performance if table size gets larger. [1]: LLVM DenseMap, Abseil's, rust's, and so on. * wtf/HashTable.h: (WTF::HashTableCapacityForSize::shouldExpand): (WTF::HashTableCapacityForSize::capacityForSize): (WTF::HashTable::shouldExpand const): (WTF::KeyTraits>::computeBestTableSize): 2020-02-14 Russell Epstein Cherry-pick r256011. rdar://problem/59446995 Unreviewed, revert 75% load-factor because of JetStream2/string-unpack-code-SP regression https://bugs.webkit.org/show_bug.cgi?id=207183 Source/WTF: * wtf/HashTable.h: (WTF::HashTable::shouldExpand const): (WTF::KeyTraits>::computeBestTableSize): (WTF::HashTable::shouldExpand): Deleted. (WTF::HashTableCapacityForSize::capacityForSize): Deleted. Tools: * TestWebKitAPI/Tests/WTF/HashSet.cpp: (TestWebKitAPI::testInitialCapacity): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256011 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-07 Yusuke Suzuki Unreviewed, revert 75% load-factor because of JetStream2/string-unpack-code-SP regression https://bugs.webkit.org/show_bug.cgi?id=207183 * wtf/HashTable.h: (WTF::HashTable::shouldExpand const): (WTF::KeyTraits>::computeBestTableSize): (WTF::HashTable::shouldExpand): Deleted. (WTF::HashTableCapacityForSize::capacityForSize): Deleted. 2020-02-14 Russell Epstein Cherry-pick r255889. rdar://problem/59446995 [WTF] Try using 75% load factor for HashTable https://bugs.webkit.org/show_bug.cgi?id=207183 Reviewed by Mark Lam. Source/WTF: We know that hash-table is one of the most memory consuming part in WebKit. By analyzing many production hash-table implementations[1], I found that many of them are using 75% load-factor while our one is 50%. A/B test shows that 75% load-factor is performance-neutral in Speedometer2 and JetStream2, while it offers 2~% improvement in Membuster. This means that we are wasting too much memory for no-performance-improvement. This patch changes the load-factor from 50% to 75%. [1]: LLVM DenseMap, Abseil's, rust's, and so on. * wtf/HashTable.h: (WTF::HashTable::shouldExpand): (WTF::HashTable::shouldExpand const): (WTF::HashTableCapacityForSize::capacityForSize): (WTF::KeyTraits>::computeBestTableSize): Tools: Fix load-factor assumption in existing tests. * TestWebKitAPI/Tests/WTF/HashSet.cpp: (TestWebKitAPI::testInitialCapacity): LayoutTests: It seems that this test is relying on hash-table's order. * http/tests/resourceLoadStatistics/aggregate-sorted-data-no-storage-access-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255889 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-05 Yusuke Suzuki [WTF] Try using 75% load factor for HashTable https://bugs.webkit.org/show_bug.cgi?id=207183 Reviewed by Mark Lam. We know that hash-table is one of the most memory consuming part in WebKit. By analyzing many production hash-table implementations[1], I found that many of them are using 75% load-factor while our one is 50%. A/B test shows that 75% load-factor is performance-neutral in Speedometer2 and JetStream2, while it offers 2~% improvement in Membuster. This means that we are wasting too much memory for no-performance-improvement. This patch changes the load-factor from 50% to 75%. [1]: LLVM DenseMap, Abseil's, rust's, and so on. * wtf/HashTable.h: (WTF::HashTable::shouldExpand): (WTF::HashTable::shouldExpand const): (WTF::HashTableCapacityForSize::capacityForSize): (WTF::KeyTraits>::computeBestTableSize): 2020-02-14 Russell Epstein Cherry-pick r255611. rdar://problem/59446995 Reduce size of HashMap and HashSet https://bugs.webkit.org/show_bug.cgi?id=207138 Reviewed by Yusuke Suzuki. Source/WTF: This reduces sizeof(HashMap) and sizeof(HashSet) from 24 to 8 on 64-bit systems. I measured that the overwhelming majority of HashMaps and HashSets never see more than 0 elements, so I moved the table metadata (tableSize, tableSizeMask, keyCount, deletedCount) to inside the dynamically allocated memory. This makes another branch in size() for non-empty tables and an additional read and write when rehashing in exchange for fewer writes in the constructor and increased cache locality of everything that uses HashMap and HashSet, which is basically everything. * wtf/HashTable.h: (WTF::HashTable::~HashTable): (WTF::HashTable::end): (WTF::HashTable::end const): (WTF::HashTable::random): (WTF::HashTable::size const): (WTF::HashTable::capacity const): (WTF::HashTable::isEmpty const): (WTF::HashTable::reserveInitialCapacity): (WTF::HashTable::shouldExpand const): (WTF::HashTable::mustRehashInPlace const): (WTF::HashTable::shouldShrink const): (WTF::HashTable::shrink): (WTF::HashTable::makeIterator): (WTF::HashTable::makeConstIterator const): (WTF::HashTable::makeKnownGoodIterator): (WTF::HashTable::makeKnownGoodConstIterator const): (WTF::HashTable::tableSize const): (WTF::HashTable::setTableSize const): (WTF::HashTable::tableSizeMask const): (WTF::HashTable::setTableSizeMask): (WTF::HashTable::keyCount const): (WTF::HashTable::setKeyCount const): (WTF::HashTable::deletedCount const): (WTF::HashTable::setDeletedCount const): (WTF::KeyTraits>::HashTable): (WTF::KeyTraits>::inlineLookup): (WTF::KeyTraits>::lookupForWriting): (WTF::KeyTraits>::fullLookupForWriting): (WTF::KeyTraits>::addUniqueForInitialization): (WTF::KeyTraits>::add): (WTF::KeyTraits>::addPassingHashCode): (WTF::KeyTraits>::remove): (WTF::KeyTraits>::removeIf): (WTF::KeyTraits>::allocateTable): (WTF::KeyTraits>::deallocateTable): (WTF::KeyTraits>::expand): (WTF::KeyTraits>::shrinkToBestSize): (WTF::KeyTraits>::deleteReleasedWeakBuckets): (WTF::KeyTraits>::rehash): (WTF::KeyTraits>::clear): (WTF::KeyTraits>::swap): (WTF::KeyTraits>::checkTableConsistencyExceptSize const): Tools: * TestWebKitAPI/Tests/WTF/HashMap.cpp: (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WTF/HashSet.cpp: (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255611 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-03 Alex Christensen Reduce size of HashMap and HashSet https://bugs.webkit.org/show_bug.cgi?id=207138 Reviewed by Yusuke Suzuki. This reduces sizeof(HashMap) and sizeof(HashSet) from 24 to 8 on 64-bit systems. I measured that the overwhelming majority of HashMaps and HashSets never see more than 0 elements, so I moved the table metadata (tableSize, tableSizeMask, keyCount, deletedCount) to inside the dynamically allocated memory. This makes another branch in size() for non-empty tables and an additional read and write when rehashing in exchange for fewer writes in the constructor and increased cache locality of everything that uses HashMap and HashSet, which is basically everything. * wtf/HashTable.h: (WTF::HashTable::~HashTable): (WTF::HashTable::end): (WTF::HashTable::end const): (WTF::HashTable::random): (WTF::HashTable::size const): (WTF::HashTable::capacity const): (WTF::HashTable::isEmpty const): (WTF::HashTable::reserveInitialCapacity): (WTF::HashTable::shouldExpand const): (WTF::HashTable::mustRehashInPlace const): (WTF::HashTable::shouldShrink const): (WTF::HashTable::shrink): (WTF::HashTable::makeIterator): (WTF::HashTable::makeConstIterator const): (WTF::HashTable::makeKnownGoodIterator): (WTF::HashTable::makeKnownGoodConstIterator const): (WTF::HashTable::tableSize const): (WTF::HashTable::setTableSize const): (WTF::HashTable::tableSizeMask const): (WTF::HashTable::setTableSizeMask): (WTF::HashTable::keyCount const): (WTF::HashTable::setKeyCount const): (WTF::HashTable::deletedCount const): (WTF::HashTable::setDeletedCount const): (WTF::KeyTraits>::HashTable): (WTF::KeyTraits>::inlineLookup): (WTF::KeyTraits>::lookupForWriting): (WTF::KeyTraits>::fullLookupForWriting): (WTF::KeyTraits>::addUniqueForInitialization): (WTF::KeyTraits>::add): (WTF::KeyTraits>::addPassingHashCode): (WTF::KeyTraits>::remove): (WTF::KeyTraits>::removeIf): (WTF::KeyTraits>::allocateTable): (WTF::KeyTraits>::deallocateTable): (WTF::KeyTraits>::expand): (WTF::KeyTraits>::shrinkToBestSize): (WTF::KeyTraits>::deleteReleasedWeakBuckets): (WTF::KeyTraits>::rehash): (WTF::KeyTraits>::clear): (WTF::KeyTraits>::swap): (WTF::KeyTraits>::checkTableConsistencyExceptSize const): 2020-02-11 Alan Coon Cherry-pick r255846. rdar://problem/59299151 Make WKWebView._negotiatedLegacyTLS accurate when loading main resouorce from network or cache https://bugs.webkit.org/show_bug.cgi?id=207207 Reviewed by Chris Dumez. Source/WebCore: * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::includeCertificateInfo const): * platform/network/ResourceResponseBase.h: (WebCore::ResourceResponseBase::usedLegacyTLS const): (WebCore::ResourceResponseBase::encode const): (WebCore::ResourceResponseBase::decode): Source/WebKit: In PageLoadState::didCommitLoad, I was resetting the value of _negotiatedLegacyTLS to false. That created a race condition when loading the main resource because the NetworkProcess would message the UIProcess setting _negotiatedLegacyTLS to false, while the NetworkProcess would message the WebProcess which would message the UIProcess to call PageLoadState::didCommitLoad which would reset it to false. Now it resets it to the correct value, whatever it is. Updating the ResourceResponseBase serialization code has the desirable side effect that the disk cache will remember whether legacy TLS was used to fetch each resource. This will make it so _negotiatedLegacyTLS is true if we read content from the disk cache that was originally fetched using legacy TLS. In order to not increase the memory footprint of ResourceResponse, I changed m_httpStatusCode from an int to a short. It just needs to be able to cover the values 0-600 or so, which really only needs 10 bits. Covered by new API tests. * NetworkProcess/NetworkCORSPreflightChecker.cpp: (WebKit::NetworkCORSPreflightChecker::didReceiveResponse): * NetworkProcess/NetworkCORSPreflightChecker.h: * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::didReceiveResponse): (WebKit::NetworkDataTask::negotiatedLegacyTLS const): Deleted. * NetworkProcess/NetworkDataTask.h: (WebKit::NetworkDataTaskClient::negotiatedLegacyTLS const): Deleted. * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse): * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::didReceiveResponse): (WebKit::NetworkLoad::notifyDidReceiveResponse): (WebKit::NetworkLoad::throttleDelayCompleted): (WebKit::NetworkLoad::negotiatedLegacyTLS const): Deleted. * NetworkProcess/NetworkLoad.h: * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/PingLoad.cpp: (WebKit::PingLoad::didReceiveResponse): * NetworkProcess/PingLoad.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::didReceiveResponse): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): * NetworkProcess/curl/NetworkDataTaskCurl.cpp: (WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse): * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): * UIProcess/PageLoadState.cpp: (WebKit::PageLoadState::didCommitLoad): * UIProcess/PageLoadState.h: * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::didCommitLoadForFrame): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::commitProvisionalPage): (WebKit::WebPageProxy::didCommitLoadForFrame): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): Source/WTF: * wtf/persistence/PersistentDecoder.cpp: (WTF::Persistence::Decoder::decode): * wtf/persistence/PersistentDecoder.h: * wtf/persistence/PersistentEncoder.cpp: (WTF::Persistence::Encoder::encode): * wtf/persistence/PersistentEncoder.h: Tools: HTTPServer now supports HTTPS. Tell your friends! * TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm: (testCertificate): (testIdentity): (credentialWithIdentity): * TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm: (TestWebKitAPI::webViewWithNavigationDelegate): (TestWebKitAPI::TEST): * TestWebKitAPI/cocoa/HTTPServer.h: * TestWebKitAPI/cocoa/HTTPServer.mm: (TestWebKitAPI::HTTPServer::HTTPServer): (TestWebKitAPI::HTTPServer::request const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255846 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-05 Alex Christensen Make WKWebView._negotiatedLegacyTLS accurate when loading main resouorce from network or cache https://bugs.webkit.org/show_bug.cgi?id=207207 Reviewed by Chris Dumez. * wtf/persistence/PersistentDecoder.cpp: (WTF::Persistence::Decoder::decode): * wtf/persistence/PersistentDecoder.h: * wtf/persistence/PersistentEncoder.cpp: (WTF::Persistence::Encoder::encode): * wtf/persistence/PersistentEncoder.h: 2020-02-10 Kocsen Chung Cherry-pick r256030. rdar://problem/59298146 Mandate UUID version 4 for mDNS ICE candidates https://bugs.webkit.org/show_bug.cgi?id=207329 Address post-commit comments from Darin by using isASCIIHexDigit. Unreviewed. * wtf/UUID.cpp: (WTF::isVersion4UUID): (WTF::isHexadecimalCharacter): Deleted. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256030 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-07 youenn fablet Mandate UUID version 4 for mDNS ICE candidates https://bugs.webkit.org/show_bug.cgi?id=207329 Address post-commit comments from Darin by using isASCIIHexDigit. Unreviewed. * wtf/UUID.cpp: (WTF::isVersion4UUID): (WTF::isHexadecimalCharacter): Deleted. 2020-02-10 Kocsen Chung Cherry-pick r256016. rdar://problem/59298146 Mandate UUID version 4 for mDNS ICE candidates https://bugs.webkit.org/show_bug.cgi?id=207329 Reviewed by Alex Christensen. Source/WebCore: Ignore ICE candidates if they are mDNS but not UUID version 4. Covered by existing tests relying on mDNS to do the connection. * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::shouldIgnoreCandidate): (WebCore::PeerConnectionBackend::addIceCandidate): Source/WebKit: * NetworkProcess/webrtc/NetworkMDNSRegister.cpp: (WebKit::NetworkMDNSRegister::registerMDNSName): Remove the count at the end of the mDNS name to make it a fully version 4 UUID. Source/WTF: Add a routine to validate version 4 UUID. * wtf/UUID.cpp: (WTF::isHexadecimalCharacter): (WTF::isVersion4UUID): * wtf/UUID.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256016 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-07 youenn fablet Mandate UUID version 4 for mDNS ICE candidates https://bugs.webkit.org/show_bug.cgi?id=207329 Reviewed by Alex Christensen. Add a routine to validate version 4 UUID. * wtf/UUID.cpp: (WTF::isHexadecimalCharacter): (WTF::isVersion4UUID): * wtf/UUID.h: 2020-02-10 Kocsen Chung Cherry-pick r255874. rdar://problem/59298178 [iOS] Do not create sandbox reports when the UI process cannot issue extensions to diagnostics service https://bugs.webkit.org/show_bug.cgi?id=207279 Source/WebKit: Reviewed by Brent Fulgham. Do not create sandbox reports when the UI process cannot issue mach extensions to the diagnostics service. The majority of clients are capable of doing this. No new tests, since it is not trivial to test if no sandbox reports are generated for a violation. * Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::SandboxExtensionImpl::create): (WebKit::SandboxExtensionImpl::sandboxExtensionForType): (WebKit::SandboxExtensionImpl::SandboxExtensionImpl): (WebKit::SandboxExtension::createHandleForMachLookup): * Shared/SandboxExtension.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): Source/WTF: Reviewed by Brent Fulgham. Add flag which avoids generating sandbox reports. * wtf/spi/darwin/SandboxSPI.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255874 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-02-05 Per Arne Vollan [iOS] Do not create sandbox reports when the UI process cannot issue extensions to diagnostics service https://bugs.webkit.org/show_bug.cgi?id=207279 Reviewed by Brent Fulgham. Add flag which avoids generating sandbox reports. * wtf/spi/darwin/SandboxSPI.h: 2020-02-03 Russell Epstein Cherry-pick r255120. rdar://problem/58942705 Move singleton Intl string locales out of JSGlobalObject. https://bugs.webkit.org/show_bug.cgi?id=206791 Source/JavaScriptCore: Reviewed by Yusuke Suzuki and Andy Wagoner. We were creating an instance of these for each JSGlobalObject when they can be a global singleton since they are always initialized with the same intl data (barring a mid-flight change in intl settings, which we don't support even in the existing code). It turns out that intlPluralRulesAvailableLocales() wasn't called anywhere. IntlPluralRules code currently just uses intlNumberFormatAvailableLocales(). To document that this is intentional, we do the following: 1. have IntlPluralRules code call intlPluralRulesAvailableLocales(), and 2. have intlPluralRulesAvailableLocales() call intlNumberFormatAvailableLocales() for its implementation. See https://bugs.webkit.org/show_bug.cgi?id=206791#c7 and https://bugs.webkit.org/show_bug.cgi?id=206791#c8. In addMissingScriptLocales(), I'm deliberately naming the string with underscores because it's much easier to read pa_PK_String and see that it refers to "pa-PK" as opposed to paPKString. Ditto for zh_CN_String, zh_HK_String, zh_SG_String, and zh_TW_String. * runtime/IntlCollator.cpp: (JSC::IntlCollator::initializeCollator): * runtime/IntlCollatorConstructor.cpp: (JSC::IntlCollatorConstructorFuncSupportedLocalesOf): * runtime/IntlDateTimeFormat.cpp: (JSC::IntlDateTimeFormat::initializeDateTimeFormat): * runtime/IntlDateTimeFormatConstructor.cpp: (JSC::IntlDateTimeFormatConstructorFuncSupportedLocalesOf): * runtime/IntlNumberFormat.cpp: (JSC::IntlNumberFormat::initializeNumberFormat): * runtime/IntlNumberFormatConstructor.cpp: (JSC::IntlNumberFormatConstructorFuncSupportedLocalesOf): * runtime/IntlObject.cpp: (JSC::convertICULocaleToBCP47LanguageTag): (JSC::addMissingScriptLocales): (JSC::intlCollatorAvailableLocales): (JSC::intlDateTimeFormatAvailableLocales): (JSC::intlNumberFormatAvailableLocales): (JSC::defaultLocale): * runtime/IntlObject.h: * runtime/IntlPluralRules.cpp: (JSC::IntlPluralRules::initializePluralRules): * runtime/IntlPluralRulesConstructor.cpp: (JSC::IntlPluralRulesConstructorFuncSupportedLocalesOf): * runtime/JSGlobalObject.cpp: (JSC::addMissingScriptLocales): Deleted. (JSC::JSGlobalObject::intlCollatorAvailableLocales): Deleted. (JSC::JSGlobalObject::intlDateTimeFormatAvailableLocales): Deleted. (JSC::JSGlobalObject::intlNumberFormatAvailableLocales): Deleted. (JSC::JSGlobalObject::intlPluralRulesAvailableLocales): Deleted. * runtime/JSGlobalObject.h: Source/WTF: Reviewed by Yusuke Suzuki. Fix a bug in StringImpl::createStaticStringImpl(): I forgot to set its hash value when I introduced it. StaticStringImpls require that its hash code be set ahead of time, and cannot be mutated at runtime. See the comment in the definition of StaticStringImpl in StringImpl.h. * wtf/text/StringImpl.cpp: (WTF::StringImpl::createStaticStringImpl): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255120 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-24 Mark Lam Move singleton Intl string locales out of JSGlobalObject. https://bugs.webkit.org/show_bug.cgi?id=206791 Reviewed by Yusuke Suzuki. Fix a bug in StringImpl::createStaticStringImpl(): I forgot to set its hash value when I introduced it. StaticStringImpls require that its hash code be set ahead of time, and cannot be mutated at runtime. See the comment in the definition of StaticStringImpl in StringImpl.h. * wtf/text/StringImpl.cpp: (WTF::StringImpl::createStaticStringImpl): 2020-02-03 Russell Epstein Cherry-pick r255112. rdar://problem/58942707 IntlObject's cached strings should be immortal and safe for concurrent access. https://bugs.webkit.org/show_bug.cgi?id=206779 Reviewed by Yusuke Suzuki. JSTests: * stress/numberingSystemsForLocale-cached-strings-should-be-immortal-and-safe-for-concurrent-access.js: Added. Source/JavaScriptCore: In IntlObject's numberingSystemsForLocale(), we have a never destroyed cachedNumberingSystems which is a singleton vector of Strings which are shared multiple VMs. Hence, the strings in this vector should be a StaticStringImpl so that it will be immortal, and can be access concurrently from multiple VMs on different threads without any ref/deref'ing race issues. * runtime/IntlObject.cpp: (JSC::numberingSystemsForLocale): Source/WTF: Add a factory for creating a dynamically allocated StaticStringImpl. Note: StaticStringImpl is guaranteed to have the same shape as StringImpl. The only difference is that s_refCountFlagIsStaticString is set on the refCount for StaticStringImpl. Since the client will use the StaticStringImpl as a StringImpl, we implement the factory by using StringImpl::createInternal() for simplicity, and set the s_refCountFlagIsStaticString flag thereafter. * wtf/text/StringImpl.cpp: (WTF::StringImpl::createStaticStringImpl): * wtf/text/StringImpl.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255112 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-24 Mark Lam IntlObject's cached strings should be immortal and safe for concurrent access. https://bugs.webkit.org/show_bug.cgi?id=206779 Reviewed by Yusuke Suzuki. Add a factory for creating a dynamically allocated StaticStringImpl. Note: StaticStringImpl is guaranteed to have the same shape as StringImpl. The only difference is that s_refCountFlagIsStaticString is set on the refCount for StaticStringImpl. Since the client will use the StaticStringImpl as a StringImpl, we implement the factory by using StringImpl::createInternal() for simplicity, and set the s_refCountFlagIsStaticString flag thereafter. * wtf/text/StringImpl.cpp: (WTF::StringImpl::createStaticStringImpl): * wtf/text/StringImpl.h: 2020-01-27 Russell Epstein Cherry-pick r255087. rdar://problem/58920164 Fix internal Apple builds after r254411 https://bugs.webkit.org/show_bug.cgi?id=206723 Reviewed by Maciej Stachowiak. The default Xcode build configuration has changed between macOS 10.13 and macOS 10.15, such that references to some frameworks when bulding for the latter don't work when building for the former. Fix this by explicitly adding support for the desired build location rather than assuming such support will be provided for us. * Configurations/WTF.xcconfig: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255087 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-24 Keith Rollin Fix internal Apple builds after r254411 https://bugs.webkit.org/show_bug.cgi?id=206723 Reviewed by Maciej Stachowiak. The default Xcode build configuration has changed between macOS 10.13 and macOS 10.15, such that references to some frameworks when bulding for the latter don't work when building for the former. Fix this by explicitly adding support for the desired build location rather than assuming such support will be provided for us. * Configurations/WTF.xcconfig: 2020-01-21 Alan Coon Cherry-pick r254632. rdar://problem/58764714 Revert bytecode checkpoints since it breaks watch https://bugs.webkit.org/show_bug.cgi?id=206301 Unreviewed, revert. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254632 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-15 Keith Miller Revert bytecode checkpoints since it breaks watch https://bugs.webkit.org/show_bug.cgi?id=206301 Unreviewed, revert. 2020-01-15 Alan Coon Cherry-pick r254187. rdar://problem/58605950 Implement css3-images image-orientation https://bugs.webkit.org/show_bug.cgi?id=89052 Patch by Said Abou-Hallawa on 2020-01-07 Reviewed by Simon Fraser. LayoutTests/imported/w3c: * web-platform-tests/css/css-images/inheritance-expected.txt: * web-platform-tests/css/css-images/inheritance.html: This test is re-synced from upstream * web-platform-tests/css/css-images/parsing/image-orientation-computed-expected.txt: * web-platform-tests/css/css-images/parsing/image-orientation-valid-expected.txt: Source/JavaScriptCore: Remove the ENABLE_CSS_IMAGE_ORIENTATION feature flag. * Configurations/FeatureDefines.xcconfig: Source/WebCore: Implement the CSS image-orientation property for content images. The valid values are "from-image" or "none". The default value is "from-image". Specification: https://drafts.csswg.org/css-images-3/#the-image-orientation GitHub issue: https://github.com/w3c/csswg-drafts/issues/4164 Tests: fast/images/image-orientation-dynamic-from-image.html fast/images/image-orientation-dynamic-none.html fast/images/image-orientation-none.html * Configurations/FeatureDefines.xcconfig: * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::operator ImageOrientation const): Deleted. * css/CSSProperties.json: * css/CSSValueKeywords.in: * css/parser/CSSPropertyParser.cpp: (WebCore::consumeImageOrientation): (WebCore::CSSPropertyParser::parseSingleValue): * rendering/RenderElement.cpp: (WebCore::RenderElement::imageOrientation const): * rendering/RenderImage.cpp: (WebCore::RenderImage::styleDidChange): * rendering/style/RenderStyle.cpp: (WebCore::rareInheritedDataChangeRequiresLayout): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::setImageOrientation): (WebCore::RenderStyle::initialImageOrientation): (WebCore::RenderStyle::imageOrientation const): * rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): (WebCore::StyleRareInheritedData::operator== const): * rendering/style/StyleRareInheritedData.h: * style/StyleBuilderConverter.h: (WebCore::Style::BuilderConverter::convertImageOrientation): Source/WebCore/PAL: Remove the ENABLE_CSS_IMAGE_ORIENTATION feature flag. * Configurations/FeatureDefines.xcconfig: Source/WebKit: Remove the ENABLE_CSS_IMAGE_ORIENTATION feature flag. * Configurations/FeatureDefines.xcconfig: Source/WebKitLegacy/mac: Remove the ENABLE_CSS_IMAGE_ORIENTATION feature flag. * Configurations/FeatureDefines.xcconfig: Source/WTF: Remove the ENABLE_CSS_IMAGE_ORIENTATION feature flag. * wtf/FeatureDefines.h: Tools: Remove the ENABLE_CSS_IMAGE_ORIENTATION feature flag. * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: LayoutTests: Test the css image-orientation property. * fast/images/image-orientation-dynamic-from-image-expected.html: Added. * fast/images/image-orientation-dynamic-from-image.html: Added. * fast/images/image-orientation-dynamic-none-expected.html: Added. * fast/images/image-orientation-dynamic-none.html: Added. * fast/images/image-orientation-none-expected.html: Added. * fast/images/image-orientation-none.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254187 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-07 Said Abou-Hallawa Implement css3-images image-orientation https://bugs.webkit.org/show_bug.cgi?id=89052 Reviewed by Simon Fraser. Remove the ENABLE_CSS_IMAGE_ORIENTATION feature flag. * wtf/FeatureDefines.h: 2020-01-15 Alan Coon Cherry-pick r254413. rdar://problem/58548648 REGRESSION(r185816): In the Hong Kong locale, navigator.language reports it's in the Taiwan locale https://bugs.webkit.org/show_bug.cgi?id=200043 Unreviewed. Fix build. * wtf/cocoa/LanguageCocoa.mm: (WTF::canMinimizeLanguages): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254413 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-11 Myles C. Maxfield REGRESSION(r185816): In the Hong Kong locale, navigator.language reports it's in the Taiwan locale https://bugs.webkit.org/show_bug.cgi?id=200043 Unreviewed. Fix build. * wtf/cocoa/LanguageCocoa.mm: (WTF::canMinimizeLanguages): 2020-01-15 Alan Coon Cherry-pick r254412. rdar://problem/58548648 REGRESSION(r185816): In the Hong Kong locale, navigator.language reports it's in the Taiwan locale https://bugs.webkit.org/show_bug.cgi?id=200043 Unreviewed. Addressing additional review comments. Source/WTF: * wtf/cocoa/LanguageCocoa.mm: (WTF::canMinimizeLanguages): LayoutTests: * fast/text/international/system-language/navigator-language/navigator-language-en-GB.html: * fast/text/international/system-language/navigator-language/navigator-language-en-US.html: * fast/text/international/system-language/navigator-language/navigator-language-en.html: * fast/text/international/system-language/navigator-language/navigator-language-es-419.html: * fast/text/international/system-language/navigator-language/navigator-language-es-ES.html: * fast/text/international/system-language/navigator-language/navigator-language-es-MX.html: * fast/text/international/system-language/navigator-language/navigator-language-es.html: * fast/text/international/system-language/navigator-language/navigator-language-fr-CA.html: * fast/text/international/system-language/navigator-language/navigator-language-fr.html: * fast/text/international/system-language/navigator-language/navigator-language-hi.html: * fast/text/international/system-language/navigator-language/navigator-language-ja.html: * fast/text/international/system-language/navigator-language/navigator-language-pt-BR.html: * fast/text/international/system-language/navigator-language/navigator-language-pt-PT.html: * fast/text/international/system-language/navigator-language/navigator-language-ru.html: * fast/text/international/system-language/navigator-language/navigator-language-zh-HK.html: * fast/text/international/system-language/navigator-language/navigator-language-zh-Hans.html: * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-HK.html: * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant.html: * fast/text/international/system-language/navigator-language/navigator-language-zh-TW.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254412 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-11 Myles C. Maxfield REGRESSION(r185816): In the Hong Kong locale, navigator.language reports it's in the Taiwan locale https://bugs.webkit.org/show_bug.cgi?id=200043 Unreviewed. Addressing additional review comments. * wtf/cocoa/LanguageCocoa.mm: (WTF::canMinimizeLanguages): 2020-01-15 Alan Coon Cherry-pick r254411. rdar://problem/58548648 Fix internal Apple builds after r254389 https://bugs.webkit.org/show_bug.cgi?id=206135 Rubber stamped by Zalan Bujtas. * wtf/spi/cocoa/NSLocaleSPI.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254411 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-11 Myles C. Maxfield Fix internal Apple builds after r254389 https://bugs.webkit.org/show_bug.cgi?id=206135 Rubber stamped by Zalan Bujtas. * wtf/spi/cocoa/NSLocaleSPI.h: 2020-01-15 Alan Coon Cherry-pick r254389. rdar://problem/58548648 REGRESSION(r185816): In the Hong Kong locale, navigator.language reports it's in the Taiwan locale https://bugs.webkit.org/show_bug.cgi?id=200043 Source/WTF: Reviewed by Dean Jackson. We ask the system for the current locale using CFLocaleCopyPreferredLanguages(), and then round-trip it through CFBundleGetLocalizationInfoForLocalization() / CFBundleCopyLocalizationForLocalizationInfo(). This was to work around the fact that CFLocaleCopyPreferredLanguages() previously didn't report BCP47 language codes. However, that round-tripping was introducing errors, such as "zh-Hant-HK" was getting turned into "zh-Hant-TW" which is clearly wrong. The CFBundle functions were never supposed to be used in this way. Instead, we can use CFLocaleCreateCanonicalLanguageIdentifierFromString() which is intended to canonicalize locale identifiers, and does return BCP47 language codes. However, this function preserves more fingerprinting entropy than the old code path, so we pass the input through new NSLocale SPI to minimize the entropy revealed. * WTF.xcodeproj/project.pbxproj: * wtf/Language.h: * wtf/Platform.h: * wtf/PlatformMac.cmake: * wtf/cf/LanguageCF.cpp: (WTF::httpStyleLanguageCode): (WTF::platformUserPreferredLanguages): * wtf/cocoa/LanguageCocoa.mm: Added. (WTF::minimizedLanguagesFromLanguages): * wtf/spi/cocoa/NSLocaleSPI.h: Added. Tools: Reviewed by Dean Jackson. Migrate system language tests to LayoutTests, to match the rest of our system language tests. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/mac/NavigatorLanguage.mm: Removed. LayoutTests: Reviewed by Dean Jackson. Migrate and update tests from TestWebKitAPI to LayoutTests, to match the rest of our system language tests. * platform/mac/TestExpectations: Mark these tests as possibly failing on older versions of macOS. * fast/text/international/system-language/navigator-language/navigator-language-en-GB-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-en-GB.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-en-US-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-en-US.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-en-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-en.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-es-419-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-es-419.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-es-ES-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-es-ES.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-es-MX-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-es-MX.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-es-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-es.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-fr-CA-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-fr-CA.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-fr-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-fr.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-hi-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-hi.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-ja-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-ja.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-pt-BR-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-pt-BR.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-pt-PT-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-pt-PT.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-ru-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-ru.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-zh-HK-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-zh-HK.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-zh-Hans-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-zh-Hans.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-HK-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-HK.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-zh-Hant.html: Added. * fast/text/international/system-language/navigator-language/navigator-language-zh-TW-expected.txt: Added. * fast/text/international/system-language/navigator-language/navigator-language-zh-TW.html: Added. * js/dom/navigator-language-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254389 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-01-10 Myles C. Maxfield REGRESSION(r185816): In the Hong Kong locale, navigator.language reports it's in the Taiwan locale https://bugs.webkit.org/show_bug.cgi?id=200043 Reviewed by Dean Jackson. We ask the system for the current locale using CFLocaleCopyPreferredLanguages(), and then round-trip it through CFBundleGetLocalizationInfoForLocalization() / CFBundleCopyLocalizationForLocalizationInfo(). This was to work around the fact that CFLocaleCopyPreferredLanguages() previously didn't report BCP47 language codes. However, that round-tripping was introducing errors, such as "zh-Hant-HK" was getting turned into "zh-Hant-TW" which is clearly wrong. The CFBundle functions were never supposed to be used in this way. Instead, we can use CFLocaleCreateCanonicalLanguageIdentifierFromString() which is intended to canonicalize locale identifiers, and does return BCP47 language codes. However, this function preserves more fingerprinting entropy than the old code path, so we pass the input through new NSLocale SPI to minimize the entropy revealed. * WTF.xcodeproj/project.pbxproj: * wtf/Language.h: * wtf/Platform.h: * wtf/PlatformMac.cmake: * wtf/cf/LanguageCF.cpp: (WTF::httpStyleLanguageCode): (WTF::platformUserPreferredLanguages): * wtf/cocoa/LanguageCocoa.mm: Added. (WTF::minimizedLanguagesFromLanguages): * wtf/spi/cocoa/NSLocaleSPI.h: Added. 2020-01-03 Dean Jackson [WebGL] Enable ANGLE by default for Cocoa platforms (except simulator) https://bugs.webkit.org/show_bug.cgi?id=205483 Reverting this from trunk (was r253926) due to the number of flakey tests and failures. * wtf/Platform.h: 2020-01-03 Simon Fraser Add some shared schemes to the WebKit.xcworkspace https://bugs.webkit.org/show_bug.cgi?id=205698 Reviewed by Tim Horton. Make WebKit.xcworkspace show the following schemes by default: All Source All Tools WTF JavaScriptCore WebCore WebKit WebKitLegacy DumpRenderTree WebKitTestRunner TestWebKitAPI MiniBrowser MobileMiniBrowser. Also remove the MobileMiniBrowserUITests scheme. * WTF.xcodeproj/xcshareddata/xcschemes/WTF.xcscheme: Copied from Tools/MobileMiniBrowser/MobileMiniBrowser.xcodeproj/xcshareddata/xcschemes/MobileMiniBrowserUITests.xcscheme. 2020-01-02 Yusuke Suzuki and Simon Fraser Experiment: create lots of different malloc zones for easier accounting of memory use https://bugs.webkit.org/show_bug.cgi?id=186422 Reviewed by Saam Barati. This patch introduces ENABLE(MALLOC_HEAP_BREAKDOWN). If this is enabled, we allocate malloc_zone per malloc kind. This offers the way to investigate the usage of memory per kind by using vmmap, like the following. VIRTUAL RESIDENT DIRTY SWAPPED ALLOCATION BYTES DIRTY+SWAP REGION MALLOC ZONE SIZE SIZE SIZE SIZE COUNT ALLOCATED FRAG SIZE % FRAG COUNT =========== ======= ========= ========= ========= ========= ========= ========= ====== ====== StringImpl_0x116efd000 188.0M 69.3M 30.9M 0K 139456 18.0M 12.9M 42% 34 DefaultMallocZone_0x10f487000 176.0M 53.9M 14.1M 0K 115956 9955K 4497K 32% 22 Vector_0x116eff000 162.0M 56.3M 55.3M 0K 140715 17.3M 37.9M 69% 36 MetadataTable_0x11843b000 152.0M 17.5M 17.5M 0K 14200 2353K 15.2M 87% 26 WebKit Using System Malloc_0x114cbe000 150.0M 31.6M 21.8M 0K 87422 16.7M 5278K 24% 23 InstructionStream_0x118469000 150.0M 5764K 5764K 0K 14470 4688K 1076K 19% 24 AssemblerData_0x117ee6000 150.0M 1928K 1928K 0K 1 16 1928K 100% 24 To achieve this goal without making very large change, we put a template type in various containers. For example, Vector will take Malloc parameter (the default one is FastMalloc allocator). If ENABLE(MALLOC_HEAP_BREAKDOWN) is enabled, we change this to specific VectorMalloc allocator, and vmmap can show memory usage of this allocator. This patch also supports malloc_zone per IsoHeap. So we can see memory allocation per IsoHeap in vmmap. To use this feature, we need to flip two compile time flags, ENABLE(MALLOC_HEAP_BREAKDOWN) in WTF and BENABLE_MALLOC_HEAP_BREAKDOWN in bmalloc. And use `vmmap $PID` to dump malloc zones. To allocate objects of a class with a specific malloc-zone, use WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(HeapIdentifier) for the class, and define allocator by DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(HeapIdentifier) in a header and DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(HeapIdentifier) in a cpp file. This patch also introduce callstack collector for malloc. Vector, HashMap etc. are used to allocate various things, but the above malloc_zone feature only tells thing like "Vector takes XXX MB memory". But what we want to know in this case is what Vector is consuming memory. We collect StackShot for each malloc call, and combine these information to tell which callsite is consuming much memory, which tell us that what Vector is consuming memory. * WTF.xcodeproj/project.pbxproj: * wtf/Bag.cpp: Copied from Source/JavaScriptCore/parser/SourceProviderCache.cpp. * wtf/Bag.h: (WTF::Private::BagNode::BagNode): Deleted. * wtf/BitVector.cpp: (WTF::BitVector::OutOfLineBits::create): (WTF::BitVector::OutOfLineBits::destroy): * wtf/CMakeLists.txt: * wtf/ConcurrentBuffer.cpp: Copied from Source/JavaScriptCore/parser/SourceProviderCache.cpp. * wtf/ConcurrentBuffer.h: * wtf/DebugHeap.cpp: Copied from Source/JavaScriptCore/runtime/CachePayload.cpp. (WTF::DebugHeap::DebugHeap): (WTF::DebugHeap::malloc): (WTF::DebugHeap::calloc): (WTF::DebugHeap::memalign): (WTF::DebugHeap::realloc): (WTF::DebugHeap::free): * wtf/DebugHeap.h: Added. * wtf/FastBitVector.cpp: (WTF::FastBitVectorWordOwner::setEqualsSlow): (WTF::FastBitVectorWordOwner::resizeSlow): * wtf/FastBitVector.h: (WTF::FastBitVectorWordOwner::~FastBitVectorWordOwner): * wtf/FastMalloc.cpp: (WTF::fastMallocDumpMallocStats): (WTF::AvoidRecordingScope::AvoidRecordingScope): (WTF::AvoidRecordingScope::~AvoidRecordingScope): (WTF::MallocCallTracker::MallocSiteData::MallocSiteData): (WTF::MallocCallTracker::singleton): (WTF::MallocCallTracker::MallocCallTracker): (WTF::MallocCallTracker::recordMalloc): (WTF::MallocCallTracker::recordRealloc): (WTF::MallocCallTracker::recordFree): (WTF::MallocCallTracker::dumpStats): (WTF::fastMalloc): (WTF::fastRealloc): (WTF::fastFree): (WTF::fastAlignedMalloc): (WTF::tryFastAlignedMalloc): (WTF::fastAlignedFree): * wtf/FastMalloc.h: (WTF::FastMalloc::zeroedMalloc): (WTF::FastMalloc::tryZeroedMalloc): * wtf/Forward.h: * wtf/HashTable.cpp: * wtf/HashTable.h: (WTF::KeyTraits>::allocateTable): (WTF::KeyTraits>::deallocateTable): (WTF::KeyTraits>::rehash): * wtf/MallocPtr.h: (WTF::MallocPtr::MallocPtr): (WTF::MallocPtr::malloc): (WTF::MallocPtr::zeroedMalloc): (WTF::MallocPtr::tryMalloc): (WTF::MallocPtr::tryZeroedMalloc): (WTF::adoptMallocPtr): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::allocFreeSpaceNode): (WTF::MetaAllocator::freeFreeSpaceNode): * wtf/MetaAllocatorHandle.h: * wtf/Platform.h: * wtf/RefCountedArray.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * wtf/RefCountedArray.h: (WTF::RefCountedArray::RefCountedArray): (WTF::RefCountedArray::~RefCountedArray): (WTF::RefCountedArray::assign): * wtf/SegmentedVector.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * wtf/SegmentedVector.h: * wtf/SmallPtrSet.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * wtf/SmallPtrSet.h: (WTF::SmallPtrSet::~SmallPtrSet): (WTF::SmallPtrSet::grow): * wtf/UniqueArray.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * wtf/UniqueArray.h: (WTF::UniqueArrayFree::operator() const): (WTF::UniqueArrayFree::Vector): (WTF::=): (WTF::Malloc>::contains const): (WTF::Malloc>::findMatching const): (WTF::Malloc>::find const): (WTF::Malloc>::reverseFind const): (WTF::Malloc>::appendIfNotContains): (WTF::Malloc>::fill): (WTF::Malloc>::appendRange): (WTF::Malloc>::expandCapacity): (WTF::Malloc>::tryExpandCapacity): (WTF::Malloc>::resize): (WTF::Malloc>::resizeToFit): (WTF::Malloc>::shrink): (WTF::Malloc>::grow): (WTF::Malloc>::asanSetInitialBufferSizeTo): (WTF::Malloc>::asanSetBufferSizeToFullCapacity): (WTF::Malloc>::asanBufferSizeWillChangeTo): (WTF::Malloc>::reserveCapacity): (WTF::Malloc>::tryReserveCapacity): (WTF::Malloc>::reserveInitialCapacity): (WTF::Malloc>::shrinkCapacity): (WTF::Malloc>::append): (WTF::Malloc>::tryAppend): (WTF::Malloc>::constructAndAppend): (WTF::Malloc>::tryConstructAndAppend): (WTF::Malloc>::appendSlowCase): (WTF::Malloc>::constructAndAppendSlowCase): (WTF::Malloc>::tryConstructAndAppendSlowCase): (WTF::Malloc>::uncheckedAppend): (WTF::Malloc>::uncheckedConstructAndAppend): (WTF::Malloc>::appendVector): (WTF::Malloc>::insert): (WTF::Malloc>::insertVector): (WTF::Malloc>::remove): (WTF::Malloc>::removeFirst): (WTF::Malloc>::removeFirstMatching): (WTF::Malloc>::removeAll): (WTF::Malloc>::removeAllMatching): (WTF::Malloc>::reverse): (WTF::Malloc>::map const): (WTF::Malloc>::releaseBuffer): (WTF::Malloc>::checkConsistency): (WTF::swap): (WTF::operator==): (WTF::operator!=): (WTF::Malloc>::isolatedCopy const): (WTF::removeRepeatedElements): (WTF::minCapacity>::Vector): Deleted. (WTF::minCapacity>::contains const): Deleted. (WTF::minCapacity>::findMatching const): Deleted. (WTF::minCapacity>::find const): Deleted. (WTF::minCapacity>::reverseFind const): Deleted. (WTF::minCapacity>::appendIfNotContains): Deleted. (WTF::minCapacity>::fill): Deleted. (WTF::minCapacity>::appendRange): Deleted. (WTF::minCapacity>::expandCapacity): Deleted. (WTF::minCapacity>::tryExpandCapacity): Deleted. (WTF::minCapacity>::resize): Deleted. (WTF::minCapacity>::resizeToFit): Deleted. (WTF::minCapacity>::shrink): Deleted. (WTF::minCapacity>::grow): Deleted. (WTF::minCapacity>::asanSetInitialBufferSizeTo): Deleted. (WTF::minCapacity>::asanSetBufferSizeToFullCapacity): Deleted. (WTF::minCapacity>::asanBufferSizeWillChangeTo): Deleted. (WTF::minCapacity>::reserveCapacity): Deleted. (WTF::minCapacity>::tryReserveCapacity): Deleted. (WTF::minCapacity>::reserveInitialCapacity): Deleted. (WTF::minCapacity>::shrinkCapacity): Deleted. (WTF::minCapacity>::append): Deleted. (WTF::minCapacity>::tryAppend): Deleted. (WTF::minCapacity>::constructAndAppend): Deleted. (WTF::minCapacity>::tryConstructAndAppend): Deleted. (WTF::minCapacity>::appendSlowCase): Deleted. (WTF::minCapacity>::constructAndAppendSlowCase): Deleted. (WTF::minCapacity>::tryConstructAndAppendSlowCase): Deleted. (WTF::minCapacity>::uncheckedAppend): Deleted. (WTF::minCapacity>::uncheckedConstructAndAppend): Deleted. (WTF::minCapacity>::appendVector): Deleted. (WTF::minCapacity>::insert): Deleted. (WTF::minCapacity>::insertVector): Deleted. (WTF::minCapacity>::remove): Deleted. (WTF::minCapacity>::removeFirst): Deleted. (WTF::minCapacity>::removeFirstMatching): Deleted. (WTF::minCapacity>::removeAll): Deleted. (WTF::minCapacity>::removeAllMatching): Deleted. (WTF::minCapacity>::reverse): Deleted. (WTF::minCapacity>::map const): Deleted. (WTF::minCapacity>::releaseBuffer): Deleted. (WTF::minCapacity>::checkConsistency): Deleted. (WTF::minCapacity>::isolatedCopy const): Deleted. * wtf/text/CString.cpp: (WTF::CStringBuffer::createUninitialized): * wtf/text/CString.h: * wtf/text/StringBuffer.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * wtf/text/StringBuffer.h: (WTF::StringBuffer::StringBuffer): (WTF::StringBuffer::~StringBuffer): (WTF::StringBuffer::resize): (WTF::StringBuffer::release): * wtf/text/StringImpl.cpp: (WTF::StringImpl::~StringImpl): (WTF::StringImpl::destroy): (WTF::StringImpl::createUninitializedInternalNonEmpty): (WTF::StringImpl::reallocateInternal): * wtf/text/StringImpl.h: (WTF::StringImpl::StringImpl): (WTF::StringImpl::createSubstringSharingImpl): (WTF::StringImpl::tryCreateUninitialized): (WTF::StringImpl::adopt): * wtf/text/cf/StringImplCF.cpp: (WTF::StringWrapperCFAllocator::allocate): (WTF::StringWrapperCFAllocator::reallocate): (WTF::StringWrapperCFAllocator::deallocate): 2020-01-02 Dean Jackson REGRESSION(r253926): Crash at libANGLE-shared.dylib: gl::LogMessage::~LogMessage https://bugs.webkit.org/show_bug.cgi?id=205690 rdar://58279401 Reviewed by Eric Carlson. Only enable ANGLE for iOS hardware while we investigate this fatal error. * wtf/Platform.h: 2020-01-02 Sam Weinig Simplify StringBuilder API/align with makeString by removing appendFixed* functions and using FormatNumber struct instead https://bugs.webkit.org/show_bug.cgi?id=205671 Reviewed by Alex Christensen. In an ongoing attempt to simplify the StringBuilder interface and unify it's functionality with makeString, this change removes appendFixedPrecisionNumber() and appendFixedWidthNumber(), replacing their uses with direct calls to append(), using a FormattedNumber object to direct it to the appropriate StringTypeAdapter. * wtf/text/StringBuilder.h: * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::appendFixedPrecisionNumber): Deleted. (WTF::StringBuilder::appendFixedWidthNumber): Deleted. Remove StringBuilder::appendFixedPrecisionNumber() and StringBuilder::appendFixedWidthNumber(). The same functionality is available and more flexible by passing FormattedNumbers to the variadic append() function. * wtf/text/TextStream.cpp: (WTF::TextStream::operator<<): * wtf/MediaTime.cpp: (WTF::MediaTime::toString const): Replace all uses of builder.appendFixedPrecisionNumber(...) with builder.append(FormattedNumber::fixedPrecision(...)) and builder.appendFixedWidthNumber(...) with with builder.append(FormattedNumber::fixedWidth(...)) 2019-12-20 Darin Adler Tidy a bit of StringBuilder usage https://bugs.webkit.org/show_bug.cgi?id=205509 Reviewed by Sam Weinig. * wtf/FileSystem.cpp: (WTF::FileSystemImpl::decodeFromFilename): Fix misleading variable name "hexDigit" for result of decoding "%+XXXX"; what's decoded is a character, not a hex digit. * wtf/HexNumber.h: Remove unused appendUnsignedAsHexFixedSize function for destinations other than StringBuilder. Don't need it at this time, could add it later if we ever decide we do. * wtf/text/StringBuilder.h: (WTF::StringBuilder::appendSubstring): Improved logic in appendSubstring so it will handle even absurd values for offset and length correctly, and added a default length of "infinity" just like in String::substring. * wtf/text/StringImpl.cpp: (WTF::StringImpl::convertToLowercaseWithoutLocale): Use isASCII. (WTF::StringImpl::convertToLowercaseWithoutLocaleStartingAtFailingIndex8Bit): Ditto. * wtf/text/WTFString.cpp: (asciiDebug): Use StringBuilder to build the string; this was the one place that used appendUnsignedAsHexFixedSize on something else, and there is no need. 2019-12-30 youenn fablet Ignore URL host for schemes that are not using host information https://bugs.webkit.org/show_bug.cgi?id=205157 Reviewed by Darin Adler. * wtf/URL.cpp: (WTF::URL::removeHostAndPort): * wtf/URL.h: 2019-12-25 Dean Jackson [WebGL] Enable ANGLE by default for Cocoa platforms (except simulator) https://bugs.webkit.org/show_bug.cgi?id=205483 rdar://56925821 Reviewed by Simon Fraser. Turn USE_ANGLE on for Cocoa, with the exception of the simulator. * wtf/Platform.h: 2019-12-24 Eric Carlson [Media in GPU process] Enable media player proxy logging https://bugs.webkit.org/show_bug.cgi?id=205557 Reviewed by Youenn Fablet. * wtf/Logger.h: (WTF::Logger::willLog const): Minor optimization: don't check m_enabled unnecessarily. 2019-12-23 Keith Miller DFG/FTL should be able to exit to the middle of a bytecode https://bugs.webkit.org/show_bug.cgi?id=205232 Reviewed by Saam Barati. * WTF.xcodeproj/project.pbxproj: * wtf/Bitmap.h: (WTF::WordType>::invert): (WTF::WordType>::operator): (WTF::WordType>::operator const const): * wtf/CMakeLists.txt: * wtf/EnumClassOperatorOverloads.h: Added. * wtf/FastBitVector.h: (WTF::FastBitReference::operator bool const): (WTF::FastBitReference::operator|=): (WTF::FastBitReference::operator&=): (WTF::FastBitVector::fill): (WTF::FastBitVector::grow): * wtf/UnalignedAccess.h: (WTF::unalignedLoad): (WTF::unalignedStore): 2019-12-21 Antti Koivisto Move Vector HashTraits to HashTraits.h to fix GCC build https://bugs.webkit.org/show_bug.cgi?id=205540 Reviewed by Zalan Bujtas. GCC is stricter than LLVM with partial specializations Error: partial specialization of struct WTF::HashTraits > after instantiation of struct WTF::HashTraits > * wtf/HashTraits.h: * wtf/VectorHash.h: 2019-12-20 Truitt Savell Unreviewed, rolling out r253820. Broke Mac testing Reverted changeset: "Invalidate only affected elements after media query evaluation changes" https://bugs.webkit.org/show_bug.cgi?id=205392 https://trac.webkit.org/changeset/253820 2019-12-20 Antti Koivisto Invalidate only affected elements after media query evaluation changes https://bugs.webkit.org/show_bug.cgi?id=205392 Reviewed by Zalan Bujtas. Fix GCC build error Error: partial specialization of ‘struct WTF::HashTraits >’ after instantiation of ‘struct WTF::HashTraits >’ * wtf/HashTraits.h: * wtf/VectorHash.h: Move to HashTraits to HashTraits.h so it gets specialized before any instantiation. 2019-12-19 Antti Koivisto Allow Vectors as hash keys https://bugs.webkit.org/show_bug.cgi?id=205449 Reviewed by Geoff Garen. Add traits to allow Vectors of hashable types to act as hash keys. * WTF.xcodeproj/project.pbxproj: * wtf/Vector.h: (WTF::Vector::Vector): (WTF::Vector::~Vector): (WTF::Vector::isHashTableDeletedValue const): Use m_size = numeric_limits::max() as the deleted value. * wtf/VectorHash.h: Added. (WTF::VectorHash::hash): (WTF::VectorHash::equal): Add traits. Empty Vector is the empty value. 2019-12-19 Jer Noble Safely iterate observers in languageDidChange() https://bugs.webkit.org/show_bug.cgi?id=205452 Reviewed by Eric Carlson. Use the "copyToVector() then verify each item is still in the original map" pattern to safely iterate over the observerMap(). * wtf/Language.cpp: (WTF::languageDidChange): 2019-12-18 Yusuke Suzuki Unreviewed, build fix after r253730 https://bugs.webkit.org/show_bug.cgi?id=204398 Thread::destructTLS is always required in POSIX environments * wtf/Threading.h: 2019-12-18 Fujii Hironori [Win] Use thread_local to hold Ref in the thread rather than using FLS https://bugs.webkit.org/show_bug.cgi?id=204398 Reviewed by Yusuke Suzuki. Use thread_local which is faster than FLS. * wtf/Threading.cpp: (WTF::initializeThreading): * wtf/Threading.h: (WTF::Thread::current): * wtf/ThreadingPrimitives.h: Deleted threadSpecificKeyCreate and related functions which aren't used now in Windows port. Deleted THREAD_SPECIFIC_CALL macro which isn't used now. * wtf/win/ThreadingWin.cpp: Added a thread_local variable s_threadHolder. (WTF::Thread::ThreadHolder::~ThreadHolder): Added. (WTF::Thread::currentMayBeNull): (WTF::Thread::initializeTLS): Store a reference of Thread into s_threadHolder. (WTF::Thread::initializeTLSKey): Deleted. (WTF::Thread::destructTLS): Deleted. 2019-12-18 Ben Nham Add network loading signposts https://bugs.webkit.org/show_bug.cgi?id=204822 Reviewed by Alex Christensen. This adds os_signposts related to network loads to aid in debugging networking performance issues. Since URLs are logged in the signposts, this capability is only enabled on Apple internal builds when an environment variable is set. * wtf/Platform.h: Add HAVE_OS_SIGNPOST. 2019-12-17 Myles C. Maxfield [iOS] Update to use CTFontCreateForCharactersWithLanguageAndOption() https://bugs.webkit.org/show_bug.cgi?id=205310 Reviewed by Simon Fraser. All our bots are on the appropriate OS version. * wtf/Platform.h: 2019-12-17 Yusuke Suzuki [JSC] 8Bit JSRopeString can contain 16Bit string in its rope https://bugs.webkit.org/show_bug.cgi?id=205323 Reviewed by Mark Lam. * wtf/text/StringImpl.h: (WTF::StringImpl::copyCharacters): 2019-12-17 Tim Horton macCatalyst: Cursor should update on mouse movement and style change https://bugs.webkit.org/show_bug.cgi?id=205317 Reviewed by Anders Carlsson. * wtf/FeatureDefines.h: Make ENABLE_CURSOR_SUPPORT true on iOS, for macCatalyst. This results in it being true everywhere, so remove it. Add a new ENABLE_CUSTOM_CURSOR_SUPPORT, indicating whether we support custom bitmap cursors. It covers the subset of ENABLE_CURSOR_SUPPORT code that we still don't support in macCatalyst. * wtf/Platform.h: Add HAVE_HISERVICES (true on macOS but not macCatalyst) and HAVE_NSCURSOR (true on macOS and macCatalyst but not e.g. iOS). 2019-12-16 Yusuke Suzuki [JSC] Remove ArrayBufferNeuteringWatchpointSet https://bugs.webkit.org/show_bug.cgi?id=205194 Reviewed by Saam Barati. This patch adds PackedRef and PackedRefPtr. They are Ref and RefPtr, but its internal pointer is packed. So we can represent them in 6 bytes with 1 byte alignment. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Packed.h: (WTF::alignof): * wtf/PackedRef.h: Copied from Source/JavaScriptCore/runtime/ArrayBufferNeuteringWatchpointSet.h. * wtf/PackedRefPtr.h: Renamed from Source/JavaScriptCore/runtime/ArrayBufferNeuteringWatchpointSet.h. * wtf/RefPtr.h: (WTF::RefPtr::operator UnspecifiedBoolType const): (WTF::RefPtr::unspecifiedBoolTypeInstance const): 2019-12-13 Saam Barati Add a Heap::finalize function that takes WTF::Function https://bugs.webkit.org/show_bug.cgi?id=205211 Reviewed by Geoffrey Garen. * wtf/Function.h: (WTF::Function [iOS] Deny mach lookup access to "*.apple-extension-service" in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=205134 Reviewed by Brent Fulgham. Add enum value for the XPC service name filter type. * wtf/spi/darwin/SandboxSPI.h: 2019-12-09 Fujii Hironori [MSVC] writeNumberToBufferUnsigned is unsafe for bool type https://bugs.webkit.org/show_bug.cgi?id=204873 Reviewed by Darin Adler. MSVC reports warning for using / operator for bool type. > warning C4804: '/': unsafe use of type 'bool' in operation And, 'bool' isn't expected to be serialized as '0' or '1'. 'bool' isn't supported. * wtf/text/IntegerToStringConversion.h: Added a static_assert to ensure UnsignedIntegerType isn't bool. 2019-07-13 Darin Adler Streamline PODIntervalTree code and remove ValueToString https://bugs.webkit.org/show_bug.cgi?id=199782 Reviewed by Anders Carlsson. * WTF.xcodeproj/project.pbxproj: Remove ValueToString.h. * wtf/CMakeLists.txt: Ditto. * wtf/MediaTime.cpp: (WTF::operator<<): Implement debug-only TextStream serialization based on toJSONString. * wtf/MediaTime.h: Ditto. * wtf/text/ValueToString.h: Removed. 2019-12-06 Zan Dobersek [GTK][WPE] Use bmalloc's memory footprint API for JSC heap growth management https://bugs.webkit.org/show_bug.cgi?id=204576 Reviewed by Saam Barati. Add the new USE_BMALLOC_MEMORY_FOOTPRINT_API, enabled for the iOS-family ports and the Linux ports, as long as system malloc enforcement is disabled and bmalloc is subsequently built and used. The flag is used in JavaScriptCore to enable usage of bmalloc's memory footprint API for JSC heap growth control. * wtf/Platform.h: 2019-12-05 Chris Dumez [IPC] Fail ObjectIdentifier decoding if the decoded integer is not a valid ID https://bugs.webkit.org/show_bug.cgi?id=204921 Reviewed by Ryosuke Niwa. * wtf/ObjectIdentifier.h: (WTF::ObjectIdentifier::decode): 2019-12-03 Sunny He Enable security assertions on all ASAN builds https://bugs.webkit.org/show_bug.cgi?id=204802 Reviewed by Ryosuke Niwa. * wtf/FeatureDefines.h: 2019-12-03 Christopher Reid Regular expression hangs in Safari only https://bugs.webkit.org/show_bug.cgi?id=202882 Reviewed by Yusuke Suzuki. BumpPointerPool::ensureCapacityCrossPool can cause an infinite loop if multiple large pools are deallocated and a new capacity does not fit in the deallocated pools. BumpPointerPool should try using more pools if the next one isn't large enough. * wtf/BumpPointerAllocator.h: (WTF::BumpPointerPool::ensureCapacityCrossPool): 2019-11-28 Fujii Hironori Remove ENABLE_KEYBOARD_CODE_ATTRIBUTE and ENABLE_KEYBOARD_KEY_ATTRIBUTE macros https://bugs.webkit.org/show_bug.cgi?id=204666 Reviewed by Ross Kirsling and Don Olmstead. * wtf/FeatureDefines.h: 2019-11-25 Fujii Hironori [Win] Update KeyboardEvent as per the latest specification https://bugs.webkit.org/show_bug.cgi?id=202183 Reviewed by Ross Kirsling. * wtf/FeatureDefines.h: 2019-11-25 Fujii Hironori Add DefaultHash> and HashTrait> specializations https://bugs.webkit.org/show_bug.cgi?id=204562 Reviewed by Daniel Bates. * WTF.xcodeproj/project.pbxproj: Added OptionSetHash.h * wtf/CMakeLists.txt: Ditto. * wtf/OptionSet.h: Made StorageType public, and use C++14 types. * wtf/OptionSetHash.h: Added. (WTF::DefaultHash>::Hash::hash): (WTF::DefaultHash>::Hash::equal): (WTF::HashTraits>::emptyValue): (WTF::HashTraits>::constructDeletedValue): (WTF::HashTraits>::isDeletedValue): 2019-11-25 Carlos Garcia Campos REGRESSION(r252770): [GTK][WPE] Remote inspector no longer works if debugger is in a different kind of system https://bugs.webkit.org/show_bug.cgi?id=204572 Reviewed by Žan Doberšek. This patch adds the following changes: - Use uint32_t instead of size_t to store the body size in the message header, because size_t has a different size in 32 and 64 bit platforms. - Use htonl/ntohl to write/read the body size in the header. - Add a flags byte to the header to include the message byte order. The sender always uses the host byter order and the receiver does the byte swapping if needed. * wtf/glib/SocketConnection.cpp: (WTF::messageIsByteSwapped): (WTF::SocketConnection::readMessage): (WTF::SocketConnection::sendMessage): 2019-11-25 Carlos Garcia Campos REGRESSION(r252770): [GTK][WPE] Remote inspector broken in debug builds after r252770 https://bugs.webkit.org/show_bug.cgi?id=204569 Reviewed by Žan Doberšek. We need to call relaxAdoptionRequirement() in SocketConnection constructor because we are taking a reference for the read monitor lambda. * wtf/glib/SocketConnection.cpp: (WTF::SocketConnection::SocketConnection): 2019-11-25 Fujii Hironori Ran sort-Xcode-project-file. Unreviewed. * WTF.xcodeproj/project.pbxproj: 2019-11-23 Carlos Garcia Campos Unreviewed. Try to fix the GTK WebDriver tests in the bots after r252770 They are failing in the bots because g_variant_new_from_data() is failing due to the given data not being properly aligned for the type being loaded. This is not a problem since GLib 2.60 that checks the alignment and reallocates the buffer in aligned memory only if needed. For previous versions we need to ensure the memory we pass to g_variant_new_from_data() is aligned. * wtf/glib/SocketConnection.cpp: (WTF::SocketConnection::readMessage): 2019-11-22 Brent Fulgham Unreviewed FTW build fix after r252687. * wtf/PlatformFTW.cmake: 2019-11-22 Carlos Garcia Campos [GTK][WPE] RemoteInspector: use sockets instead of DBus https://bugs.webkit.org/show_bug.cgi?id=204503 Reviewed by Žan Doberšek. Add SocketConnection class. * wtf/PlatformGTK.cmake: * wtf/PlatformWPE.cmake: * wtf/glib/GSocketMonitor.cpp: Renamed from Source/WebKit/Platform/IPC/glib/GSocketMonitor.cpp. (WTF::GSocketMonitor::start): * wtf/glib/GSocketMonitor.h: Renamed from Source/WebKit/Platform/IPC/glib/GSocketMonitor.h. (WTF::GSocketMonitor::isActive const): * wtf/glib/GTypedefs.h: * wtf/glib/GUniquePtr.h: * wtf/glib/SocketConnection.cpp: Added. (WTF::SocketConnection::SocketConnection): (WTF::SocketConnection::~SocketConnection): (WTF::SocketConnection::read): (WTF::SocketConnection::readMessage): (WTF::SocketConnection::sendMessage): (WTF::SocketConnection::write): (WTF::SocketConnection::waitForSocketWritability): (WTF::SocketConnection::close): (WTF::SocketConnection::didClose): * wtf/glib/SocketConnection.h: Added. (WTF::SocketConnection::create): (WTF::SocketConnection::isClosed const): 2019-11-21 Yusuke Suzuki Unreviewed, rolling in again, regression is not caused by it https://bugs.webkit.org/show_bug.cgi?id=202471 * wtf/text/StringCommon.h: (WTF::findCommon): 2019-11-21 Commit Queue Unreviewed, rolling out r252683 and r252721. https://bugs.webkit.org/show_bug.cgi?id=204475 13% regression in JetStream2/prepack-wtb (Requested by yusukesuzuki on #webkit). Reverted changesets: "Implement String.prototype.replaceAll" https://bugs.webkit.org/show_bug.cgi?id=202471 https://trac.webkit.org/changeset/252683 "Unreviewed, address Darin's feedback on r252683." https://trac.webkit.org/changeset/252721 2019-11-21 Tuomas Karkkainen add ASSERT_NOT_REACHED_WITH_MESSAGE and RELEASE_ASSERT_NOT_REACHED_WITH_MESSAGE https://bugs.webkit.org/show_bug.cgi?id=204445 Reviewed by Antti Koivisto. Add assertions that combine ASSERT_NOT_REACHED and ASSERT_WITH_MESSAGE. * wtf/Assertions.h: 2019-11-20 Ross Kirsling Unreviewed, address Darin's feedback on r252683. * wtf/text/StringCommon.h: (WTF::findCommon): 2019-11-20 ChangSeok Oh [GTK] Add ANGLE backend to GTK port https://bugs.webkit.org/show_bug.cgi?id=199060 Reviewed by Žan Doberšek. The GTK port uses TEXTURE_MAPPER that has a gl context for accelerated rendering, and ANGLE has an egl context for WebGL. We want to make both live together so an exception is made where TEXTURE_MAPPER is enabled. * wtf/Platform.h: 2019-11-20 Fujii Hironori [Win] Implement WTF::ThreadSpecific in WTF::Thread https://bugs.webkit.org/show_bug.cgi?id=204341 Reviewed by Brent Fulgham and Yusuke Suzuki. Thread::destructTLS had a tricky code to defer destroying WTF::Thread in TLS in order to ensure WTF::Thread is destructed after other ThreadSpecific are destructed, which is a part of cause of nasty hanging issue in the process termination (Bug 204192). This change implements WTF::ThreadSpecific in WTF::Thread by adding a new class Thread::SpecificStorage to manage TLS. Simplify Thread::destructTLS. Remove threadMapMutex in ThreadingWin.cpp * wtf/PlatformWin.cmake: * wtf/ThreadSpecific.h: (WTF::canBeGCThread>::ThreadSpecific): (WTF::canBeGCThread>::get): (WTF::canBeGCThread>::setInTLS): (WTF::canBeGCThread>::destroy): (WTF::canBeGCThread>::~ThreadSpecific): Deleted. * wtf/Threading.h: (WTF::Thread::specificStorage): (WTF::Thread::current): * wtf/win/ThreadSpecificWin.cpp: Removed. * wtf/win/ThreadingWin.cpp: (WTF::Thread::initializeTLSKey): (WTF::Thread::initializeTLS): (WTF::Thread::destructTLS): (WTF::Thread::SpecificStorage::allocateKey): (WTF::Thread::SpecificStorage::get): (WTF::Thread::SpecificStorage::set): (WTF::Thread::SpecificStorage::destroySlots): (): Deleted. (WTF::Thread::currentDying): Deleted. (WTF::Thread::get): Deleted. 2019-11-19 Ross Kirsling Implement String.prototype.replaceAll https://bugs.webkit.org/show_bug.cgi?id=202471 Reviewed by Yusuke Suzuki. * wtf/text/StringCommon.h: (WTF::findCommon): Fix logic: "start > length" early out should come before "empty search string" early out. 2019-11-19 Yusuke Suzuki [IndexedDB] IndexedDB's threading assertion should respect Web thread https://bugs.webkit.org/show_bug.cgi?id=204346 Reviewed by Daniel Bates. * wtf/MainThread.cpp: (WTF::canCurrentThreadAccessThreadLocalData): (WTF::canAccessThreadLocalDataForThread): Deleted. * wtf/MainThread.h: * wtf/cocoa/MainThreadCocoa.mm: (WTF::canCurrentThreadAccessThreadLocalData): (WTF::canAccessThreadLocalDataForThread): Deleted. 2019-11-18 Fujii Hironori Remove self-defined C++14 features in StdLibExtras.h https://bugs.webkit.org/show_bug.cgi?id=204220 Reviewed by Ross Kirsling. Remove std::conjunction, std::in_place_t and std::make_unique definitions. Remove unsued std::clz. * wtf/StdLibExtras.h: (std::make_unique): Deleted. (std::exchange): Deleted. (std::clz): Deleted. 2019-11-18 Alex Christensen Use SecTrustEvaluateWithError instead of SecTrustEvaluate where available https://bugs.webkit.org/show_bug.cgi?id=204159 Reviewed by Darin Adler. * wtf/Platform.h: 2019-11-15 Yusuke Suzuki [JSC] Remove index-masking on ScopedArguments and put it in IsoSubspace https://bugs.webkit.org/show_bug.cgi?id=204269 Reviewed by Saam Barati. * wtf/MathExtras.h: (WTF::computeIndexingMask): Deleted. (WTF::preciseIndexMaskShiftForSize): Deleted. (WTF::preciseIndexMaskShift): Deleted. (WTF::opaque): Deleted. (WTF::preciseIndexMaskPtr): Deleted. 2019-11-14 Yusuke Suzuki [JSC] BlockDirectory's bits should be compact https://bugs.webkit.org/show_bug.cgi?id=204149 Reviewed by Robin Morisset. * wtf/FastBitVector.h: (WTF::fastBitVectorArrayLength): (WTF::FastBitVectorImpl::unsafeWords): (WTF::FastBitVectorImpl::unsafeWords const): (WTF::FastBitReference::FastBitReference): (WTF::FastBitReference::operator bool const): (WTF::FastBitReference::operator=): (WTF::FastBitVector::at): (WTF::FastBitVector::operator[]): (WTF::FastBitVector::BitReference::BitReference): Deleted. (WTF::FastBitVector::BitReference::operator bool const): Deleted. (WTF::FastBitVector::BitReference::operator=): Deleted. 2019-11-11 Ross Kirsling UTC offset for Samoa is miscalculated when !HAVE(TIMEGM) https://bugs.webkit.org/show_bug.cgi?id=204032 Reviewed by Yusuke Suzuki. We have code assuming that the world's time zones haven't changed in the past decade, but Samoa changed from UTC-11 to UTC+13 at the beginning of 2012. (Note: "Samoa" here means the Independent State of Samoa (Pacific/Apia) and not American Samoa (Pacific/Samoa). See https://en.wikipedia.org/wiki/Time_in_Samoa for more information.) * wtf/DateMath.cpp: (WTF::calculateUTCOffset): Update "canned date" from 2009 to 2019. 2019-11-07 Mark Lam Add a stack overflow check in Yarr::ByteCompiler::emitDisjunction(). https://bugs.webkit.org/show_bug.cgi?id=203936 Reviewed by Saam Barati. 1. Add a StackCheck utility class so that we don't have to keep reinventing this every time we need to add stack checking somewhere. 2. Rename some arguments and constants in StackBounds to be more descriptive of what they actually are. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/StackBounds.h: (WTF::StackBounds::recursionLimit const): * wtf/StackCheck.h: Added. (WTF::StackCheck::StackCheck): (WTF::StackCheck::isSafeToRecurse): 2019-11-06 Mark Lam Remove remnants of support code for an upwards growing stack. https://bugs.webkit.org/show_bug.cgi?id=203942 Reviewed by Yusuke Suzuki. We haven't supported an upwards growing stack in years, and a lot of code has since been written specifically with only a downwards growing stack in mind (e.g. the LLInt, the JITs). Also, all our currently supported platforms use a downward growing stack. We should remove the remnants of support code for an upwards growing stack. The presence of that code is deceptive in that it conveys support for an upwards growing stack where this hasn't been the case in years. * wtf/StackBounds.cpp: (WTF::StackBounds::newThreadStackBounds): (WTF::StackBounds::currentThreadStackBoundsInternal): (WTF::StackBounds::stackDirection): Deleted. (WTF::testStackDirection2): Deleted. (WTF::testStackDirection): Deleted. * wtf/StackBounds.h: (WTF::StackBounds::size const): (WTF::StackBounds::contains const): (WTF::StackBounds::recursionLimit const): (WTF::StackBounds::StackBounds): (WTF::StackBounds::isGrowingDownwards const): (WTF::StackBounds::checkConsistency const): (WTF::StackBounds::isGrowingDownward const): Deleted. * wtf/StackStats.cpp: (WTF::StackStats::CheckPoint::CheckPoint): (WTF::StackStats::CheckPoint::~CheckPoint): (WTF::StackStats::probe): (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint): 2019-11-05 Mark Lam WTF::RunLoop should not depend on isMainThread() idiom. https://bugs.webkit.org/show_bug.cgi?id=203873 Reviewed by Saam Barati, Ryosuke Niwa, and Devin Rousso. The isMainThread() idiom is only meaningful for WebCore. It is less meaningful for JSC since a VM instance can be entered from multiple threads, as long as only one thread enters it at any time. Hence, the concept of a main thread doesn't make sense at the JSC level. Since r251036, we started using a WTF::String to represent the RunLoop mode. This caused problems for JSC clients when USE(CF) since it necessitated the use of StringWrapperCFAllocator to track the life cycle of the CFStringRef generated from the WTF::String. To fix this problem, we should restore the original behavior of using CFStringRefs as the RunLoop mode token. * wtf/RunLoop.h: (WTF::RunLoop::cycle): Deleted. * wtf/cf/RunLoopCF.cpp: (WTF::RunLoop::cycle): * wtf/generic/RunLoopGeneric.cpp: (WTF::RunLoop::cycle): * wtf/glib/RunLoopGLib.cpp: (WTF::RunLoop::cycle): * wtf/win/RunLoopWin.cpp: (WTF::RunLoop::cycle): 2019-11-05 Tuomas Karkkainen Add definitions of ANSI colors for colorful log output https://bugs.webkit.org/show_bug.cgi?id=203805 Reviewed by Saam Barati. * WTF.xcodeproj/project.pbxproj: * wtf/AnsiColors.h: Added. * wtf/CMakeLists.txt: 2019-11-05 Tuomas Karkkainen move CrashReporterClientSPI.h and parts of WKCrashReporter to WTF so it can be used in JavaScriptCore https://bugs.webkit.org/show_bug.cgi?id=203803 Reviewed by Saam Barati. * WTF.xcodeproj/project.pbxproj: * wtf/PlatformMac.cmake: * wtf/cocoa/CrashReporter.cpp: Added. (WTF::setCrashLogMessage): * wtf/cocoa/CrashReporter.h: Added. * wtf/spi/cocoa/CrashReporterClientSPI.h: Renamed from Source/WebKit/Platform/spi/Cocoa/CrashReporterClientSPI.h. 2019-11-02 Devin Rousso Web Inspector: Add diagnostic logging for frontend feature usage https://bugs.webkit.org/show_bug.cgi?id=203579 Reviewed by Brian Burg. Original patch by Matt Baker . * wtf/FeatureDefines.h: Add `ENABLE_INSPECTOR_TELEMETRY`, which is only enabled for macOS. 2019-11-01 Devin Rousso Web Inspector: Timelines: add a timeline that shows information about any recorded CSS animation/transition https://bugs.webkit.org/show_bug.cgi?id=203651 Reviewed by Brian Burg. * wtf/Markable.h: (WTF::operator==): (WTF::operator!=): Add extra utility operators. 2019-10-31 Tim Horton Turn on IOSurface support in the iOS Simulator https://bugs.webkit.org/show_bug.cgi?id=203026 Reviewed by Simon Fraser. * wtf/Platform.h: Turn on HAVE(IOSURFACE) and USE(IOSURFACE_CANVAS_BACKING_STORE) in the simulator. Add HAVE(IOSURFACE_COREIMAGE_SUPPORT). 2019-10-31 Jer Noble [EME] Batch multiple key requests into one request and response https://bugs.webkit.org/show_bug.cgi?id=203580 Reviewed by Eric Carlson. Support appending an r-value reference Vector to another. * wtf/Vector.h: (WTF::minCapacity>::appendVector): 2019-10-31 Alex Christensen Remove unneeded HAVE_TIMINGDATAOPTIONS https://bugs.webkit.org/show_bug.cgi?id=202990 Reviewed by Brady Eidson. * wtf/Platform.h: 2019-10-31 Yusuke Suzuki [JSC] DateMath should have TimeClipped version https://bugs.webkit.org/show_bug.cgi?id=203550 Reviewed by Saam Barati. We found that our Date constructor is slow because GregorianDateTime calculation takes so long. We are doing many `fmod`, floating division, `floor` etc. These operations, in particular `fmod`, takes very long time. As a result, 30% of JetStream2/date-format-xparb is taken by `fmod` function. But since we are performance timeClip operation, double value in DateInstance is always Int52. We should have integer version of GregorianDateTime calculation which avoids many unnecessary fmod etc. While integer division is truncate-to-zero, many Date calculation requires `floor(value / xxx)`. For now, we use integer fast path only when the value is Int52 and positive. We see 10~ % improvement in JetStream2/date-format-xparb-SP (from 201 to 239). * wtf/DateMath.cpp: (WTF::isLeapYear): Deleted. (WTF::daysInYear): Deleted. (WTF::daysFrom1970ToYear): Deleted. (WTF::msToDays): Deleted. (WTF::msToYear): Deleted. (WTF::dayInYear): Deleted. (WTF::msToMinutes): Deleted. (WTF::msToHours): Deleted. (WTF::monthFromDayInYear): Deleted. (WTF::checkMonth): Deleted. (WTF::dayInMonthFromDayInYear): Deleted. (WTF::dateToDaysFrom1970): Deleted. (WTF::timeClip): Deleted. * wtf/DateMath.h: (WTF::TimeClippedPositiveMilliseconds::TimeClippedPositiveMilliseconds): (WTF::TimeClippedPositiveMilliseconds::value const): (WTF::TimeClippedPositiveMilliseconds::asDouble const): (WTF::timeClip): (WTF::daysFrom1970ToYear): (WTF::daysFrom1970ToYearTimeClippedPositive): (WTF::isLeapYear): (WTF::daysInYear): (WTF::msToDays): (WTF::dayInYear): (WTF::dateToDaysFrom1970): (WTF::msToYear): (WTF::msToMinutes): (WTF::msToHours): (WTF::msToSeconds): (WTF::msToWeekDay): (WTF::monthFromDayInYear): (WTF::dayInMonthFromDayInYear): * wtf/GregorianDateTime.cpp: (WTF::GregorianDateTime::GregorianDateTime): * wtf/GregorianDateTime.h: 2019-10-30 Alex Christensen Prevent Mac CMake build from bit rotting https://bugs.webkit.org/show_bug.cgi?id=203647 Reviewed by Tim Horton. * wtf/PlatformMac.cmake: 2019-10-30 Yusuke Suzuki [JSC] Date functions should have intrinsic https://bugs.webkit.org/show_bug.cgi?id=202187 Reviewed by Keith Miller. * wtf/DateMath.h: * wtf/GregorianDateTime.cpp: (WTF::GregorianDateTime::setToCurrentLocalTime): * wtf/GregorianDateTime.h: 2019-10-30 Per Arne Vollan It should be possible to create a mach sandbox extension for the WebContent process before the audit token is known https://bugs.webkit.org/show_bug.cgi?id=203618 Reviewed by Brent Fulgham. Added SPI to create mach extension without PID or audit token. * wtf/spi/darwin/SandboxSPI.h: 2019-10-30 Daniel Bates Add pretty printer for CompactPointerTuple https://bugs.webkit.org/show_bug.cgi?id=203495 Reviewed by Jer Noble. #include for the definition of WTF_MAKE_FAST_ALLOCATED. * wtf/CompactPointerTuple.h: 2019-10-29 Yusuke Suzuki [JSC] Add fast path for String#localeCompare https://bugs.webkit.org/show_bug.cgi?id=202676 Reviewed by Mark Lam. * wtf/text/StringView.h: (WTF::StringView::isAllASCII const): 2019-10-26 Chris Lord Put OffscreenCanvas behind a build flag https://bugs.webkit.org/show_bug.cgi?id=203146 Reviewed by Ryosuke Niwa. * wtf/FeatureDefines.h: 2019-10-25 Andy Estes [Quick Look] Move the QLPreviewConverter delegate into PreviewConverter and vend a C++ client interface https://bugs.webkit.org/show_bug.cgi?id=203396 Reviewed by Alex Christensen. * wtf/FeatureDefines.h: Defined ENABLE_PREVIEW_CONVERTER. 2019-10-23 Yusuke Suzuki [JSC] Figure out missing prepareCallOperation https://bugs.webkit.org/show_bug.cgi?id=203285 Reviewed by Mark Lam. Enable USE(BUILTIN_FRAME_ADDRESS) regardless of platform is the compilers and architectures match. * wtf/Platform.h: 2019-10-23 Tim Horton macCatalyst: Should dispatch contextmenu event on right click https://bugs.webkit.org/show_bug.cgi?id=203316 Reviewed by Wenson Hsieh. * wtf/FeatureDefines.h: 2019-10-23 Truitt Savell Unreviewed, rolling out r251261. This broke multiple tests Reverted changeset: "Using version 1 CFRunloopSource for faster task dispatch" https://bugs.webkit.org/show_bug.cgi?id=202874 https://trac.webkit.org/changeset/251261 2019-10-23 Myles C. Maxfield [iOS] Remove Hiragino Sans site-specific quirk for Yahoo Japan https://bugs.webkit.org/show_bug.cgi?id=203345 Reviewed by Simon Fraser. * wtf/Platform.h: 2019-10-22 Yusuke Suzuki Make `JSGlobalObject*` threading change more stabilized by adding tests and assertions https://bugs.webkit.org/show_bug.cgi?id=203274 Reviewed by Saam Barati. * wtf/Platform.h: 2019-10-22 Antti Koivisto operator==(Vector, Vector) should work with different inline capacities https://bugs.webkit.org/show_bug.cgi?id=203245 Reviewed by Alex Christensen. Also allow different overflow behavior and minimum capacity. * wtf/Vector.h: (WTF::operator==): (WTF::operator!=): 2019-10-22 Rob Buis https://bugs.webkit.org/show_bug.cgi?id=169667 URL: protocol setter needs to be more restrictive around file Reviewed by Alex Christensen. Restrict setting protocol to "file" as indictaed in the spec [1]. Test: imported/w3c/web-platform-tests/url/url-setters.html [1] https://url.spec.whatwg.org/#scheme-state steps 2.1.3 and 2.1.4. * wtf/URL.cpp: (WTF::URL::setProtocol): 2019-10-21 Tim Horton macCatalyst: Swipe navigation gestures do not work https://bugs.webkit.org/show_bug.cgi?id=203205 Reviewed by Wenson Hsieh. * wtf/Platform.h: Add a new HAVE. 2019-10-20 Mark Lam Remove all uses of untagCodePtr in debugging code. https://bugs.webkit.org/show_bug.cgi?id=203188 Reviewed by Yusuke Suzuki. We want the ability to always assert on failure to authenticate in untagCodePtr (though we don't currently do that yet). * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::retagCodePtrImpl): (WTF::tagCFunctionPtrImpl): (WTF::untagCFunctionPtrImpl): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): 2019-10-19 Simon Fraser Add support to TextStream for dumping HashMap<> and HashSet<> https://bugs.webkit.org/show_bug.cgi?id=202969 Reviewed by Dean Jackson. Make it possible to output HashMap<> and HashSet<> to TextStream, so long as key and value types are streamable. Also implement operator<<(char) so that chars show as ASCII, rather than numbers. * wtf/text/TextStream.cpp: (WTF::TextStream::operator<<): * wtf/text/TextStream.h: (WTF::operator<<): 2019-10-18 Yusuke Suzuki [JSC] Make ConcurrentJSLock Lock even if ENABLE_CONCURRENT_JS=OFF https://bugs.webkit.org/show_bug.cgi?id=202892 Reviewed by Mark Lam. BaselineJIT also has concurrent compiler. ENABLE(CONCURRENT_JS) should not rely on ENABLE(DFG_JIT). It should rely on ENABLE(JIT) instead. * wtf/Platform.h: 2019-10-17 Mark Lam Use constexpr in more places and remove some unnecessary external linkage. https://bugs.webkit.org/show_bug.cgi?id=203115 Reviewed by Yusuke Suzuki. Also removed unused lockSpinLimit in Threading.h. * wtf/MD5.h: * wtf/SHA1.h: * wtf/StackBounds.h: * wtf/Threading.h: 2019-10-17 Sihui Liu Using version 1 CFRunloopSource for faster task dispatch https://bugs.webkit.org/show_bug.cgi?id=202874 Reviewed by Geoffrey Garen. We used CFRunLoopWakeUp to wake up runloop to process source, which seems to be slow according to profiling. To avoid calling CFRunLoopWakeUp, we should use version 1 CFRunloopSource instead of version 0. This patch brings about 15% speedup for test PerformanceTests/IndexedDB/basic/objectstore-get.html. * wtf/RunLoop.cpp: (WTF::RunLoop::initializeWebRunLoop): (WTF::RunLoop::web): * wtf/RunLoop.h: * wtf/cf/RunLoopCF.cpp: (WTF::RunLoop::performWork): (WTF::RunLoop::RunLoop): (WTF::RunLoop::~RunLoop): (WTF::RunLoop::wakeUp): * wtf/cocoa/MainThreadCocoa.mm: (WTF::initializeMainThreadPlatform): (WTF::scheduleDispatchFunctionsOnMainThread): (WTF::initializeWebThread): (-[JSWTFMainThreadCaller call]): Deleted. 2019-10-16 Wenson Hsieh Unreviewed, fix the internal macOS 10.13 and 10.14 builds after r251171 * wtf/Platform.h: Add a HAVE() macro for AXClientType, which is only available on macOS 10.15+ SDKs. 2019-10-15 Chris Dumez [macOS] Simplify main thread initialization https://bugs.webkit.org/show_bug.cgi?id=203001 Reviewed by Geoff Garen. Simplify main thread initialization on macOS by always using pthread main as main thread. The complexity is now isolated to the USE(WEB_THREAD) code path. This patch also adds a debug assertion in WTF::initializeWebThreadPlatform() to make sure it gets called on the actual main thread. In release, it will log a fault message indicating it was called on the wrong thread. * wtf/MainThread.cpp: * wtf/MainThread.h: * wtf/RefCounted.h: (WTF::RefCountedBase::RefCountedBase): (WTF::RefCountedBase::applyRefDerefThreadingCheck const): * wtf/cocoa/MainThreadCocoa.mm: (WTF::initializeMainThreadPlatform): (WTF::scheduleDispatchFunctionsOnMainThread): (WTF::initializeWebThreadPlatform): (WTF::canAccessThreadLocalDataForThread): (WTF::isMainThread): * wtf/generic/MainThreadGeneric.cpp: * wtf/text/cf/StringImplCF.cpp: (WTF::StringImpl::createCFString): * wtf/win/MainThreadWin.cpp: 2019-10-14 Tim Horton Unify sources for bindings more densely https://bugs.webkit.org/show_bug.cgi?id=202918 Reviewed by Simon Fraser. * Scripts/generate-unified-source-bundles.rb: Add an option to separate and more densely unify sources that match a given glob pattern. 2019-10-14 Keith Rollin Remove some support for < iOS 13 https://bugs.webkit.org/show_bug.cgi?id=202820 Reviewed by Anders Carlsson. Remove some support for iOS versions less than 13.0. Update conditionals that reference __IPHONE_OS_VERSION_MIN_REQUIRED and __IPHONE_OS_VERSION_MAX_ALLOWED, assuming that they both have values >= 130000. This means that expressions like "__IPHONE_OS_VERSION_MIN_REQUIRED < 101300" are always False and "__IPHONE_OS_VERSION_MIN_REQUIRED >= 101300" are always True. This removal is part of a series of patches effecting the removal of dead code for old versions of iOS. This particular pass involves changes in which Devin Rousso was involved. These changes are isolated from other similar changes in order to facilitate the reviewing process. * wtf/Platform.h: 2019-10-14 Alex Christensen REGRESSION: [iOS 13?] TestWebKitAPI.SharedBufferTest.tryCreateArrayBufferLargeSegments is failing https://bugs.webkit.org/show_bug.cgi?id=201902 Reviewed by Ryosuke Niwa. * wtf/Vector.h: The code introduced in r108153 to workaround a warning when building Chrome was causing us to use uninitialized memory when we create a Vector with the size_t/{signed,unsigned}char constructor with a constexpr size_t. This was the cause of bug 201902 and bug 201620 which only manifested themselves in release builds with some compilers. 2019-10-14 Per Arne Vollan [macOS] Sandbox extensions should be created with audit tokens, not PIDs https://bugs.webkit.org/show_bug.cgi?id=201828 Reviewed by Brent Fulgham. Remove HAVE macro for issuing sandbox extension by PID, and fix version checks for the HAVE macros related to issuing sandbox extensions by audit token. Remove SPI for creating extensions by PID, and add SPI for creating mach extension by audit token. Also remove an unneeded flag. * wtf/Platform.h: * wtf/spi/darwin/SandboxSPI.h: 2019-10-08 Ryosuke Niwa Make WebInspector's remote debug EventLoop code into RunLoop https://bugs.webkit.org/show_bug.cgi?id=202716 Reviewed by Joseph Pecoraro. This patch merges WebInspector's EventLoop code into RunLoop as a static function. * wtf/RunLoop.h: (WTF::RunLoop::cycle): * wtf/cf/RunLoopCF.cpp: (WTF::RunLoop::cycle): Added. * wtf/generic/RunLoopGeneric.cpp: (WTF::RunLoop::cycle): Added. * wtf/glib/RunLoopGLib.cpp: (WTF::RunLoop::cycle): Added. * wtf/win/RunLoopWin.cpp: (WTF::RunLoop::cycle): Added. 2019-10-10 Ryosuke Niwa Make it safe to store a ThreadSafeRefCounted object in Ref & RefPtr safe inside its destructor https://bugs.webkit.org/show_bug.cgi?id=201576 Reviewed by Geoffrey Garen and Mark Lam. This patch leaves m_refCount 1 inside the last deref call to ThreadSafeRefCounted so that storing an instance of this object in Ref or RefPtr would not trigger a recursive delete. Note: this patch does not try to fix a race condition by which another thread tries to ref() this object after the "last" call to deref had happened since such a code would ref() this object long after it had been removed (UAF), nor some code calling deref() before calling ref() inside a destructor since there is no way to defend against unpaired calls to ref() & deref() like that. Also added m_deletionHasBegun like RefCounted. * wtf/ThreadSafeRefCounted.h: (WTF::ThreadSafeRefCountedBase::ref const): (WTF::ThreadSafeRefCountedBase::hasOneRef const): (WTF::ThreadSafeRefCountedBase::derefBase const): 2019-10-11 Alex Christensen Only use CFNetwork SPI for metrics where needed https://bugs.webkit.org/show_bug.cgi?id=202825 Reviewed by Joseph Pecoraro. * wtf/Platform.h: 2019-10-11 Keith Rollin Remove some support for < iOS 13 https://bugs.webkit.org/show_bug.cgi?id=202819 Reviewed by Anders Carlsson. Remove some support for iOS versions less than 13.0. Update conditionals that reference __IPHONE_OS_VERSION_MIN_REQUIRED and __IPHONE_OS_VERSION_MAX_ALLOWED, assuming that they both have values >= 130000. This means that expressions like "__IPHONE_OS_VERSION_MIN_REQUIRED < 101300" are always False and "__IPHONE_OS_VERSION_MIN_REQUIRED >= 101300" are always True. This removal is part of a series of patches effecting the removal of dead code for old versions of iOS. This particular pass involves changes in which Jiewen Tan was involved. These changes are isolated from other similar changes in order to facilitate the reviewing process. * wtf/Platform.h: 2019-10-11 Jonathan Bedard Unreviewed, rolling out r250945. Broke 18 Debug API tests Reverted changeset: "Add support for CompactPointerTuple<..., OptionSet<...>>" https://bugs.webkit.org/show_bug.cgi?id=201316 https://trac.webkit.org/changeset/250945 2019-10-11 Xabier Rodriguez Calvar MediaTime pretty printer can print if time is invalid https://bugs.webkit.org/show_bug.cgi?id=202735 Reviewed by Eric Carlson. * wtf/MediaTime.cpp: (WTF::MediaTime::toString const): Append ", invalid" if isInvalid(). (WTF::MediaTime::toJSONObject const): Set boolean invalid to true when invalid. 2019-10-09 Keith Rollin Remove some support for < iOS 13 https://bugs.webkit.org/show_bug.cgi?id=202371 Reviewed by Youenn Fablet. Remove some support for iOS versions less than 13.0. Update conditionals that reference __IPHONE_OS_VERSION_MIN_REQUIRED and __IPHONE_OS_VERSION_MAX_ALLOWED, assuming that they both have values >= 130000. This means that expressions like "__IPHONE_OS_VERSION_MIN_REQUIRED < 101300" are always False and "__IPHONE_OS_VERSION_MIN_REQUIRED >= 101300" are always True. This removal is part of a series of patches effecting the removal of dead code for old versions of iOS. This particular pass involves changes in which Dean Jackson was involved. These changes are isolated from other similar changes in order to facilitate the reviewing process. * wtf/FeatureDefines.h: * wtf/Platform.h: 2019-10-09 Daniel Bates Add support for CompactPointerTuple<..., OptionSet<...>> https://bugs.webkit.org/show_bug.cgi?id=201316 Reviewed by Yusuke Suzuki. Support using an OptionSet<> for the byte value portion of a CompactPointerTuple so that you can encode both a pointer and 8-bit bitmask in a type-safe way. Another benefit of supporting OptionSet<> is that we have a LLDB pretty-printer for it so this makes it easy to see the set flags in such a CompactPointerTuple. * wtf/CompactPointerTuple.h: 2019-10-09 Russell Epstein Unreviewed, rolling out r250930. Broke watchOS Builds Reverted changeset: "Add support for CompactPointerTuple<..., OptionSet<...>>" https://bugs.webkit.org/show_bug.cgi?id=201316 https://trac.webkit.org/changeset/250930 2019-10-09 Daniel Bates Add support for CompactPointerTuple<..., OptionSet<...>> https://bugs.webkit.org/show_bug.cgi?id=201316 Reviewed by Yusuke Suzuki. Support using an OptionSet<> for the byte value portion of a CompactPointerTuple so that you can encode both a pointer and 8-bit bitmask in a type-safe way. Another benefit of supporting OptionSet<> is that we have a LLDB pretty-printer for it so this makes it easy to see the set flags in such a CompactPointerTuple. * wtf/CompactPointerTuple.h: 2019-10-08 Robin Morisset dataLogIf should be ALWAYS_INLINE https://bugs.webkit.org/show_bug.cgi?id=202703 Reviewed by Saam Barati. We often have the following pattern: ``` static constexpr bool verbose = false; ... dataLogLnIf(verbose, "Something is happening"); ``` To make sure that these are always properly eliminated I'd like to make dataLogIf/dataLogLnIf ALWAYS_INLINE. We may as well mark the branch as UNLIKELY too, for the cases where the condition comes from Options::verboseSomething() and is only known at runtime. * wtf/DataLog.h: (WTF::dataLogIf): (WTF::dataLogLnIf): 2019-10-07 Alexey Proskuryakov Build failure in WebHTMLView.mm with the public SDK (Xcode 11 and Mojave) https://bugs.webkit.org/show_bug.cgi?id=199705 Patch by Dan Bernstein and Kenneth Russell. Reviewed by Alexey Proskuryakov. * wtf/Platform.h: Added HAVE_SUBVIEWS_IVAR_DECLARED_BY_SDK. 2019-10-04 Commit Queue Unreviewed, rolling out r250762. https://bugs.webkit.org/show_bug.cgi?id=202609 Broke JSC tests by breaking refCount check in DropAllLocks::DropAllLocks (Requested by rniwa on #webkit). Reverted changeset: "Make a ThreadSafeRefCounted object safe to ref & deref inside its destructor" https://bugs.webkit.org/show_bug.cgi?id=201576 https://trac.webkit.org/changeset/250762 2019-10-04 Ryosuke Niwa Build fix for macOS Catalina. * wtf/spi/darwin/SandboxSPI.h: 2019-10-04 Ryosuke Niwa Make a ThreadSafeRefCounted object safe to ref & deref inside its destructor https://bugs.webkit.org/show_bug.cgi?id=201576 Reviewed by Geoffrey Garen. This patch leaves m_refCount 1 inside the last deref call to ThreadSafeRefCounted such that ref'ing and deref'ing it again inside its destructor would never try to double delete the object. Also added m_deletionHasBegun like RefCounted. * wtf/ThreadSafeRefCounted.h: (WTF::ThreadSafeRefCountedBase::ref const): (WTF::ThreadSafeRefCountedBase::hasOneRef const): (WTF::ThreadSafeRefCountedBase::derefBase const): 2019-10-04 Heiko Becker Fix build with icu 65.1 https://bugs.webkit.org/show_bug.cgi?id=202600 Reviewed by Konstantin Tokarev. * wtf/URLHelpers.cpp: (WTF::URLHelpers::allCharactersInIDNScriptWhiteList): 2019-10-04 Truitt Savell Unreviewed, rolling out r250583. Broke multiple internal API tests Reverted changeset: "[JSC] Place VM* in TLS" https://bugs.webkit.org/show_bug.cgi?id=202391 https://trac.webkit.org/changeset/250583 2019-10-03 Keith Rollin Remove some support for < iOS 13 https://bugs.webkit.org/show_bug.cgi?id=202549 Reviewed by Alex Christensen. Remove some support for iOS versions less than 13.0. Update conditionals that reference __IPHONE_OS_VERSION_MIN_REQUIRED and __IPHONE_OS_VERSION_MAX_ALLOWED, assuming that they both have values >= 130000. This means that expressions like "__IPHONE_OS_VERSION_MIN_REQUIRED < 101300" are always False and "__IPHONE_OS_VERSION_MIN_REQUIRED >= 101300" are always True. This removal is part of a series of patches effecting the removal of dead code for old versions of iOS. This particular pass involves changes in which Michael Saboff was involved. These changes are isolated from other similar changes in order to facilitate the reviewing process. * wtf/spi/darwin/ProcessMemoryFootprint.h: 2019-10-03 Per Arne Vollan REGRESSION(249649): Unable to open local files in MiniBrowser on macOS https://bugs.webkit.org/show_bug.cgi?id=201798 Reviewed by Brent Fulgham. Add HAVE_AUDIT_TOKEN and SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_AUDIT_TOKEN defines. * wtf/Platform.h: 2019-10-02 Myles C. Maxfield REGRESSION (r245672): a runtime enabled (on-by-default) feature https://bugs.webkit.org/show_bug.cgi?id=189162 Reviewed by Wenson Hsieh and Tim Horton. * wtf/FeatureDefines.h: 2018-10-06 Mark Lam Adding some temporary asserts with data logging to debug a mysterious ASAN bot crash. https://bugs.webkit.org/show_bug.cgi?id=190334 Reviewed by Yusuke Suzuki. These assertions are needed because we can't reproduce the issue locally. We'll remove these asserts after the needed data has been collected from the bot. * wtf/StackBounds.cpp: (WTF::StackBounds::newThreadStackBounds): * wtf/StackBounds.h: (WTF::StackBounds::checkConsistency const): 2018-10-07 Yusuke Suzuki Name Heap threads https://bugs.webkit.org/show_bug.cgi?id=190337 Reviewed by Mark Lam. Add a functionality naming threads of ParallelHelperPool. * wtf/ParallelHelperPool.cpp: (WTF::ParallelHelperPool::ParallelHelperPool): * wtf/ParallelHelperPool.h: 2018-10-06 Mark Lam Adding some temporary asserts to debug a mysterious ASAN bot crash. https://bugs.webkit.org/show_bug.cgi?id=190331 Reviewed by Filip Pizlo. These assertions are needed because we can't reproduce the issue locally. We'll remove these asserts after the needed data has been collected from the bot. * wtf/StackBounds.h: (WTF::StackBounds::checkConsistency const): 2018-10-05 Yusuke Suzuki [JSC][Linux] Support Perf JITDump logging https://bugs.webkit.org/show_bug.cgi?id=189893 Reviewed by Mark Lam. * wtf/PageReservation.h: (WTF::PageReservation::reserveAndCommitWithGuardPages): 2018-10-03 Dan Bernstein WTF part of [Xcode] Update some build settings as recommended by Xcode 10 https://bugs.webkit.org/show_bug.cgi?id=190250 Reviewed by Alex Christensen. * Configurations/Base.xcconfig: Enabled CLANG_WARN_COMMA, CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS, and CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF. * WTF.xcodeproj/project.pbxproj: Let Xcode update LastUpgradeCheck. * wtf/MathExtras.h: (WTF::fastLog2): Addressed newly-enabled CLANG_WARN_COMMA by splitting some comma-separated expressions into individual statements. 2018-10-03 Mark Lam Make string MaxLength for all WTF and JS strings consistently equal to INT_MAX. https://bugs.webkit.org/show_bug.cgi?id=190187 Reviewed by Michael Saboff. * wtf/text/StringConcatenate.h: (WTF::tryMakeStringFromAdapters): (WTF::sumWithOverflow): Deleted. * wtf/text/StringImpl.h: * wtf/text/WTFString.h: 2018-10-03 Michael Catanzaro -Wunused-variable in RenderLayer::updateScrollableAreaSet https://bugs.webkit.org/show_bug.cgi?id=190200 Reviewed by Yusuke Suzuki. Add a new UNUSED_VARIABLE() macro. It's the same as UNUSED_PARAM(), just named differently. * wtf/Compiler.h: 2018-10-01 Dean Jackson [macOS] Switching to discrete GPU should be done in the UI process https://bugs.webkit.org/show_bug.cgi?id=189361 Reviewed by Simon Fraser. Define GL_SILENCE_DEPRECATION to avoid deprecation warnings for OpenGL. * wtf/Platform.h: 2018-10-02 Commit Queue Unreviewed, rolling out r236624 and r236671. https://bugs.webkit.org/show_bug.cgi?id=190207 The change in r236624 introduced crashes on the bots (Requested by ryanhaddad on #webkit). Reverted changesets: "Refactoring: eliminate raw pointer usage in Fullscreen code" https://bugs.webkit.org/show_bug.cgi?id=188747 https://trac.webkit.org/changeset/236624 "Unify implementation in VideoFullscreenInterfaceAVKit" https://bugs.webkit.org/show_bug.cgi?id=190091 https://trac.webkit.org/changeset/236671 2018-10-02 Caio Lima [BigInt] BigInt.proptotype.toString is broken when radix is power of 2 https://bugs.webkit.org/show_bug.cgi?id=190033 Reviewed by Yusuke Suzuki. * wtf/MathExtras.h: (WTF::ctz32): 2018-10-01 Andy Estes [watchOS] Adopt NSURLSessionCompanionProxyPreference https://bugs.webkit.org/show_bug.cgi?id=190177 Reviewed by Wenson Hsieh. * wtf/FeatureDefines.h: 2018-10-01 Koby Boyango [WTF][JSCONLY] Use MainThreadWin on Windows in the JSCOnly port https://bugs.webkit.org/show_bug.cgi?id=190121 Reviewed by Yusuke Suzuki. This fixes JSCOnly build on Windows after r236617. * wtf/PlatformJSCOnly.cmake: 2018-10-01 Commit Queue Unreviewed, rolling out r236647. https://bugs.webkit.org/show_bug.cgi?id=190124 Breaking test stress/big-int-to-string.js (Requested by caiolima_ on #webkit). Reverted changeset: "[BigInt] BigInt.proptotype.toString is broken when radix is power of 2" https://bugs.webkit.org/show_bug.cgi?id=190033 https://trac.webkit.org/changeset/236647 2018-09-30 Caio Lima [BigInt] BigInt.proptotype.toString is broken when radix is power of 2 https://bugs.webkit.org/show_bug.cgi?id=190033 Reviewed by Yusuke Suzuki. * wtf/MathExtras.h: (WTF::ctz32): 2018-09-28 Jer Noble Refactoring: eliminate raw pointer usage in Fullscreen code https://bugs.webkit.org/show_bug.cgi?id=188747 Reviewed by Alex Christensen. * WTF.xcodeproj/project.pbxproj: * wtf/WeakPtrContainer.h: Added. 2018-09-28 Yusuke Suzuki [WTF] Make isMainThread more reliable https://bugs.webkit.org/show_bug.cgi?id=189880 Reviewed by Mark Lam. isMainThread() relied on Thread::current(). This API becomes broken in Windows when the Thread is about to be destroyed since TLS is already cleared. This causes a bug since `isMainThread()` is called in Thread::didExit in Windows. This patch makes this `isMainThread` more reliable in all the platforms. In Windows, we use `Thread::currentID()` instead of `Thread::current()` since `Thread::currentID` uses Win32 GetCurrentThreadId directly. In the other system, we use `pthread_main_np` or `pthread_self` instead. We also move `holdLock` code inside `if (shouldRemoveThreadFromThreadGroup())`. If the other thread takes a mutex and destroyed, this `holdLock` waits forever. This problem only happens in Windows since Windows calls TLS destructor for the main thread. * WTF.xcodeproj/project.pbxproj: * wtf/MainThread.cpp: (WTF::initializeMainThread): (): Deleted. (WTF::isMainThread): Deleted. (WTF::isMainThreadIfInitialized): Deleted. * wtf/Platform.h: * wtf/PlatformMac.cmake: * wtf/Threading.cpp: (WTF::Thread::didExit): * wtf/cocoa/MainThreadCocoa.mm: Renamed from Source/WTF/wtf/mac/MainThreadMac.mm. * wtf/generic/MainThreadGeneric.cpp: (WTF::initializeMainThreadPlatform): (WTF::isMainThread): (WTF::isMainThreadIfInitialized): * wtf/win/MainThreadWin.cpp: (WTF::initializeMainThreadPlatform): (WTF::isMainThread): (WTF::isMainThreadIfInitialized): 2018-09-28 Commit Queue Unreviewed, rolling out r236605. https://bugs.webkit.org/show_bug.cgi?id=190087 caused three API test timeouts (Requested by jernoble on #webkit). Reverted changeset: "Refactoring: eliminate raw pointer usage in Fullscreen code" https://bugs.webkit.org/show_bug.cgi?id=188747 https://trac.webkit.org/changeset/236605 2018-09-28 Brian Burg Replace recently added line comments in Compiler.h https://bugs.webkit.org/show_bug.cgi?id=190062 Reviewed by Joseph Pecoraro. This breaks some Apple-internal tooling. For now, work around it by changing the comment style. On the other side, the issue will be fixed more permanently by adopting the approach from r230213. * wtf/Compiler.h: Use multiline comments. 2018-09-28 Jer Noble Refactoring: eliminate raw pointer usage in Fullscreen code https://bugs.webkit.org/show_bug.cgi?id=188747 Reviewed by Alex Christensen. * WTF.xcodeproj/project.pbxproj: * wtf/WeakPtrContainer.h: Added. 2018-09-28 Koby Boyango [WTF] Add ExternalStringImpl, a StringImpl for user controlled buffers https://bugs.webkit.org/show_bug.cgi?id=189991 Reviewed by Yusuke Suzuki. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/text/ExternalStringImpl.cpp: Added. * wtf/text/ExternalStringImpl.h: Added. * wtf/text/StringImpl.cpp: * wtf/text/StringImpl.h: 2018-09-27 Saam barati Verify the contents of AssemblerBuffer on arm64e https://bugs.webkit.org/show_bug.cgi?id=190057 Reviewed by Mark Lam. * wtf/PtrTag.h: (WTF::tagInt): 2018-09-27 Jer Noble MediaPlayer should have mediaPlayerWaitingForKeyChanged() / bool waitingForKey() accessor https://bugs.webkit.org/show_bug.cgi?id=189951 Reviewed by Eric Carlson. Templated functions should take r-value references, as they have perfect type deduction for all parameter types; references, l-value references, and r-value references in template function parameters have special type deduction semantics. See: Previously, const reference parameters would be copied when passed into anyOf(), and containers of Ref<> would generate compile errors when passed into anyOf, as they cannot be copied. Now, with r-value reference types in template parameters, a const reference is mapped to a const reference, a non-const reference is mapped to a non-const reference, and a r-value reference is mapped to an r-value reference. * wtf/Algorithms.h: (WTF::forEach): (WTF::anyOf): (WTF::allOf): 2018-09-25 John Wilander Change from HAVE(CFNETWORK_STORAGE_PARTITIONING) to ENABLE(RESOURCE_LOAD_STATISTICS) https://bugs.webkit.org/show_bug.cgi?id=189959 Reviewed by Chris Dumez. * wtf/Platform.h: Enables RESOURCE_LOAD_STATISTICS for Cocoa platforms. 2018-09-24 Fujii Hironori Rename WTF_COMPILER_GCC_OR_CLANG to WTF_COMPILER_GCC_COMPATIBLE https://bugs.webkit.org/show_bug.cgi?id=189733 Reviewed by Michael Catanzaro. Clang for Windows build enables WTF_COMPILER_CLANG and WTF_COMPILER_MSVC, but disables WTF_COMPILER_GCC_OR_CLANG. It is strange WTF_COMPILER_GCC_OR_CLANG is not enabled even though WTF_COMPILER_CLANG is enabled. However, Clang for Windows imitates MSVC, and codes for COMPILER(GCC_OR_CLANG) are for non MSVC. At least at the moment, it is not feasible to define WTF_COMPILER_GCC_OR_CLANG for Clang for Windows. To solve the issue, this change renames WTF_COMPILER_GCC_OR_CLANG to WTF_COMPILER_GCC_COMPATIBLE. As an exception, I'd like to use IGNORE_WARNINGS_* macros even in Clang for Windows builds. * wtf/Assertions.cpp: Replaced COMPILER(GCC_OR_CLANG) with COMPILER(GCC_COMPATIBLE). * wtf/Assertions.h: Ditto. * wtf/Atomics.h: Ditto. * wtf/CheckedArithmetic.h: Ditto. * wtf/FastMalloc.h: Ditto. * wtf/MathExtras.h: Ditto. * wtf/Platform.h: Ditto. * wtf/StdLibExtras.h: Ditto. * wtf/Vector.h: Ditto. * wtf/text/ASCIIFastPath.h: Ditto. * wtf/Compiler.h: Ditto. Replaced "COMPILER(GCC_OR_CLANG)" with "COMPILER(GCC) || COMPILER(CLANG)" of IGNORE_WARNINGS_* macros. 2018-09-21 Yusuke Suzuki [JSC] Enable LLInt ASM interpreter on X64 and ARM64 in non JIT configuration https://bugs.webkit.org/show_bug.cgi?id=189778 Reviewed by Keith Miller. This patch adds ENABLE(C_LOOP) which indicates we use CLoop as the interpreter. Previously, we used !ENABLE(JIT) for this configuration. But now, we have a build configuration that has LLInt ASM interpreter (not CLoop) and !ENABLE(JIT). We enable LLInt ASM interpreter for non JIT environment in X86_64 and ARM64 architectures. And we enable ENABLE(ASSEMBLER) for non JIT environment since it offers machine register information which is used for LLInt and SamplingProfiler. * wtf/Platform.h: 2018-09-21 Keith Miller Add Promise SPI https://bugs.webkit.org/show_bug.cgi?id=189809 Reviewed by Saam Barati. Fix issue where creating a JSContextRef off the main thread before creating initializing the main thread would cause an assertion failure. * wtf/MainThread.cpp: (WTF::isMainThreadIfInitialized): * wtf/MainThread.h: * wtf/mac/MainThreadMac.mm: (WTF::isMainThreadIfInitialized): * wtf/text/cf/StringImplCF.cpp: (WTF::StringImpl::createCFString): 2018-09-21 Ryan Haddad Unreviewed, rolling out r236359. Broke the Windows build. Reverted changeset: "Add Promise SPI" https://bugs.webkit.org/show_bug.cgi?id=189809 https://trac.webkit.org/changeset/236359 2018-09-21 Keith Miller Add Promise SPI https://bugs.webkit.org/show_bug.cgi?id=189809 Reviewed by Saam Barati. Fix issue where creating a JSContextRef off the main thread before creating initializing the main thread would cause an assertion failure. * wtf/MainThread.cpp: (WTF::isMainThreadIfInitialized): * wtf/MainThread.h: * wtf/mac/MainThreadMac.mm: (WTF::isMainThreadIfInitialized): * wtf/text/cf/StringImplCF.cpp: (WTF::StringImpl::createCFString): 2018-09-20 Fujii Hironori [Win][Clang] UNUSED_PARAM(this) causes compilation error of "cannot take the address of an rvalue of type" https://bugs.webkit.org/show_bug.cgi?id=189732 Reviewed by Per Arne Vollan. Clang for Windows can't compile the MSVC workaround of UNUSED_PARAM which has been introduced for Windows CE and Visual Studio 10. I think it's safe just to remove it. * wtf/Compiler.h: Removed the code for COMPILER(MSVC). 2018-09-20 Alex Christensen Unreviewed, rolling out r235976. Broke ARM Reverted changeset: "Use a Variant instead of a union in CSSSelector" https://bugs.webkit.org/show_bug.cgi?id=188559 https://trac.webkit.org/changeset/235976 2018-09-17 Yusuke Suzuki [WTF] Use Semaphore and BinarySemaphore instead of dispatch_semaphore_t https://bugs.webkit.org/show_bug.cgi?id=185339 Reviewed by Mark Lam. This patch adds WTF::Semaphore, which is based on WTF::Lock and WTF::Condition. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Semaphore.h: Added. (WTF::Semaphore::Semaphore): (WTF::Semaphore::signal): (WTF::Semaphore::waitUntil): (WTF::Semaphore::waitFor): (WTF::Semaphore::wait): * wtf/generic/WorkQueueGeneric.cpp: (WorkQueue::platformInitialize): * wtf/threads/BinarySemaphore.cpp: (WTF::BinarySemaphore::waitUntil): (WTF::BinarySemaphore::wait): Deleted. * wtf/threads/BinarySemaphore.h: (WTF::BinarySemaphore::waitFor): (WTF::BinarySemaphore::wait): Align the names of the functions to WTF::Condition. Add BinarySemaphore::wait(), which is the same to waitUntil(WallTime::infinity()). 2018-09-17 Jer Noble Add support for HEVC codec types in Media Capabilities https://bugs.webkit.org/show_bug.cgi?id=189565 Reviewed by Eric Carlson. Extract the toIntegralType template into its own header. * wtf/CMakeLists.txt: * wtf/text/StringConversion.h: Added. (isCharacterAllowedInBase): (toIntegralType): * wtf/text/WTFString.cpp: 2018-09-17 Jer Noble Enable USE_MEDIAREMOTE on iOS https://bugs.webkit.org/show_bug.cgi?id=189096 Reviewed by Eric Carlson. * wtf/Platform.h: 2018-09-17 Frederic Wang Build error in ImageBufferCG when compiled with IOSurfacePool https://bugs.webkit.org/show_bug.cgi?id=189579 Reviewed by Tim Horton. IOSurface.h might be included with different value of IOSURFACE_CANVAS_BACKING_STORE, causing compilation errors when files in the same unified source do not agree on the definition. This patch moves the definition of IOSURFACE_CANVAS_BACKING_STORE from ImageBufferDataCG.h to Platform.h so that IOSURFACE_CANVAS_BACKING_STORE is set to the same value in all files. Finally some minors changes to explicitly declare/define ImageBuffer are performed in order to prevent future issues with Unified build rotating. * wtf/Platform.h: Move definition from ImageBufferDataCG.h. 2018-09-14 Ryan Haddad Unreviewed, rolling out r235990. Introduced TestWebKitAPI.NowPlayingTest timeouts on iOS Reverted changeset: "Enable USE_MEDIAREMOTE on iOS" https://bugs.webkit.org/show_bug.cgi?id=189096 https://trac.webkit.org/changeset/235990 2018-09-13 Jer Noble Enable USE_MEDIAREMOTE on iOS https://bugs.webkit.org/show_bug.cgi?id=189096 Reviewed by Eric Carlson. * wtf/Platform.h: 2018-09-13 Alex Christensen Use a Variant instead of a union in CSSSelector https://bugs.webkit.org/show_bug.cgi?id=188559 Reviewed by Antti Koivisto. * wtf/Variant.h: Add packing macros to make it so Variant-containing structures don't always have 7 bytes of padding per Variant. 2018-09-12 Guillaume Emont Add IGNORE_WARNING_.* macros https://bugs.webkit.org/show_bug.cgi?id=188996 Reviewed by Michael Catanzaro. * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Compiler.h: * wtf/MD5.cpp: (WTF::MD5::MD5): (WTF::MD5::addBytes): (WTF::MD5::checksum): * wtf/PrintStream.cpp: (WTF::PrintStream::printfVariableFormat): * wtf/SHA1.cpp: (WTF::SHA1::SHA1): (WTF::SHA1::addBytes): (WTF::SHA1::computeHash): * wtf/ThreadingPthreads.cpp: * wtf/Vector.h: (WTF::VectorBuffer::endOfBuffer): * wtf/text/WTFString.cpp: (WTF::createWithFormatAndArguments): == Rolled over to ChangeLog-2018-09-11 ==