2016-09-23 Filip Pizlo Need a store-load fence between setting cell state and visiting the object in SlotVisitor https://bugs.webkit.org/show_bug.cgi?id=162354 Reviewed by Mark Lam. Fix this on x86-32. * wtf/Atomics.h: (WTF::x86_ortop): 2016-09-23 Caitlin Potter [JSC] Implement parsing of Async Functions https://bugs.webkit.org/show_bug.cgi?id=161409 Reviewed by Yusuke Suzuki. * wtf/FeatureDefines.h: 2016-09-23 Commit Queue Unreviewed, rolling out r206314, r206316, and r206319. https://bugs.webkit.org/show_bug.cgi?id=162506 These changes broke various builds (Requested by ryanhaddad on #webkit). Reverted changesets: "Need a store-load fence between setting cell state and visiting the object in SlotVisitor" https://bugs.webkit.org/show_bug.cgi?id=162354 http://trac.webkit.org/changeset/206314 "Unreviewed, fix cloop." http://trac.webkit.org/changeset/206316 "Unreviewed, fix all other builds." http://trac.webkit.org/changeset/206319 2016-09-23 Carlos Garcia Campos REGRESSION(r194387): Crash on github.com in IntlDateTimeFormat::resolvedOptions in C locale https://bugs.webkit.org/show_bug.cgi?id=162139 Reviewed by Michael Catanzaro. Handle the case of "C" or "POSIX" locale and use "en-US" as default. That matches what ICU and other ports do, as well as what layout tests expect (some tests like js/intl-collator.html pass in the bots only because we use en-US as system locale in those bots). * wtf/PlatformUserPreferredLanguagesUnix.cpp: (WTF::platformLanguage): 2016-09-22 Filip Pizlo Need a store-load fence between setting cell state and visiting the object in SlotVisitor https://bugs.webkit.org/show_bug.cgi?id=162354 Reviewed by Mark Lam. Fix this on x86-32. * wtf/Atomics.h: (WTF::x86_ortop): 2016-09-22 Filip Pizlo Fences on x86 should be a lot cheaper https://bugs.webkit.org/show_bug.cgi?id=162417 Reviewed by Mark Lam and Geoffrey Garen. It turns out that: lock; orl $0, (%rsp) does everything that we wanted from: mfence And it's a lot faster. When I tried mfence for making object visiting concurrent-GC-TSO- friendly, it was a 9% regression on Octane/splay. But when I tried ortop, it was neutral. So, we should use ortop from now on. This part of the change just affects our Atomics. I also changed this in the JITs. * wtf/Atomics.h: (WTF::x86_ortop): (WTF::storeLoadFence): (WTF::x86_mfence): Deleted. 2016-09-21 Alexey Proskuryakov Rolling out r206244, as it caused flaky crashes on tests. Was: Correct uses of 'safeCast' * wtf/StdLibExtras.h: (WTF::safeCast): 2016-09-21 Keith Miller Fix build for future versions of Clang. https://bugs.webkit.org/show_bug.cgi?id=162346 Reviewed by Filip Pizlo. This fixes issues with the WebCore build where inline template-class function definitions are marked as exported. This genereates a weak external symobl that our build does not like. * wtf/text/StringImpl.h: 2016-09-20 Brent Fulgham Correct uses of 'safeCast' https://bugs.webkit.org/show_bug.cgi?id=162301 Reviewed by Antti Koivisto. * wtf/StdLibExtras.h: (WTF::safeCast): RELEASE_ASSERT on overflow. 2016-09-21 Commit Queue Unreviewed, rolling out r206222 and r206227. https://bugs.webkit.org/show_bug.cgi?id=162361 "broke the windows build" (Requested by keith_mi_ on #webkit). Reverted changesets: "Fix build for future versions of Clang." https://bugs.webkit.org/show_bug.cgi?id=162346 http://trac.webkit.org/changeset/206222 "Attempt to fix windows build after r206222." http://trac.webkit.org/changeset/206227 2016-09-21 Keith Miller Fix build for future versions of Clang. https://bugs.webkit.org/show_bug.cgi?id=162346 Reviewed by Filip Pizlo. This fixes issues with the WebCore build where inline template-class function definitions are marked as exported. This genereates a weak external symobl that our build does not like. * wtf/text/StringImpl.h: 2016-09-20 Alex Christensen Require WTFMove for String::adopt https://bugs.webkit.org/show_bug.cgi?id=162313 Reviewed by Yusuke Suzuki. * wtf/text/StringImpl.cpp: (WTF::StringImpl::removeCharacters): (WTF::StringImpl::simplifyMatchedCharactersToSpace): (WTF::StringImpl::adopt): * wtf/text/StringImpl.h: (WTF::StringImpl::adopt): * wtf/text/WTFString.h: (WTF::String::adopt): 2016-09-20 Filip Pizlo Make MarkedBlock state tracking support overlapped allocation and marking state https://bugs.webkit.org/show_bug.cgi?id=161581 Reviewed by Geoffrey Garen. The main change here is to bring back FastBitVector.cpp, so that I could outline some large slow path functions. This also adds some utilities, like atomicSetAndCheck() and isEmpty(). The GC uses these. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/FastBitVector.cpp: Added. (WTF::FastBitVectorWordOwner::setEqualsSlow): (WTF::FastBitVectorWordOwner::resizeSlow): * wtf/FastBitVector.h: (WTF::FastBitVectorWordOwner::operator=): (WTF::FastBitVectorWordOwner::resize): (WTF::FastBitVectorImpl::isEmpty): (WTF::FastBitVector::atomicSetAndCheck): (WTF::FastBitVector::operator[]): Deleted. 2016-09-20 Jonathan Bedard Undefined behavior: Left shift negative number https://bugs.webkit.org/show_bug.cgi?id=161866 Reviewed by Keith Miller. Left shifting a negative number is undefined behavior in C/C++, although most implementations do define it. Explicitly clarifying the intended behavior due to shifting negative number in some cases. * wtf/text/Base64.cpp: (WTF::base64EncodeInternal): Changed signed character to unsigned when shifting. (WTF::base64Encode): Ditto. (WTF::base64URLEncode): Ditto. (WTF::base64DecodeInternal): Ditto. * wtf/text/Base64.h: Ditto. (WTF::SignedOrUnsignedCharVectorAdapter): Rebuilt to stop using union as a bitwise_cast. (WTF::ConstSignedOrUnsignedCharVectorAdapter): Ditto. 2016-09-19 Daniel Bates Remove ENABLE(TEXT_AUTOSIZING) automatic text size adjustment code https://bugs.webkit.org/show_bug.cgi?id=162167 Reviewed by Simon Fraser. * wtf/FeatureDefines.h: 2016-09-14 Jer Noble [media-source] fix imported/w3c/web-platform-tests/media-source/mediasource-duration.html https://bugs.webkit.org/show_bug.cgi?id=161999 Reviewed by Eric Carlson. The mediasource-duration.html test tries to set the duration of a MediaSource to a double value (5.0), then some work happens and the duration is set to a media time (12533/2500, or 5.0132). The test then tries to set that value as the duration, converted from a media time to a double, and asserts that no duration change event is fired. But because the floating point value and the media time value are ever so slightly different, this round-tripping fails. Fix this bug in MediaTime by, when one side or the other of a comparison is a floating point MediaTime, convert both sides to doubles and run the comparison against those values. This preserves the transitive equality of doubles <-> MediaTimes. * wtf/MediaTime.cpp: (WTF::MediaTime::compare): 2016-09-16 Anders Carlsson Fix isValidEnum to work with older versions of GCC https://bugs.webkit.org/show_bug.cgi?id=162065 Reviewed by Michael Catanzaro. Use the ternary operator instead of a more complex function body. * wtf/EnumTraits.h: 2016-09-15 JF Bastien TextBreakIterator: unconvolute character break cache https://bugs.webkit.org/show_bug.cgi?id=162001 Reviewed by Michael Saboff. Simplify the one-element cache. Added here (fixed a bit after): https://bugs.webkit.org/attachment.cgi?id=144118&action=prettypatch Updated to never use a lock, and always use weak cmpxchg here: https://bugs.webkit.org/attachment.cgi?id=261719&action=prettypatch It's just trying to reduce the number of times it calls into ICU to initialize a UBRK_CHARACTER. The implementation keeps a one-element cache of the latest used one, which threads can optimistically grab. Failure is fine (just create a new one), same for failure to cache (just destroy it), but the logic is odd and you technically need release / acquire semantics because the UBRK_CHARACTER creation's store need to be visible on acquisition (but realistically it was created and then used and *then* cached, so it's probably been long ago enough that read reorders never manifested). Using exchange directly achieves this without the headache. * wtf/text/TextBreakIterator.cpp: (WTF::getNonSharedCharacterBreakIterator): (WTF::cacheNonSharedCharacterBreakIterator): (WTF::NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator): (WTF::NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator): (WTF::compareAndSwapNonSharedCharacterBreakIterator): Deleted. 2016-09-15 Keith Miller Pragma out undefined-var-template warnings in JSC for JSObjects that are templatized https://bugs.webkit.org/show_bug.cgi?id=161985 Reviewed by Alex Christensen. Fix WTF_EXPORT_PRIVATE for an inline member function. This would generate a weak export. * wtf/MetaAllocator.h: (WTF::MetaAllocator::getLock): 2016-09-14 Commit Queue Unreviewed, rolling out r205933 and r205936. https://bugs.webkit.org/show_bug.cgi?id=162002 broke the build (Requested by keith_miller on #webkit). Reverted changesets: "Pragma out undefined-var-template warnings in JSC for JSObjects that are templatized" https://bugs.webkit.org/show_bug.cgi?id=161985 http://trac.webkit.org/changeset/205933 "Unreviewed, fix the Windows build." http://trac.webkit.org/changeset/205936 2016-09-14 Keith Miller Pragma out undefined-var-template warnings in JSC for JSObjects that are templatized https://bugs.webkit.org/show_bug.cgi?id=161985 Reviewed by Geoffrey Garen. Fix WTF_EXPORT_PRIVATE for an inline member function. This would generate a weak export. * wtf/MetaAllocator.h: (WTF::MetaAllocator::getLock): 2016-09-14 JF Bastien Atomics on ARM don't require full-system fencing, and other minutiae https://bugs.webkit.org/show_bug.cgi?id=161928 Reviewed by Geoffrey Garen. Add cmpxchg versions with both success and failure memory ordering. In some interesting cases we can craft code which needs barriers which aren't as strong. weakCompareAndSwap is super dubious, its 3 uses seem questionable... but for now I'm just adding debug asserts. Rename armv7_dmb* functions to arm_dmb* because they apply to v7 and v8 (or more precisely; to ARMv7's ARM and Thumb2, as well as ARMv8's aarch32 A32/T32 and aarch64). Use inner-shareability domain for ARM barriers instead of full-system. This is what C++ uses. The default case for barriers simply used a compiler barrier. This is generally wrong, e.g. for MIPS. * wtf/Atomics.h: (WTF::Atomic::compareExchangeWeak): offer two-order version (WTF::Atomic::compareExchangeStrong): offer two-order version (WTF::weakCompareAndSwap): a few assertions (WTF::arm_dmb): rename since it applies to ARMv7 and v8; make it innser-shareable (WTF::arm_dmb_st): rename since it applies to ARMv7 and v8; make it innser-shareable (WTF::loadLoadFence): incorrect generally (WTF::loadStoreFence): incorrect generally (WTF::storeLoadFence): incorrect generally (WTF::storeStoreFence): incorrect generally (WTF::memoryBarrierAfterLock): incorrect generally (WTF::memoryBarrierBeforeUnlock): incorrect generally (WTF::armV7_dmb): Deleted. (WTF::armV7_dmb_st): Deleted. 2016-09-14 JF Bastien Alwasys inline atomic operations https://bugs.webkit.org/show_bug.cgi?id=155371 Reviewed by Geoffrey Garen. Fixes "build fails with memory model cannot be stronger than success memory model for ‘__atomic_compare_exchange’". Pre-5 revisions of GCC at Os only generated an error message related to invalid failure memory ordering. The reason is that libstdc++ tries to be clever about enforcing the C++ standard's clause [atomics.types.operations.req] ¶21 which states: Requires: The failure argument shall not be `memory_order_release` nor `memory_order_acq_rel`. The failure argument shall be no stronger than the success argument. It fails at doing this because its inlining heuristics are modified by Os, and they're not quite as dumb as O0 but not smart enough to get to the good code at O1. Adding ALWAYS_INLINE fixes the silliness at Os, leaves O1 great, and makes O0 slightly less bad but still pretty bad. The other good news is that I'm going to get this particular problem fixed in the version of C++ which will come after C++17: https://github.com/jfbastien/papers/blob/master/source/P0418r1.bs While we're at it we should always inline all of these wrapped functions because the generated code is horrendous if the memory order isn't known at compile time. * wtf/Atomics.h: (WTF::Atomic::load): (WTF::Atomic::store): (WTF::Atomic::compareExchangeWeak): (WTF::Atomic::compareExchangeStrong): (WTF::Atomic::exchangeAndAdd): (WTF::Atomic::exchange): 2016-09-13 Michael Saboff Promises aren't resolved properly when making a ObjC API callback https://bugs.webkit.org/show_bug.cgi?id=161929 Reviewed by Geoffrey Garen. Removed resetCurrentAtomicStringTable() which is no longer referenced. * wtf/WTFThreadData.h: (WTF::WTFThreadData::resetCurrentAtomicStringTable): Deleted. 2016-09-13 Alex Christensen Implement URLSearchParams https://bugs.webkit.org/show_bug.cgi?id=161920 Reviewed by Chris Dumez. * wtf/text/StringView.h: (WTF::StringView::split): Added. 2016-09-12 Filip Pizlo ParkingLot is going to have a bad time with threads dying https://bugs.webkit.org/show_bug.cgi?id=161893 Reviewed by Michael Saboff. If a thread dies right as it falls out of parkConditionally, then unparkOne() and friends might die because they will dereference a deallocated ThreadData. The solution is to ref-count ThreadData's. When unparkOne() and friends want to hold onto a ThreadData past the queue lock, they can use RefPtr<>. * wtf/ParkingLot.cpp: (WTF::ParkingLot::unparkOne): (WTF::ParkingLot::unparkOneImpl): (WTF::ParkingLot::unparkAll): 2016-09-12 Chris Dumez Fix post-landing review comments after r205787 https://bugs.webkit.org/show_bug.cgi?id=161885 Reviewed by Darin Adler. Add new StringBuilder::append(CFStringRef) / append(NSString*) overloads to avoid an extra string copy when possible. * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::append): * wtf/text/StringBuilder.h: (WTF::StringBuilder::append): 2016-09-12 Yusuke Suzuki [WTF] HashTable's rehash is not compatible to Ref and ASan https://bugs.webkit.org/show_bug.cgi?id=161763 Reviewed by Darin Adler. Destructors of HashTable's empty values need to be called while ones of deleted values don't. * wtf/HashTable.h: (WTF::KeyTraits>::deallocateTable): * wtf/Ref.h: 2016-09-12 Myles C. Maxfield [Cocoa] Reduce uses of CGFonts in favor of CTFonts https://bugs.webkit.org/show_bug.cgi?id=161809 Reviewed by Daniel Bates. * wtf/unicode/CharacterNames.h: 2016-09-12 Saam Barati MapHash should do constant folding when it has a constant argument and its legal to hash that value https://bugs.webkit.org/show_bug.cgi?id=161639 Reviewed by Filip Pizlo. This patch adds a concurrentHash method to StringImpl. It's probably safe to get the actual hash while being racy, however, it's simpler and more future proof to not have to worry about that and to just compute it on demand. Users of this API should be aware that it's doing non-trivial work. Currently, the only user is JSC's JIT compilers, and they only ask for hashes for small-ish strings. * wtf/text/StringImpl.h: * wtf/text/StringStatics.cpp: (WTF::StringImpl::concurrentHash): 2016-09-11 Filip Pizlo DFG::forAllKilledOperands() could use a faster bitvector scan in the same-inline-stack fast path https://bugs.webkit.org/show_bug.cgi?id=161849 Reviewed by Saam Barati. It turns out that templates make private fields weird. FastBitVectorImpl can't necessarily touch privates in instances of different template specializations of itself. So, I added a public method called wordView() that exposes the necessary private field. * wtf/FastBitVector.h: (WTF::FastBitVectorImpl::operator&): (WTF::FastBitVectorImpl::operator|): (WTF::FastBitVectorImpl::operator~): (WTF::FastBitVectorImpl::forEachSetBit): (WTF::FastBitVectorImpl::wordView): 2016-09-11 Filip Pizlo FastBitVector should have efficient and easy-to-use vector-vector operations https://bugs.webkit.org/show_bug.cgi?id=161847 Reviewed by Saam Barati. FastBitVector is a bitvector representation that supports manual dynamic resizing and is optimized for speed, not space. (BitVector supports automatic dynamic resizing and is optimized for space, while Bitmap is sized statically and is optimized for both speed and space.) This change greatly increases the power of FastBitVector. We will use these new powers for changing the JSC GC to use FastBitVectors to track sets of MarkedBlocks (bug 161581) instead of using a combination of Vectors and doubly-linked lists. This change splits FastBitVector into two parts: - A thing that manages the storage of a bitvector: a uint32_t array and a size_t numBits. We call this the word view. - A thing that takes some kind of abstract array of uint32_t's and does bitvector operations to it. We call this the FastBitVectorImpl. FastBitVectorImpl and word views are immutable. The FastBitVector class is a subclass of FastBitVectorImpl specialized on a word view that owns its words and has additional support for mutable operations. Doing this allows us to efficiently support things like this without any unnecessary memory allocation or copying: FastBitVector a, b, c; // Assume that there is code to initialize these. a &= b | ~c; Previously, this kind of operation would not be efficient, because "~c" would have to create a whole new FastBitVector. But now, it just returns a FastBitVectorImpl whose underlying word view bitnots (~) its words on the fly. Using template magic, this can get pretty complex. For example "b | ~c" returns a FastBitVectorImpl that wraps a word view whose implementation of WordView::word(size_t index) is something like: uint32_t word(size_t index) { return b.m_words.word(index) | ~c.m_words.word(index); } FastBitVectorImpl supports all of the fast bulk bitvector operations, like forEachSetBit(), bitCount(), etc. So, when you say "a &= b | ~c", the actual implementation is going to run these bit operations on word granularity directly over the storage inside a, b, c. The use of operator overloading is worth explaining a bit. Previously, FastBitVector avoided operator overloading. For example, the &= operation was called filter(). I think that this was a pretty good approach at the time. I tried using non-operator methods in this FastBitVector rewrite, but I found it very odd to say things like: a.filter(b.bitOr(c.bitNot())); I think that it's harder to see what is going on here, then using operators, because infix notation is always better. * WTF.xcodeproj/project.pbxproj: * wtf/BitVector.h: (WTF::BitVector::findBitInWord): Deleted. * wtf/CMakeLists.txt: * wtf/Dominators.h: (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::pruneDominators): * wtf/FastBitVector.cpp: Removed. * wtf/FastBitVector.h: (WTF::fastBitVectorArrayLength): (WTF::FastBitVectorWordView::FastBitVectorWordView): (WTF::FastBitVectorWordView::numBits): (WTF::FastBitVectorWordView::word): (WTF::FastBitVectorWordOwner::FastBitVectorWordOwner): (WTF::FastBitVectorWordOwner::~FastBitVectorWordOwner): (WTF::FastBitVectorWordOwner::view): (WTF::FastBitVectorWordOwner::operator=): (WTF::FastBitVectorWordOwner::setAll): (WTF::FastBitVectorWordOwner::clearAll): (WTF::FastBitVectorWordOwner::set): (WTF::FastBitVectorWordOwner::numBits): (WTF::FastBitVectorWordOwner::arrayLength): (WTF::FastBitVectorWordOwner::resize): (WTF::FastBitVectorWordOwner::word): (WTF::FastBitVectorWordOwner::words): (WTF::FastBitVectorAndWords::FastBitVectorAndWords): (WTF::FastBitVectorAndWords::view): (WTF::FastBitVectorAndWords::numBits): (WTF::FastBitVectorAndWords::word): (WTF::FastBitVectorOrWords::FastBitVectorOrWords): (WTF::FastBitVectorOrWords::view): (WTF::FastBitVectorOrWords::numBits): (WTF::FastBitVectorOrWords::word): (WTF::FastBitVectorNotWords::FastBitVectorNotWords): (WTF::FastBitVectorNotWords::view): (WTF::FastBitVectorNotWords::numBits): (WTF::FastBitVectorNotWords::word): (WTF::FastBitVectorImpl::FastBitVectorImpl): (WTF::FastBitVectorImpl::numBits): (WTF::FastBitVectorImpl::size): (WTF::FastBitVectorImpl::arrayLength): (WTF::FastBitVectorImpl::operator==): (WTF::FastBitVectorImpl::operator!=): (WTF::FastBitVectorImpl::at): (WTF::FastBitVectorImpl::operator[]): (WTF::FastBitVectorImpl::bitCount): (WTF::FastBitVectorImpl::operator&): (WTF::FastBitVectorImpl::operator|): (WTF::FastBitVectorImpl::operator~): (WTF::FastBitVectorImpl::forEachSetBit): (WTF::FastBitVectorImpl::forEachClearBit): (WTF::FastBitVectorImpl::forEachBit): (WTF::FastBitVectorImpl::findBit): (WTF::FastBitVectorImpl::findSetBit): (WTF::FastBitVectorImpl::findClearBit): (WTF::FastBitVectorImpl::dump): (WTF::FastBitVectorImpl::atImpl): (WTF::FastBitVector::FastBitVector): (WTF::FastBitVector::operator=): (WTF::FastBitVector::resize): (WTF::FastBitVector::setAll): (WTF::FastBitVector::clearAll): (WTF::FastBitVector::setAndCheck): (WTF::FastBitVector::operator|=): (WTF::FastBitVector::operator&=): (WTF::FastBitVector::at): (WTF::FastBitVector::operator[]): (WTF::FastBitVector::BitReference::BitReference): (WTF::FastBitVector::BitReference::operator bool): (WTF::FastBitVector::BitReference::operator=): (WTF::FastBitVector::~FastBitVector): Deleted. (WTF::FastBitVector::numBits): Deleted. (WTF::FastBitVector::set): Deleted. (WTF::FastBitVector::equals): Deleted. (WTF::FastBitVector::merge): Deleted. (WTF::FastBitVector::filter): Deleted. (WTF::FastBitVector::exclude): Deleted. (WTF::FastBitVector::clear): Deleted. (WTF::FastBitVector::get): Deleted. (WTF::FastBitVector::bitCount): Deleted. (WTF::FastBitVector::forEachSetBit): Deleted. (WTF::FastBitVector::arrayLength): Deleted. * wtf/StdLibExtras.h: (WTF::findBitInWord): 2016-09-10 Chris Dumez parseHTMLInteger() should take a StringView in parameter https://bugs.webkit.org/show_bug.cgi?id=161669 Reviewed by Ryosuke Niwa. * wtf/text/StringBuilder.h: (WTF::StringBuilder::append): Add StringBuilder::append() overload taking an AtomicString in parameter. It used to call StringBuilder::append(const String&) implicitly when passing an AtomicString. However, it is now ambiguous because there is an overload taking a StringView, and it is now possible to construct a StringView from an AtomicString. * wtf/text/StringView.h: (WTF::StringView::StringView): - Add StringView constructor taking an AtomicString in parameter for convenience. This avoids having to call AtomicString::string() explicitly at call sites. - Add StringView constructor taking a 'const char*' in parameter for performance. There are several call sites that were passing a const char* and implicitly constructing an unnecessary String to construct a StringView. This became more obvious because the constructor taking an AtomicString in parameter made such calls ambiguous. 2016-09-09 Mark Lam Gardening: fixing a few JSC test failures. https://bugs.webkit.org/show_bug.cgi?id=161760 Not reviewed. Without this fix, the following tests will crash on a null dereference of isGCThread. stress/slow-path-generator-updating-current-node-dfg.js.misc-ftl-no-cjit stress/unshift-array-storage.js.misc-ftl-no-cjit * wtf/MainThread.cpp: (WTF::mayBeGCThread): 2016-09-08 Yusuke Suzuki [WTF] HashTable's rehash is not compatible to Ref and ASan https://bugs.webkit.org/show_bug.cgi?id=161763 Reviewed by Mark Lam. If we move an object, the location which the moved object used should not be touched anymore. HashTable::rehash performs WTFMove for the object that resides in the old table. However, after moving it, we accidentally touch this location by using `!isEmptyOrDeletedBucket(table[i])` in HashTable::deallocateTable. And it causes ASan crashing if we use Ref<> for HashTable's key or value. In this patch, we call the destructor right after moving the object. And HashTable::rehash just calls fastFree since all the objects in the old table are already moved and destructed. And we also change HashTable::deallocate to destruct only live objects. Calling destructors for empty objects is meaningless. And according to the Ref<>'s comment, empty object is not designed to be destructed. * wtf/HashTable.h: (WTF::KeyTraits>::deallocateTable): 2016-09-08 Filip Pizlo Heap::isMarked() shouldn't pay the price of concurrent lazy flipping https://bugs.webkit.org/show_bug.cgi?id=161760 Reviewed by Mark Lam. * wtf/MainThread.cpp: (WTF::isMainThreadOrGCThread): (WTF::mayBeGCThread): * wtf/MainThread.h: 2016-09-08 Myles C. Maxfield Support new emoji group candidates https://bugs.webkit.org/show_bug.cgi?id=161664 Reviewed by Simon Fraser. Update breaking rules. * wtf/text/TextBreakIterator.cpp: (WTF::cursorMovementIterator): 2016-09-07 JF Bastien bitwise_cast: allow const destination type https://bugs.webkit.org/show_bug.cgi?id=161719 Reviewed by Saam Barati. * wtf/StdLibExtras.h: (WTF::bitwise_cast): allow `const To to = bitwise_cast(from);` 2016-09-07 Mark Lam Add CatchScope and force all exception checks to be via ThrowScope or CatchScope. https://bugs.webkit.org/show_bug.cgi?id=161498 Reviewed by Geoffrey Garen. * wtf/Platform.h: 2016-09-07 Youenn Fablet [Streams API] Separate compile flag for ReadableStream and WritableStream https://bugs.webkit.org/show_bug.cgi?id=161044 Reviewed by Alex Christensen. * wtf/FeatureDefines.h: 2016-09-06 Saam Barati Make JSMap and JSSet faster https://bugs.webkit.org/show_bug.cgi?id=160989 Reviewed by Filip Pizlo. I made s_flagCount public in StringImpl since JSC's JITs now use this field. * wtf/text/StringImpl.h: 2016-09-06 Commit Queue Unreviewed, rolling out r205504. https://bugs.webkit.org/show_bug.cgi?id=161645 Broke the iOS device build (Requested by ryanhaddad on #webkit). Reverted changeset: "Make JSMap and JSSet faster" https://bugs.webkit.org/show_bug.cgi?id=160989 http://trac.webkit.org/changeset/205504 2016-09-06 Saam Barati Make JSMap and JSSet faster https://bugs.webkit.org/show_bug.cgi?id=160989 Reviewed by Filip Pizlo. I made s_flagCount public since JSC's JITs now use this field. * wtf/text/StringImpl.h: 2016-09-06 Per Arne Vollan [Win] Enable strict runtime stack buffer checks. https://bugs.webkit.org/show_bug.cgi?id=161629 Reviewed by Brent Fulgham. * wtf/Platform.h: 2016-09-06 Daniel Bates Remove EXTERN_C from WTF https://bugs.webkit.org/show_bug.cgi?id=161090 Reviewed by Brent Fulgham. Guard external C declarations in WTF_EXTERN_C_BEGIN, WTF_EXTERN_C_END. * wtf/Compiler.h: Remove macro definition EXTERN_C. * wtf/spi/cf/CFBundleSPI.h: * wtf/spi/cocoa/NSMapTableSPI.h: * wtf/spi/cocoa/SecuritySPI.h: * wtf/spi/darwin/CommonCryptoSPI.h: * wtf/spi/darwin/SandboxSPI.h: * wtf/spi/darwin/XPCSPI.h: * wtf/spi/darwin/dyldSPI.h: 2016-08-31 Filip Pizlo Butterflies should be allocated in Auxiliary MarkedSpace instead of CopiedSpace and we should rewrite as much of the GC as needed to make this not a regression https://bugs.webkit.org/show_bug.cgi?id=160125 Reviewed by Geoffrey Garen and Keith Miller. I needed tryFastAlignedMalloc() so I added it. * wtf/FastMalloc.cpp: (WTF::tryFastAlignedMalloc): * wtf/FastMalloc.h: * wtf/ParkingLot.cpp: (WTF::ParkingLot::forEachImpl): (WTF::ParkingLot::forEach): Deleted. * wtf/ParkingLot.h: (WTF::ParkingLot::parkConditionally): (WTF::ParkingLot::unparkOne): (WTF::ParkingLot::forEach): * wtf/ScopedLambda.h: (WTF::scopedLambdaRef): * wtf/SentinelLinkedList.h: (WTF::SentinelLinkedList::forEach): (WTF::RawNode>::takeFrom): * wtf/SimpleStats.h: (WTF::SimpleStats::operator bool): (WTF::SimpleStats::operator!): Deleted. 2016-09-02 JF Bastien bitwise_cast infinite loops if called from the default constructor in ToType https://bugs.webkit.org/show_bug.cgi?id=161365 Reviewed by Saam Barati. * wtf/StdLibExtras.h: (WTF::bitwise_cast): use aggregate initialization to avoid ctor 2016-09-01 Anders Carlsson Use BlockPtr::fromCallable in WorkQueue::dispatch and WorkQueue::dispatchAfter https://bugs.webkit.org/show_bug.cgi?id=161512 Reviewed by Chris Dumez. This lets us get rid of leakCallable and adoptCallable. * wtf/BlockPtr.h: * wtf/Function.h: * wtf/cocoa/WorkQueueCocoa.cpp: (WTF::WorkQueue::dispatch): (WTF::WorkQueue::dispatchAfter): 2016-09-01 Anders Carlsson add BlockPtr::fromCallable https://bugs.webkit.org/show_bug.cgi?id=161504 Reviewed by Tim Horton. BlockPtr::fromCallable lets you create an Objective-C block from any callable object - including lambdas that contain move-only types. The block will be allocated on the heap so it doesn't ever need to be copied (which is how it can work with move-only types). * wtf/BlockPtr.h: 2016-08-31 Keith Rollin WebKit should set a subsystem for os_log so it's easier to filter for WebKit log messages https://bugs.webkit.org/show_bug.cgi?id=160969 Reviewed by Simon Fraser. Add support for attaching a subsystem and category when logging via the RELEASE_LOG macros. This support is provided by adding subsystem and category information to WTFLogChannel. An os_log_t object is then created to enacpsulate that information. When using RELEASE_LOG to log through that channel, the associated log object is used when calling os_log. To help support the inclusion of the subsystem and category information in WTFLogChannel, the DECLARE_LOG_CHANNEL, DEFINE_LOG_CHANNEL, and LOG_CHANNEL_ADDRESS macros that were defined in various modules are consolidated and moved to Assertions.h. DEFINE_LOG_CHANNEL is now defined to initialize the subsystem and category. * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/RefCountedLeakCounter.cpp: 2016-08-31 Alex Christensen Implement IPv6 parsing in URLParser https://bugs.webkit.org/show_bug.cgi?id=161390 Reviewed by Darin Adler. * wtf/ASCIICType.h: (WTF::lowerNibbleToLowercaseASCIIHexDigit): (WTF::upperNibbleToLowercaseASCIIHexDigit): 2016-08-30 Brady Eidson GameController.framework backend for gamepad API. https://bugs.webkit.org/show_bug.cgi?id=161086 Reviewed by Alex Christensen. * wtf/RunLoop.h: (WTF::RunLoop::TimerBase::startOneShot): 2016-08-30 Mark Lam Introduce the ThrowScope and force every throw site to instantiate a ThrowScope. https://bugs.webkit.org/show_bug.cgi?id=161171 Reviewed by Filip Pizlo and Geoffrey Garen. * wtf/Platform.h: - Introduced the ENABLE(THROW_SCOPE_VERIFICATION) flag. 2016-08-27 Alex Christensen URLParser should parse relative URLs https://bugs.webkit.org/show_bug.cgi?id=161282 Reviewed by Darin Adler. * wtf/text/StringView.h: Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=. 2016-08-26 JF Bastien bitwise_cast uses inactive member of union https://bugs.webkit.org/show_bug.cgi?id=161244 Reviewed by Benjamin Poulain. * wtf/Compiler.h: Add COMPILER_HAS_CLANG_FEATURE * wtf/StdLibExtras.h: (WTF::bitwise_cast): Fix C++ UB, add trivially-copyable check. bitwise_cast stores into a union with one type and reads with another, which is technically C++ undefined behavior because it's accessing the wrong active member of the union. The better way to do this is through memcpy, which compilers optimize as well because it's known-size in known-not-to-escape storage (for small types they'll inline and then convert stack memory access to SSA values which may be in-register if that makes sense, which would be a move between int/FP registers at worst). The C++ Standard's section [basic.types] explicitly blesses memcpy: For any trivially copyable type T, if two pointers to T point to distinct T objects obj1 and obj2, where neither obj1 nor obj2 is a base-class subobject, if the underlying bytes (1.7) making up obj1 are copied into obj2, 42 obj2 shall subsequently hold the same value as obj1. [Example: T* t1p; T* t2p; // provided that t2p points to an initialized object ... std::memcpy(t1p, t2p, sizeof(T)); // at this point, every subobject of trivially copyable type in *t1p contains // the same value as the corresponding subobject in *t2p — end example ] Whereas section [class.union] says: In a union, at most one of the non-static data members can be active at any time, that is, the value of at most one of the non-static data members can be stored in a union at any time. While we're at it, checking that sizeof(To) == sizeof(From) is good, but we should also check that both types are trivially copyable (can have a ctor, no dtor, and copy is defaulted as if by memcpy for type and all subtypes). Unfortunately that trait isn't implemented consistently in all recent compiler+stdlib implementations, but recent clang has an equivalent builtin (other compilers simply won't do the check, and will break on bots with the right compilers which is better than the current silent breakage). This builtin hack also avoids #include which really doesn't save much. 2016-08-26 Johan K. Jensen Web Inspector: Frontend should have access to Resource Timing information https://bugs.webkit.org/show_bug.cgi?id=160095 Reviewed by Alex Christensen. Add method to get elapsed time for any monotonic time. Used by InspectorNetworkAgent. * wtf/Stopwatch.h: (WTF::Stopwatch::elapsedTimeSinceMonotonicTime): 2016-08-26 Csaba Osztrogonác Fix the ENABLE(WEBASSEMBLY) build on Linux https://bugs.webkit.org/show_bug.cgi?id=161197 Reviewed by Mark Lam. * wtf/Platform.h: 2016-08-25 Yusuke Suzuki [DFG][FTL] Implement ES6 Generators in DFG / FTL https://bugs.webkit.org/show_bug.cgi?id=152723 Reviewed by Filip Pizlo. * wtf/FastBitVector.h: (WTF::FastBitVector::FastBitVector): 2016-08-25 JF Bastien TryGetById should have a ValueProfile so that it can predict its output type https://bugs.webkit.org/show_bug.cgi?id=160921 Reviewed by Saam Barati. Add WTF_CONCAT to StdLibExtras.h * wtf/StdLibExtras.h: 2016-08-25 Johan K. Jensen Don't store networkLoadTiming in the disk cache https://bugs.webkit.org/show_bug.cgi?id=161161 Reviewed by Antti Koivisto. * wtf/Forward.h: Remove Encode and Decode forward declarations. 2016-08-24 Yusuke Suzuki [JSC] Move generic data structures out of B3 https://bugs.webkit.org/show_bug.cgi?id=161155 Reviewed by Saam Barati. Add IndexSet, IndexMap, and IndexedContainerIterator. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/IndexMap.h: Copied from Source/JavaScriptCore/b3/B3IndexMap.h. (WTF::IndexMap::IndexMap): (WTF::IndexMap::resize): (WTF::IndexMap::clear): (WTF::IndexMap::size): (WTF::IndexMap::operator[]): * wtf/IndexSet.h: Renamed from Source/JavaScriptCore/b3/B3IndexSet.h. (WTF::IndexSet::IndexSet): (WTF::IndexSet::add): (WTF::IndexSet::addAll): (WTF::IndexSet::remove): (WTF::IndexSet::contains): (WTF::IndexSet::size): (WTF::IndexSet::isEmpty): (WTF::IndexSet::Iterable::Iterable): (WTF::IndexSet::Iterable::iterator::iterator): (WTF::IndexSet::Iterable::iterator::operator*): (WTF::IndexSet::Iterable::iterator::operator++): (WTF::IndexSet::Iterable::iterator::operator==): (WTF::IndexSet::Iterable::iterator::operator!=): (WTF::IndexSet::Iterable::begin): (WTF::IndexSet::Iterable::end): (WTF::IndexSet::values): (WTF::IndexSet::indices): (WTF::IndexSet::dump): * wtf/IndexedContainerIterator.h: Renamed from Source/JavaScriptCore/b3/B3IndexMap.h. (WTF::IndexedContainerIterator::IndexedContainerIterator): (WTF::IndexedContainerIterator::operator++): (WTF::IndexedContainerIterator::operator==): (WTF::IndexedContainerIterator::operator!=): (WTF::IndexedContainerIterator::findNext): 2016-08-24 Andreas Kling Add WTF::isFastMallocEnabled(). Reviewed by Joseph Pecoraro. * wtf/FastMalloc.cpp: (WTF::isFastMallocEnabled): * wtf/FastMalloc.h: 2016-08-23 Anders Carlsson Add enum traits and use them in the IPC::Decoder https://bugs.webkit.org/show_bug.cgi?id=161103 Reviewed by Sam Weinig. Add EnumTraits.h which provides a forward declaration for WTF::EnumTraits as well as the WTF::isValidEnum function. * WTF.xcodeproj/project.pbxproj: * wtf/EnumTraits.h: Added. 2016-08-24 Filip Pizlo Unreviewed, roll out r204901, r204897, r204866, r204856, r204854. * wtf/FastMalloc.cpp: (WTF::tryFastAlignedMalloc): Deleted. * wtf/FastMalloc.h: * wtf/ParkingLot.cpp: (WTF::ParkingLot::forEach): (WTF::ParkingLot::forEachImpl): Deleted. * wtf/ParkingLot.h: (WTF::ParkingLot::parkConditionally): (WTF::ParkingLot::unparkOne): (WTF::ParkingLot::forEach): Deleted. * wtf/ScopedLambda.h: (WTF::scopedLambdaRef): Deleted. 2016-08-22 Filip Pizlo Butterflies should be allocated in Auxiliary MarkedSpace instead of CopiedSpace and we should rewrite as much of the GC as needed to make this not a regression https://bugs.webkit.org/show_bug.cgi?id=160125 Reviewed by Geoffrey Garen. I needed tryFastAlignedMalloc() so I added it. * wtf/FastMalloc.cpp: (WTF::fastAlignedMalloc): (WTF::tryFastAlignedMalloc): (WTF::fastAlignedFree): * wtf/FastMalloc.h: 2016-08-22 Keith Miller Actually enable the WASM build. https://bugs.webkit.org/show_bug.cgi?id=160933 Reviewed by Geoffrey Garen. * wtf/FeatureDefines.h: 2016-08-17 Don Olmstead Use find_library within Windows build https://bugs.webkit.org/show_bug.cgi?id=160904 Reviewed by Brent Fulgham. * wtf/CMakeLists.txt: 2016-08-17 Anders Carlsson Move WKSignedPublicKeyAndChallengeString into WebCore and make it proper C++ https://bugs.webkit.org/show_bug.cgi?id=160945 Reviewed by Dan Bernstein. * wtf/RetainPtr.h: (WTF::RetainPtr::operator&): Cast this to the right type. * wtf/spi/cocoa/SecuritySPI.h: Add new SPI. 2016-08-17 Antti Koivisto Remove CSS_IMAGE_SET feature define https://bugs.webkit.org/show_bug.cgi?id=160944 Reviewed by Dean Jackson. * wtf/FeatureDefines.h: 2016-08-16 Keith Miller Enable WebAssembly in the build. https://bugs.webkit.org/show_bug.cgi?id=160916 Reviewed by Benjamin Poulain. This patch turns on WebAssembly on all the platforms that support B3. Turning on WebAssembly by default lets us check the build on every platform. * wtf/FeatureDefines.h: 2016-08-16 Anders Carlsson Fix a thinko. * wtf/Scope.h: 2016-08-16 Anders Carlsson Add WTF::ScopeExit https://bugs.webkit.org/show_bug.cgi?id=160908 Reviewed by Geoffrey Garen. WTF::ScopeExit and WTF::makeScopeExit let you define an object that will invoke a function when the object goes out of scope. This is going to be used to avoid spagetti-code and gotos in a future patch. The class is modeled after the LWG paper "P0052 - Generic Scope Guard and RAII Wrapper for the Standard Library". * WTF.xcodeproj/project.pbxproj: * wtf/Scope.h: Added. (WTF::makeScopeExit): 2016-08-15 Anders Carlsson Add an address-of operator to RetainPtr https://bugs.webkit.org/show_bug.cgi?id=160879 Reviewed by Tim Horton. This will make some security-related code from WebKitSystemInterface easier to port. * wtf/HashIterators.h: (WTF::HashTableValuesIterator::get): * wtf/HashTable.h: (WTF::HashTableBucketInitializer::initialize): Use std::addressof instead of &, in case & is overloaded. * wtf/RetainPtr.h: (WTF::RetainPtr::operator&): Implement this. 2016-08-15 Sam Weinig Speed up compile times by not including wtf/Variant.h so much https://bugs.webkit.org/show_bug.cgi?id=160847 Reviewed by Alex Christensen and Saam Barati. * wtf/Forward.h: Add forward declaration of std::variant. * wtf/StdLibExtras.h: Remove references to std::variant. Move them to wtf/Variant.h 2016-08-15 Keith Miller Implement WASM Parser and B3 IR generator https://bugs.webkit.org/show_bug.cgi?id=160681 Reviewed by Benjamin Poulain. * wtf/DataLog.h: (WTF::dataLogLn): Add a new dataLog function, dataLogLn that automagically includes a new line at the end of the print. * wtf/LEBDecoder.h: (decodeUInt32): (decodeInt32): Change the LEBDecoder to take a pointer and length rather than a Vector. 2016-08-15 Keith Rollin Rename LOG_ALWAYS https://bugs.webkit.org/show_bug.cgi?id=160768 Rename LOG_ALWAYS and friends, given that the first parameter to it is a boolean expression that determines whether or not logging should be performed. Reviewed by Chris Dumez. * wtf/Assertions.h: 2016-08-15 Joseph Pecoraro Remove unused includes of wtf headers https://bugs.webkit.org/show_bug.cgi?id=160839 Reviewed by Alex Christensen. * wtf/BackwardsGraph.h: * wtf/DataLog.cpp: * wtf/WorkQueue.cpp: * wtf/text/StringImpl.cpp: * wtf/unicode/icu/CollatorICU.cpp: 2016-08-14 Daniel Bates Fix compiler errors when building iOS WebKit using the iOS 10 beta SDK https://bugs.webkit.org/show_bug.cgi?id=160725 Reviewed by Sam Weinig. For now, disable OS_LOG when building with the iOS 10 beta SDK until we have the fix for . * wtf/Platform.h: 2016-08-13 Dan Bernstein Build fix follow-up to r204433. * wtf/StdLibExtras.h: (WTF::makeVisitor): Don’t use an auto return type. 2016-08-12 Sam Weinig Make variant only available when compiling for C++14 or greater https://bugs.webkit.org/show_bug.cgi?id=160813 Reviewed by Anders Carlsson. * wtf/Compiler.h: * wtf/StdLibExtras.h: * wtf/Variant.h: 2016-08-11 Maureen Daum Add NSButtonType to AppKitCompatibilityDeclarations.h. https://bugs.webkit.org/show_bug.cgi?id=160767. Reviewed by Dan Bernstein. Add NSButtonType to AppKitCompatibilityDeclarations.h so that we can use the new names but still build successfully on older OS versions. * wtf/mac/AppKitCompatibilityDeclarations.h: 2016-08-10 Benjamin Poulain [JSC] TinyPtrSet::deleteListIfNecessary() no longer needs to test for reservedValue https://bugs.webkit.org/show_bug.cgi?id=160721 Reviewed by Sam Weinig. Previously, TinyPtrSet was using a ThinFlag if there was no OutOfLineList. A side effect is that isThin() was false for reservedValue. When deleting the list, we had to consider both cases: isThin() and reservedValue. In r204065, I changed the flag to a FatFlag to ensure TinyPtrSet can be initialized with bzero(). This changes the value of isThin() of reservedValue to true since reservedValue does not have the FatFlag bit set. This patch removes the useless condition from deleteListIfNecessary(). * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::deleteListIfNecessary): 2016-08-09 Sam Weinig Fix windows build. * wtf/Variant.h: (std::experimental::__visit_helper2::__visit): MSVC does not support extended constexpr. Use a ternary operator instead of an if statement. 2016-08-06 Sam Weinig Replace NodeOrString with std::variant, String> https://bugs.webkit.org/show_bug.cgi?id=160638 Reviewed by Anders Carlsson. * wtf/StdLibExtras.h: (WTF::Visitor::Visitor): (WTF::makeVisitor): Add WTF::makeVisitor() which takes a list of lambdas to use an an overload set for a visitor object. Also, re-export std::experimental::variant (and helpers) in the std namespace using type aliasing. * wtf/Variant.h: Make std::experimental::variant work in WebCore. 2016-08-06 Sam Weinig WTF needs a variant implementation https://bugs.webkit.org/show_bug.cgi?id=160618 Reviewed by Darin Adler. Add an implementation of std::experimental::variant matching the C++17 draft http://wg21.link/n4606 taken from https://bitbucket.org/anthonyw/variant/src (5bce47fa788648f79e5ea1d77b0eef2e8f0b2999) and modified to support compiling without exceptions (where it used to throw, we lovingly CRASH()). * WTF.xcodeproj/project.pbxproj: Add new file. * wtf/Compiler.h: Add COMPILER_SUPPORTS define for C++ exceptions. * wtf/Variant.h: Added. 2016-08-05 Keith Miller Add LEBDecoder and tests https://bugs.webkit.org/show_bug.cgi?id=160625 Reviewed by Benjamin Poulain. Adds some LEB decoder functions to WTF. These are used in the WASM spec to encode numbers in a semi-compressed format. * WTF.xcodeproj/project.pbxproj: * wtf/LEBDecoder.h: Added. (decodeUInt32): (decodeInt32): 2016-08-05 Keith Miller Delete out of date WASM code. https://bugs.webkit.org/show_bug.cgi?id=160603 Reviewed by Saam Barati. Add Feature define for WebAssembly on mac. * wtf/FeatureDefines.h: 2016-08-03 Csaba Osztrogonác Lacking support on a arm-traditional disassembler. https://bugs.webkit.org/show_bug.cgi?id=123717 Reviewed by Mark Lam. * wtf/Platform.h: 2016-08-02 Myles C. Maxfield Update breaking rules to match ICU 57 https://bugs.webkit.org/show_bug.cgi?id=160488 Reviewed by Darin Adler. This patch fixes a typo in the uax14AssignmentsAfter rules which was causing flag emoji to have line breaking opportunities in their middles. It also fixes significant language issues for languages such as Hebrew, and adds correct breaking opportunities around hyphens. * wtf/text/TextBreakIterator.cpp: (WTF::cursorMovementIterator): (WTF::uax14AssignmentsAfter): (WTF::uax14Forward): (WTF::uax14Reverse): 2016-08-02 Benjamin Poulain [JSC] Simplify the initialization of AbstractValue in the AbstractInterpreter https://bugs.webkit.org/show_bug.cgi?id=160370 Reviewed by Saam Barati. * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::set): 2016-08-02 Benjamin Poulain Clean up some useless AtomicString atoms https://bugs.webkit.org/show_bug.cgi?id=160471 Reviewed by Geoffrey Garen. * wtf/text/AtomicString.h: * wtf/text/StringStatics.cpp: (WTF::AtomicString::init): Deleted. 2016-08-01 Benjamin Poulain [JSC][ARM64] Fix branchTest32/64 taking an immediate as mask https://bugs.webkit.org/show_bug.cgi?id=160439 Reviewed by Filip Pizlo. * wtf/MathExtras.h: (getLSBSet): This was not working at all for MacroAssembler. Since TrustedImm32/64 are signed integers, the arithmetic shift would never get rid of the top bit and we get an infinite loop. 2016-07-29 Mark Lam Make StringView capable of being passed or returned in only 2 registers. https://bugs.webkit.org/show_bug.cgi?id=160344 Reviewed by Geoffrey Garen. We just need to #if out copy and move constructors and assignment operators. After this change, the following test code: JS_EXPORT_PRIVATE StringView returnStringView(StringView sv) { return sv; } ... compiles to the following for x86_64: __ZN3JSC16returnStringViewEN3WTF10StringViewE: 000000000093fb20 pushq %rbp 000000000093fb21 movq %rsp, %rbp 000000000093fb24 movq %rdi, %rax // Copy from arg word 0 to ret word 0. 000000000093fb27 movq %rsi, %rdx // Copy from arg word 1 to ret word 1. 000000000093fb2a popq %rbp 000000000093fb2b retq ... and this for arm64: __ZN3JSC16returnStringViewEN3WTF10StringViewE: 0000000000818504 ret // arg word 0 and 1 are in the same regs as ret word 0 and 1. * wtf/text/StringView.h: (WTF::StringView::StringView): (WTF::StringView::~StringView): (WTF::StringView::operator=): 2016-07-29 Csaba Osztrogonác Remove PassRef.h after r177259 https://bugs.webkit.org/show_bug.cgi?id=160348 Reviewed by Andreas Kling. * wtf/PassRef.h: Removed. 2016-07-28 Mark Lam StringView should have an explicit m_is8Bit field. https://bugs.webkit.org/show_bug.cgi?id=160282 Reviewed by Benjamin Poulain. The current implementation reserves 1 bit in the 32-bit m_length field as an is16Bit flag. As a result, a StringView is incapable of handling strings that have a length of 32-bit in size. This results in a mismatch with the expectations of String, StringImpl, and JavaScriptCore's JSString which all support a 32-bit unsigned length. This patch fixes this issue by introducing an explicit m_is8Bit field, thereby allowing m_length to be a full 32-bit again. We also introduced a clear() convenience method to set the fields of StringView to empty values. Previously, we were duplicating the code for clearing those fields. We now call clear() in all those places instead. Note: in clear(), we set m_is8Bit to true because we want an empty StringView to be 8-bit rather than 16-bit. This is consistent with what the empty() method returns. * wtf/text/StringView.h: (WTF::StringView::setUnderlyingString): (WTF::StringView::StringView): (WTF::StringView::operator=): (WTF::StringView::initialize): (WTF::StringView::clear): (WTF::StringView::empty): (WTF::StringView::length): (WTF::StringView::operator bool): (WTF::StringView::is8Bit): (WTF::StringView::substring): (WTF::StringView::getCharactersWithUpconvert): (WTF::StringView::toString): (WTF::StringView::toAtomicString): (WTF::StringView::toFloat): (WTF::StringView::toInt): (WTF::StringView::toIntStrict): (WTF::StringView::toStringWithoutCopying): (WTF::StringView::find): 2016-07-24 Filip Pizlo B3 should support multiple entrypoints https://bugs.webkit.org/show_bug.cgi?id=159391 Reviewed by Saam Barati. * wtf/GraphNodeWorklist.h: Expose some handy functionality. (WTF::GraphNodeWorklist::pop): (WTF::GraphNodeWorklist::saw): (WTF::GraphNodeWorklist::seen): * wtf/VectorTraits.h: Fix a bug! Otherwise filling a vector of byte-sized enum classes doesn't work. 2016-07-21 Myles C. Maxfield [macOS] Caret placement occurs in the middle of new emoji group candidates https://bugs.webkit.org/show_bug.cgi?id=160008 Reviewed by Simon Fraser. r203330 added support for new emoji group candidates. This patch updates the rules governing caret placement around these new emoji groups. * wtf/text/TextBreakIterator.cpp: (WTF::cursorMovementIterator): 2016-07-20 Rajeev Misra Remove unnecessary if check from ParkingLot.cpp https://bugs.webkit.org/show_bug.cgi?id=159961 Reviewed by Alex Christensen. A good practice is to have as less conditional statement or special cases as possible in code. This change simply removes a unnecessary "if" statement for condition which was already evaluated by switch/case and thus there was no need to evaluate again. * wtf/ParkingLot.cpp: 2016-07-18 Anders Carlsson WebKit nightly fails to build on macOS Sierra https://bugs.webkit.org/show_bug.cgi?id=159902 rdar://problem/27365672 Reviewed by Tim Horton. * icu/unicode/ucurr.h: Added. Add ucurr.h from ICU. 2016-07-18 Michael Saboff ASSERTION FAILED: : (year >= 1970 && yearday >= 0) || (year < 1970 && yearday < 0) -- WTF/wtf/DateMath.cpp https://bugs.webkit.org/show_bug.cgi?id=159883 Reviewed by Filip Pizlo. The function daysFrom1970ToYear() takes an integer year and returns a double result. The calculation uses 1970 as a baseline year and subtracts 1970 from the argument year. It does that subtraction using integer arithmetic, which given negative years close to INT_MIN can underflow as a result of subtracting 1970. Since we want a double result, the fix is to cast year as a double before the subtraction, which eliminates the underflow. * wtf/DateMath.cpp: (WTF::daysFrom1970ToYear): 2016-07-17 Filip Pizlo RegisterSet should use a Bitmap instead of a BitVector so that it never allocates memory and is trivial to copy https://bugs.webkit.org/show_bug.cgi?id=159863 Reviewed by Saam Barati. Give Bitmap all of the power of BitVector (except for automatic resizing). This means a variant of set() that takes a bool, and a bunch of helper methods (merge, filter, exclude, forEachSetBit, ==, !=, and hash). * wtf/Bitmap.h: (WTF::WordType>::set): (WTF::WordType>::testAndSet): (WTF::WordType>::isFull): (WTF::WordType>::merge): (WTF::WordType>::filter): (WTF::WordType>::exclude): (WTF::WordType>::forEachSetBit): (WTF::=): (WTF::WordType>::hash): 2016-07-02 Filip Pizlo WTF::Lock should be fair eventually https://bugs.webkit.org/show_bug.cgi?id=159384 Reviewed by Geoffrey Garen. In https://webkit.org/blog/6161/locking-in-webkit/ we showed how relaxing the fairness of locks makes them fast. That post presented lock fairness as a trade-off between two extremes: - Barging. A barging lock, like WTF::Lock, releases the lock in unlock() even if there was a thread on the queue. If there was a thread on the queue, the lock is released and that thread is made runnable. That thread may then grab the lock, or some other thread may grab the lock first (it may barge). Usually, the barging thread is the thread that released the lock in the first place. This maximizes throughput but hurts fairness. There is no good theoretical bound on how unfair the lock may become, but empirical data suggests that it's fair enough for the cases we previously measured. - FIFO. A FIFO lock, like HandoffLock in ToyLocks.h, does not release the lock in unlock() if there is a thread waiting. If there is a thread waiting, unlock() will make that thread runnable and inform it that it now holds the lock. This ensures perfect round-robin fairness and allows us to reason theoretically about how long it may take for a thread to grab the lock. For example, if we know that only N threads are running and each one may contend on a critical section, and each one may hold the lock for at most S seconds, then the time it takes to grab the lock is N * S. Unfortunately, FIFO locks perform very badly in most cases. This is because for the common case of short critical sections, they force a context switch after each critical section if the lock is contended. This change makes WTF::Lock almost as fair as FIFO while still being as fast as barging. Thanks to this new algorithm, you can now have both of these things at the same time. This change makes WTF::Lock eventually fair. We can almost (more on the caveats below) guarantee that the time it takes to grab a lock is N * max(1ms, S). In other words, critical sections that are longer than 1ms are always fair. For shorter critical sections, the amount of time that any thread waits is 1ms times the number of threads. There are some caveats that arise from our use of randomness, but even then, in the limit as the critical section length goes to infinity, the lock becomes fair. The corner cases are unlikely to happen; our experiments show that the lock becomes exactly as fair as a FIFO lock for any critical section that is 1ms or longer. The fairness mechanism is broken into two parts. WTF::Lock can now choose to unlock a lock fairly or unfairly thanks to the new ParkingLot token mechanism. WTF::Lock knows when to use fair unlocking based on a timeout mechanism in ParkingLot called timeToBeFair. ParkingLot::unparkOne() and ParkingLot::parkConditionally() can now communicate with each other via a token. unparkOne() can pass a token, which parkConditionally() will return. This change also makes parkConditionally() a lot more precise about when it was unparked due to a call to unparkOne(). If unparkOne() is told that a thread was unparked then this thread is guaranteed to report that it was unparked rather than timing out, and that thread is guaranteed to get the token that unparkOne() passed. The token is an intptr_t. We use it as a boolean variable in WTF::Lock, but you could use it to pass arbitrary data structures. By default, the token is zero. WTF::Lock's unlock() will pass 1 as the token if it is doing fair unlocking. In that case, unlock() will not release the lock, and lock() will know that it holds the lock as soon as parkConditionally() returns. Note that this algorithm relies on unparkOne() invoking WTF::Lock's callback while the queue lock is held, so that WTF::Lock can make a decision about unlock strategy and inject a token while it has complete knowledge over the state of the queue. As such, it's not immediately obvious how to implement this algorithm on top of futexes. You really need ParkingLot! WTF::Lock does not use fair unlocking every time. We expose a new API, Lock::unlockFairly(), which forces the fair unlocking behavior. Additionally, ParkingLot now maintains a per-bucket stochastic fairness timeout. When the timeout fires, the unparkOne() callback sees UnparkResult::timeToBeFair = true. This timeout is set to be anywhere from 0ms to 1ms at random. When a dequeue happens and there are threads that actually get dequeued, we check if the time since the last unfair unlock (the last time timeToBeFair was set to true) is more than the timeout amount. If so, then we set timeToBeFair to true and reset the timeout. This means that in the absence of ParkingLot collisions, unfair unlocking is guaranteed to happen at least once per millisecond. It will happen at 2 KHz on average. If there are collisions, then each collision adds one millisecond to the worst case (and 0.5 ms to the average case). The reason why we don't just use a fixed 1ms timeout is that we want to avoid resonance. Imagine a program in which some thread acquires a lock at 1 KHz in-phase with the timeToBeFair timeout. Then this thread would be the benefactor of fairness to the detriment of everyone else. Randomness ensures that we aren't too fair to any one thread. Empirically, this is neutral on our major benchmarks like JetStream but it's an enormous improvement in LockFairnessTest. It's common for an unfair lock (either our BargingLock, the old WTF::Lock, any of the other futex-based locks that barge, or new os_unfair_lock) to allow only one thread to hold the lock during a whole second in which each thread is holding the lock for 1ms at a time. This is because in a barging lock, releasing a lock after holding it for 1ms and then reacquiring it immediately virtually ensures that none of the other threads can wake up in time to grab it before it's relocked. But the new WTF::Lock handles this case like a champ: each thread gets equal turns. Here's some data. If we launch 10 threads and have each of them run for 1 second while repeatedly holding a critical section for 1ms, then here's how many times each thread gets to hold the lock using the old WTF::Lock algorithm: 799, 6, 1, 1, 1, 1, 1, 1, 1, 1 One thread hogged the lock for almost the whole time! With the new WTF::Lock, the lock becomes totally fair: 80, 79, 79, 79, 79, 79, 79, 80, 80, 79 I don't know of anyone creating such an automatically-fair adaptive lock before, so I think that this is a pretty awesome advancement to the state of the art! This change is good for three reasons: - We do have long critical sections in WebKit and we don't want to have to worry about starvation. This reduces the likelihood that we will see starvation due to our lock strategy. - I was talking to ggaren about bmalloc's locking needs, and he wanted unlockFairly() or lockFairly() or some moral equivalent for the scavenger thread. - If we use a WTF::Lock to manage heap access in a multithreaded GC, we'll need the ability to unlock and relock without barging. * benchmarks/LockFairnessTest.cpp: (main): * benchmarks/ToyLocks.h: * wtf/Condition.h: (WTF::ConditionBase::waitUntil): (WTF::ConditionBase::notifyOne): * wtf/Lock.cpp: (WTF::LockBase::lockSlow): (WTF::LockBase::unlockSlow): (WTF::LockBase::unlockFairlySlow): (WTF::LockBase::unlockSlowImpl): * wtf/Lock.h: (WTF::LockBase::try_lock): (WTF::LockBase::unlock): (WTF::LockBase::unlockFairly): (WTF::LockBase::isHeld): (WTF::LockBase::isFullyReset): * wtf/ParkingLot.cpp: (WTF::ParkingLot::parkConditionallyImpl): (WTF::ParkingLot::unparkOne): (WTF::ParkingLot::unparkOneImpl): (WTF::ParkingLot::unparkAll): * wtf/ParkingLot.h: (WTF::ParkingLot::parkConditionally): (WTF::ParkingLot::compareAndPark): (WTF::ParkingLot::unparkOne): 2016-07-17 Myles C. Maxfield Support new emoji group candidates https://bugs.webkit.org/show_bug.cgi?id=159755 Reviewed by Dean Jackson. This patch doesn't update the rules for our cursor movement iterator, because I don't know the language used for implementing these rules. These rules will be updated in the near future. When they do, editing/deleting/delete-emoji-expected.txt will need to be updated. * wtf/text/TextBreakIterator.cpp: (WTF::cursorMovementIterator): 2016-07-16 Chris Dumez Add move constructor / assignment operator to ListHashSet https://bugs.webkit.org/show_bug.cgi?id=159837 Reviewed by Darin Adler. Add move constructor / assignment operator to ListHashSet. * wtf/ListHashSet.h: (WTF::ListHashSetConstIterator::operator++): (WTF::U>::ListHashSet): (WTF::=): (WTF::U>::clear): (WTF::U>::appendNode): (WTF::U>::prependNode): (WTF::U>::deleteAllNodes): (WTF::ListHashSetNode::ListHashSetNode): Deleted. 2016-07-15 Chris Dumez Use emptyString() / nullAtom when possible https://bugs.webkit.org/show_bug.cgi?id=159850 Reviewed by Ryosuke Niwa. Use emptyString() / nullAtom when possible, for performance. * wtf/text/AtomicString.cpp: (WTF::AtomicString::convertASCIICase): 2016-07-15 Chris Dumez Unreviewed, rolling out r203304. This is wrong because of Node* entries in the internal HashMap Reverted changeset: "Add move constructor / assignment operator to ListHashSet" https://bugs.webkit.org/show_bug.cgi?id=159837 http://trac.webkit.org/changeset/203304 2016-07-15 Chris Dumez Add move constructor / assignment operator to ListHashSet https://bugs.webkit.org/show_bug.cgi?id=159837 Reviewed by Alex Christensen. Add move constructor / assignment operator to ListHashSet. * wtf/ListHashSet.h: 2016-07-15 Geoffrey Garen Added a makeRef helper https://bugs.webkit.org/show_bug.cgi?id=159835 Reviewed by Andreas Kling. Anders told me to! * wtf/Ref.h: (WTF::makeRef): Helper function to do type inference for you. 2016-07-15 Ryan Haddad Unreviewed, rolling out r203266. This change caused editing/deleting/delete-emoji.html to time out on El Capitan, crash under GuardMalloc Reverted changeset: "Support new emoji group candidates" https://bugs.webkit.org/show_bug.cgi?id=159755 http://trac.webkit.org/changeset/203266 2016-07-15 Csaba Osztrogonác Revert r202560 to fix the ARMv7 build with ARM instruction set https://bugs.webkit.org/show_bug.cgi?id=159707 Reviewed by Carlos Garcia Campos. * wtf/Platform.h: Revert r202560. 2016-07-14 Myles C. Maxfield Support new emoji group candidates https://bugs.webkit.org/show_bug.cgi?id=159755 Reviewed by Dean Jackson. This patch doesn't update the rules for our cursor movement iterator, because I don't know the language used for implementing these rules. These rules will be updated in the near future. When they do, editing/deleting/delete-emoji-expected.txt will need to be updated. * wtf/text/TextBreakIterator.cpp: (WTF::cursorMovementIterator): 2016-07-14 Alex Christensen Allow RefPtrs of const RefCounted types https://bugs.webkit.org/show_bug.cgi?id=158269 Reviewed by Anders Carlsson. * wtf/RefCounted.h: (WTF::RefCountedBase::ref): (WTF::RefCountedBase::~RefCountedBase): (WTF::RefCountedBase::derefBase): (WTF::RefCounted::deref): Creating references to a const object does not really modify the object, so everything in RefCounted is now mutable, and ref and deref are const. 2016-07-14 Chris Dumez Avoid an extra heap allocation when dispatching Functions to WorkQueue https://bugs.webkit.org/show_bug.cgi?id=158367 Reviewed by Anders Carlsson. Avoid an extra heap allocation when dispatching Functions to WorkQueue by adding leakCallable() / adoptCallable() functions to Function. * wtf/Function.h: * wtf/cocoa/WorkQueueCocoa.cpp: (WTF::WorkQueue::dispatch): (WTF::WorkQueue::dispatchAfter): 2016-07-13 Myles C. Maxfield Addressing post-review comments after r203119 https://bugs.webkit.org/show_bug.cgi?id=159749 Unreviewed. * wtf/text/StringView.h: (WTF::StringView::CodePoints::Iterator::Iterator): (WTF::StringView::CodePoints::Iterator::operator*): (WTF::StringView::CodePoints::Iterator::operator==): 2016-07-13 Enrica Casucci Update supported platforms in xcconfig files to match the sdk names. https://bugs.webkit.org/show_bug.cgi?id=159728 Reviewed by Tim Horton. * Configurations/Base.xcconfig: 2016-07-13 Carlos Garcia Campos [GTK] WebKitGtk+ uses too many file descriptors https://bugs.webkit.org/show_bug.cgi?id=152316 Reviewed by Michael Catanzaro. Add helper functions to duplicate a file descriptor setting close on exec flag, and also to set close on exec flag to an existing file descriptor. * wtf/UniStdExtras.h: * wtf/UniStdExtras.cpp (WTF::setCloseOnExec): (WTF::dupCloseOnExec): 2016-07-12 Benjamin Poulain [JSC] Array.prototype.join() fails some conformance tests https://bugs.webkit.org/show_bug.cgi?id=159657 Reviewed by Saam Barati. * wtf/text/AtomicString.cpp: (WTF::AtomicString::number): * wtf/text/AtomicString.h: 2016-07-12 Commit Queue Unreviewed, rolling out r203131. https://bugs.webkit.org/show_bug.cgi?id=159698 This change caused an existing LayoutTest to time out on debug testers (Requested by ryanhaddad on #webkit). Reverted changeset: "[JSC] Array.prototype.join() fails some conformance tests" https://bugs.webkit.org/show_bug.cgi?id=159657 http://trac.webkit.org/changeset/203131 2016-07-12 Filip Pizlo platformUserPreferredLanguages on Mac should not try to put the region into the language https://bugs.webkit.org/show_bug.cgi?id=159693 Rubber stamped by Alexey Proskuryakov. Currently, navigator.language is the thing that we use as the BCP-47 tag in our Intl code when certain APIs are called without a locale argument. That mostly makes sense, and is deeply wired into our engine. In r200105, we made Intl aware of the region as a separate thing from the language by having platformUserPreferredLanguages() return something like a BCP-47 tag that was -. For example, if I told System Preferences that I want to speak English but live in Poland then we'd get "en-pl". This had the effect of making Intl APIs format dates using Polish formatting, for example. But this is an odd change, since that same function also feeds into navigator.language. "en-pl" isn't what we want there, since my System Preferences settings aren't supposed to mean that I want to speak Polish-style English. There's no such thing. It may be worthwhile to wire the region settings more elegantly into Intl, but if we do that, it should be via a mechanism that is separate from navigator.language. So, this change simply reverts r200105. * wtf/PlatformUserPreferredLanguagesMac.mm: (WTF::httpStyleLanguageCode): (WTF::platformUserPreferredLanguages): (WTF::isValidICUCountryCode): Deleted. 2016-07-12 Per Arne Vollan [Win] Fix for build error when trying to version stamp dll. https://bugs.webkit.org/show_bug.cgi?id=159692 Reviewed by Brent Fulgham. Use correct path to version stamp script. * wtf/CMakeLists.txt: 2016-07-12 Benjamin Poulain [JSC] Array.prototype.join() fails some conformance tests https://bugs.webkit.org/show_bug.cgi?id=159657 Reviewed by Saam Barati. * wtf/text/AtomicString.cpp: (WTF::AtomicString::number): * wtf/text/AtomicString.h: 2016-07-12 Myles C. Maxfield Relax ordering requirements on StringView::CodePoints iterator https://bugs.webkit.org/show_bug.cgi?id=159609 Reviewed by Darin Adler. Previously, there was a requirement where if you use a CodePoints iterator, you couldn't dereference twice in a row or increment twice in a row. This restriction is unnecessary. * wtf/text/StringView.h: (WTF::StringView::CodePoints::Iterator::Iterator): (WTF::StringView::CodePoints::Iterator::advanceCurrentCodePoint): (WTF::StringView::CodePoints::Iterator::operator*): (WTF::StringView::CodePoints::Iterator::operator==): 2016-07-12 Csaba Osztrogonác JSCOnly bulidfix after r203078 https://bugs.webkit.org/show_bug.cgi?id=159669 Reviewed by Yusuke Suzuki. * wtf/PlatformJSCOnly.cmake: * wtf/text/jsconly/TextBreakIteratorInternalICUJSCOnly.cpp: Added. (WTF::currentSearchLocaleID): (WTF::currentTextBreakLocaleID): 2016-07-12 Per Arne Vollan [Win] DLLs are missing version information. https://bugs.webkit.org/show_bug.cgi?id=159349 Reviewed by Brent Fulgham. Generate autoversion.h and run perl version stamp utility. * wtf/CMakeLists.txt: 2016-07-11 Myles C. Maxfield Implement grapheme cluster iterator on StringView https://bugs.webkit.org/show_bug.cgi?id=159598 Reviewed by Anders Carlsson. This is in preparation for honoring the second argument to FontFaceSet.load(). * wtf/text/StringView.cpp: (WTF::StringView::GraphemeClusters::Iterator::Impl::Impl): (WTF::StringView::GraphemeClusters::Iterator::Impl::operator++): (WTF::StringView::GraphemeClusters::Iterator::Impl::operator*): (WTF::StringView::GraphemeClusters::Iterator::Impl::operator==): (WTF::StringView::GraphemeClusters::Iterator::Impl::computeIndexEnd): (WTF::StringView::GraphemeClusters::Iterator::Iterator): (WTF::StringView::GraphemeClusters::Iterator::~Iterator): (WTF::StringView::GraphemeClusters::Iterator::operator*): (WTF::StringView::GraphemeClusters::Iterator::operator==): (WTF::StringView::GraphemeClusters::Iterator::operator!=): * wtf/text/StringView.h: (WTF::StringView::GraphemeClusters::GraphemeClusters): * text/TextBreakIterator.cpp: (WebCore::NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator): * text/TextBreakIterator.h: 2016-07-10 Myles C. Maxfield Move breaking iterator code to WTF https://bugs.webkit.org/show_bug.cgi?id=159594 Reviewed by Alex Christensen. This is in preparation for giving StringView a GraphemeClusters iterator. Such an interator needs to be implemented on top of our breaking iterator code. * WTF.xcodeproj/project.pbxproj: * icu/unicode/ubrk.h: Added. * icu/unicode/utext.h: Renamed from Source/WebCore/icu/unicode/utext.h. * wtf/CMakeLists.txt: * wtf/PlatformEfl.cmake: * wtf/PlatformGTK.cmake: * wtf/PlatformMac.cmake: * wtf/PlatformWin.cmake: * wtf/TinyLRUCache.h: * wtf/text/LineBreakIteratorPoolICU.h: Renamed from Source/WebCore/platform/text/LineBreakIteratorPoolICU.h. (WTF::LineBreakIteratorPool::LineBreakIteratorPool): (WTF::LineBreakIteratorPool::sharedPool): (WTF::LineBreakIteratorPool::makeLocaleWithBreakKeyword): (WTF::LineBreakIteratorPool::take): (WTF::LineBreakIteratorPool::put): * wtf/text/TextBreakIterator.cpp: Renamed from Source/WebCore/platform/text/TextBreakIterator.cpp. (WTF::initializeIterator): (WTF::initializeIteratorWithRules): (WTF::setTextForIterator): (WTF::setContextAwareTextForIterator): (WTF::wordBreakIterator): (WTF::sentenceBreakIterator): (WTF::cursorMovementIterator): (WTF::acquireLineBreakIterator): (WTF::releaseLineBreakIterator): (WTF::mapLineIteratorModeToRules): (WTF::isCJKLocale): (WTF::openLineBreakIterator): (WTF::closeLineBreakIterator): (WTF::compareAndSwapNonSharedCharacterBreakIterator): (WTF::NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator): (WTF::NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator): (WTF::textBreakFirst): (WTF::textBreakLast): (WTF::textBreakNext): (WTF::textBreakPrevious): (WTF::textBreakPreceding): (WTF::textBreakFollowing): (WTF::textBreakCurrent): (WTF::isTextBreak): (WTF::isWordTextBreak): (WTF::numGraphemeClusters): (WTF::numCharactersInGraphemeClusters): * wtf/text/TextBreakIterator.h: Renamed from Source/WebCore/platform/text/TextBreakIterator.h. (WTF::LazyLineBreakIterator::LazyLineBreakIterator): (WTF::LazyLineBreakIterator::~LazyLineBreakIterator): (WTF::LazyLineBreakIterator::string): (WTF::LazyLineBreakIterator::isLooseCJKMode): (WTF::LazyLineBreakIterator::lastCharacter): (WTF::LazyLineBreakIterator::secondToLastCharacter): (WTF::LazyLineBreakIterator::setPriorContext): (WTF::LazyLineBreakIterator::updatePriorContext): (WTF::LazyLineBreakIterator::resetPriorContext): (WTF::LazyLineBreakIterator::priorContextLength): (WTF::LazyLineBreakIterator::get): (WTF::LazyLineBreakIterator::resetStringAndReleaseIterator): (WTF::NonSharedCharacterBreakIterator::operator TextBreakIterator*): * wtf/text/TextBreakIteratorInternalICU.h: Renamed from Source/WebCore/platform/text/TextBreakIteratorInternalICU.h. * wtf/text/efl/TextBreakIteratorInternalICUEfl.cpp: Renamed from Source/WebCore/platform/text/efl/TextBreakIteratorInternalICUEfl.cpp. (WebCore::currentSearchLocaleID): (WebCore::currentTextBreakLocaleID): * wtf/text/gtk/TextBreakIteratorInternalICUGtk.cpp: Renamed from Source/WebCore/platform/text/gtk/TextBreakIteratorInternalICUGtk.cpp. (WebCore::currentSearchLocaleID): (WebCore::currentTextBreakLocaleID): * wtf/text/icu/UTextProvider.cpp: Renamed from Source/WebCore/platform/text/icu/UTextProvider.cpp. (WTF::fixPointer): (WTF::uTextCloneImpl): * wtf/text/icu/UTextProvider.h: Renamed from Source/WebCore/platform/text/icu/UTextProvider.h. (WTF::uTextProviderContext): (WTF::initializeContextAwareUTextProvider): (WTF::uTextAccessPinIndex): (WTF::uTextAccessInChunkOrOutOfRange): * wtf/text/icu/UTextProviderLatin1.cpp: Renamed from Source/WebCore/platform/text/icu/UTextProviderLatin1.cpp. (WTF::uTextLatin1Clone): (WTF::uTextLatin1NativeLength): (WTF::uTextLatin1Access): (WTF::uTextLatin1Extract): (WTF::uTextLatin1MapOffsetToNative): (WTF::uTextLatin1MapNativeIndexToUTF16): (WTF::uTextLatin1Close): (WTF::openLatin1UTextProvider): (WTF::textLatin1ContextAwareGetCurrentContext): (WTF::textLatin1ContextAwareMoveInPrimaryContext): (WTF::textLatin1ContextAwareSwitchToPrimaryContext): (WTF::textLatin1ContextAwareMoveInPriorContext): (WTF::textLatin1ContextAwareSwitchToPriorContext): (WTF::uTextLatin1ContextAwareClone): (WTF::uTextLatin1ContextAwareNativeLength): (WTF::uTextLatin1ContextAwareAccess): (WTF::uTextLatin1ContextAwareExtract): (WTF::uTextLatin1ContextAwareClose): (WTF::openLatin1ContextAwareUTextProvider): * wtf/text/icu/UTextProviderLatin1.h: Renamed from Source/WebCore/platform/text/icu/UTextProviderLatin1.h. * wtf/text/icu/UTextProviderUTF16.cpp: Renamed from Source/WebCore/platform/text/icu/UTextProviderUTF16.cpp. (WTF::textUTF16ContextAwareGetCurrentContext): (WTF::textUTF16ContextAwareMoveInPrimaryContext): (WTF::textUTF16ContextAwareSwitchToPrimaryContext): (WTF::textUTF16ContextAwareMoveInPriorContext): (WTF::textUTF16ContextAwareSwitchToPriorContext): (WTF::uTextUTF16ContextAwareClone): (WTF::uTextUTF16ContextAwareNativeLength): (WTF::uTextUTF16ContextAwareAccess): (WTF::uTextUTF16ContextAwareExtract): (WTF::uTextUTF16ContextAwareClose): (WTF::openUTF16ContextAwareUTextProvider): * wtf/text/icu/UTextProviderUTF16.h: Renamed from Source/WebCore/platform/text/icu/UTextProviderUTF16.h. * wtf/text/mac/TextBreakIteratorInternalICUMac.mm: Renamed from Source/WebCore/platform/text/mac/TextBreakIteratorInternalICUMac.mm. (WTF::textBreakLocalePreference): (WTF::topLanguagePreference): (WTF::getLocale): (WTF::getSearchLocale): (WTF::currentSearchLocaleID): (WTF::getTextBreakLocale): (WTF::currentTextBreakLocaleID): * wtf/text/win/TextBreakIteratorInternalICUWin.cpp: Renamed from Source/WebCore/platform/text/win/TextBreakIteratorInternalICUWin.cpp. (WebCore::currentSearchLocaleID): (WebCore::currentTextBreakLocaleID): 2016-07-08 Commit Queue Unreviewed, rolling out r202799. https://bugs.webkit.org/show_bug.cgi?id=159568 Caused build failure (Requested by perarne on #webkit). Reverted changeset: "[Win] DLLs are missing version information." https://bugs.webkit.org/show_bug.cgi?id=159349 http://trac.webkit.org/changeset/202799 2016-07-08 Jiewen Tan Define DYLD_MACOSX_VERSION_10_12 https://bugs.webkit.org/show_bug.cgi?id=159525 Reviewed by Brent Fulgham. * wtf/spi/darwin/dyldSPI.h: 2016-07-01 Jer Noble REGRESSION (r202641): Netflix playback stalls after a few seconds https://bugs.webkit.org/show_bug.cgi?id=159365 Reviewed by Eric Carlson. Add a isBetween() convenience method. * wtf/MediaTime.cpp: (WTF::MediaTime::isBetween): * wtf/MediaTime.h: 2016-07-03 Per Arne Vollan [Win] DLLs are missing version information. https://bugs.webkit.org/show_bug.cgi?id=159349 Reviewed by Brent Fulgham. Generate autoversion.h in the prebuild step. Run the perl version stamp utility. * wtf/CMakeLists.txt: 2016-07-03 Saam Barati BytecodeGenerator::getVariablesUnderTDZ is too conservative https://bugs.webkit.org/show_bug.cgi?id=159387 Reviewed by Filip Pizlo. I've templatized SmallPtrSet on its SmallArraySize instead of it always being 8. * wtf/SmallPtrSet.h: (WTF::SmallPtrSet::SmallPtrSet): (WTF::SmallPtrSet::add): (WTF::SmallPtrSet::iterator::operator!=): (WTF::SmallPtrSet::bucket): 2016-07-03 Filip Pizlo Ugh. Once again, unreviewed, roll out unintentional commit in r202790. * benchmarks/LockFairnessTest.cpp: (main): 2016-07-02 Dan Bernstein Build fix. * wtf/Assertions.cpp: 2016-07-02 Filip Pizlo Unreviewed, roll back unintentional commit in r202778. * benchmarks/LockFairnessTest.cpp: (main): 2016-07-01 Jer Noble Deadlock inside -[WebCoreNSURLSession dealloc] https://bugs.webkit.org/show_bug.cgi?id=159331 Reviewed by Alex Christensen. A Function<> object can wrap any callable type, including a C++ lambda. dispatchFunctionsFromMainThread() holds a lock while iterating over the functions in functionQueue(), and during ths iteration, the previous callable object is destroyed by assigning the result of functionQueue().takeFirst(). Because lambdas (and other callables, like functors) can own objects, destroying this callable can have side effects, and if one of those side effects is to call callOnMainThread(), this can deadlock. Move this side-effect-having call outside the locked block by clearing the function object immediately after calling it. * wtf/MainThread.cpp: (WTF::dispatchFunctionsFromMainThread): 2016-06-29 Jer Noble Adopt MediaRemote. https://bugs.webkit.org/show_bug.cgi?id=159250 Reviewed by Eric Carlson. Add USE_MEDIAREMOTE. * wtf/Platform.h: 2016-06-28 Commit Queue Unreviewed, rolling out r202580. https://bugs.webkit.org/show_bug.cgi?id=159245 Caused all WKTR tests to fail on GuardMalloc and Production only for unknown reasons, investigating offline. (Requested by brrian on #webkit). Reverted changeset: "RunLoop::Timer should use constructor templates instead of class templates" https://bugs.webkit.org/show_bug.cgi?id=159153 http://trac.webkit.org/changeset/202580 2016-06-28 Brian Burg RunLoop::Timer should use constructor templates instead of class templates https://bugs.webkit.org/show_bug.cgi?id=159153 Reviewed by Alex Christensen. Refactor RunLoop::Timer to align with WebCore::Timer. Use a constructor template instead of a class template. Store a bound std::function rather than a templated member and function. Add a constructor that takes a std::function. * wtf/RunLoop.h: (WTF::RunLoop::Timer::Timer): (WTF::RunLoop::Timer::fired): 2016-06-28 Tomas Popela THUMB2 support not correctly detected on Fedora with GCC 6.1. https://bugs.webkit.org/show_bug.cgi?id=159083 Reviewed by Carlos Garcia Campos. On Fedora 24 with GCC 6.1. the __thumb2__ and __thumb__ are not defined so the detection of THUMB2 support will fail. Look also whether the __ARM_ARCH_ISA_THUMB is defined to fix the THUMB2 detection. * wtf/Platform.h: 2016-06-27 Joseph Pecoraro Remove now unused WTF::findNextLineStart https://bugs.webkit.org/show_bug.cgi?id=159157 Reviewed by Mark Lam. Unused after r202498. * wtf/text/StringImpl.cpp: (WTF::StringImpl::findNextLineStart): Deleted. * wtf/text/StringImpl.h: (WTF::findNextLineStart): Deleted. * wtf/text/WTFString.h: (WTF::String::findNextLineStart): Deleted. 2016-06-21 Anders Carlsson Rename NoncopyableFunction to Function https://bugs.webkit.org/show_bug.cgi?id=158354 Reviewed by Chris Dumez. * WTF.xcodeproj/project.pbxproj: * wtf/CrossThreadTask.h: (WTF::CrossThreadTask::CrossThreadTask): * wtf/Function.h: Renamed from Source/WTF/wtf/NoncopyableFunction.h. * wtf/FunctionDispatcher.h: * wtf/MainThread.cpp: (WTF::functionQueue): (WTF::dispatchFunctionsFromMainThread): (WTF::callOnMainThread): * wtf/MainThread.h: * wtf/RunLoop.cpp: (WTF::RunLoop::performWork): (WTF::RunLoop::dispatch): * wtf/RunLoop.h: * wtf/WorkQueue.h: * wtf/cocoa/WorkQueueCocoa.cpp: (WTF::WorkQueue::dispatch): (WTF::WorkQueue::dispatchAfter): * wtf/efl/DispatchQueueWorkItemEfl.h: (WorkItem::WorkItem): (TimerWorkItem::create): (TimerWorkItem::TimerWorkItem): * wtf/efl/WorkQueueEfl.cpp: (WTF::WorkQueue::dispatch): (WTF::WorkQueue::dispatchAfter): * wtf/generic/RunLoopGeneric.cpp: (WTF::RunLoop::TimerBase::ScheduledTask::create): (WTF::RunLoop::TimerBase::ScheduledTask::ScheduledTask): (WTF::RunLoop::dispatchAfter): * wtf/generic/WorkQueueGeneric.cpp: (WorkQueue::dispatch): (WorkQueue::dispatchAfter): * wtf/glib/RunLoopGLib.cpp: (WTF::DispatchAfterContext::DispatchAfterContext): (WTF::RunLoop::dispatchAfter): * wtf/win/WorkItemWin.cpp: (WTF::WorkItemWin::WorkItemWin): (WTF::WorkItemWin::create): (WTF::HandleWorkItem::HandleWorkItem): (WTF::HandleWorkItem::createByAdoptingHandle): * wtf/win/WorkItemWin.h: (WTF::WorkItemWin::function): * wtf/win/WorkQueueWin.cpp: (WTF::WorkQueue::dispatch): (WTF::WorkQueue::dispatchAfter): 2016-06-23 David Kilzer REGRESSION (r202380): iOS 9.x internal builds are broken Follow-up fix for: Enable window.open() for existing versions of Secret Society * wtf/spi/darwin/dyldSPI.h: Define DYLD_IOS_VERSION_10_0 when building on internal SDKs older than iOS 10. 2016-06-23 John Wilander Enable window.open() for existing versions of Secret Society https://bugs.webkit.org/show_bug.cgi?id=159049 Reviewed by Andy Estes. The Secret Society Hidden Mystery app has a broken version check treating iOS 10 as iOS 1 on iPads. Therefore it believes it can use window.open() in a tap handler. We should allow the existing versions of the app to do this to not break them. * wtf/spi/darwin/dyldSPI.h: Added DYLD_IOS_VERSION_10_0. 2016-06-21 Said Abou-Hallawa Add system tracing points for requestAnimationFrame() workflow https://bugs.webkit.org/show_bug.cgi?id=158723 Reviewed by Simon Fraser. Define new trace score codes for requestAnimationFrame(). * wtf/SystemTracing.h: (WTF::TracePoint): (WTF::TraceScope::TraceScope): (WTF::TraceScope::~TraceScope): 2016-06-20 Commit Queue Unreviewed, rolling out r202136. https://bugs.webkit.org/show_bug.cgi?id=158932 JSBench wasn't regressed by r202002 and r202111 on iOS after all (Requested by rniwa_ on #webkit). Reverted changeset: "Unreviewed, rolling out r202002 and r202111." https://bugs.webkit.org/show_bug.cgi?id=158638 http://trac.webkit.org/changeset/202136 2016-06-17 Chris Dumez Optimize parseCacheHeader() by using StringView https://bugs.webkit.org/show_bug.cgi?id=158891 Reviewed by Darin Adler. Add a StringView::find() overload which takes a CharacterMatchFunction to match the one on String. * wtf/text/StringView.h: (WTF::StringView::find): 2016-06-17 Mark Lam OOM Assertion failure in JSON.stringify. https://bugs.webkit.org/show_bug.cgi?id=158794 Reviewed by Saam Barati. The bug was actually in StringBuilder::appendQuotedJSONString() where it failed to detect an imminent unsigned int overflow. The fix is to use Checked for the needed math, and RELEASE_ASSERT afterwards that we did not overflow. I also added more assertions to detect sooner if any there are any problems with StringBuilder's m_buffer or m_length being incorrectly sized. These assertions have been run on the JSC and layout tests without any issue. * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::resize): (WTF::StringBuilder::allocateBuffer): (WTF::StringBuilder::allocateBufferUpConvert): (WTF::StringBuilder::reallocateBuffer): (WTF::StringBuilder::reallocateBuffer): (WTF::StringBuilder::reserveCapacity): (WTF::StringBuilder::appendUninitializedSlow): (WTF::StringBuilder::append): (WTF::StringBuilder::appendQuotedJSONString): * wtf/text/StringBuilder.h: (WTF::StringBuilder::swap): 2016-06-14 Filip Pizlo Baseline JIT should be concurrent https://bugs.webkit.org/show_bug.cgi?id=158755 Reviewed by Geoffrey Garen. The concurrent baseline JIT needs to be able to clone bytecode to get a consistent snapshot. So, this adds such a method. * wtf/RefCountedArray.h: (WTF::RefCountedArray::RefCountedArray): (WTF::RefCountedArray::clone): 2016-06-16 Chris Dumez No need to ref connection in lambda inside NetworkResourceLoader::tryStoreAsCacheEntry() https://bugs.webkit.org/show_bug.cgi?id=158862 Reviewed by Darin Adler. Add NoncopyableFunction constructor that takes a nullptr_t in, in order to match the std::function API and make porting from one to the other easier. * wtf/NoncopyableFunction.h: 2016-06-16 Chris Dumez Unreviewed, rolling out r202002 and r202111. Ryosuke says this was a JSBench regression on iOS Reverted changesets: "Make HashMap and HashSet work with Refs" https://bugs.webkit.org/show_bug.cgi?id=158638 http://trac.webkit.org/changeset/202002 "Improve HashMap and HashSet support for Ref" https://bugs.webkit.org/show_bug.cgi?id=158789 http://trac.webkit.org/changeset/202111 2016-06-15 Chris Dumez [Cocoa] Clean up / optimize ResourceResponse::platformLazyInit(InitLevel) https://bugs.webkit.org/show_bug.cgi?id=158809 Reviewed by Darin Adler. Add toAtomicString() method to StringView to avoid having to call toString() and then atomizing the String at call sites. * wtf/text/StringView.h: (WTF::StringView::toAtomicString): 2016-06-15 Sam Weinig Improve HashMap and HashSet support for Ref https://bugs.webkit.org/show_bug.cgi?id=158789 Reviewed by Chris Dumez. Tests: Add more cases to WTF_HashMap.Ref_Key, WTF_HashMap.Ref_Value and WTF_HashSet.Ref * wtf/HashMap.h: * wtf/HashSet.h: Add a MappedTakeType typedef and rework the take functions to use it and HashTraits::take(...). * wtf/HashTraits.h: (WTF::GenericHashTraits::assignToEmpty): Move to GenericHashTraits rather than GenericHashTraitsBase, since it is not different between integral and non-integral HashTraits. (WTF::GenericHashTraits::take): Add a trait function for take that defaults as a forward. This allows us to override take just like we do with get/peek. (WTF::HashTraits>::emptyValue): Remove unnecessary explicit construction. (WTF::HashTraits>::peek): Fix assertion that could happen if you did a HashMap.get() on an empty Ref value. (WTF::HashTraits>::take): Make the TakeType of a Ref

be Optional>, to avoid having empty Refs returned from HashMap and HashSet. Implement an explicit take() function to construct one. (WTF::HashTraits>::customDeleteBucket): Deleted. Remove unnecessary customDeleteBucket implementation. Ref does not assign nullptr to it's m_ptr in destruction, so there is no dead store to avoid here. * wtf/Ref.h: (WTF::Ref::ptrAllowingHashTableEmptyValue): Add HashTrait helper to allow getting the value of m_ptr even when it is null. This allows us to avoid a branch in HashTraits>::peek(). 2016-06-15 Konstantin Tokarev Only Mac port needs ObjC API for JSC https://bugs.webkit.org/show_bug.cgi?id=158780 Reviewed by Philippe Normand. * wtf/FeatureDefines.h: 2016-06-15 Yusuke Suzuki Unreviewed, follow up patch for r202092 https://bugs.webkit.org/show_bug.cgi?id=158661 During checking Windows port on EWS, accidentally introduce the regression. * wtf/Platform.h: 2016-06-15 Yusuke Suzuki [JSC] Move calling convention flags to WTF https://bugs.webkit.org/show_bug.cgi?id=158661 Reviewed by Keith Miller. * wtf/Platform.h: 2016-06-14 Myles C. Maxfield Honor bidi unicode codepoints https://bugs.webkit.org/show_bug.cgi?id=149170 Reviewed by Simon Fraser. * wtf/unicode/CharacterNames.h: 2016-06-14 Commit Queue Unreviewed, rolling out r202057. https://bugs.webkit.org/show_bug.cgi?id=158749 This change broke the Windows build. (Requested by ryanhaddad on #webkit). Reverted changeset: "Honor bidi unicode codepoints" https://bugs.webkit.org/show_bug.cgi?id=149170 http://trac.webkit.org/changeset/202057 2016-06-14 Myles C. Maxfield Honor bidi unicode codepoints https://bugs.webkit.org/show_bug.cgi?id=149170 Reviewed by Simon Fraser. * wtf/unicode/CharacterNames.h: 2016-06-13 Alex Christensen Add WebSocketProvider stub https://bugs.webkit.org/show_bug.cgi?id=158702 Reviewed by Brady Eidson. * wtf/UniqueRef.h: (WTF::UniqueRef::operator->): (WTF::UniqueRef::operator T&): (WTF::UniqueRef::operator const T&): Added operator T& to avoid unneeded .get() calls. 2016-06-13 Sam Weinig Make HashMap and HashSet work with Refs https://bugs.webkit.org/show_bug.cgi?id=158638 Reviewed by Darin Adler. * wtf/GetPtr.h: Move HashTableDeletedValueType and HashTableEmptyValueType here, as they are now shared by more than one smart pointer. This file should probably be renamed to something else at some point to indicate that it contains helpers for pointer and ref related functionality. * wtf/HashFunctions.h: Add a DefaultHash for Refs. Customize the PtrHash to indicate that it is not safe to compare to empty or deleted Refs. * wtf/HashMap.h: (WTF::HashMapTranslator::equal): (WTF::HashMapTranslator::translate): (WTF::HashMapEnsureTranslator::equal): (WTF::HashMapEnsureTranslator::translate): * wtf/HashSet.h: (WTF::IdentityExtractor::extract): (WTF::HashSetTranslator::hash): (WTF::HashSetTranslator::equal): (WTF::HashSetTranslator::translate): * wtf/HashTable.h: (WTF::IdentityHashTranslator::hash): (WTF::IdentityHashTranslator::equal): (WTF::IdentityHashTranslator::translate): Use the new assignToEmpty trait function to allow uninitialized Ref's to be safely assigned to. * wtf/HashTraits.h: (WTF::HashTraits>::emptyValue): (WTF::HashTraits>::isEmptyValue): (WTF::HashTraits>::assignToEmpty): (WTF::HashTraits>::peek): (WTF::HashTraits>::customDeleteBucket): Add custom HashTraits for Ref. Also, introduce a new trait function, assignToEmpty, for use in translation assignments. This is necessary since the default assignment operator for Ref will not allow assignment to the empty Ref, which we need to do here. * wtf/Ref.h: (WTF::Ref::operator=): (WTF::Ref::Ref): (WTF::Ref::isHashTableDeletedValue): (WTF::Ref::hashTableDeletedValue): (WTF::Ref::isHashTableEmptyValue): (WTF::Ref::hashTableEmptyValue): Add explicit constructors/predicates for making deleted/empty Refs. (WTF::Ref::assignToHashTableEmptyValue): Add a special function that allows assignment to an empty Ref, which the assignment operator does not. (WTF::IsSmartPtr): Add an IsSmartPtr override to indicate that Ref is a smart pointer. * wtf/RefPtr.h: Move HashTableDeletedValueType to GetPtr.h. 2016-06-13 Fujii Hironori Stack overflow at RefPtr::release on Windows port since r201782 https://bugs.webkit.org/show_bug.cgi?id=158687 Reviewed by Chris Dumez. RefPtr::release calls RefPtr::RefPtr, and RefPtr::RefPtr calls RefPtr::release. RefPtr::RefPtr does not need to call RefPtr::release. * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Do not call RefPtr::release. 2016-06-11 Myles C. Maxfield Addressing post-review comments after r201978. https://bugs.webkit.org/show_bug.cgi?id=158649 Unreviewed. * wtf/text/StringCommon.h: (WTF::equal): (WTF::naiveEqualWithoutPerformingUnicodeNormalization): Deleted. 2016-06-11 Myles C. Maxfield [Cocoa] Map commonly used Chinese Windows font names to names present on Cocoa operating systems https://bugs.webkit.org/show_bug.cgi?id=158649 Reviewed by Darin Adler. * wtf/text/StringCommon.h: (WTF::naiveEqualWithoutPerformingUnicodeNormalization): Added. 2016-06-11 Chris Dumez WorkerNavigator is missing some attributes https://bugs.webkit.org/show_bug.cgi?id=158593 Reviewed by Darin Adler. * wtf/PlatformUserPreferredLanguages.h: * wtf/PlatformUserPreferredLanguagesWin.cpp: (WTF::platformLanguage): (WTF::platformUserPreferredLanguages): Make platformUserPreferredLanguages() thread safe on Windows. The Mac and Unix implementations are already thread-safe. HAS_FASTCALL_CALLING_CONVENTION is changed to COMPILER_SUPPORTS(FASTCALL_CALLING_CONVENTION). 2016-06-10 Alex Christensen Introduce WTF::UniqueRef https://bugs.webkit.org/show_bug.cgi?id=158596 Reviewed by Brady Eidson. WTF::UniqueRef is like a std::unique_ptr that is guaranteed to be non-null. std::make_unique returns a non-null value that is put into a std::unique_ptr, a type that could contain null values. To be able to pass such values around and store them without wondering if they are null, we now have WTF::UniqueRef which cannot be null. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/UniqueRef.h: Added. (WTF::makeUniqueRef): (WTF::UniqueRef::UniqueRef): (WTF::UniqueRef::get): (WTF::UniqueRef::operator&): (WTF::UniqueRef::operator->): 2016-06-09 Brady Eidson Unaddressed review feedback from r201872 * wtf/CrossThreadTask.h: (WTF::callFunctionForCrossThreadTask): Fix typo. 2016-06-09 Brady Eidson Greatly simplify CrossThreadTask.h. https://bugs.webkit.org/show_bug.cgi?id=158542 Reviewed by Darin Adler. * wtf/CrossThreadTask.h: (WTF::crossThreadCopy): (WTF::callFunctionForCrossThreadTaskImpl): (WTF::callFunctionForCrossThreadTask): (WTF::createCrossThreadTask): (WTF::callMemberFunctionForCrossThreadTaskImpl): (WTF::callMemberFunctionForCrossThreadTask): 2016-06-08 Brady Eidson Make CrossThreadCopier more efficient (fewer copies!). https://bugs.webkit.org/show_bug.cgi?id=158456 Reviewed by Alex Christensen. Previously, we'd run all arguments through CrossThreadCopier, then immediately make an unnecessary copy of the result during lambda capture. Instead, we should just put the CrossThreadCopier generated objects directly in lambdas, which are then captured by NoncopyableFunctions. This reduces the number of constructor calls per argument from 2 copies to 1 move. * wtf/CrossThreadTask.h: (WTF::CrossThreadTask::CrossThreadTask): (WTF::createCrossThreadTask): 2016-06-07 Filip Pizlo Implement Air::allocateStack() in ES6 to see how much of a bad idea that is https://bugs.webkit.org/show_bug.cgi?id=158318 Reviewed by Saam Barati. * wtf/Insertion.h: (WTF::executeInsertions): I found a bug while rewriting this code in JS. * wtf/PrintStream.h: (WTF::PrintStream::print): (WTF::PrintStream::println): This is useful to have. 2016-06-07 Keith Rollin Remove all uses of PassRefPtr in WTF https://bugs.webkit.org/show_bug.cgi?id=157596 Reviewed by Chris Dumez. Remove/update most interfaces that take or return PassRefPtrs. Remaining references include those in non-Cocoa implementations and those required for continued compatibility with modules that still use PassRefPtrs (specifically: Forward.h, RefPtr interoperability, SizeLimits.h, WorkQueue (Windows) DispatchQueueEfl, DispatchWorkItemEfl, and PassRefPtr itself). Update calls to interfaces that no longer take or return PassRefPtrs. Update adoptRef(T*) to return a RefPtr instead of a PassRefPtr and move it to RefPtr.h from PassRefPtr.h. * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::allocate): * wtf/MetaAllocator.h: * wtf/ParallelJobsGeneric.h: (WTF::ParallelEnvironment::ThreadPrivate::create): * wtf/text/AtomicStringImpl.cpp: (WTF::HashAndUTF8CharactersTranslator::translate): (WTF::SubstringTranslator::translate): * wtf/text/CString.cpp: (WTF::CStringBuffer::createUninitialized): * wtf/text/CString.h: * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::reifyString): (WTF::StringBuilder::resize): (WTF::StringBuilder::reallocateBuffer): (WTF::StringBuilder::reallocateBuffer): * wtf/text/StringImpl.cpp: (WTF::StringImpl::reallocateInternal): (WTF::StringImpl::reallocate): (WTF::StringImpl::create8BitIfPossible): (WTF::StringImpl::createSymbol): (WTF::StringImpl::createNullSymbol): (WTF::StringImpl::convertToLowercaseWithoutLocale): (WTF::StringImpl::convertToUppercaseWithoutLocale): (WTF::StringImpl::convertToLowercaseWithLocale): (WTF::StringImpl::convertToUppercaseWithLocale): (WTF::StringImpl::convertASCIICase): * wtf/text/StringImpl.h: (WTF::StringImpl::StringImpl): (WTF::StringImpl::createSubstringSharingImpl): (WTF::StringImpl::tryCreateUninitialized): (WTF::StringImpl::extractFoldedStringInSymbol): * wtf/text/SymbolRegistry.cpp: (WTF::SymbolRegistry::symbolForKey): * wtf/text/WTFString.cpp: (WTF::String::substringSharingImpl): * wtf/text/WTFString.h: (WTF::String::String): Deleted. * wtf/text/cf/StringImplCF.cpp: 2016-06-07 Yusuke Suzuki [JSC] Do not allocate unnecessary UTF-8 string for encodeXXX functions https://bugs.webkit.org/show_bug.cgi?id=158416 Reviewed by Darin Adler and Geoffrey Garen. * wtf/Bitmap.h: (WTF::Bitmap::size): (WTF::WordType>::Bitmap): (WTF::WordType>::get): (WTF::WordType>::set): (WTF::WordType>::testAndSet): (WTF::WordType>::testAndClear): (WTF::WordType>::concurrentTestAndSet): (WTF::WordType>::concurrentTestAndClear): (WTF::WordType>::clear): (WTF::WordType>::clearAll): (WTF::WordType>::nextPossiblyUnset): (WTF::WordType>::findRunOfZeros): (WTF::WordType>::count): (WTF::WordType>::isEmpty): (WTF::WordType>::isFull): 2016-06-06 Saam Barati equal(StringView, StringView) for strings should have a fast path for pointer equality https://bugs.webkit.org/show_bug.cgi?id=158452 Reviewed by Andreas Kling. JSBench does a lot of StringView::operator== on StringViews that have the same underlying characters pointer. This becomes hot inside JSBench because JSBench heavily stresses JSC's UnlinkedCodeCache with a high hit rate. This means that when we get a hit in the cache, we used to do the long form of string compare. However, we were often comparing two StringViews that had the same underlying buffer and length. This patch speeds this case up to run in constant time instead of linear time. * wtf/text/StringCommon.h: (WTF::equalCommon): * wtf/text/StringImpl.h: (WTF::StringImpl::StringImpl): (WTF::StringImpl::data): * wtf/text/StringView.h: (WTF::StringView::data): 2016-06-04 Anders Carlsson Get rid of WorkItemWin https://bugs.webkit.org/show_bug.cgi?id=158381 Reviewed by Sam Weinig. * wtf/PlatformWin.cmake: * wtf/WorkQueue.h: * wtf/win/WorkItemWin.cpp: Removed. (WTF::WorkItemWin::WorkItemWin): Deleted. (WTF::WorkItemWin::create): Deleted. (WTF::WorkItemWin::~WorkItemWin): Deleted. * wtf/win/WorkItemWin.h: Removed. (WTF::WorkItemWin::function): Deleted. (WTF::WorkItemWin::queue): Deleted. * wtf/win/WorkQueueWin.cpp: (WTF::WorkQueue::performWorkOnRegisteredWorkThread): (WTF::WorkQueue::dispatch): 2016-06-03 Anders Carlsson Get rid of HANDLE registration code in WorkQueueWin https://bugs.webkit.org/show_bug.cgi?id=158375 Reviewed by Darin Adler. * wtf/WorkQueue.h: * wtf/win/WorkItemWin.cpp: (WTF::HandleWorkItem::HandleWorkItem): Deleted. (WTF::HandleWorkItem::createByAdoptingHandle): Deleted. (WTF::HandleWorkItem::~HandleWorkItem): Deleted. * wtf/win/WorkItemWin.h: (WTF::HandleWorkItem::setWaitHandle): Deleted. (WTF::HandleWorkItem::waitHandle): Deleted. * wtf/win/WorkQueueWin.cpp: (WTF::WorkQueue::handleCallback): Deleted. (WTF::WorkQueue::platformInvalidate): Deleted. (WTF::WorkQueue::unregisterWaitAndDestroyItemSoon): Deleted. (WTF::WorkQueue::unregisterWaitAndDestroyItemCallback): Deleted. 2016-06-03 Commit Queue Unreviewed, rolling out r201663. https://bugs.webkit.org/show_bug.cgi?id=158374 Broke the Windows build (Requested by andersca on #webkit). Reverted changeset: "Rename NoncopyableFunction to Function" https://bugs.webkit.org/show_bug.cgi?id=158354 http://trac.webkit.org/changeset/201663 2016-06-03 Anders Carlsson Rename NoncopyableFunction to Function https://bugs.webkit.org/show_bug.cgi?id=158354 Reviewed by Chris Dumez. * WTF.xcodeproj/project.pbxproj: * wtf/CrossThreadTask.h: (WTF::CrossThreadTask::CrossThreadTask): * wtf/Function.h: Renamed from Source/WTF/wtf/NoncopyableFunction.h. * wtf/FunctionDispatcher.h: * wtf/MainThread.cpp: (WTF::functionQueue): (WTF::dispatchFunctionsFromMainThread): (WTF::callOnMainThread): * wtf/MainThread.h: * wtf/RunLoop.cpp: (WTF::RunLoop::performWork): (WTF::RunLoop::dispatch): * wtf/RunLoop.h: * wtf/WorkQueue.h: * wtf/cocoa/WorkQueueCocoa.cpp: (WTF::WorkQueue::dispatch): (WTF::WorkQueue::dispatchAfter): * wtf/efl/DispatchQueueWorkItemEfl.h: (WorkItem::WorkItem): (TimerWorkItem::create): (TimerWorkItem::TimerWorkItem): * wtf/efl/WorkQueueEfl.cpp: (WTF::WorkQueue::dispatch): (WTF::WorkQueue::dispatchAfter): * wtf/generic/RunLoopGeneric.cpp: (WTF::RunLoop::TimerBase::ScheduledTask::create): (WTF::RunLoop::TimerBase::ScheduledTask::ScheduledTask): (WTF::RunLoop::dispatchAfter): * wtf/generic/WorkQueueGeneric.cpp: (WorkQueue::dispatch): (WorkQueue::dispatchAfter): * wtf/glib/RunLoopGLib.cpp: (WTF::DispatchAfterContext::DispatchAfterContext): (WTF::RunLoop::dispatchAfter): * wtf/win/WorkItemWin.cpp: (WTF::WorkItemWin::WorkItemWin): (WTF::WorkItemWin::create): (WTF::HandleWorkItem::HandleWorkItem): (WTF::HandleWorkItem::createByAdoptingHandle): * wtf/win/WorkItemWin.h: (WTF::WorkItemWin::function): * wtf/win/WorkQueueWin.cpp: (WTF::WorkQueue::dispatch): (WTF::WorkQueue::dispatchAfter): 2016-06-03 Mark Lam Clean up how StackVisitor dumps its frames. https://bugs.webkit.org/show_bug.cgi?id=158316 Reviewed by Keith Miller. Added an Indenter class what works with dataLog. * WTF.xcodeproj/project.pbxproj: * wtf/Indenter.h: Added. (WTF::Indenter::Indenter): (WTF::Indenter::dump): (WTF::Indenter::operator++): (WTF::Indenter::operator--): 2016-06-02 Said Abou-Hallawa [iOS] PDFDocumentImage should not create a cached image larger than 4M pixels https://bugs.webkit.org/show_bug.cgi?id=157857 Reviewed by Darin Adler. * wtf/StdLibExtras.h: Add a constant value for GB (2^30). 2016-06-02 Oliver Hunt JS parser incorrectly handles invalid utf8 in error messages. https://bugs.webkit.org/show_bug.cgi?id=158128 Reviewed by Saam Barati. Add a new toStringWithLatin1Fallback that simply uses String::fromUTF8WithLatin1Fallback, so we can avoid the standard String::fromUTF8 null return. * wtf/StringPrintStream.cpp: (WTF::StringPrintStream::toStringWithLatin1Fallback): * wtf/StringPrintStream.h: 2016-06-02 Keith Miller Unreviewed, reland r201532. The associated regressions have been fixed by r201584. 2016-06-02 Filip Pizlo Use "= delete" for Locker(int) Rubber stamped by Saam Barati. See discussion: https://bugs.webkit.org/show_bug.cgi?id=158306#c8 * wtf/Locker.h: (WTF::Locker::Locker): (WTF::Locker::~Locker): 2016-06-02 Filip Pizlo Make it harder to accidentally pass an integer to a locker. Rubber stamped by Keith Miller. See here for the discussion: https://bugs.webkit.org/show_bug.cgi?id=158306#c3 * wtf/Locker.h: (WTF::Locker::Locker): (WTF::Locker::~Locker): 2016-06-02 Filip Pizlo Make it easier to use NoLockingNecessary https://bugs.webkit.org/show_bug.cgi?id=158306 Reviewed by Keith Miller. An idiom that we borrowed from LLVM is that if a function requires a lock to be held, we have it take a const Locker& as its first argument. This may not communicate which lock is to be held, but it does help us to remember that some lock must be held. So far, it's been relatively easy to then figure out which lock. We've had bugs where we forgot to hold a lock but I don't remember the last time we had a bug where we grabbed the wrong lock. But sometimes, we know at the point where we call such a method that we actually don't need to hold any lock. This usually happens during object construction. If we're constructing some object then we usually know that we have not escaped it yet, so we don't need to waste time acquiring its lock. We could solve this by having a separate set of methods that don't do or require locking. This would be cumbersome, since usually for every variant that takes const Locker&, there is already one that doesn't, and that one will grab the lock for you. So this means having a third variant, that also doesn't take a const Locker&, but does no locking. That's pretty weird. So, we introduced NoLockingNecessary for situations like this. The idiom went like so: Locker locker(Locker::NoLockingNecessary) stuff->foo(locker); Usually though, there would be some distance between where the locker is defined and where it's used, so when you just look at stuff->foo(locker) in isolation you don't know if this is a real locker or a NoLockingNecessary cast. Also, requiring two lines for this just adds code. This change makes this easier. Now you can just do: stuff->foo(NoLockingNecessary). This is because NoLockingNecessary has been pulled out into the WTF namespace (and is usinged from the global namespace) and the Locker<> constructor that takes NoLockingNecessaryTag is now implicit. The only possible downside of this change is that people might use this idiom more frequently now that it's easier to use. I don't think that's a bad thing. I'm now convinced that this is not a bad idiom. When I was fixing an unrelated bug, I almost went the way of adding more locking to some core JSC data structures, and in the process, I needed to use NoLockingNecessary. It's clear that this is a general-purpose idiom and we should not impose artificial constraints on its use. * wtf/Locker.h: (WTF::Locker::Locker): (WTF::Locker::~Locker): 2016-06-01 Brady Eidson Get rid of StringCapture. https://bugs.webkit.org/show_bug.cgi?id=158285 Reviewed by Chris Dumez. * wtf/text/WTFString.h: (WTF::StringCapture::StringCapture): Deleted. (WTF::StringCapture::string): Deleted. (WTF::StringCapture::releaseString): Deleted. (WTF::StringCapture::operator=): Deleted. 2016-06-01 Benjamin Poulain [JSC] Some setters for components of Date do not timeClip() their result https://bugs.webkit.org/show_bug.cgi?id=158278 Unreviewed. * wtf/DateMath.cpp: (WTF::equivalentYearForDST): Deleted. The assertion is bogus. As the comments above explains, the function is completely wrong for years outside [1900-2100]. The tests passing large values for years are failing (year <= maxYear). The weird NaN test is a mystery. The old changelog does not explain it. 2016-05-31 Commit Queue Unreviewed, rolling out r201363 and r201456. https://bugs.webkit.org/show_bug.cgi?id=158240 "40% regression on date-format-xparb" (Requested by keith_miller on #webkit). Reverted changesets: "LLInt should be able to cache prototype loads for values in GetById" https://bugs.webkit.org/show_bug.cgi?id=158032 http://trac.webkit.org/changeset/201363 "get_by_id should support caching unset properties in the LLInt" https://bugs.webkit.org/show_bug.cgi?id=158136 http://trac.webkit.org/changeset/201456 2016-05-31 Brady Eidson Make createCrossThreadTask() functions return on the stack instead of the heap. https://bugs.webkit.org/show_bug.cgi?id=158215 Reviewed by Darin Adler. * WTF.xcodeproj/project.pbxproj: * wtf/CrossThreadCopier.cpp: * wtf/CrossThreadQueue.h: Added. A lightweight of MessageQueue that deals directly in objects instead of in std::unique_ptrs. (WTF::CrossThreadQueue::isKilled): (WTF::CrossThreadQueue::append): (WTF::CrossThreadQueue::waitForMessage): (WTF::CrossThreadQueue::tryGetMessage): * wtf/CrossThreadTask.h: (WTF::createCrossThreadTask): (WTF::CrossThreadTask::CrossThreadTask): Deleted. 2016-05-30 Brady Eidson Move CrossThreadCopier/CrossThreadTask to WTF. https://bugs.webkit.org/show_bug.cgi?id=158207 Reviewed by Alex Christensen. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/CrossThreadCopier.cpp: Renamed from Source/WebCore/platform/CrossThreadCopier.cpp. * wtf/CrossThreadCopier.h: Renamed from Source/WebCore/platform/CrossThreadCopier.h. (WTF::CrossThreadCopierPassThrough::copy): * wtf/CrossThreadTask.h: Renamed from Source/WebCore/platform/CrossThreadTask.h. (WTF::CrossThreadTask::CrossThreadTask): (WTF::CrossThreadTask::performTask): (WTF::createCrossThreadTask): 2016-05-28 Chris Dumez Templatize NoncopyableFunction class similarly to std::function https://bugs.webkit.org/show_bug.cgi?id=158185 Reviewed by Darin Adler. Templatize NoncopyableFunction class similarly to std::function, so that it can be used as a std::function replacement in more places. Previously, NoncopyableFunction could only support "void()" lambdas. * wtf/FunctionDispatcher.h: * wtf/MainThread.cpp: (WTF::functionQueue): (WTF::dispatchFunctionsFromMainThread): (WTF::callOnMainThread): * wtf/MainThread.h: * wtf/NoncopyableFunction.h: * wtf/RunLoop.cpp: (WTF::RunLoop::performWork): (WTF::RunLoop::dispatch): * wtf/RunLoop.h: * wtf/WorkQueue.h: * wtf/cocoa/WorkQueueCocoa.cpp: (WTF::WorkQueue::dispatch): (WTF::WorkQueue::dispatchAfter): * wtf/efl/DispatchQueueWorkItemEfl.h: (WorkItem::WorkItem): (TimerWorkItem::create): (TimerWorkItem::TimerWorkItem): * wtf/efl/WorkQueueEfl.cpp: (WTF::WorkQueue::dispatch): (WTF::WorkQueue::dispatchAfter): * wtf/generic/RunLoopGeneric.cpp: (WTF::RunLoop::TimerBase::ScheduledTask::create): (WTF::RunLoop::TimerBase::ScheduledTask::ScheduledTask): (WTF::RunLoop::dispatchAfter): * wtf/generic/WorkQueueGeneric.cpp: (WorkQueue::dispatch): (WorkQueue::dispatchAfter): * wtf/glib/RunLoopGLib.cpp: (WTF::DispatchAfterContext::DispatchAfterContext): (WTF::RunLoop::dispatchAfter): * wtf/win/WorkItemWin.cpp: (WTF::WorkItemWin::WorkItemWin): (WTF::WorkItemWin::create): (WTF::HandleWorkItem::HandleWorkItem): (WTF::HandleWorkItem::createByAdoptingHandle): * wtf/win/WorkItemWin.h: (WTF::WorkItemWin::function): * wtf/win/WorkQueueWin.cpp: (WTF::WorkQueue::dispatch): (WTF::WorkQueue::dispatchAfter): 2016-05-28 Dan Bernstein Build fix for projects that include MainThread.h without including FastMalloc.h. * wtf/NoncopyableFunction.h: Include FastMalloc.h from here. 2016-05-27 Chris Dumez callOnMainThread() should not copy captured lambda variables https://bugs.webkit.org/show_bug.cgi?id=158166 Reviewed by Brady Eidson. callOnMainThread() should not copy captured lambda variables. This function is usually called cross-thread with a lambda and copying the lambda (and its captured variables) can lead to thread-safety issues. This patch updates callOnMainThread() to take a NoncopyableFunction&& in parameter instead of a std::function. The call sites of callOnMainThread() have also been updated to use C++14's lambda capture with initializer. * WTF.xcodeproj/project.pbxproj: * wtf/FunctionDispatcher.h: * wtf/NoncopyableFunction.h: - Moved NoncopyableFunction from FunctionDispatcher.h to NoncopyableFunction.h. - Add a new operator=(nullptr_t) operator to NoncopyableFunction to match std::function, as one of the call sites needed it. * wtf/MainThread.cpp: (WTF::functionQueue): (WTF::dispatchFunctionsFromMainThread): (WTF::callOnMainThread): * wtf/MainThread.h: 2016-05-27 Yusuke Suzuki Unreviewed, build fix for JSCOnly port. https://bugs.webkit.org/show_bug.cgi?id=158111 Use NoncopyableFunction instead of std::function<>. * wtf/generic/RunLoopGeneric.cpp: (WTF::RunLoop::TimerBase::ScheduledTask::create): (WTF::RunLoop::TimerBase::ScheduledTask::ScheduledTask): 2016-05-27 Chris Dumez WorkQueue::dispatch() / RunLoop::dispatch() should not copy captured lambda variables https://bugs.webkit.org/show_bug.cgi?id=158111 Reviewed by Darin Adler. WorkQueue::dispatch() / RunLoop::dispatch() should not copy captured lambda variables. These are often used cross-thread and copying the captured lambda variables can be dangerous (e.g. we do not want to copy a String after calling isolatedCopy() upon capture). This patch introduces a new NoncopyableFunction type that behaves similarly to std::function but guarantees that the passed-in lambda (and its captured variables) cannot be copied. This new NoncopyableFunction type is now used for WorkQueue / RunLoop's dispatch() / dispatchAfter() which are commonly used cross-thread. This should now allow us to call WorkQueue::dispatch() with a lambda that captures a String like so: [str = str.isolatedCopy()]() { } Also note that even though this is not leveraged in this patch, NoncopyableFunction would allow us to capture move-only types such as std::unique_ptr as so: [p = WTFMove(p)]() { } This does not work if we convert the lambda into an std::function because std::function requires the lambda to be copyable, NoncopyableFunction does not. * wtf/FunctionDispatcher.h: (WTF::CallableWrapperBase::~CallableWrapperBase): (WTF::NoncopyableFunction::NoncopyableFunction): (WTF::NoncopyableFunction::operator()): (WTF::NoncopyableFunction::operator bool): (WTF::NoncopyableFunction::operator=): * wtf/RunLoop.cpp: (WTF::RunLoop::performWork): (WTF::RunLoop::dispatch): * wtf/RunLoop.h: * wtf/WorkQueue.h: * wtf/cocoa/WorkQueueCocoa.cpp: (WTF::WorkQueue::dispatch): (WTF::WorkQueue::dispatchAfter): * wtf/efl/DispatchQueueWorkItemEfl.h: (WorkItem::WorkItem): (TimerWorkItem::create): (TimerWorkItem::TimerWorkItem): * wtf/efl/WorkQueueEfl.cpp: (WTF::WorkQueue::dispatch): (WTF::WorkQueue::dispatchAfter): * wtf/generic/RunLoopGeneric.cpp: (WTF::RunLoop::dispatchAfter): * wtf/generic/WorkQueueGeneric.cpp: (WorkQueue::dispatch): (WorkQueue::dispatchAfter): * wtf/glib/RunLoopGLib.cpp: (WTF::DispatchAfterContext::DispatchAfterContext): (WTF::RunLoop::dispatchAfter): * wtf/win/WorkItemWin.cpp: (WTF::WorkItemWin::WorkItemWin): (WTF::WorkItemWin::create): (WTF::HandleWorkItem::HandleWorkItem): (WTF::HandleWorkItem::createByAdoptingHandle): * wtf/win/WorkItemWin.h: (WTF::WorkItemWin::function): * wtf/win/WorkQueueWin.cpp: (WTF::WorkQueue::dispatch): (WTF::WorkQueue::timerCallback): (WTF::WorkQueue::dispatchAfter): 2016-05-26 Filip Pizlo ScopedLambda should have a lifetime story that makes sense to the compiler https://bugs.webkit.org/show_bug.cgi?id=158118 Reviewed by Mark Lam. Prior to this change, there were two lifetime bugs in ScopedLambda: - scopedLambda(Functor&&) would bind Functor to const lambda&, so the resulting ScopedLambdaFunctor would hold a reference to the original lambda. This would have surprising behavior; for example it meant that this code was wrong: auto l = scopedLambda([&] ...); The solution is to have explicit copy/move versions of scopedLambda() rather than rely on perfect forwarding. - ScopedLambdaFunctor did not override its copy or move operations, so if the compiler did not RVO scopedLambda(), it would return a ScopedLambdaFunctor whose m_arg points to a dead temporary ScopedLambdaFunctor instance. The solution is to have explicit copy/move constructors and operators, which preserve the invariant that ScopedLambda::m_arg points to this. One nice side-effect of all of these constructors and operators being explicit is that we can rely on WTFMove's excellent assertions, which helped catch the first issue. This reverts ParkingLot to use ScopedLambda again. * wtf/ParkingLot.cpp: (WTF::ParkingLot::parkConditionallyImpl): (WTF::ParkingLot::unparkOne): (WTF::ParkingLot::unparkOneImpl): * wtf/ParkingLot.h: (WTF::ParkingLot::parkConditionally): (WTF::ParkingLot::unparkOne): * wtf/ScopedLambda.h: (WTF::scopedLambda): 2016-05-25 Anders Carlsson Get rid of WTF/Functional.h https://bugs.webkit.org/show_bug.cgi?id=158081 Reviewed by Chris Dumez. This is no longer used, and removing it will free up the name for a new Functional.h implementation. * WTF.xcodeproj/project.pbxproj: * wtf/Functional.h: Removed. (WTF::RefAndDeref::ref): Deleted. (WTF::RefAndDeref::deref): Deleted. (WTF::ParamStorageTraits::wrap): Deleted. (WTF::ParamStorageTraits::unwrap): Deleted. (WTF::ParamStorageTraits>::wrap): Deleted. (WTF::ParamStorageTraits>::unwrap): Deleted. (WTF::ParamStorageTraits>::wrap): Deleted. (WTF::ParamStorageTraits>::unwrap): Deleted. (WTF::ParamStorageTraits>::wrap): Deleted. (WTF::ParamStorageTraits>::unwrap): Deleted. (WTF::FunctionImplBase::~FunctionImplBase): Deleted. (WTF::FunctionBase::isNull): Deleted. (WTF::FunctionBase::FunctionBase): Deleted. (WTF::FunctionBase::impl): Deleted. (WTF::bind): Deleted. * wtf/mac/DeprecatedSymbolsUsedBySafari.mm: 2016-05-24 Keith Miller LLInt should be able to cache prototype loads for values in GetById https://bugs.webkit.org/show_bug.cgi?id=158032 Reviewed by Filip Pizlo. Add move constructors/initializers to Bags. * wtf/Bag.h: (WTF::Bag::Bag): (WTF::Bag::operator=): 2016-05-24 Chris Dumez Use auto for some of our lambda function parameters https://bugs.webkit.org/show_bug.cgi?id=158001 Reviewed by Darin Adler. Use auto for some of our lambda function parameters now that we build with c++14. * wtf/BubbleSort.h: (WTF::bubbleSort): 2016-05-23 Chris Dumez Speed up move of vectors of POD types that have an inline buffer https://bugs.webkit.org/show_bug.cgi?id=158003 Reviewed by Benjamin Poulain. When moving a vector of POD types that have an inline buffer, we would call std::swap() on the inline buffers. This unnecessarily slow because: 1. It does not consider the vector size, and therefore may end up doing more work than necessary when the inline buffer is not full. 2. In the "move" case, the destination buffer is completely empty so we don't really want a swap. We merely want the move the content of the source's inline buffer into the destination's one. Instead of calling std::swap(), we now call swapInlineBuffers() which was already used for non-POD types. swapInlineBuffers() will do just what we want in the "move" case because swapBound is going to be 0. As a result, we will only move the content of the source buffer into the destination one. Also swapInlineBuffers() is aware of the source vector's size so it will only move what's strictly needed. This seems to be a 2% progression on Dromaeo DOM attributes test. * wtf/Vector.h: (WTF::VectorBuffer::swapInlineBuffer): 2016-05-22 Dan Bernstein Added NSEventMaskMouseMoved to AppKitCompatibilityDeclarations.h. Rubber-stamped by Anders Carlsson. * wtf/mac/AppKitCompatibilityDeclarations.h: 2016-05-22 Dan Bernstein Another attempt to fix the GTK build after my previous changes. * wtf/StdLibExtras.h: 2016-05-22 Dan Bernstein Tried to fix the GTK build after r201257. * wtf/StdLibExtras.h: 2016-05-22 Dan Bernstein Additional fixes for non-C++14 Apple projects that use WTF. * wtf/StdLibExtras.h: (std::exchange): 2016-05-22 Dan Bernstein Additional fixes for non-C++14 Apple projects that use WTF. * wtf/StdLibExtras.h: (std::make_unique): (std::move): 2016-05-22 Dan Bernstein Correct the previous build fix attempt. * wtf/StdLibExtras.h: 2016-05-22 Dan Bernstein Build fix for non-C++14 Apple projects that use WTF. Rubber-stamped by Anders. * wtf/StdLibExtras.h: 2016-05-22 Brady Eidson Move to C++14. https://bugs.webkit.org/show_bug.cgi?id=157948 Reviewed by Michael Catanzaro. * Configurations/Base.xcconfig: Delete a lot of "stl additions until we can adopt C++14" code: * wtf/StdLibExtras.h: (std::make_unique): Deleted. (std::index_sequence::size): Deleted. (std::exchange): Deleted. (std::literals::chrono_literals::operator _s): Deleted. (std::literals::chrono_literals::operator _ms): Deleted. 2016-05-20 Rawinder Singh Implement operator== for WeakPtr https://bugs.webkit.org/show_bug.cgi?id=157883 Reviewed by Chris Dumez. Implement operator== and operator!= for WeakPtr and update code to use the operators. * wtf/WeakPtr.h: (WTF::operator==): (WTF::operator!=): 2016-05-19 Chris Dumez Improve compile-time assertions in is<>() / downcast<>() https://bugs.webkit.org/show_bug.cgi?id=157817 Reviewed by Darin Adler. * wtf/Ref.h: (WTF::is): Add is<>() overloads taking a Ref<>() so that is<>() keeps working when passing a Ref<>(), despite the new static assertions on the input type. Some call sites were already leveraging this as it was working by implicitly converting the Ref into a T&. * wtf/TypeCasts.h: (WTF::is): (WTF::downcast): Make static assertions stricter in is<>() / downcast<>() to catch more cases where those are either unnecessary or incorrect. 2016-05-19 Filip Pizlo Unreviewed, fix all of the builds. I failed a second time. * wtf/BackwardsGraph.h: (WTF::BackwardsGraph::rootName): 2016-05-19 Filip Pizlo Unreviewed, fix all of the builds. I had made an additional change that I did not mean to commit. This fixes it. * wtf/BackwardsGraph.h: (WTF::BackwardsGraph::rootName): (WTF::BackwardsGraph::Set::dump): (WTF::BackwardsGraph::dump): 2016-05-18 Filip Pizlo DFG::LICMPhase shouldn't hoist type checks unless it knows that the check will succeed at the loop pre-header https://bugs.webkit.org/show_bug.cgi?id=144527 Reviewed by Saam Barati. This adds an adaptor for graphs called BackwardsGraph. The WTF graph framework is based on passing around a Graph template argument that follows the protocol shared by DFG::CFG, B3::CFG, and Air::CFG. These graphs always have a single root node but may have many leaf nodes. This new BackwardsGraph adaptor reverses the graph by creating a synthetic return node that it uses as the root in the inverted graph. This currently may resort to some heuristics in programs that have an infinite loop, but other than that, it'll work well in the general case. This allows us to say Dominators> as a way of computing backwards dominators, which then allows us to easily answer control flow equivalence queries. * CMakeLists.txt: * WTF.xcodeproj/project.pbxproj: * wtf/BackwardsGraph.h: Added. (WTF::BackwardsGraph::Node::Node): (WTF::BackwardsGraph::Node::root): (WTF::BackwardsGraph::Node::operator==): (WTF::BackwardsGraph::Node::operator!=): (WTF::BackwardsGraph::Node::operator bool): (WTF::BackwardsGraph::Node::isRoot): (WTF::BackwardsGraph::Node::node): (WTF::BackwardsGraph::Set::Set): (WTF::BackwardsGraph::Set::add): (WTF::BackwardsGraph::Set::remove): (WTF::BackwardsGraph::Set::contains): (WTF::BackwardsGraph::Set::dump): (WTF::BackwardsGraph::Map::Map): (WTF::BackwardsGraph::Map::clear): (WTF::BackwardsGraph::Map::size): (WTF::BackwardsGraph::Map::operator[]): (WTF::BackwardsGraph::BackwardsGraph): (WTF::BackwardsGraph::root): (WTF::BackwardsGraph::newMap): (WTF::BackwardsGraph::successors): (WTF::BackwardsGraph::predecessors): (WTF::BackwardsGraph::index): (WTF::BackwardsGraph::node): (WTF::BackwardsGraph::numNodes): (WTF::BackwardsGraph::dump): * wtf/Dominators.h: (WTF::Dominators::Dominators): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): * wtf/GraphNodeWorklist.h: (WTF::GraphNodeWith::GraphNodeWith): (WTF::GraphNodeWith::operator bool): * wtf/StdLibExtras.h: (WTF::callStatelessLambda): (WTF::checkAndSet): 2016-05-18 Saam barati StringBuilder::appendQuotedJSONString doesn't properly protect against the math it's doing. Make the math fit the assertion. https://bugs.webkit.org/show_bug.cgi?id=157868 Reviewed by Benjamin Poulain. appendQuotedJSONString was rounding up to the next power of two when resizing its buffer. Lets call the allocation size X. If X > 2^31, then roundUpToPowerOfTwo(X) == 0. This patch fixes this by making the assertion reflect what the code is doing. We now allocate to a size of X = std::max(maximumCapacityRequired , roundUpToPowerOfTwo(maximumCapacityRequired)) * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::appendQuotedJSONString): 2016-05-17 Joseph Pecoraro REGRESSION(r192855): Math.random() always produces the same first 7 decimal points the first two invocations https://bugs.webkit.org/show_bug.cgi?id=157805 Reviewed by Geoffrey Garen. * wtf/WeakRandom.h: (WTF::WeakRandom::setSeed): Advance once to randomize the 32bit seed across the 128bit state and avoid re-using 64bits of state in the second advance. 2016-05-17 Dean Jackson Remove ES6_GENERATORS flag https://bugs.webkit.org/show_bug.cgi?id=157815 Reviewed by Geoffrey Garen. This flag isn't needed. Generators are enabled everywhere and part of a stable specification. * wtf/FeatureDefines.h: 2016-05-17 Filip Pizlo WTF should know about Language https://bugs.webkit.org/show_bug.cgi?id=157756 Reviewed by Geoffrey Garen. This contains two changes: - Move everything that WebCore's logic for getting the platform user preferred language depended on into WTF. This means CFBundleSPI.h and BlockObjCExceptions.h|cpp. - Move WebCore::platformUserPreferredLanguages() to WTF::platformUserPreferredLanguages(). This is needed by https://bugs.webkit.org/show_bug.cgi?id=157755, which will make JSC use this to detect the platform user preferred language when running standalone. Moving the dependencies accounts for a huge chunk of this change, since we have to rewire all of the references to those headers in all of WebKit. Moving platformUserPreferredLanguages() is mostly easy except for the weird callback. That function would call languageDidChange(), which needs to stay in WebCore. So, this gives WebCore the ability to register a languageDidChange callback. Other than this new logic, the code being added to WTF is just being lifted out of WebCore. * WTF.xcodeproj/project.pbxproj: * wtf/BlockObjCExceptions.h: Added. * wtf/BlockObjCExceptions.mm: Added. (ReportBlockedObjCException): * wtf/PlatformEfl.cmake: * wtf/PlatformGTK.cmake: * wtf/PlatformJSCOnly.cmake: * wtf/PlatformMac.cmake: * wtf/PlatformUserPreferredLanguages.h: Added. * wtf/PlatformUserPreferredLanguagesMac.mm: Added. (WTF::setPlatformUserPreferredLanguagesChangedCallback): (WTF::preferredLanguages): (+[WTFLanguageChangeObserver languagePreferencesDidChange:]): (WTF::httpStyleLanguageCode): (WTF::isValidICUCountryCode): (WTF::platformUserPreferredLanguages): * wtf/PlatformUserPreferredLanguagesUnix.cpp: Added. (WTF::setPlatformUserPreferredLanguagesChangedCallback): (WTF::platformLanguage): (WTF::platformUserPreferredLanguages): * wtf/PlatformUserPreferredLanguagesWin.cpp: Added. (WTF::setPlatformUserPreferredLanguagesChangedCallback): (WTF::localeInfo): (WTF::platformLanguage): (WTF::platformUserPreferredLanguages): * wtf/PlatformWin.cmake: * wtf/spi/cf: Added. * wtf/spi/cf/CFBundleSPI.h: Added. 2016-05-17 Youenn Fablet DOMPromise should only restrict the resolution type https://bugs.webkit.org/show_bug.cgi?id=157307 Reviewed by Darin Adler. * wtf/Ref.h: Adding static constexpr to ease detection of Ref for templates. * wtf/RefPtr.h: Ditto. 2016-05-16 Michael Saboff ARMV7K: Crash at JavaScriptCore: WTF::ScopedLambdaFunctor Use more references in JS wrappers related code https://bugs.webkit.org/show_bug.cgi?id=157721 Reviewed by Darin Adler. Add new static_reference_cast() overload that takes a Ref&& in in order to downcast Ref<> types without causing ref-counting churn. * wtf/Ref.h: (WTF::static_reference_cast): 2016-05-13 Chris Dumez Unreviewed, rolling out r200837. Seems to have regressed Speedometer and JetStream on iOS Reverted changeset: "DOMPromise should only restrict the resolution type" https://bugs.webkit.org/show_bug.cgi?id=157307 http://trac.webkit.org/changeset/200837 2016-05-13 Beth Dakin Add dyldSPI.h https://bugs.webkit.org/show_bug.cgi?id=157401 -and corresponding- rdar://problem/26253396 Reviewed by Darin Adler. New header for dyld spi. * WTF.xcodeproj/project.pbxproj: * wtf/spi/darwin/dyldSPI.h: Added. 2016-05-13 Youenn Fablet DOMPromise should only restrict the resolution type https://bugs.webkit.org/show_bug.cgi?id=157307 Reviewed by Darin Adler. * wtf/Ref.h: Adding static constexpr to ease detection of Ref for templates. * wtf/RefPtr.h: Ditto. 2016-05-12 Daniel Bates Use SecTask SPI to retrieve code signing identifier for user directory suffix https://bugs.webkit.org/show_bug.cgi?id=157570 Reviewed by Darin Adler. Forward declare SPI SecTaskCopySigningIdentifier(). * wtf/spi/cocoa/SecuritySPI.h: 2016-05-12 Csaba Osztrogonác Remove ENABLE(ES6_ARROWFUNCTION_SYNTAX) guards https://bugs.webkit.org/show_bug.cgi?id=157564 Reviewed by Darin Adler. * wtf/FeatureDefines.h: 2016-05-10 Filip Pizlo Internal JSC profiler should have a timestamped log of events for each code block https://bugs.webkit.org/show_bug.cgi?id=157538 Reviewed by Benjamin Poulain. * wtf/PrintStream.h: (WTF::PrintStream::print): 2016-05-10 Chris Dumez Get rid of a lot of calls to RefPtr::release() https://bugs.webkit.org/show_bug.cgi?id=157505 Reviewed by Alex Christensen. Get rid of a lot of calls to RefPtr::release() and use WTFMove() instead. * wtf/text/AtomicStringImpl.cpp: (WTF::HashAndUTF8CharactersTranslator::translate): * wtf/text/CString.cpp: (WTF::CString::copyBufferIfNeeded): * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::allocateBuffer): (WTF::StringBuilder::allocateBufferUpConvert): (WTF::StringBuilder::shrinkToFit): * wtf/text/WTFString.cpp: (WTF::String::append): (WTF::String::insert): (WTF::String::removeInternal): * wtf/text/WTFString.h: (WTF::String::String): (WTF::String::operator=): (WTF::String::releaseImpl): (WTF::String::isNull): Deleted. 2016-05-08 Chris Dumez [COCOA] Disable HAVE_DTRACE at build time https://bugs.webkit.org/show_bug.cgi?id=157433 Reviewed by Mark Lam. Disable HAVE_DTRACE on COCOA since it is mostly unused and has a performance impact, at least on iOS. * wtf/Platform.h: 2016-05-08 Chris Dumez [Bindings] Simplify [RequiresExistingAtomicString] IDL extended attribute handling https://bugs.webkit.org/show_bug.cgi?id=157465 Reviewed by Darin Adler. Add an AtomicString(RefPtr&&) constructor that is now used by the bindings when [RequiresExistingAtomicString] is used. This is more efficient than using AtomicString(AtomicStringImpl*) as the caller has a RefPtr and is consistent with the pre-existing String(RefPtr&&) constructor. * wtf/text/AtomicString.h: (WTF::AtomicString::AtomicString): 2016-05-08 Darin Adler * wtf/text/WTFString.h: Remove pragma once. Not working for some reason. 2016-05-08 Darin Adler Follow-up to that last patch (missed review comments). * wtf/text/WTFString.h: Use nullptr instead of 0 as needed. Also use pragma once. 2016-05-08 Darin Adler Change EventSource constructor to take an IDL dictionary instead of a WebCore::Dictionary https://bugs.webkit.org/show_bug.cgi?id=157459 Reviewed by Chris Dumez. * wtf/text/WTFString.h: Export a symbol now used in WebCore. 2016-05-02 Sam Weinig On platforms that support it, use a SecTrustRef as the basis of CertificateInfo instead of a chain of SecCertificateRefs. https://bugs.webkit.org/show_bug.cgi?id=157220 Reviewed by Darin Adler. * wtf/Platform.h: Add support for HAVE(SEC_TRUST_SERIALIZATION). * wtf/spi/cocoa/SecuritySPI.h: Add SPI access to SecTrustSerialize and SecTrustDeserialize. 2016-05-04 Filip Pizlo Add HLE locks and synchronic TTAS locks to the ToyLocks benchmark suite https://bugs.webkit.org/show_bug.cgi?id=157367 Rubber stamped by Benjamin Poulain. Turns out they are both a lot slower than WTF::Lock. The HLE lock is written according to Intel's documentation. The synchronic lock follows the algorithm of the "ttas_lock" in the synchronic test.hpp. * benchmarks/ToyLocks.h: 2016-05-04 Filip Pizlo Add a few more WTF locking benchmarks https://bugs.webkit.org/show_bug.cgi?id=157365 Rubber stamped by Benjamin Poulain. Factors out our toy locks into ToyLocks.h and adds a new test (LockFairnessTest) that measures the fairness of locks. The result: WTF::Lock is pretty fair enough. * benchmarks/LockFairnessTest.cpp: Added. (main): * benchmarks/LockSpeedTest.cpp: (main): * benchmarks/ToyLocks.h: Added. 2016-05-04 Filip Pizlo Speed up JSGlobalObject initialization by making some properties lazy https://bugs.webkit.org/show_bug.cgi?id=157045 Reviewed by Keith Miller. This WTF change is at the heart of a large JSC change. In JSC I found myself wanting to do this a lot: static void callback(Foo& foo) { ... } foo.setCallback(callback); But that's not very nice to write if many different setCallback() calls are inside of the same very large function: you'll have to have a lot of static function definitions in one part of the file, and then a bunch of setCallback() calls in another part. It's hard to reason about what's going on with such code. So what if you wrote this instead: foo.setCallback([] (Foo& foo) { ... }); Much nicer! There is a standard way to do this: lambdas that are stateless are convertible to function pointers. This change also offers another approach that is a bit more general. These additions to WTF help you do it: isStatelessLambda(): tells you if Func is a stateless lambda. This uses is_empty to test if the lambda is stateless. This turns out to be a stronger property than convertibility to function pointers. For example, a function pointer is convertible to a function pointer, but it is definitely stateful: you cannot successfully call it if you only has its type. On the other hand, a stateless lambda is really stateless in the sense that you only need its type to call it. callStatelessLambda(Arguments&&...): calls the given stateless lambda. JSC uses these to build up some sophisticated lazy-initialization APIs. The use of statelessness allows JSC to combine a lambda with other logic into a single function pointer. * wtf/StdLibExtras.h: (WTF::isStatelessLambda): (WTF::callStatelessLambda): 2016-05-04 Per Arne Vollan [Win] Use NeverDestroyed template. https://bugs.webkit.org/show_bug.cgi?id=157345 Reviewed by Darin Adler. * wtf/ThreadingWin.cpp: (WTF::threadMapMutex): (WTF::threadMap): 2016-05-04 Chris Dumez Unreviewed, rolling out r200383 and r200406. Seems to have caused crashes on iOS / ARMv7s Reverted changesets: "Speed up JSGlobalObject initialization by making some properties lazy" https://bugs.webkit.org/show_bug.cgi?id=157045 http://trac.webkit.org/changeset/200383 "REGRESSION(r200383): Setting lazily initialized properties across frame boundaries crashes" https://bugs.webkit.org/show_bug.cgi?id=157333 http://trac.webkit.org/changeset/200406 2016-05-03 Filip Pizlo Speed up JSGlobalObject initialization by making some properties lazy https://bugs.webkit.org/show_bug.cgi?id=157045 Reviewed by Keith Miller. This WTF change is at the heart of a large JSC change. In JSC I found myself wanting to do this a lot: static void callback(Foo& foo) { ... } foo.setCallback(callback); But that's not very nice to write if many different setCallback() calls are inside of the same very large function: you'll have to have a lot of static function definitions in one part of the file, and then a bunch of setCallback() calls in another part. It's hard to reason about what's going on with such code. So what if you wrote this instead: foo.setCallback([] (Foo& foo) { ... }); Much nicer! There is a standard way to do this: lambdas that are stateless are convertible to function pointers. This change also offers another approach that is a bit more general. These additions to WTF help you do it: isStatelessLambda(): tells you if Func is a stateless lambda. This uses is_empty to test if the lambda is stateless. This turns out to be a stronger property than convertibility to function pointers. For example, a function pointer is convertible to a function pointer, but it is definitely stateful: you cannot successfully call it if you only has its type. On the other hand, a stateless lambda is really stateless in the sense that you only need its type to call it. callStatelessLambda(Arguments&&...): calls the given stateless lambda. JSC uses these to build up some sophisticated lazy-initialization APIs. The use of statelessness allows JSC to combine a lambda with other logic into a single function pointer. * wtf/StdLibExtras.h: (WTF::isStatelessLambda): (WTF::callStatelessLambda): 2016-05-03 Per Arne Vollan [Win] Remove Windows XP Compatibility Requirements https://bugs.webkit.org/show_bug.cgi?id=152899 Reviewed by Brent Fulgham. Windows XP is not supported anymore, we can remove workarounds. * wtf/Assertions.cpp: 2016-05-03 Per Arne Vollan [Win] Warning fix. https://bugs.webkit.org/show_bug.cgi?id=157309 Reviewed by Darin Adler. MSVC gives a warning when converting from signed to unsigned. * wtf/SmallPtrSet.h: (WTF::SmallPtrSet::begin): 2016-05-02 Brady Eidson Add the ability to accumulate logs for specific logging channels to help diagnose test timeouts. https://bugs.webkit.org/show_bug.cgi?id=157274 Reviewed by Alex Christensen. This patch changes WTFLog to add the logging string to the logging accumulator if the logging channel says so. It also adds support for using this new accumulation mechanism. * WTF.xcodeproj/project.pbxproj: * wtf/Assertions.cpp: (WTF::resetAccumulatedLogs): (WTF::getAndResetAccumulatedLogs): * wtf/Assertions.h: * wtf/LoggingAccumulator.h: Added. Expose functions to get accumulated logs and to reset the accumulation. * wtf/text/WTFString.cpp: (WTF::String::format): Update to handle %@ on CF (Well, really ObjC) platforms. 2016-05-02 Per Arne Vollan [Win] Enable IndexedDB. https://bugs.webkit.org/show_bug.cgi?id=157192 Reviewed by Brent Fulgham. Fix compile errors when format specifiers like PRIu64 is used, by defining __STDC_FORMAT_MACROS before inttypes.h is included. * wtf/Platform.h: 2016-04-27 Brady Eidson Modern IDB: Implement native IDBFactory.getAllDatabaseNames for WebInspector. https://bugs.webkit.org/show_bug.cgi?id=157072 Reviewed by Alex Christensen. Moved these Hex Digit utilities from WebCore URL code (???), and add a checked version of getting the hex digit value. * wtf/HexNumber.h: (WTF::isHexDigit): (WTF::uncheckedHexDigit): (WTF::hexDigitValue): (WTF::uncheckedHexDigitValue): 2016-04-25 Ryosuke Niwa Remove the build flag for template elements https://bugs.webkit.org/show_bug.cgi?id=157022 Reviewed by Daniel Bates. * wtf/FeatureDefines.h: 2016-04-25 Fujii Hironori Heap corruption is detected when destructing JSGlobalObject https://bugs.webkit.org/show_bug.cgi?id=156831 Reviewed by Mark Lam. WebKit uses CRT static library on Windows. Each copy of the CRT library has its own heap manager, allocating memory in one CRT library and passing the pointer across a DLL boundary to be freed by a different copy of the CRT library is a potential cause for heap corruption. Potential Errors Passing CRT Objects Across DLL Boundaries JSGlobalObject::createRareDataIfNeeded is inlined but JSGlobalObject::~JSGlobalObject is not. Then, the heap of allocating JSGlobalObjectRareData is WebKit.dll, but deallocating JavaScriptCore.dll. Adding WTF_MAKE_FAST_ALLOCATED to JSGlobalObjectRareData ensures heap consistency of it. WTF::Lock also needs WTF_MAKE_FAST_ALLOCATED because it is allocated from the inlined constructor of JSGlobalObjectRareData. * wtf/Lock.h: Add WTF_MAKE_FAST_ALLOCATED. 2016-04-21 Saam barati Lets do less locking of symbol tables in the BytecodeGenerator where we don't have race conditions https://bugs.webkit.org/show_bug.cgi?id=156821 Reviewed by Filip Pizlo. This patch introduces a new constructor for Locker which implies no locking is necessary. You instantiate such a locker like so: `Locker locker(Locker::NoLockingNecessary);` This is useful to for very specific places when it is not yet required to engage in a specified locking protocol. As an example, we use this in JSC when we allocate a particular object that engages in a locking protocol with the concurrent compiler thread, but before a concurrent compiler thread that could have access to the object exists. * wtf/Locker.h: (WTF::Locker::Locker): (WTF::Locker::~Locker): 2016-04-19 Michael Saboff iTunes crashing JavaScriptCore.dll https://bugs.webkit.org/show_bug.cgi?id=156647 Reviewed by Filip Pizlo. If a thread was created without using the WTF thread apis and that thread uses a JavaScript VM and that thread exits with the VM still around, JSC won't know that the thread has exited. Currently, we use ThreadSpecificThreadExit() to clean up any thread specific keys. Cleaning up these keys is how JSC is notified of a thread exit. We only call ThreadSpecificThreadExit() from wtfThreadEntryPoint() when the thread entry point function returns. This mechanism was put in place for Windows because we layer the WTF::ThreadSpecific functionality on top of TLS (Thread Local Storage), but TLS doesn't have a thread exiting callback the way that pthread_create_key does. The fix is to change from using TLS to using FLS (Fiber Local Storage). Although Windows allows multiple fibers per thread, WebKit is not designed to work with a multiple fibers per thread. When there is only one fiber per thread, FLS works just like TLS, but it has the destroy callback. I restructured the Windows version of WTF::ThreadSpecific to be almost the same as the pthread version. Added THREAD_SPECIFIC_CALL to set the correct calling convenction for Windows 32 bit. * wtf/ThreadSpecific.h: (WTF::threadSpecificKeyCreate): (WTF::threadSpecificKeyDelete): (WTF::threadSpecificSet): (WTF::threadSpecificGet): (WTF::ThreadSpecific::ThreadSpecific): (WTF::ThreadSpecific::~ThreadSpecific): (WTF::ThreadSpecific::get): (WTF::ThreadSpecific::set): (WTF::ThreadSpecific::destroy): Restructured to use FLS. Renamed TLS* to FLS*. * wtf/ThreadSpecificWin.cpp: (WTF::flsKeyCount): (WTF::flsKeys): Renamed from tlsKey*() to flsKey*(). (WTF::destructorsList): Deleted. (WTF::destructorsMutex): Deleted. (WTF::PlatformThreadSpecificKey::PlatformThreadSpecificKey): Deleted. (WTF::PlatformThreadSpecificKey::~PlatformThreadSpecificKey): Deleted. (WTF::PlatformThreadSpecificKey::setValue): Deleted. (WTF::PlatformThreadSpecificKey::value): Deleted. (WTF::PlatformThreadSpecificKey::callDestructor): Deleted. (WTF::tlsKeyCount): Deleted. (WTF::tlsKeys): Deleted. (WTF::threadSpecificKeyCreate): Deleted. (WTF::threadSpecificKeyDelete): Deleted. (WTF::threadSpecificSet): Deleted. (WTF::threadSpecificGet): Deleted. (WTF::ThreadSpecificThreadExit): Deleted. * wtf/ThreadingWin.cpp: (WTF::wtfThreadEntryPoint): Eliminated call to ThreadSpecificThreadExit. 2016-04-19 Filip Pizlo Add more locking algorithms to the LockSpeedTest. Rubber stamped by Saam Barati. * benchmarks/LockSpeedTest.cpp: (main): 2016-04-19 Filip Pizlo Clean up the ParkingLot uparking API a bit https://bugs.webkit.org/show_bug.cgi?id=156746 Reviewed by Saam Barati and Geoffrey Garen. Previously, unparkOne() would either return a boolean to tell you if there are any more threads on the queue or it would pass your callback a pair of booleans - one to tell if a thread was unparked and another to tell if there are any more threads. This was an annoying inconsistency. What if you wanted to know if unparkOne() unparked a thread but you don't care to use callbacks? This fixes unparkOne() to use a struct called UnparkResult for both of its variants. This makes the code a bit cleaner. * wtf/Atomics.h: Add some more atomic ops. (WTF::Atomic::exchangeAndAdd): (WTF::Atomic::exchange): * wtf/Condition.h: Change calls to unparkOne(). (WTF::ConditionBase::notifyOne): * wtf/Lock.cpp: Change calls to unparkOne(). (WTF::LockBase::unlockSlow): * wtf/ParkingLot.cpp: (WTF::ParkingLot::parkConditionally): (WTF::ParkingLot::unparkOne): * wtf/ParkingLot.h: Switch to using ScopedLambda and introduce UnparkResult. 2016-04-19 Commit Queue Unreviewed, rolling out r199726. https://bugs.webkit.org/show_bug.cgi?id=156748 WebKit tests crash on Windows 32 (Requested by msaboff on #webkit). Reverted changeset: "iTunes crashing JavaScriptCore.dll" https://bugs.webkit.org/show_bug.cgi?id=156647 http://trac.webkit.org/changeset/199726 2016-04-19 Michael Saboff iTunes crashing JavaScriptCore.dll https://bugs.webkit.org/show_bug.cgi?id=156647 Reviewed by Saam Barati. If a thread was created without using the WTF thread apis and that thread uses a JavaScript VM and that thread exits with the VM still around, JSC won't know that the thread has exited. Currently, we use ThreadSpecificThreadExit() to clean up any thread specific keys. Cleaning up these keys is how JSC is notified of a thread exit. We only call ThreadSpecificThreadExit() from wtfThreadEntryPoint() when the thread entry point function returns. This mechanism was put in place for Windows because we layer the WTF::ThreadSpecific functionality on top of TLS (Thread Local Storage), but TLS doesn't have a thread exiting callback the way that pthread_create_key. The fix is to change from using TLS to using FLS (Fiber Local Storage). Although Windows allows multiple fibers per thread, WebKit is not designed to work with a multiple fibers per thread. When there is only one fiber per thread, FLS works just like TLS, but it has the destroy callback. I restructured the Windows version of WTF::ThreadSpecific to be almost the same as the pthread version. * wtf/ThreadSpecific.h: (WTF::threadSpecificKeyCreate): (WTF::threadSpecificKeyDelete): (WTF::threadSpecificSet): (WTF::threadSpecificGet): (WTF::ThreadSpecific::ThreadSpecific): (WTF::ThreadSpecific::~ThreadSpecific): (WTF::ThreadSpecific::get): (WTF::ThreadSpecific::set): (WTF::ThreadSpecific::destroy): Restructured to use FLS. Renamed TLS* to FLS*. * wtf/ThreadSpecificWin.cpp: (WTF::flsKeyCount): (WTF::flsKeys): Renamed from tlsKey*() to flsKey*(). (WTF::destructorsList): Deleted. (WTF::destructorsMutex): Deleted. (WTF::PlatformThreadSpecificKey::PlatformThreadSpecificKey): Deleted. (WTF::PlatformThreadSpecificKey::~PlatformThreadSpecificKey): Deleted. (WTF::PlatformThreadSpecificKey::setValue): Deleted. (WTF::PlatformThreadSpecificKey::value): Deleted. (WTF::PlatformThreadSpecificKey::callDestructor): Deleted. (WTF::tlsKeyCount): Deleted. (WTF::tlsKeys): Deleted. (WTF::threadSpecificKeyCreate): Deleted. (WTF::threadSpecificKeyDelete): Deleted. (WTF::threadSpecificSet): Deleted. (WTF::threadSpecificGet): Deleted. (WTF::ThreadSpecificThreadExit): Deleted. * wtf/ThreadingWin.cpp: (WTF::wtfThreadEntryPoint): Eliminated call to ThreadSpecificThreadExit. 2016-04-19 Yusuke Suzuki [GTK] Use Generic WorkQueue instead of WorkQueueGLib https://bugs.webkit.org/show_bug.cgi?id=156721 Reviewed by Benjamin Poulain. WorkQueueGLib includes platform-dependent part only for WorkQueue::dispatchAfter. However, its code is related to RunLoopGLib rather than WorkQueueGLib. In this patch, we move the code from WorkQueueGLib to RunLoopGLib, drop WorkQueueGLib and use WorkQueueGeneric. * wtf/PlatformGTK.cmake: * wtf/RunLoop.h: * wtf/WorkQueue.h: * wtf/glib/RunLoopGLib.cpp: (WTF::DispatchAfterContext::DispatchAfterContext): (WTF::DispatchAfterContext::dispatch): (WTF::RunLoop::dispatchAfter): * wtf/glib/WorkQueueGLib.cpp: Removed. (WTF::WorkQueue::platformInitialize): Deleted. (WTF::WorkQueue::platformInvalidate): Deleted. (WTF::WorkQueue::dispatch): Deleted. (WTF::DispatchAfterContext::DispatchAfterContext): Deleted. (WTF::DispatchAfterContext::~DispatchAfterContext): Deleted. (WTF::DispatchAfterContext::dispatch): Deleted. (WTF::WorkQueue::dispatchAfter): Deleted. 2016-04-18 Yusuke Suzuki [JSCOnly] Implement RunLoop and remove glib dependency https://bugs.webkit.org/show_bug.cgi?id=155706 Reviewed by Michael Catanzaro. Add missing RunLoop and WorkQueue platform code for JSCOnly port. The implementation does not use platform specific things. Instead, we implement them on WTF framework; using condition variables to construct the run loop and timers. Since the fallback is implemented, it is not necessary for JSCOnly port to depend on GLib's RunLoop abstraction. So this patch removes its dependency. As a result, now, JSCOnly port removes dependencies except for the system ICU. We clean up event loop ifdefs by introducing USE_XXX_EVENT_LOOP flags. USE(XXX_EVENT_LOOP) is exclusive to each other. So from now, we do not need to take care of the order of if-defs for the event loops. (For example, USE(GLIB) should have lead before OS(DARWIN) in WorkQueue.h for WebKitGTK on Darwin.) EVENT_LOOP determination is done in Platform.h. This follows the style of WTF PLATFORM. * wtf/Platform.h: * wtf/PlatformJSCOnly.cmake: * wtf/RunLoop.h: * wtf/WorkQueue.h: * wtf/generic/MainThreadGeneric.cpp: Renamed from Source/WTF/wtf/none/MainThreadNone.cpp. (WTF::initializeMainThreadPlatform): (WTF::scheduleDispatchFunctionsOnMainThread): * wtf/generic/RunLoopGeneric.cpp: Added. (WTF::RunLoop::TimerBase::ScheduledTask::create): (WTF::RunLoop::TimerBase::ScheduledTask::ScheduledTask): (WTF::RunLoop::TimerBase::ScheduledTask::fired): (WTF::RunLoop::TimerBase::ScheduledTask::scheduledTimePoint): (WTF::RunLoop::TimerBase::ScheduledTask::updateReadyTime): (WTF::RunLoop::TimerBase::ScheduledTask::EarliestSchedule::operator()): (WTF::RunLoop::TimerBase::ScheduledTask::isActive): (WTF::RunLoop::TimerBase::ScheduledTask::deactivate): (WTF::RunLoop::RunLoop): (WTF::RunLoop::~RunLoop): (WTF::RunLoop::populateTasks): (WTF::RunLoop::runImpl): (WTF::RunLoop::run): (WTF::RunLoop::iterate): (WTF::RunLoop::stop): (WTF::RunLoop::wakeUp): (WTF::RunLoop::schedule): (WTF::RunLoop::scheduleAndWakeUp): (WTF::RunLoop::dispatchAfter): (WTF::RunLoop::TimerBase::TimerBase): (WTF::RunLoop::TimerBase::~TimerBase): (WTF::RunLoop::TimerBase::start): (WTF::RunLoop::TimerBase::stop): (WTF::RunLoop::TimerBase::isActive): * wtf/generic/WorkQueueGeneric.cpp: Added. (WorkQueue::platformInitialize): (WorkQueue::platformInvalidate): (WorkQueue::dispatch): (WorkQueue::dispatchAfter): * wtf/none/MainThreadNone.cpp: (WTF::initializeMainThreadPlatform): Deleted. (WTF::scheduleDispatchFunctionsOnMainThread): Deleted. * wtf/none/RunLoopNone.cpp: (WTF::RunLoop::RunLoop): Deleted. (WTF::RunLoop::~RunLoop): Deleted. (WTF::RunLoop::run): Deleted. (WTF::RunLoop::stop): Deleted. (WTF::RunLoop::wakeUp): Deleted. (WTF::RunLoop::TimerBase::TimerBase): Deleted. (WTF::RunLoop::TimerBase::~TimerBase): Deleted. (WTF::RunLoop::TimerBase::start): Deleted. (WTF::RunLoop::TimerBase::stop): Deleted. (WTF::RunLoop::TimerBase::isActive): Deleted. * wtf/none/WorkQueueNone.cpp: (WorkQueue::platformInitialize): Deleted. (WorkQueue::platformInvalidate): Deleted. (WorkQueue::dispatch): Deleted. (WorkQueue::dispatchAfter): Deleted. 2016-04-18 Commit Queue Unreviewed, rolling out r199621. https://bugs.webkit.org/show_bug.cgi?id=156708 made windows tests crash (Requested by alexchristensen on #webkit). Reverted changeset: "iTunes crashing JavaScriptCore.dll" https://bugs.webkit.org/show_bug.cgi?id=156647 http://trac.webkit.org/changeset/199621 2016-04-15 Michael Saboff iTunes crashing JavaScriptCore.dll https://bugs.webkit.org/show_bug.cgi?id=156647 Reviewed by Geoffrey Garen. If a thread was created without using the WTF thread apis and that thread uses a JavaScript VM and that thread exits with the VM still around, JSC won't know that the thread has exited. Currently, we use ThreadSpecificThreadExit() to clean up any thread specific keys. Cleaning up these keys is how JSC is notified of a thread exit. We only call ThreadSpecificThreadExit() from wtfThreadEntryPoint() when the thread entry point function returns. This mechanism was put in place for Windos because we layer the WTF::ThreadSpecific functionality on top of TLS (Thread Local Storage), but TLS doesn't have a thread exiting callback the way that pthread_create_key. The fix is to change from using TLS to using FLS (Fiber Local Storage). Although Windows allows multiple fibers per thread, WebKit is not designed to work with a multiple fibers per thread. When ther is only one fiber per thread, FLS works just like TLS, but it has the destroy callback. I restructured the Windows version of WTF::ThreadSpecific to be almost the same as the pthread version. * wtf/ThreadSpecific.h: (WTF::threadSpecificKeyCreate): (WTF::threadSpecificKeyDelete): (WTF::threadSpecificSet): (WTF::threadSpecificGet): (WTF::ThreadSpecific::ThreadSpecific): (WTF::ThreadSpecific::~ThreadSpecific): (WTF::ThreadSpecific::get): (WTF::ThreadSpecific::set): (WTF::ThreadSpecific::destroy): Restructured to use FLS. Renamed TLS* to FLS*. * wtf/ThreadSpecificWin.cpp: (WTF::flsKeyCount): (WTF::flsKeys): Renamed from tlsKey*() to flsKey*(). (WTF::destructorsList): Deleted. (WTF::destructorsMutex): Deleted. (WTF::PlatformThreadSpecificKey::PlatformThreadSpecificKey): Deleted. (WTF::PlatformThreadSpecificKey::~PlatformThreadSpecificKey): Deleted. (WTF::PlatformThreadSpecificKey::setValue): Deleted. (WTF::PlatformThreadSpecificKey::value): Deleted. (WTF::PlatformThreadSpecificKey::callDestructor): Deleted. (WTF::tlsKeyCount): Deleted. (WTF::tlsKeys): Deleted. (WTF::threadSpecificKeyCreate): Deleted. (WTF::threadSpecificKeyDelete): Deleted. (WTF::threadSpecificSet): Deleted. (WTF::threadSpecificGet): Deleted. (WTF::ThreadSpecificThreadExit): Deleted. * wtf/ThreadingWin.cpp: (WTF::wtfThreadEntryPoint): Eliminated call to ThreadSpecificThreadExit. 2016-04-12 Filip Pizlo PolymorphicAccess should buffer AccessCases before regenerating https://bugs.webkit.org/show_bug.cgi?id=156457 Reviewed by Benjamin Poulain. * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::add): Add a helpful comment because I had forgotten what the bool return meant. 2016-04-12 Tomas Popela S390X and PPC64 architectures detection is wrong https://bugs.webkit.org/show_bug.cgi?id=156337 Reviewed by Carlos Garcia Campos. After the http://trac.webkit.org/changeset/198919 was committed it showed that the PPC64 detection is wrong as the CPU(PPC) path was activated even for PPC64. The thing is that GCC defines __ppc__ even on PPC64 and not just on PPC(32). The same applies for S390X. * wtf/Platform.h: 2016-04-05 Oliver Hunt Remove compile time define for SEPARATED_HEAP https://bugs.webkit.org/show_bug.cgi?id=155508 Reviewed by Mark Lam. * wtf/FeatureDefines.h: * wtf/Platform.h: 2016-04-11 Fujii Hironori [CMake] Make FOLDER property INHERITED https://bugs.webkit.org/show_bug.cgi?id=156460 Reviewed by Brent Fulgham. * CMakeLists.txt: Set FOLDER directory property 2016-04-08 Alex Christensen Progress towards running CMake WebKit2 on Mac https://bugs.webkit.org/show_bug.cgi?id=156426 Reviewed by Tim Horton. * wtf/PlatformMac.cmake: 2016-04-08 Yusuke Suzuki [JSC] Enable Concurrent JIT by default https://bugs.webkit.org/show_bug.cgi?id=156341 Reviewed by Filip Pizlo. We enable Concurrent JIT by default when DFG JIT and JSVALUE64 are enabled. This change offers Concurrent JIT to the JSCOnly port. * wtf/Platform.h: 2016-04-07 Joseph Pecoraro Remove ENABLE(ENABLE_ES6_CLASS_SYNTAX) guards https://bugs.webkit.org/show_bug.cgi?id=156384 Reviewed by Ryosuke Niwa. * wtf/FeatureDefines.h: 2016-04-06 Filip Pizlo JSC should have a simple way of gathering IC statistics https://bugs.webkit.org/show_bug.cgi?id=156317 Reviewed by Benjamin Poulain. Make it easier to do relative sleeping on a condition. Previously you could do this using std::chrono. I now believe that std::chrono is just a bad decision, and I always want to use doubles instead. This makes it easier to do the right thing and use doubles. * wtf/Condition.h: (WTF::ConditionBase::waitUntilMonotonicClockSeconds): (WTF::ConditionBase::waitForSeconds): 2016-04-06 Simon Fraser Fix Windows build by converting clampToInteger() into a template that only takes integral types. * wtf/MathExtras.h: (clampToInteger): 2016-04-06 Simon Fraser Page tiles are missing when graphics acceleration is unavailable https://bugs.webkit.org/show_bug.cgi?id=156325 Reviewed by Tim Horton. Add clampToInteger(size_t). * wtf/MathExtras.h: (clampToInteger): 2016-04-05 Simon Fraser Implement operator== and operator!= for Optional<> https://bugs.webkit.org/show_bug.cgi?id=156266 Reviewed by Anders Carlsson. Implement non-member operator== and operator!= variants for Optional<>. * wtf/Optional.h: (WTF::operator==): (WTF::operator!=): 2016-03-19 Filip Pizlo DFG and FTL should constant-fold RegExpExec https://bugs.webkit.org/show_bug.cgi?id=155270 Reviewed by Saam Barati. Make executeInsertions() return the amount by which the vector increased in size. This is a convenient feature that I use in DFG::InsertionSet. * wtf/Insertion.h: (WTF::executeInsertions): 2016-04-05 Antoine Quint [WebGL2] Allow enabling WebGL2 with a runtime flag https://bugs.webkit.org/show_bug.cgi?id=156166 Removed the manual overrides of ENABLE_WEBGL2. Reviewed by Dean Jackson. * wtf/FeatureDefines.h: 2016-03-31 Konstantin Tokarev Removed leftovers of ENABLE(INSPECTOR) and ENABLE(VIEWPORT). https://bugs.webkit.org/show_bug.cgi?id=156064 Reviewed by Csaba Osztrogonác. This ifdef guards were removed in r178820 and r147714, respectively. * wtf/FeatureDefines.h: 2016-03-31 Brent Fulgham [WK2] Support download attribute feature https://bugs.webkit.org/show_bug.cgi?id=102914 Reviewed by Darin Adler. * wtf/FeatureDefines.h: Turn the ENABLE_DOWNLOAD_ATTRIBUTE flag on to see what happens. 2016-03-30 Brian Burg Web Automation: Add Automation.performKeyboardInteractions https://bugs.webkit.org/show_bug.cgi?id=155990 Reviewed by Timothy Hatcher. Add a missing NSEventType declaration. * wtf/mac/AppKitCompatibilityDeclarations.h: 2016-03-29 Benjamin Poulain [WTF] Removing a smart pointer from HashTable issues two stores to the same location https://bugs.webkit.org/show_bug.cgi?id=155676 Reviewed by Darin Adler. While working on the hot loop of r198376, I noticed something weird... Every time we removed a smart pointer from the hash table, the code generated was something like: Load([bucket]) -> Tmp Store(0 -> [bucket]) JumpIfZero(Tmp, ->End) Call fastFree() Store(-1 -> [bucket]) -> End: The useless store before the branch is annoying, especially on ARM. Here is what happens: 1) The destructor of the smart pointer swaps its internal value with nullptr. 2) Since the smart pointer is not a local in-register value, that nullptr is stored in memory because it could be observable from fastFree(). 3) The destructor destroy the value if not zero (or deref for RefPtr). The "if-not-zero" may or may not be eliminated depending on what is between getting the iterator and the call to remove(). 4) fastFree() is called. 5) The deleted value is set in the bucket. This patch adds custom deletion for those cases to avoid the useless store. The useless null check is still eliminated when we are lucky. I went this path instead of changing the destructor of RefPtr for two reasons: -I need this to work in unique_ptr for JSC. -Nulling the memory may have security advantages in the cases where we do not immediately write over that memory again. This patch removes 13kb out of x86_64 WebCore. * wtf/HashTable.h: (WTF::HashTable::deleteBucket): (WTF::KeyTraits>::removeIf): * wtf/HashTraits.h: (WTF::HashTraits>::customDeleteBucket): (WTF::hashTraitsDeleteBucket): (WTF::KeyValuePairHashTraits::customDeleteBucket): * wtf/text/AtomicStringHash.h: (WTF::HashTraits::isEmptyValue): (WTF::HashTraits::customDeleteBucket): * wtf/text/StringHash.h: (WTF::HashTraits::customDeleteBucket): 2016-03-28 Brian Burg Web Automation: implement Automation.performMouseInteraction https://bugs.webkit.org/show_bug.cgi?id=155606 Reviewed by Timothy Hatcher. * wtf/mac/AppKitCompatibilityDeclarations.h: Add missing some NSEventTypes. 2016-03-29 Yusuke Suzuki REGRESSION(r192914): 10% regression on Sunspider's date-format-tofte https://bugs.webkit.org/show_bug.cgi?id=155559 Reviewed by Saam Barati. Add HashTable::inlineLookup and HashMap::fastGet. * wtf/HashMap.h: * wtf/HashTable.h: 2016-03-25 Alex Christensen Add a compile time flag for using QTKit https://bugs.webkit.org/show_bug.cgi?id=155868 Reviewed by Dan Bates. * wtf/Platform.h: 2016-03-24 Alex Christensen Fix iOS9 performance regression after r197572 https://bugs.webkit.org/show_bug.cgi?id=155845 Reviewed by Chris Dumez. * wtf/Platform.h: Use CFURLConnection instead of NSURLConnection on internal iOS9 builds. 2016-03-23 Saam Barati SmallPtrSet leaks memory in its move assignment operator when !this->isSmall() https://bugs.webkit.org/show_bug.cgi?id=155701 Reviewed by Darin Adler. * wtf/SmallPtrSet.h: (WTF::SmallPtrSet::SmallPtrSet): (WTF::SmallPtrSet::operator=): 2016-03-22 Per Arne Vollan [Win] [64-bit] Remove MSVC 2013 FMA3 Bug Workaround https://bugs.webkit.org/show_bug.cgi?id=141499 Reviewed by Brent Fulgham. As we have moved on to VS2015, this workaround is no longer needed. * wtf/PlatformWin.cmake: * wtf/win/WTFDLL.cpp: Removed. 2016-03-20 Dan Bernstein [Mac] Determine TARGET_MAC_OS_X_VERSION_MAJOR from MACOSX_DEPLOYMENT_TARGET rather than from MAC_OS_X_VERSION_MAJOR https://bugs.webkit.org/show_bug.cgi?id=155707 Reviewed by Darin Adler. * Configurations/Base.xcconfig: Set TARGET_MAC_OS_X_VERSION_MAJOR based on the last component of MACOSX_DEPLOYMENT_TARGET. * Configurations/DebugRelease.xcconfig: For engineering builds, preserve the behavior of TARGET_MAC_OS_X_VERSION_MAJOR being the host’s OS version. 2016-03-20 Dan Bernstein Update build settings Rubber-stamped by Andy Estes. * Configurations/DebugRelease.xcconfig: 2016-03-17 Benjamin Poulain [JSC] Make CSE's ImpureData faster when dealing with large blocks https://bugs.webkit.org/show_bug.cgi?id=155594 Reviewed by Filip Pizlo. * wtf/HashSet.h: (WTF::V>::removeIf): 2016-03-17 Saam barati Implement SmallPtrSet and integrate it into the Parser https://bugs.webkit.org/show_bug.cgi?id=155552 Reviewed by Filip Pizlo. This patch implements the SmallPtrSet data struture. Inspired by the implementation in llvm: http://llvm.org/docs/doxygen/html/SmallPtrSet_8h_source.html The data structure uses an inline array for storage up until a fixed limit (8 entries in our implementation). If that storage fills up, we fall back to a simple hash table implementation. Crucially, this implementation doesn't support the remove operation. This is on purpose. The hash table will only ever grow. Also, the implementation allows for it to be memcopied around. I.e, we can put SmallPtrSet inside a Vector and allow that Vector to use memcpy as its move operation (of course this is only valid if the SmallPtrSet in the old memory doesn't have its destructor called unless it is set back to its initial state.) For now, SmallPtrSet only supports pointer types that are trivially destructible. It's probably not too difficult to extend this to smart pointers, but it's not part of this original implementation. I've also implemented a pure forwarding varargs constructAndAppend method on Vector. This allows you to do: Vector v; v.constructAndAppend(a1, a2, ...) as long as T has a constructor that accepts arguments (a1, a2, ...). * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/SmallPtrSet.h: Added. (WTF::SmallPtrSet::SmallPtrSet): (WTF::SmallPtrSet::operator=): (WTF::SmallPtrSet::~SmallPtrSet): (WTF::SmallPtrSet::add): (WTF::SmallPtrSet::contains): (WTF::SmallPtrSet::iterator::operator++): (WTF::SmallPtrSet::iterator::operator*): (WTF::SmallPtrSet::iterator::operator==): (WTF::SmallPtrSet::iterator::operator!=): (WTF::SmallPtrSet::begin): (WTF::SmallPtrSet::end): (WTF::SmallPtrSet::size): (WTF::SmallPtrSet::emptyValue): (WTF::SmallPtrSet::isValidEntry): (WTF::SmallPtrSet::isSmall): (WTF::SmallPtrSet::initialize): (WTF::SmallPtrSet::grow): (WTF::SmallPtrSet::bucket): * wtf/Vector.h: (WTF::Vector::append): (WTF::Vector::uncheckedAppend): (WTF::minCapacity>::append): (WTF::minCapacity>::constructAndAppend): (WTF::minCapacity>::appendSlowCase): (WTF::minCapacity>::constructAndAppendSlowCase): 2016-03-16 Filip Pizlo Replace all of the various non-working and non-compiling sampling profiler hacks with a single super hack https://bugs.webkit.org/show_bug.cgi?id=155561 Reviewed by Saam Barati. This patch replaces all of our various ad hoc profiling hacks with a single ad hoc profiling hack. That needs to be able to sleep a thread, so I added a portable way to do it. This also removes a bunch of ENABLE flags for all of the old non-working hacks. * wtf/CurrentTime.cpp: (WTF::currentCPUTime): (WTF::sleep): * wtf/CurrentTime.h: (WTF::sleepMS): * wtf/Platform.h: 2016-03-17 Chris Dumez Set the WebContent process's main thread QoS to USER-INTERACTIVE https://bugs.webkit.org/show_bug.cgi?id=155595 Reviewed by Antti Koivisto. Add a relativePriority parameter to setCurrentThreadIsUser*() so that we can do more fine-grained prioritization of threads that have the same QoS. * wtf/Threading.cpp: (WTF::setCurrentThreadIsUserInteractive): (WTF::setCurrentThreadIsUserInitiated): (WTF::createThread): Deleted. * wtf/Threading.h: 2016-03-17 Filip Pizlo Silence leaks in ParkingLot https://bugs.webkit.org/show_bug.cgi?id=155510 Reviewed by Alexey Proskuryakov. ParkingLot has a concurrent hashtable that it reallocates on demand. It will not reallocate it in steady state. The hashtable is sized to accommodate the high watermark of the number of active threads - so long as the program doesn't just keep starting an unbounded number of threads that are all active, the hashtable will stop resizing. Each resize operation is designed to stay out of the way of the data-access-parallel normal path, in which two threads operating on different lock addresses don't have to synchronize. To do this, it simply drops the old hashtable without deleting it, so that threads that were still using it don't crash. They will realize that they have the wrong hashtable before doing anything bad, but we don't have a way of proving when all of those threads are no longer going to read from the old hashtables. So, we just leak them. This is a bounded leak, since the hashtable resizes exponentially. Thus the total memory utilization of all hashtables, including the leaked ones, converges to a linear function of the current hashtable's size (it's 2 * size of current hashtable). But this leak is a problem for leaks tools, which will always report this leak. This is not useful. It's better to silence the leak. That's what this patch does by ensuring that all hashtables, including leaked ones, end up in a global vector. This is perf-neutral. This requires making a StaticWordLock variant of WordLock. That's probably the biggest part of this change. * wtf/ParkingLot.cpp: * wtf/WordLock.cpp: (WTF::WordLockBase::lockSlow): (WTF::WordLockBase::unlockSlow): (WTF::WordLock::lockSlow): Deleted. (WTF::WordLock::unlockSlow): Deleted. * wtf/WordLock.h: (WTF::WordLockBase::lock): (WTF::WordLockBase::isLocked): (WTF::WordLock::WordLock): (WTF::WordLock::lock): Deleted. (WTF::WordLock::isLocked): Deleted. 2016-03-16 Chris Dumez Unreviewed, rolling out r198235, r198240, r198241, and r198252. Causing crashes on ARM Reverted changesets: "Remove compile time define for SEPARATED_HEAP" https://bugs.webkit.org/show_bug.cgi?id=155508 http://trac.webkit.org/changeset/198235 "Gardening: build fix after r198235." http://trac.webkit.org/changeset/198240 "Build fix." http://trac.webkit.org/changeset/198241 "Rename performJITMemcpy to something more inline with our normal webkit function names" https://bugs.webkit.org/show_bug.cgi?id=155525 http://trac.webkit.org/changeset/198252 2016-03-15 Oliver Hunt Remove compile time define for SEPARATED_HEAP https://bugs.webkit.org/show_bug.cgi?id=155508 Reviewed by Mark Lam. Remove the feature define. * wtf/FeatureDefines.h: * wtf/Platform.h: 2016-03-14 Mark Lam Need to distinguish between Symbol() and Symbol(""). https://bugs.webkit.org/show_bug.cgi?id=155438 Reviewed by Saam Barati. While toString of both Symbol() and Symbol("") yields "Symbol()", Function.name should yield "" and "[]" respectively. Hence, we need to tell between the two. This functionality will be needed later in https://bugs.webkit.org/show_bug.cgi?id=155437. We achieve this by creating another singleton instance like the empty StringImpl as the null StringImpl. isNullSymbol() tests if the Stringimpl instance is a symbol, and its substring is the null() singleton. * wtf/text/StringImpl.cpp: (WTF::StringImpl::createSymbol): (WTF::StringImpl::createNullSymbol): (WTF::StringImpl::containsOnlyWhitespace): (WTF::StringImpl::createSymbolEmpty): Deleted. * wtf/text/StringImpl.h: (WTF::StringImpl::tryCreateUninitialized): (WTF::StringImpl::stringKind): (WTF::StringImpl::isSymbol): (WTF::StringImpl::isAtomic): (WTF::StringImpl::isNullSymbol): * wtf/text/StringStatics.cpp: (WTF::StringImpl::null): 2016-03-13 Joseph Pecoraro Remove ENABLE(ES6_TEMPLATE_LITERAL_SYNTAX) guards https://bugs.webkit.org/show_bug.cgi?id=155417 Reviewed by Yusuke Suzuki. * wtf/FeatureDefines.h: 2016-03-13 Konstantin Tokarev Added new port JSCOnly. https://bugs.webkit.org/show_bug.cgi?id=154512 Reviewed by Michael Catanzaro. This port allows to build JavaScriptCore engine with minimal dependencies. * wtf/PlatformJSCOnly.cmake: Added. * wtf/none/MainThreadNone.cpp: Added. * wtf/none/RunLoopNone.cpp: Added. * wtf/none/WorkQueueNone.cpp: Added. 2016-03-13 David Kilzer REGRESSION (r198079): Windows build broke because of "%PRId64" format specifier This fixes the following build failure in WebCore for Windows: C:\Source\WebCore\page\DOMTimer.cpp(396): error C2146: syntax error: missing ')' before identifier 'PRId64' [C:\WebKitBuild\Debug\Source\WebCore\WebCore.vcxproj] C:\Source\WebCore\page\DOMTimer.cpp(399): error C2146: syntax error: missing ')' before identifier 'PRId64' [C:\WebKitBuild\Debug\Source\WebCore\WebCore.vcxproj] * wtf/StdLibExtras.h: Define "PRId64" for Windows here so it may be shared. This should fix DOMTimer.cpp after r198079 since it already includes StdLibExtras.h. 2016-03-11 Youenn Fablet WTF should have a similar function as equalLettersIgnoringASCIICase to match beginning of strings https://bugs.webkit.org/show_bug.cgi?id=153419 Reviewed by Darin Adler. Introducing startsWithLettersIgnoringASCIICase, to check the beginning of a string. Moving some code from WTF::equalLettersIgnoringASCIICaseCommonWithoutLength in WTF::hasPrefixWithLettersIgnoringASCIICaseCommon to enable reuse in WTF::startsWithLettersIgnoringASCIICaseCommon. * wtf/text/StringCommon.h: (WTF::hasPrefixWithLettersIgnoringASCIICaseCommon): (WTF::equalLettersIgnoringASCIICaseCommonWithoutLength): (WTF::startsWithLettersIgnoringASCIICaseCommonWithoutLength): (WTF::startsWithLettersIgnoringASCIICaseCommon): * wtf/text/StringImpl.h: (WTF::startsWithLettersIgnoringASCIICase): * wtf/text/WTFString.h: (WTF::startsWithLettersIgnoringASCIICase): 2016-03-10 Frederic Wang [GTK] Add support for WOFF2 https://bugs.webkit.org/show_bug.cgi?id=152616 Reviewed by Carlos Garcia Campos. * wtf/FeatureDefines.h: Enable USE_WOFF2 flag on GTK. 2016-03-09 Ryosuke Niwa Add runtime flags for shadow DOM and custom elements https://bugs.webkit.org/show_bug.cgi?id=155213 Reviewed by Dean Jackson. Removed the manual overrides of ENABLE_SHADOW_DOM and ENABLE_CUSTOM_ELEMENTS as they were making --no-shadow-dom and --no-custom-elements flags on build-webkit useless. * wtf/FeatureDefines.h: 2016-03-09 Keith Rollin Add state dumping facility https://bugs.webkit.org/show_bug.cgi?id=154930 Reviewed by Anders Carlsson. Add an OS_STATE flag to control the inclusion of process state dumping functionality. * wtf/Platform.h: 2016-03-09 Oliver Hunt Fix old iOS * wtf/Platform.h: 2016-03-08 Filip Pizlo Remove failing assertion. There are strings that claim to be atomic but that the compiler thread can totally deal with, like the empty string. Rubber stamped by Mark Lam. * wtf/text/StringImpl.h: (WTF::StringImpl::ref): (WTF::StringImpl::deref): 2016-03-08 Filip Pizlo DFG should be able to constant-fold strings https://bugs.webkit.org/show_bug.cgi?id=155200 Reviewed by Geoffrey Garen. Also disable assertions about reference counting strings on the JIT thread. We will do that now and it's OK. * wtf/text/StringImpl.h: (WTF::StringImpl::ref): (WTF::StringImpl::deref): 2016-03-08 Anders Carlsson Fix AppKitCompatibilityDeclarations build. * wtf/mac/AppKitCompatibilityDeclarations.h: Remove duplicate declarations, conditionally define NSTextAlignment and add a NSWindowStyleMask typedef. 2016-03-08 Oliver Hunt Start moving to separated writable and executable mappings in the JIT https://bugs.webkit.org/show_bug.cgi?id=155178 Reviewed by Fil Pizlo. Update feature defines. * wtf/FeatureDefines.h: * wtf/Platform.h: ARM64 for now. 2016-03-08 Anders Carlsson Add AppKit compatibility header https://bugs.webkit.org/show_bug.cgi?id=155202 Reviewed by Beth Dakin. * WTF.xcodeproj/project.pbxproj: * wtf/mac/AppKitCompatibilityDeclarations.h: Added. 2016-03-08 Commit Queue Unreviewed, rolling out r197793 and r197799. https://bugs.webkit.org/show_bug.cgi?id=155195 something weird happened while landing this and everything broke (Requested by olliej on #webkit). Reverted changesets: "Start moving to separated writable and executable mappings in the JIT" https://bugs.webkit.org/show_bug.cgi?id=155178 http://trac.webkit.org/changeset/197793 "arm64 build fix after r197793." http://trac.webkit.org/changeset/197799 2016-03-08 Oliver Hunt Start moving to separated writable and executable mappings in the JIT https://bugs.webkit.org/show_bug.cgi?id=155178 Reviewed by Filip Pizlo. Update feature defines. * wtf/FeatureDefines.h: * wtf/Platform.h: ARM64 for now. 2016-03-08 Daniel Bates Support iterating over an OptionSet and checking if it is empty https://bugs.webkit.org/show_bug.cgi?id=154941 Reviewed by Darin Adler. Implements support for iterating over the enumerators in an OptionSet as well as determining if the set is empty. Iterating over an OptionSet is in Big Theta(N) where N is the number of items in the set. More precisely, it is in Big Theta(log M) where M is the bitmask represented by the bitwise OR-ing of all enumerators in the set. * wtf/OptionSet.h: Added comment to describe the purpose of this class and its invariant - the enumerators must be positive powers of two. (WTF::OptionSet::Iterator::operator*): Returns the enumerator pointed to by the iterator. (WTF::OptionSet::Iterator::operator++): Advance to the next smallest enumerator in the set. (WTF::OptionSet::Iterator::operator==): Returns whether the iterator is equal to the specified iterator. (WTF::OptionSet::Iterator::operator!=): Returns whether the iterator is not equal to the specified iterator. (WTF::OptionSet::Iterator::Iterator): Added. (WTF::OptionSet::fromRaw): Instantiate using specialized private constructor to allow instantiation with a raw value of 0. (WTF::OptionSet::OptionSet): Specialized constructor that asserts that the specified value is a positive power of two. This variant is only compiled when assertions are enabled (i.e. !ASSERT_DISABLED). (WTF::OptionSet::isEmpty): Returns whether the set is empty. (WTF::OptionSet::begin): Returns an iterator to the enumerator with the smallest value in the set. (WTF::OptionSet::end): Returns an iterator that represents the end sentinel of the set. 2016-03-07 Keith Rollin Enhance logging: Use "always on" macros https://bugs.webkit.org/show_bug.cgi?id=154499 Reviewed by Chris Dumez. Update LOG_ALWAYS and LOG_ALWAYS_ERROR macros to take an expression to be evaluated. If the expression evaluates to True, the associated message is logged. This facility is used to prevent logging from being performed in private sessions, but it could be extended to prevent logging under other circumstances as well. * wtf/Assertions.h: 2016-03-04 Alex Christensen Remove vcxproj build system https://bugs.webkit.org/show_bug.cgi?id=154388 Rubber-stamped by Brent Fulgham. * WTF.vcxproj/WTF.submit.sln: Removed. * WTF.vcxproj/WTF.vcxproj: Removed. * WTF.vcxproj/WTF.vcxproj.filters: Removed. * WTF.vcxproj/WTFCFLite.props: Removed. * WTF.vcxproj/WTFCommon.props: Removed. * WTF.vcxproj/WTFCoreFoundation.props: Removed. * WTF.vcxproj/WTFDebug.props: Removed. * WTF.vcxproj/WTFDebugWinCairo.props: Removed. * WTF.vcxproj/WTFGenerated.make: Removed. * WTF.vcxproj/WTFGenerated.vcxproj: Removed. * WTF.vcxproj/WTFGenerated.vcxproj.filters: Removed. * WTF.vcxproj/WTFGeneratedCommon.props: Removed. * WTF.vcxproj/WTFGeneratedDebug.props: Removed. * WTF.vcxproj/WTFGeneratedProduction.props: Removed. * WTF.vcxproj/WTFGeneratedRelease.props: Removed. * WTF.vcxproj/WTFPostBuild.cmd: Removed. * WTF.vcxproj/WTFPreBuild.cmd: Removed. * WTF.vcxproj/WTFProduction.props: Removed. * WTF.vcxproj/WTFRelease.props: Removed. * WTF.vcxproj/WTFReleaseWinCairo.props: Removed. * WTF.vcxproj/build-generated-files.pl: Removed. * WTF.vcxproj/copy-files.cmd: Removed. * WTF.vcxproj/work-around-vs-dependency-tracking-bugs.py: Removed. 2016-03-04 Alex Christensen Use NSURLSession for loading in WebKit2 https://bugs.webkit.org/show_bug.cgi?id=154993 Reviewed by Sam Weinig. * wtf/Platform.h: 2016-03-03 Daniel Bates Add unit tests for WTF::OptionSet https://bugs.webkit.org/show_bug.cgi?id=154925 Reviewed by Darin Adler. * wtf/CMakeLists.txt: Add header OptionSet.h to the list of WTF headers. * wtf/OptionSet.h: Use in-class initialization to initialize m_storage and declare the trivial constexpr constructor as default. (WTF::OptionSet::OptionSet): For convenience add a constructor that takes a std::initializer_list. This code was written by Anders Carlsson. 2016-03-03 Andy Estes Adopt CFNetwork storage partitioning SPI https://bugs.webkit.org/show_bug.cgi?id=154957 rdar://problem/23614620 Reviewed by Darin Adler. * wtf/Platform.h: Defined HAVE_CFNETWORK_STORAGE_PARTITIONING. 2016-03-02 Konstantin Tokarev [cmake] Moved PRE/POST_BUILD_COMMAND to WEBKIT_FRAMEWORK. https://bugs.webkit.org/show_bug.cgi?id=154651 Reviewed by Alex Christensen. * CMakeLists.txt: Moved shared code to WEBKIT_FRAMEWORK macro. 2016-03-01 Commit Queue Unreviewed, rolling out r197226 and r197256. https://bugs.webkit.org/show_bug.cgi?id=154910 Caused crashes on Mac 32-bit and on ARM (Requested by ap on #webkit). Reverted changesets: "Remove the on demand executable allocator" https://bugs.webkit.org/show_bug.cgi?id=154749 http://trac.webkit.org/changeset/197226 "CLoop build fix." http://trac.webkit.org/changeset/197256 2016-03-01 Alex Christensen Reduce size of internal windows build output https://bugs.webkit.org/show_bug.cgi?id=154763 Reviewed by Brent Fulgham. * WTF.vcxproj/WTF.proj: 2016-03-01 Commit Queue Unreviewed, rolling out r197056. https://bugs.webkit.org/show_bug.cgi?id=154870 broke win ews (Requested by alexchristensen on #webkit). Reverted changeset: "[cmake] Moved PRE/POST_BUILD_COMMAND to WEBKIT_FRAMEWORK." https://bugs.webkit.org/show_bug.cgi?id=154651 http://trac.webkit.org/changeset/197056 2016-02-29 Gavin Barraclough RefCounter::Event -> RefCounterEvent https://bugs.webkit.org/show_bug.cgi?id=154767 Reviewed by Darin Adler. RefCounter::Event is kinda verbose to use, and there is no need for this to be specific to a particular typeof RefCounter. Move the enum class up to the top level & rename to RefCounterEvent. * wtf/RefCounter.h: (WTF::RefCounter::Count::ref): (WTF::RefCounter::Count::deref): 2016-02-26 Oliver Hunt Remove the on demand executable allocator https://bugs.webkit.org/show_bug.cgi?id=154749 Reviewed by Geoffrey Garen. Remove the DeamndExecutableAllocator compile flags. * wtf/Platform.h: 2016-02-26 Keith Rollin Enhance logging: Add "always on" macros https://bugs.webkit.org/show_bug.cgi?id=154498 Reviewed by Chris Dumez. Add support for efficient always-on logging (logging that is available in both debug and release builds). This is implemented in the form of some new macros: - LOG_ALWAYS: Always log information-level statements. - LOG_ALWAYS_ERROR: Always log error-level statements. These can be filtered out of the normal logging so that they can be found more easily. In cases where there is no efficient underlying facility for it to utilize, LOG_ALWAYS_ERROR is redirected to WTFReportError as a backup mechanism. LOG_ALWAYS is not given a similar treatment so that we don't overwhelm other logging systems that aren't prepared for "always on" logging. * wtf/Assertions.h: * wtf/Platform.h: 2016-02-26 Anders Carlsson Add WTF::OptionSet and use it for the website data types enum https://bugs.webkit.org/show_bug.cgi?id=154733 Reviewed by Geoffrey Garen. Add WTF::OptionSet which makes it easier to use strong enums as flags. * WTF.xcodeproj/project.pbxproj: * wtf/Forward.h: * wtf/OptionSet.h: Copied from Source/WebKit2/Shared/WebsiteData/WebsiteData.h. (WTF::OptionSet::fromRaw): (WTF::OptionSet::OptionSet): (WTF::OptionSet::toRaw): (WTF::OptionSet::contains): (WTF::OptionSet::operator|=): 2016-02-26 Commit Queue Unreviewed, rolling out r197168. https://bugs.webkit.org/show_bug.cgi?id=154728 crashing on some devices (Requested by kling on #webkit). Reverted changeset: "[Darwin] Use vm_kernel_page_size for WTF::pageSize()." https://bugs.webkit.org/show_bug.cgi?id=154726 http://trac.webkit.org/changeset/197168 2016-02-26 Andreas Kling [Darwin] Use vm_kernel_page_size for WTF::pageSize(). Reviewed by Antti Koivisto. Make sure we use the right VM page size on Darwin systems. On devices where the native page size is 4 KB, it's both possible and profitable to madvise in smaller chunks. * wtf/PageBlock.cpp: (WTF::systemPageSize): 2016-02-25 Gavin Barraclough RefCounter value changed callback should be called on all changes (not just zero edge). https://bugs.webkit.org/show_bug.cgi?id=154699 Reviewed by Anders Carlsson. RefCounter currently only triggers a callback when the count goes from zero to non-zero and vice-versa. Change that, to be useful to more clients. * wtf/RefCounter.h: (WTF::RefCounter::Count::Count): (WTF::RefCounter::RefCounter): - Removed superfluous WTF_EXPORT_PRIVATE. (WTF::RefCounter::value): - Changed value() to a size_t. (WTF::RefCounter::Count::ref): (WTF::RefCounter::Count::deref): - Trigger the callback on all increments/decrements. (WTF::RefCounter::RefCounter): - Changed siganture of callback. 2016-02-25 Gavin Barraclough Replace RefCounter::Token implementation with RefPtr https://bugs.webkit.org/show_bug.cgi?id=154698 Reviewed by Anders Carlsson. * wtf/RefCounter.h: (WTF::RefCounter::RefCounter): (WTF::RefCounter::count): (WTF::RefCounter::value): (WTF::RefCounter::~RefCounter): (WTF::RefCounter::Token::Token): Deleted. (WTF::RefCounter::Token::operator bool): Deleted. (WTF::RefCounter::Token::Token): Deleted. (WTF::=): Deleted. - Delete. 2016-02-25 Gavin Barraclough Should template RefCounter instead of RefCounter::Token https://bugs.webkit.org/show_bug.cgi?id=154691 Speculative windows build fix. * wtf/RefCounter.h: (WTF::RefCounter::RefCounter): (WTF::RefCounter::count): 2016-02-25 Commit Queue Unreviewed, rolling out r197137. https://bugs.webkit.org/show_bug.cgi?id=154700 broke windows build (Requested by alexchristensen on #webkit). Reverted changeset: "Replace RefCounter::Token implementation with RefPtr" https://bugs.webkit.org/show_bug.cgi?id=154698 http://trac.webkit.org/changeset/197137 2016-02-25 Gavin Barraclough Replace RefCounter::Token implementation with RefPtr https://bugs.webkit.org/show_bug.cgi?id=154698 Reviewed by Anders Carlsson. * wtf/RefCounter.h: (WTF::RefCounter::RefCounter): (WTF::RefCounter::count): (WTF::RefCounter::value): (WTF::RefCounter::~RefCounter): (WTF::RefCounter::Token::Token): Deleted. (WTF::RefCounter::Token::operator bool): Deleted. (WTF::RefCounter::Token::Token): Deleted. (WTF::=): Deleted. - Delete. 2016-02-25 Gavin Barraclough Should template RefCounter instead of RefCounter::Token https://bugs.webkit.org/show_bug.cgi?id=154691 Reviewed by Anders Carlsson. My real goal here is to make the counter accurate. Currently returning a Token from token<>() results in ref-count churn. Fixing this either means changing the return value, or improving Token (which will probably mean replacing it with RefPtr). Either way would break the current type checking. Move type tag to RefCount so this can still be enforced. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/RefCounter.cpp: Removed. - Removed RefCounter.cpp. * wtf/RefCounter.h: (WTF::RefCounter::Token::Token): (WTF::RefCounter::Token::operator bool): (WTF::RefCounter::RefCounter): (WTF::RefCounter::count): (WTF::RefCounter::value): (WTF::RefCounter::Count::ref): (WTF::RefCounter::Count::deref): (WTF::RefCounter::RefCounter): (WTF::RefCounter::~RefCounter): (WTF::RefCounter::Token::Token): (WTF::=): (WTF::RefCounter::token): Deleted. (WTF::RefCounter::Token::Token): Deleted. - RefCounter -> RefCounter, - Token -> Token, - renamed token<>() -> count(). 2016-02-25 Sam Weinig HashMap::ensure() should return an AddResult like all the other add-like functions. https://bugs.webkit.org/show_bug.cgi?id=154680 Reviewed by Anders Carlsson. While adopting HashMap::ensure(), I found it was useful in some circumstances to know if the value was added or not. While I could discern this information by setting a bool in the passed in lambda, it seemed clearer and more idiomatic to just have ensure return an AddResult like all the other add-like functions do. * wtf/HashMap.h: Change return type of HashMap::ensure() to be an AddResult. 2016-02-24 Nikos Andronikos [web-animations] Add AnimationTimeline, DocumentTimeline and add extensions to Document interface https://bugs.webkit.org/show_bug.cgi?id=151688 Reviewed by Dean Jackson. Enables the WEB_ANIMATIONS compiler switch. * wtf/FeatureDefines.h: 2016-02-24 Konstantin Tokarev [cmake] Moved PRE/POST_BUILD_COMMAND to WEBKIT_FRAMEWORK. https://bugs.webkit.org/show_bug.cgi?id=154651 Reviewed by Alex Christensen. * CMakeLists.txt: Moved shared code to WEBKIT_FRAMEWORK macro. 2016-02-23 Dan Bernstein [Xcode] Linker errors display mangled names, but no longer should https://bugs.webkit.org/show_bug.cgi?id=154632 Reviewed by Sam Weinig. * Configurations/Base.xcconfig: Stop setting LINKER_DISPLAYS_MANGLED_NAMES to YES. 2016-02-23 Gavin Barraclough Remove HIDDEN_PAGE_DOM_TIMER_THROTTLING feature define https://bugs.webkit.org/show_bug.cgi?id=112323 Reviewed by Chris Dumez. This feature is controlled by a runtime switch, and defaults off. * wtf/FeatureDefines.h: 2016-02-22 Konstantin Tokarev [cmake] Moved library setup code to WEBKIT_FRAMEWORK macro. https://bugs.webkit.org/show_bug.cgi?id=154450 Reviewed by Alex Christensen. * wtf/CMakeLists.txt: 2016-02-20 Mark Lam Use of inlined asm statements causes problems for -std=c99 builds. https://bugs.webkit.org/show_bug.cgi?id=154507 Reviewed by Dan Bernstein. WTF's Assertions.h may inadvertantly get included by other projects that are built with -std=c99. The use of the inlined asm statements with the keyword "asm" is not recognized when the -std compiler flag is used. https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html says "When writing code that can be compiled with -ansi and the various -std options, use __asm__ instead of asm (see Alternate Keywords)." So, to be a good citizen, we can change the use of "asm" in CRASH() to "__asm__" so that we don't break the build of such other projects. * wtf/Assertions.h: 2016-02-18 Brent Fulgham Extend HashCountedSet with a method to efficiently set the count of an entry https://bugs.webkit.org/show_bug.cgi?id=154352 Reviewed by Geoffrey Garen. Tested by new TestWebKitAPI tests. Update the HashCountedSet class with a new 'add' method to support efficient initialization of the count of a given key. Also provide move and pointer template specializations to expand the types of data that can be used as 'keys' in the HashCountedSet to match the underlying HashMap implementation. * wtf/HashCountedSet.h: (WTF::Traits>::add): Added new overload supporting a supplied count. 2016-02-18 Commit Queue Unreviewed, rolling out r196791. https://bugs.webkit.org/show_bug.cgi?id=154438 broke windows build (Requested by alexchristensen on #webkit). Reverted changeset: "Extend HashCountedSet with a method to efficiently set the count of an entry" https://bugs.webkit.org/show_bug.cgi?id=154352 http://trac.webkit.org/changeset/196791 2016-02-18 Brent Fulgham Extend HashCountedSet with a method to efficiently set the count of an entry https://bugs.webkit.org/show_bug.cgi?id=154352 Reviewed by Geoffrey Garen. Tested by new TestWebKitAPI tests. Update the HashCountedSet class with a new 'add' method to support efficient initialization of the count of a given key. Also provide move and pointer template specializations to expand the types of data that can be used as 'keys' in the HashCountedSet to match the underlying HashMap implementation. * wtf/HashCountedSet.h: (WTF::Traits>::add): Added new overload supporting a supplied count. 2016-02-17 Filip Pizlo Remove LLVM dependencies from WebKit https://bugs.webkit.org/show_bug.cgi?id=154323 Reviewed by Antti Koivisto and Benjamin Poulain. * wtf/Platform.h: 2016-02-16 Sam Weinig Add an ensure function on HashMap that takes a key and a function to make the lazy value initialization idiom easier https://bugs.webkit.org/show_bug.cgi?id=134857 Reviewed by Geoffrey Garen. The current idiom for adding a value to a HashMap if the key is not already present, to allow for not unnecessarily constructing the new value if it won't be used, is: { auto result = map.add(key, Value()); if (!result.isNewEntry) return result.iterator->value; result.iterator->value = createNewValue(); return result.iterator->value; } or sometimes { auto& value = map.add(key, Value()).iterator->value; if (!value) value = createNewValue(); return value; } With this patch, you can now use the new function HashMap::ensure(key, functor). This will allow us to change to using the following idiom: { return map.ensure(key, [] { return createNewValue(); }); } The passed in functor will only be called if the key is not already present in the HashMap. * wtf/HashMap.h: (WTF::HashMapTranslator::translate): (WTF::HashMapEnsureTranslator::hash): (WTF::HashMapEnsureTranslator::equal): (WTF::HashMapEnsureTranslator::translate): (WTF::HashMapTranslatorAdapter::hash): 2016-02-16 Filip Pizlo FTL_USES_B3 should be unconditionally true https://bugs.webkit.org/show_bug.cgi?id=154324 Reviewed by Benjamin Poulain. * wtf/Platform.h: 2016-02-13 Mark Lam Eliminate the need for WTFCrashImpl(). https://bugs.webkit.org/show_bug.cgi?id=154202 Reviewed by Alexey Proskuryakov. * wtf/Assertions.cpp: * wtf/Assertions.h: 2016-02-12 Sukolsak Sakshuwong Update ICU header files to version 52 https://bugs.webkit.org/show_bug.cgi?id=154160 Reviewed by Alex Christensen. Update ICU header files to version 52 to allow the use of newer APIs. * icu/unicode/bytestream.h: * icu/unicode/localpointer.h: * icu/unicode/platform.h: * icu/unicode/ptypes.h: * icu/unicode/putil.h: * icu/unicode/rep.h: (Replaceable::Replaceable): * icu/unicode/std_string.h: * icu/unicode/strenum.h: * icu/unicode/stringpiece.h: * icu/unicode/uchar.h: * icu/unicode/ucnv.h: * icu/unicode/ucol.h: * icu/unicode/uconfig.h: * icu/unicode/uenum.h: * icu/unicode/uiter.h: * icu/unicode/uloc.h: * icu/unicode/umachine.h: * icu/unicode/unistr.h: (UnicodeString::UnicodeString): (UnicodeString::operator== ): (UnicodeString::startsWith): (UnicodeString::setTo): (UnicodeString::remove): (UnicodeString::replace): Deleted. (UnicodeString::extract): Deleted. (UnicodeString::char32At): Deleted. (UnicodeString::getChar32Start): Deleted. (UnicodeString::getChar32Limit): Deleted. (UnicodeString::getTerminatedBuffer): Deleted. (UnicodeString::append): Deleted. (UnicodeString::truncate): Deleted. * icu/unicode/unorm2.h: * icu/unicode/uobject.h: * icu/unicode/urename.h: * icu/unicode/uscript.h: * icu/unicode/uset.h: * icu/unicode/ustring.h: * icu/unicode/utf.h: * icu/unicode/utf16.h: * icu/unicode/utf8.h: * icu/unicode/utf_old.h: * icu/unicode/utypes.h: * icu/unicode/uvernum.h: * icu/unicode/uversion.h: 2016-02-11 Mark Lam Need WTFCrash workaround for shipping SafariForWebKitDevelopment binaries. https://bugs.webkit.org/show_bug.cgi?id=154125 Reviewed by Joseph Pecoraro. Presently shipping SafariForWebKitDevelopment binaries still expect to link to a WTFCrash function. We need to provide this function as a workaround until we can update SafariForWebKitDevelopment to use the new inlined version. We do this by doing: 1. Make WTFCrashImpl() the sole function for implementing a crash. The CRASH() macro is now defined to be WTFCrashImpl() instead of WTFCrash(). 2. Renamed the legacy WTFCrash() to WTFCrashImpl() for debug or non-Darwin builds. For (non-debug && OS(DARWIN)) builds, WTFCrashImpl() will be an inlined function with an asm statement that issues a breakpoint trap. 3. Implement WTFCrash() as a function that calls CRASH(). This satisfies the need of shipping SafariForWebKitDevelopment binaries. 4. Change WTFCrashWithSecurityImplication() to call CRASH(). This ensures that we have a consistent implementation of how we crash. 5. Changed WTFLogAlwaysAndCrash() to call CRASH() instead of WTFCrash(). This is just to have consistency in that all code in the WebKit project now crashes by calling CRASH(), not WTFCrash(). * wtf/Assertions.cpp: * wtf/Assertions.h: 2016-02-09 Mark Lam Changed WTFCrash to not trash the crash site register state. https://bugs.webkit.org/show_bug.cgi?id=153996 Reviewed by Geoffrey Garen. When doing post-mortem crash site analysis using data from crash reports, it is immensely valuable to be able to infer the crashing program's state from the register values at crash time. However, for RELEASE_ASSERT failures, we crash using WTFCrash(), and WTFCrash() is currently implemented as a function call that, in turn, calls a lot of other functions to do crash handling before actually crashing. As a result, the register values captured in the crash reports are not likely to still contain the values used by the caller function that failed the RELEASE_ASSERT. This patch aims to remedy this issue for non-debug builds on OS(DARWIN) ports. It does so by changing WTFCrash() into an inlined function that has an inlined asm statement to issues the CPU specific breakpoint trap instruction. As a result, for non-debug OS(DARWIN) builds, crashes due to failed RELEASE_ASSERTs will now show up in crash reports as crashing due to EXC_BREAKPOINT (SIGTRAP) instead of a EXC_BAD_ACCESS (SIGSEGV) on address 0xbbadbeef. For debug and non-DARWIN builds, WTFCrash() behavior currently remains unchanged. * wtf/Assertions.cpp: * wtf/Assertions.h: 2016-02-09 Csaba Osztrogonác [GTK][EFL] Fix several build configuration related to SamplingProfiler after r196245 https://bugs.webkit.org/show_bug.cgi?id=154033 Reviewed by Michael Catanzaro. * wtf/Platform.h: 2016-02-08 Filip Pizlo Make sure that locking code that relies on module boundaries for compiler fences uses NEVER_INLINE https://bugs.webkit.org/show_bug.cgi?id=153972 Reviewed by Andreas Kling. When this code was written, we assumed that module boundaries were compiler fences. That might not be the case if we ever do LTO. * wtf/Lock.cpp: (WTF::LockBase::lockSlow): (WTF::LockBase::unlockSlow): * wtf/ParkingLot.cpp: (WTF::ParkingLot::parkConditionally): (WTF::ParkingLot::unparkOne): (WTF::ParkingLot::unparkAll): (WTF::ParkingLot::forEach): * wtf/WordLock.cpp: (WTF::WordLock::lockSlow): (WTF::WordLock::unlockSlow): 2016-02-07 Yusuke Suzuki [GTK][EFL] Enable SamplingProfiler https://bugs.webkit.org/show_bug.cgi?id=153638 Reviewed by Michael Catanzaro. * wtf/Platform.h: 2016-02-07 Dan Bernstein [Cocoa] Replace __has_include guards around inclusion of Apple-internal-SDK headers with USE(APPLE_INTERNAL_SDK) https://bugs.webkit.org/show_bug.cgi?id=153963 Reviewed by Sam Weinig. * wtf/SystemTracing.h: * wtf/WTFThreadData.h: * wtf/spi/darwin/CommonCryptoSPI.h: 2016-02-06 Darin Adler Finish auditing call sites of upper() and lower(), eliminate many, and rename the functions https://bugs.webkit.org/show_bug.cgi?id=153905 Reviewed by Sam Weinig. * wtf/text/AtomicString.cpp: (WTF::AtomicString::lower): Deleted. * wtf/text/AtomicString.h: Deleted the lower function. * wtf/text/StringImpl.cpp: (WTF::StringImpl::convertToLowercaseWithoutLocale): Renamed from lower. (WTF::StringImpl::convertToUppercaseWithoutLocale): Renamed from upper. (WTF::StringImpl::convertToLowercaseWithLocale): Renamed from lower. (WTF::StringImpl::convertToUppercaseWithLocale): Renamed from upper. (WTF::StringImpl::foldCase): Added fast cases for ASCII since this is now used in some more-performance-critical code. * wtf/text/StringImpl.h: Renamed lower and upper. * wtf/text/WTFString.cpp: (WTF::String::convertToLowercaseWithoutLocale): Renamed from lower. (WTF::String::convertToUppercaseWithoutLocale): Renamed from upper. (WTF::String::convertToLowercaseWithLocale): Renamed from lower. (WTF::String::convertToUppercaseWithLocale): Renamed from upper. * wtf/text/WTFString.h: Renamed lower and upper. Removed unneeded comment. 2016-02-03 Darin Adler Convert another batch of String::lower callsites to something better, typically convertToASCIILowercase https://bugs.webkit.org/show_bug.cgi?id=153789 Reviewed by Sam Weinig. * wtf/text/StringView.h: (WTF::StringView::toInt): Added an overload without the out parameter. 2016-02-03 Michael Catanzaro [GTK][EFL] Switch FTL to B3 https://bugs.webkit.org/show_bug.cgi?id=153478 Reviewed by Csaba Osztrogonác. Enable B3 by default on all x86. * wtf/Platform.h: 2016-02-03 Anders Carlsson Fix BlockPtr's call operator https://bugs.webkit.org/show_bug.cgi?id=153836 Reviewed by Enrica Casucci. * wtf/BlockPtr.h: 2016-02-01 Said Abou-Hallawa Cache the Path instead of creating it every time it is required https://bugs.webkit.org/show_bug.cgi?id=152939 Reviewed by Darin Adler. If the key type of an LRU cache can't to be strongly tided to a specific data type; e.g. FloatRect -> Path, we need to be able to pass the policy type to the TinyLRUCache template instead of just specializing it. This will make the code more readable and will allow different caches for the same key type. * wtf/TinyLRUCache.h: (WebCore::TinyLRUCache::get): 2016-02-01 Alex Christensen [Win] WTFHeaderDetection.h no longer needed https://bugs.webkit.org/show_bug.cgi?id=153753 rdar://problem/24434627 Reviewed by Darin Adler. * wtf/Platform.h: * wtf/PlatformWin.cmake: 2016-01-31 Darin Adler Cut down on calls to String::lower; mostly replace with convertToASCIILowercase https://bugs.webkit.org/show_bug.cgi?id=153732 Reviewed by Dean Jackson. * wtf/text/StringView.h: Added toIntStrict. Not thrilled about the name of this function, but generally it seems likely to be useful more often than toInt. And it's needed for one call site in WebCore that was using String::lower. 2016-01-31 Darin Adler Get rid of most calls to String::upper; mostly replace them with convertToASCIIUppercase https://bugs.webkit.org/show_bug.cgi?id=153715 Reviewed by Gyuyoung Kim. * wtf/text/AtomicString.h: (WTF::AtomicString::upper): Deleted. 2016-01-31 Dan Bernstein [Cocoa] Remove unused definition of HAVE_HEADER_DETECTION_H https://bugs.webkit.org/show_bug.cgi?id=153729 Reviewed by Sam Weinig. After r141700, HAVE_HEADER_DETECTION_H is no longer used. * Configurations/Base.xcconfig: 2016-01-31 Darin Adler Replace CaseFoldingHash with ASCIICaseInsensitiveHash https://bugs.webkit.org/show_bug.cgi?id=153639 Reviewed by Filip Pizlo. * wtf/text/StringHash.h: Renamed CaseFoldingHash to ASCIICaseInsensitiveHash. (WTF::ASCIICaseInsensitiveHash::foldCase): Use toASCIILower. (WTF::ASCIICaseInsensitiveHash::equal): Use equalIgnoringASCIICase. Also added some assertions. * wtf/text/StringImpl.cpp: Made the latin1CaseFoldTable private to this file, since it's no longer needed by CaseFoldingHash. Moved it up before its first use. (WTF::equalCompatibilityCaseless): Fixed typo in the name of this function. (WTF::equalCompatibiltyCaselessNonNull): Deleted. * wtf/text/StringImpl.h: Removed declarations of latin1CaseFoldTable and equalCompatibiltyCaselessNonNull 2016-01-30 Commit Queue Unreviewed, rolling out r195911. https://bugs.webkit.org/show_bug.cgi?id=153723 Caused frequent assertion failures on bots (Requested by ap on #webkit). Reverted changeset: "Replace CaseFoldingHash with ASCIICaseInsensitiveHash" https://bugs.webkit.org/show_bug.cgi?id=153639 http://trac.webkit.org/changeset/195911 2016-01-30 Darin Adler Replace CaseFoldingHash with ASCIICaseInsensitiveHash https://bugs.webkit.org/show_bug.cgi?id=153639 Reviewed by Filip Pizlo. * wtf/text/StringHash.h: Renamed CaseFoldingHash to ASCIICaseInsensitiveHash. (WTF::ASCIICaseInsensitiveHash::foldCase): Use toASCIILower. (WTF::ASCIICaseInsensitiveHash::equal): Use equalIgnoringASCIICase. Also added some assertions. * wtf/text/StringImpl.cpp: Made the latin1CaseFoldTable private to this file, since it's no longer needed by CaseFoldingHash. Moved it up before its first use. (WTF::equalCompatibilityCaseless): Fixed typo in the name of this function. (WTF::equalCompatibiltyCaselessNonNull): Deleted. * wtf/text/StringImpl.h: Removed declarations of latin1CaseFoldTable and equalCompatibiltyCaselessNonNull 2016-01-29 Ada Chan Enable VIDEO_PRESENTATION_MODE only in Debug and Release builds on Mac https://bugs.webkit.org/show_bug.cgi?id=153665 Reviewed by Dan Bernstein. * wtf/Platform.h: Remove this as the flag is already defined in FeatureDefines.xcconfig files. 2016-01-30 Yusuke Suzuki Enable SamplingProfiler on POSIX environment https://bugs.webkit.org/show_bug.cgi?id=153584 Reviewed by Michael Saboff. Use __GLIBC__ since mcontext_t layout depends on it. * wtf/Platform.h: 2016-01-28 Darin Adler Remove equalIgnoringCase since all callers really wanted equalIgnoringASCIICase https://bugs.webkit.org/show_bug.cgi?id=153411 Reviewed by Ryosuke Niwa. * wtf/text/AtomicString.h: Removed equalIgnoringCase. Added some overloads for equalIgnoringASCIICase and moved the function bodies to bottom of the file to make the function declarations easier to read and scan through. I plan to do this for more of the functions in this class in the future. * wtf/text/StringCommon.h: Added overloads for equalIgnoringASCIICase, equalPossiblyIgnoringASCIICase, and a helper named equalIgnoringASCIICaseCommon. Added an overload for equalLettersIgnoringASCIICase. * wtf/text/StringImpl.cpp: (WTF::equalIgnoringCase): Made the few remaining versions of this function private to this file. Once we get done moving every client that should be using ASCII case instead to new functions, these will almost certainly be deleted. (WTF::equalIgnoringASCIICaseNonNull): Tweaked implementation a tiny bit. * wtf/text/StringImpl.h: Sorted forward declarations at the top of the file. Fixed some small formatting mistakes. Removed equalIgnoringCase, but left equalIgnoringCaseNonNull behind for use by CaseFoldingHash until it is replaced with ASCIICaseFoldingHash. Improved equalIgnoringASCIICase implementation. Removed unneeded using for equalIgnoringASCIICase now that StringCommon.h takes care of it. * wtf/text/StringView.cpp: (WTF::equalIgnoringASCIICase): Deleted. We no longer pass in the length for this, so the arguments have changed and the implementation is also now in ASCIICommon.h so it's an inline in the header file. * wtf/text/StringView.h: Added an overload of equalIgnoringASCIICase,while removing another. * wtf/text/WTFString.h: Removed some unneeded forward delcarations. Fixed formatting of the type name NSString *. Improved some comments. Removed equalIgnoringCase. Separated declaration from implementation in a few cases to start making the function declarations easier to read and scan through. I plan to do more in the future. 2016-01-27 Chris Dumez window.atob() should ignore spaces in input https://bugs.webkit.org/show_bug.cgi?id=153522 Reviewed by Benjamin Poulain. Turn Base64DecodePolicy enum into flags so that the caller can indicate to both validate padding AND ignore spaces. Also make sure that the output Vector size is properly shrunk when spaces are ignored. * wtf/text/Base64.cpp: (WTF::base64DecodeInternal): (WTF::base64Decode): (WTF::base64URLDecode): * wtf/text/Base64.h: 2016-01-27 Alexey Proskuryakov Remove ENABLE_CURRENTSRC https://bugs.webkit.org/show_bug.cgi?id=153545 Reviewed by Simon Fraser. * wtf/FeatureDefines.h: 2016-01-26 I-Ting Liu Implement wildcard matching for plug-in policy host. https://bugs.webkit.org/show_bug.cgi?id=153090 Reviewed by Darin Adler. * wtf/text/AtomicString.h: (WTF::AtomicString::AtomicString): Add __bridge to allow compilation. 2016-01-26 Joseph Pecoraro Generalize ResourceUsageData gathering to be used outside of ResourceUsageOverlay https://bugs.webkit.org/show_bug.cgi?id=153509 Reviewed by Andreas Kling. * wtf/Platform.h: Rename the ENABLE flag. 2016-01-26 Yusuke Suzuki Make HashTable iterators STL iterators compatible https://bugs.webkit.org/show_bug.cgi?id=153512 Reviewed by Alex Christensen. While r178581 makes many hash table iterators STL compatible, still several iterators are not. This patch fixes that; inheriting std::iterator correctly to meet STL iterator requirements (like iterator_category etc.) It could recover Windows build failure. * wtf/HashTable.h: 2016-01-26 Anders Carlsson BlockPtr needs boolean operators https://bugs.webkit.org/show_bug.cgi?id=153506 Reviewed by Tim Horton. * wtf/BlockPtr.h: 2016-01-25 Filip Pizlo FTLB3Output should maintain good block order like the LLVM one does https://bugs.webkit.org/show_bug.cgi?id=152222 Reviewed by Geoffrey Garen. In the FTL we need to be able to construct a list by inserting elements before other specific elements. We didn't already have a scalable way to do this, so this adds such a data structure to WTF. This also has changes to SentinelLinkedList to make it support these kinds of insertions. * WTF.xcodeproj/project.pbxproj: * wtf/OrderMaker.h: Added. (WTF::OrderMaker::Node::Node): (WTF::OrderMaker::OrderMaker): (WTF::OrderMaker::prepend): (WTF::OrderMaker::append): (WTF::OrderMaker::insertBefore): (WTF::OrderMaker::insertAfter): (WTF::OrderMaker::iterator::iterator): (WTF::OrderMaker::iterator::operator*): (WTF::OrderMaker::iterator::operator++): (WTF::OrderMaker::iterator::operator==): (WTF::OrderMaker::iterator::operator!=): (WTF::OrderMaker::begin): (WTF::OrderMaker::end): (WTF::OrderMaker::newNode): * wtf/SentinelLinkedList.h: (WTF::BasicRawSentinelNode::isOnList): (WTF::BasicRawSentinelNode::remove): (WTF::BasicRawSentinelNode::prepend): (WTF::BasicRawSentinelNode::append): (WTF::RawNode>::SentinelLinkedList): (WTF::RawNode>::push): (WTF::RawNode>::append): (WTF::RawNode>::remove): (WTF::RawNode>::prepend): (WTF::RawNode>::isOnList): 2016-01-25 Alex Christensen [Win] Copy forwarding headers before building a project https://bugs.webkit.org/show_bug.cgi?id=153434 Reviewed by Brent Fulgham. * wtf/CMakeLists.txt: * wtf/PlatformWin.cmake: 2016-01-20 Ryosuke Niwa HTMLElement::nodeName should not upper case non-ASCII characters https://bugs.webkit.org/show_bug.cgi?id=153231 Reviewed by Darin Adler. Added convertToASCIIUppercase to AtomicString, String, and StringImpl. * wtf/text/AtomicString.cpp: (WTF::AtomicString::convertASCIICase): Generalized from convertToASCIILowercase. (WTF::AtomicString::convertToASCIILowercase): (WTF::AtomicString::convertToASCIIUppercase): * wtf/text/AtomicString.h: * wtf/text/StringImpl.cpp: (WTF::StringImpl::convertASCIICase): Generalized from convertToASCIILowercase. (WTF::StringImpl::convertToASCIILowercase): (WTF::StringImpl::convertToASCIIUppercase): * wtf/text/StringImpl.h: * wtf/text/WTFString.cpp: (WTF::String::convertToASCIIUppercase): Added. * wtf/text/WTFString.h: 2016-01-22 Chris Dumez Unreviewed attempt to fix the Windows build after r195452. * wtf/text/WTFString.h: 2016-01-22 Darin Adler Reduce use of equalIgnoringCase to just ignore ASCII case https://bugs.webkit.org/show_bug.cgi?id=153266 Reviewed by Ryosuke Niwa. * wtf/ASCIICType.h: (WTF::isASCIIAlphaCaselessEqual): Loosened the assertion in this function so it can work with ASCII spaces, numeric digits, and some punctuation. Commented that we might want to change its name later. * wtf/Assertions.cpp: (WTFInitializeLogChannelStatesFromString): Use equalLettersIgnoringASCIICase. * wtf/text/AtomicString.h: (WTF::equalLettersIgnoringASCIICase): Added. Calls the version that takes a String. * wtf/text/StringCommon.h: (WTF::equalLettersIgnoringASCIICase): Added. Takes a pointer to characters. (WTF::equalLettersIgnoringASCIICaseCommonWithoutLength): Added. (WTF::equalLettersIgnoringASCIICaseCommon): Added. * wtf/text/StringImpl.h: (WTF::equalLettersIgnoringASCIICase): Added. Calls equalLettersIgnoringASCIICaseCommon. * wtf/text/StringView.h: (WTF::equalLettersIgnoringASCIICase): Added. Calls equalLettersIgnoringASCIICaseCommon. * wtf/text/WTFString.h: Reordered/reformatted a little. (WTF::equalIgnoringASCIICase): Added. Calls the version that takes a StringImpl. 2016-01-22 Csaba Osztrogonác Buildfix for older GCCs after r195142 https://bugs.webkit.org/show_bug.cgi?id=153351 Unreviewed buildfix. * wtf/SystemTracing.h: 2016-01-21 Filip Pizlo REGRESSION(r195417): many tests crash https://bugs.webkit.org/show_bug.cgi?id=153316 Reviewed by Saam Barati. This rolls out the StdLibExtras.h change, and simplifies RangeSet to not use binary search. That's fine for now, since B3 doesn't stress RangeSet enough right now. * wtf/RangeSet.h: (WTF::RangeSet::contains): (WTF::RangeSet::overlaps): (WTF::RangeSet::clear): (WTF::RangeSet::findRange): * wtf/StdLibExtras.h: (WTF::binarySearchImpl): (WTF::binarySearch): (WTF::tryBinarySearch): (WTF::approximateBinarySearch): 2016-01-21 Filip Pizlo B3 should have load elimination https://bugs.webkit.org/show_bug.cgi?id=153288 Reviewed by Geoffrey Garen. I needed a way to track sets of ranges, where there is a high likelihood that all of the ranges overlap. So I created RangeSet. It's a usually-sorted list of coalesced ranges. Practically this means that right now, FTL B3 will end up with two kinds of range sets: a set that just contains top and a set that contains nothing. In the future, most sets will either be top of empty but some of them will contain a handful of other things. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/MathExtras.h: (WTF::leftShiftWithSaturation): (WTF::nonEmptyRangesOverlap): (WTF::rangesOverlap): * wtf/RangeSet.h: Added. (WTF::RangeSet::RangeSet): (WTF::RangeSet::~RangeSet): (WTF::RangeSet::add): (WTF::RangeSet::contains): (WTF::RangeSet::overlaps): (WTF::RangeSet::clear): (WTF::RangeSet::dump): (WTF::RangeSet::dumpRaw): (WTF::RangeSet::compact): (WTF::RangeSet::overlapsNonEmpty): (WTF::RangeSet::subsumesNonEmpty): (WTF::RangeSet::findRange): * wtf/StdLibExtras.h: (WTF::binarySearchImpl): (WTF::binarySearch): (WTF::tryBinarySearch): (WTF::approximateBinarySearch): 2016-01-19 Ada Chan Make it possible to enable VIDEO_PRESENTATION_MODE on other Cocoa platforms. https://bugs.webkit.org/show_bug.cgi?id=153218 Reviewed by Eric Carlson. * wtf/Platform.h: 2016-01-19 Filip Pizlo B3 should have basic path specialization https://bugs.webkit.org/show_bug.cgi?id=153200 Reviewed by Benjamin Poulain. * wtf/GraphNodeWorklist.h: (WTF::GraphNodeWorklist::push): (WTF::GraphNodeWorklist::pushAll): (WTF::GraphNodeWorklist::isEmpty): (WTF::GraphNodeWorklist::notEmpty): 2016-01-20 Said Abou-Hallawa Refactor AtomicStringKeyedMRUCache to be a generic LRU cache https://bugs.webkit.org/show_bug.cgi?id=153109 Reviewed by Darin Adler. Refactor AtomicStringKeyedMRUCache, move it to WTF project and rename it to be TinyLRUCache. Define another template and call it TinyLRUCachePolicy. This one can be overridden for different keys and values. Its function is creating the cached values. * WTF.xcodeproj/project.pbxproj: * wtf/TinyLRUCache.h: Added. (WebCore::TinyLRUCachePolicy::isKeyNull): (WebCore::TinyLRUCachePolicy::createValueForNullKey): (WebCore::TinyLRUCachePolicy::createValueForKey): (WebCore::TinyLRUCache::get): 2016-01-19 Saam barati WTF::Bag should be non-copyable https://bugs.webkit.org/show_bug.cgi?id=153253 Reviewed by Filip Pizlo. * wtf/Bag.h: * wtf/SegmentedVector.h: (WTF::SegmentedVector::append): (WTF::SegmentedVector::alloc): 2016-01-19 Enrica Casucci Add support for DataDetectors in WK (iOS). https://bugs.webkit.org/show_bug.cgi?id=152989 rdar://problem/22855960 Reviewed by Tim Horton. Adding feature definition for data detection. * wtf/FeatureDefines.h: 2016-01-19 Commit Queue Unreviewed, rolling out r195300. https://bugs.webkit.org/show_bug.cgi?id=153244 enrica wants more time to fix Windows (Requested by thorton on #webkit). Reverted changeset: "Add support for DataDetectors in WK (iOS)." https://bugs.webkit.org/show_bug.cgi?id=152989 http://trac.webkit.org/changeset/195300 2016-01-19 Chris Dumez Unreviewed, rolling out r195141. Seems to cause crashes on iOS9 64bit Reverted changeset: "Fragmentation-free allocator for timeless and/or coupled allocations." https://bugs.webkit.org/show_bug.cgi?id=152696 http://trac.webkit.org/changeset/195141 2016-01-19 Enrica Casucci Add support for DataDetectors in WK (iOS). https://bugs.webkit.org/show_bug.cgi?id=152989 rdar://problem/22855960 Reviewed by Tim Horton. Adding feature definition for data detection. * wtf/FeatureDefines.h: 2016-01-17 Filip Pizlo FTL B3 should be just as fast as FTL LLVM on Octane/crypto https://bugs.webkit.org/show_bug.cgi?id=153113 Reviewed by Saam Barati. * wtf/IndexSparseSet.h: (WTF::IndexSparseSet::IndexSparseSet): (WTF::IndexSparseSet::add): (WTF::IndexSparseSet::remove): * wtf/StringPrintStream.h: (WTF::StringPrintStream::length): 2016-01-17 Michael Catanzaro [CMake] Do not build bmalloc when USE_SYSTEM_MALLOC is ON https://bugs.webkit.org/show_bug.cgi?id=153190 Reviewed by Csaba Osztrogonác. Build bmalloc when NOT USE_SYSTEM_MALLOC rather than when NOT WIN32. * wtf/CMakeLists.txt: 2016-01-15 Simon Fraser Add kdebug_trace signposts for a few WebCore operations https://bugs.webkit.org/show_bug.cgi?id=153136 rdar://problem/24208487 Reviewed by Sam Weinig. New header with the reserved WebKit component code, trace point codes, and a stack-based helper that traces scope entry and exit. The available range of trace point codes is arbitrarily segmented into WTF, JSC, WebCore, WebKit and WebKit2. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/SystemTracing.h: Added. (WTF::TraceScope::TraceScope): (WTF::TraceScope::~TraceScope): 2016-01-15 Andreas Kling Fragmentation-free allocator for timeless and/or coupled allocations. Reviewed by Antti Koivisto. Introduce BumpArena, a space-efficient memory allocator for situations where you feel pretty confident betting on allocation lifetimes. Basic design: - Reserves 128MB range of memory at startup. - Allocates 4kB-aligned blocks of 4kB from VM at a time. - Bump-pointer allocates out of a block until it reaches end. - Each allocation increments the ref-count of its block. - Each deallocation decrements the ref-count of its block. - Transparently falls back to fastMalloc()/fastFree() when needed. Interface: - BumpArena::create() Create your very own BumpArena! - BumpArena::allocate(BumpArena* arena, size_t size) Allocates 'size' bytes of memory from 'arena'. If 'arena' is null, falls back to fastMalloc(). - BumpArena::deallocate(void* ptr) If 'ptr' is BumpArena allocation, decrements block ref-count. If 'ptr' is FastMalloc allocation, calls fastFree() on it. - WTF_MAKE_BUMPARENA_ALLOCATED; Macro that gives a class or struct custom operators new and delete for allocation out of BumpArena. Just like WTF_MAKE_FAST_ALLOCATED; Note that while the name of this patch says "fragmentation-free allocator" it will only be fragmentation-free when used for appropriate things. This is not meant to be a general-purpose allocator. Only use it for sets of allocations that are known to die roughly at the same time. BumpArena will never resume allocating from a block that has been filled, so it's even more important than usual that everything gets deallocated. BumpArena redirects allocations to FastMalloc in three cases: - When invoked with a null BumpArena* - When allocation request is larger than BumpArena's block size (4kB) - When BumpArena has exhausted all of its pre-reserved VM. (128MB) The VM allocator will eagerly return blocks of VM to the kernel by calling madvise(). Average time spent in madvise is around 0.007ms on my box. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/BumpArena.cpp: Added. (WTF::BumpArena::Block::capacity): (WTF::BumpArena::Block::arena): (WTF::BumpArena::Block::payloadStart): (WTF::arenas): (WTF::BumpArena::Block::Block): (WTF::BumpArena::Block::~Block): (WTF::BumpArena::Block::ref): (WTF::BlockAllocator::BlockAllocator): (WTF::BlockAllocator::isAllocation): (WTF::blockAllocator): (WTF::BlockAllocator::allocateBlock): (WTF::BlockAllocator::deallocateBlock): (WTF::BumpArena::Block::deref): (WTF::BumpArena::Block::create): (WTF::BumpArena::Block::dump): (WTF::BumpArena::dump): (WTF::BumpArena::create): (WTF::BumpArena::BumpArena): (WTF::BumpArena::~BumpArena): (WTF::BumpArena::allocateSlow): (WTF::BumpArena::allocate): (WTF::BumpArena::deallocate): (WTF::BumpArena::Block::blockFor): (WTF::BumpArena::arenaFor): * wtf/BumpArena.h: Added. * wtf/CMakeLists.txt: 2016-01-15 Konstantin Tokarev [EFL] WorkQueue methods should be defined inside WTF namespace. https://bugs.webkit.org/show_bug.cgi?id=153097 Reviewed by Gyuyoung Kim. * wtf/efl/WorkQueueEfl.cpp: 2016-01-14 Chris Dumez Unreviewed, rolling out r195035. Caused 1-3% PLT regression on iOS Reverted changeset: "Part 2/2: Stop using USE(CFNETWORK) path on iOS" https://bugs.webkit.org/show_bug.cgi?id=142540 http://trac.webkit.org/changeset/195035 2016-01-14 David Kilzer Part 2/2: Stop using USE(CFNETWORK) path on iOS Original patch by Antti Koivisto on 2015-03-10 Reviewed by Chris Dumez. * wtf/Platform.h: Turn off USE(CFNETWORK) for PLATFORM(IOS). 2016-01-14 Per Arne Vollan [Win] Remove workarounds for fixed bugs in fmod and pow. https://bugs.webkit.org/show_bug.cgi?id=153071 Reviewed by Brent Fulgham. The bugs have been fixed in the MSVC CRT, and we can remove the workarounds. * wtf/MathExtras.h: (wtf_fmod): Deleted. (wtf_pow): Deleted. 2016-01-13 Commit Queue Unreviewed, rolling out r194963. https://bugs.webkit.org/show_bug.cgi?id=153079 This change causes ASan tests to crash and exit early (Requested by ryanhaddad on #webkit). Reverted changeset: "Fragmentation-free allocator for timeless and/or coupled allocations." https://bugs.webkit.org/show_bug.cgi?id=152696 http://trac.webkit.org/changeset/194963 2016-01-13 Andreas Kling Fragmentation-free allocator for timeless and/or coupled allocations. Reviewed by Antti Koivisto. Introduce BumpArena, a space-efficient memory allocator for situations where you feel pretty confident betting on allocation lifetimes. Basic design: - Allocates 4kB-aligned blocks of 4kB from bmalloc at a time. - Bump-pointer allocates out of a block until it reaches end. - Each allocation increments the ref-count of its block. - Each deallocation decrements the ref-count of its block. Interface: - BumpArena::create() Create your very own BumpArena! - BumpArena::allocate(BumpArena* arena, size_t size) Allocates 'size' bytes of memory from 'arena'. If 'arena' is null, allocation comes out of the shared global BumpArena. - BumpArena::deallocate(void* ptr) Deallocates 'ptr', decrementing the ref-count of its block. - WTF_MAKE_BUMPARENA_ALLOCATED; Macro that gives a class or struct custom operators new and delete for allocation out of BumpArena. Just like WTF_MAKE_FAST_ALLOCATED; Note that while the name of this patch says "fragmentation-free allocator" it will only be fragmentation-free when used for appropriate things. This is not meant to be a general-purpose allocator. Only use it for sets of allocations that are known to die roughly at the same time. BumpArena will never resume allocating from a block that has been filled, so it's even more important than usual that everything gets deallocated. As noted above, calling allocate() with a null BumpArena will allocate out of a global shared arena. Ideally you're always allocating out of a specific, controlled arena, but there are situations where you may not have one. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/BumpArena.cpp: Added. (WTF::BumpArena::Block::defaultCapacity): (WTF::BumpArena::Block::arena): (WTF::BumpArena::Block::payloadStart): (WTF::globalArena): (WTF::arenas): (WTF::BumpArena::Block::Block): (WTF::BumpArena::Block::~Block): (WTF::BumpArena::Block::ref): (WTF::BumpArena::Block::deref): (WTF::BumpArena::Block::create): (WTF::BumpArena::Block::dump): (WTF::BumpArena::dump): (WTF::BumpArena::create): (WTF::BumpArena::BumpArena): (WTF::BumpArena::~BumpArena): (WTF::BumpArena::allocateSlow): (WTF::BumpArena::allocate): (WTF::BumpArena::deallocate): (WTF::BumpArena::Block::blockFor): (WTF::BumpArena::arenaFor): * wtf/BumpArena.h: Added. * wtf/CMakeLists.txt: 2016-01-08 Andy Estes [Content Filtering] Lazily load platform frameworks https://bugs.webkit.org/show_bug.cgi?id=152881 rdar://problem/23270886 Reviewed by Brady Eidson. * wtf/Platform.h: Moved definition of HAVE_NETWORK_EXTENSION to here from WebCore/platform/cocoa/NetworkExtensionContentFilter.h. 2016-01-12 Ryosuke Niwa Add a build flag for custom element https://bugs.webkit.org/show_bug.cgi?id=153005 Reviewed by Alex Christensen. * wtf/FeatureDefines.h: 2016-01-11 Andreas Kling NeverDestroyed should relax adoption requirements on all RefCountedBase subclasses. Reviewed by Antti Koivisto. Instead of relaxing on subclasses of RefCounted, relax on subclasses of RefCountedBase. This allows e.g NeverDestroyed to relax its pointee despite the class hierarchy starting with RefCounted (not RefCounted.) * wtf/NeverDestroyed.h: 2016-01-10 Saam barati Implement a sampling profiler https://bugs.webkit.org/show_bug.cgi?id=151713 Reviewed by Filip Pizlo. * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::decrementPageOccupancy): (WTF::MetaAllocator::isInAllocatedMemory): (WTF::MetaAllocator::roundUp): * wtf/MetaAllocator.h: (WTF::MetaAllocator::getLock): * wtf/Platform.h: 2016-01-10 Filip Pizlo It should be possible to run liveness over registers without also tracking Tmps https://bugs.webkit.org/show_bug.cgi?id=152963 Reviewed by Saam Barati. Add set methods (add/contains/remove) to BitVector, since it gets used as a set in a lot of places. This also makes BitVector a drop-in replacement for HashSet in a lot of places. Also made the iterator methods of BitVector live on BitVector directly rather than behind the thing returned from setBits(). This makes sense since that makes BitVector even more of a drop-in for HashSet. It's not harmful since we've never added any other mode of iterating a BitVector other than this, so it doesn't make sense to make it harder to access. * wtf/BitVector.h: (WTF::BitVector::get): (WTF::BitVector::contains): (WTF::BitVector::set): (WTF::BitVector::add): (WTF::BitVector::ensureSizeAndSet): (WTF::BitVector::clear): (WTF::BitVector::remove): (WTF::BitVector::hash): (WTF::BitVector::iterator::iterator): (WTF::BitVector::iterator::operator*): (WTF::BitVector::iterator::operator++): (WTF::BitVector::iterator::operator==): (WTF::BitVector::iterator::operator!=): (WTF::BitVector::begin): (WTF::BitVector::end): (WTF::BitVector::bitsInPointer): (WTF::BitVector::SetBitsIterable::SetBitsIterable): Deleted. (WTF::BitVector::SetBitsIterable::iterator::iterator): Deleted. (WTF::BitVector::SetBitsIterable::iterator::operator*): Deleted. (WTF::BitVector::SetBitsIterable::iterator::operator++): Deleted. (WTF::BitVector::SetBitsIterable::iterator::operator==): Deleted. (WTF::BitVector::SetBitsIterable::iterator::operator!=): Deleted. (WTF::BitVector::SetBitsIterable::begin): Deleted. (WTF::BitVector::SetBitsIterable::end): Deleted. (WTF::BitVector::setBits): Deleted. 2016-01-09 Andreas Kling Use NeverDestroyed instead of DEPRECATED_DEFINE_STATIC_LOCAL Reviewed by Anders Carlsson. Mostly mechanical conversion to NeverDestroyed throughout WTF. * wtf/RunLoop.cpp: (WTF::RunLoop::current): * wtf/ThreadingPthreads.cpp: (WTF::threadMapMutex): (WTF::threadMap): 2016-01-08 Anders Carlsson Nullopt and InPlace should be structs, not enum values https://bugs.webkit.org/show_bug.cgi?id=152915 Reviewed by Andreas Kling. Without this, Optional o = flag ? 1 : Nullopt; would cause Nullopt to be treated as an integer, causing o to be initialized to 0, instead of Nullopt. With this change, the above code now causes a compile error. Also, get rid of the CONSTEXPR macro since all compilers support constexpr properly, and add a WTF::makeOptional to match the current iteration of std::experimental::optional. * wtf/Compiler.h: * wtf/Forward.h: * wtf/Optional.h: (WTF::NulloptTag::NulloptTag): (WTF::makeOptional): * wtf/StdLibExtras.h: (std::literals::chrono_literals::operator _s): (std::literals::chrono_literals::operator _ms): (std::move): 2016-01-06 Anders Carlsson Add a smart block pointer https://bugs.webkit.org/show_bug.cgi?id=152799 Reviewed by Tim Horton. Introduce WTF::BlockPtr, a smart block pointer. * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: Added. (WTF::makeBlockPtr): 2016-01-04 Carlos Garcia Campos [GTK] Allow to save and restore session https://bugs.webkit.org/show_bug.cgi?id=115600 Reviewed by Michael Catanzaro. Add GVariantIter specialization of GUniquePtr. * wtf/glib/GTypedefs.h: * wtf/glib/GUniquePtr.h: 2016-01-04 Tim Horton Turn on gesture events when building for Yosemite https://bugs.webkit.org/show_bug.cgi?id=152704 rdar://problem/24042472 Reviewed by Anders Carlsson. * wtf/FeatureDefines.h: 2016-01-04 Benjamin Poulain [JSC] Build B3 by default on iOS ARM64 https://bugs.webkit.org/show_bug.cgi?id=152525 Reviewed by Filip Pizlo. * wtf/Platform.h: 2016-01-03 Andreas Kling Unreviewed, rolling out r194510. Broke 2 API tests, no time to investigate right now Reverted changeset: "StringBuilder often creates two StringImpls." https://bugs.webkit.org/show_bug.cgi?id=152662 http://trac.webkit.org/changeset/194510 2016-01-03 Khem Raj WebKit fails to build with musl libc library https://bugs.webkit.org/show_bug.cgi?id=152625 Reviewed by Daniel Bates. Disable ctype.h check for musl C library on Linux. Enable backtrace on Linux when using glibc. We don't have backtrace() implemented on non-glibc system C libraries on Linux e.g. musl. * wtf/DisallowCType.h: Check for __GLIBC__. * wtf/Assertions.cpp: (WTFGetBacktrace): Check if libc is glibc. 2016-01-03 Andreas Kling StringBuilder often creates two StringImpls. Reviewed by Anders Carlsson. If StringBuilder didn't manage to guess the exact final length of the string being built, it would still keep the buffer around, and the final build process would then return a substring into that buffer. This effectively yielded two StringImpls instead of one, with the substring retaining the longer buffer StringImpl. This patch improves the situation by having StringImpl crop the buffer's m_length field to the final built string length. That way we never have to return a substring. * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::reifyString): * wtf/text/StringImpl.h: 2016-01-03 Andreas Kling Remove redundant StringImpl substring creation function. Reviewed by Daniel Bates. Remove StringImpl::createSubstringSharingImpl8() and make the only caller use createSubstringSharingImpl() instead. They do the same thing anyway, the only difference is that the branch on is8Bit() now happens in the callee instead of at the call site. * wtf/text/StringImpl.h: (WTF::StringImpl::createSubstringSharingImpl8): Deleted. 2015-12-31 Andy Estes Replace WTF::move with WTFMove https://bugs.webkit.org/show_bug.cgi?id=152601 Reviewed by Brady Eidson. This also removes the definition of WTF::move. * wtf/Deque.h: * wtf/HashMap.h: * wtf/HashSet.h: * wtf/HashTable.h: (WTF::HashTable::add): (WTF::KeyTraits>::HashTable): * wtf/Insertion.h: (WTF::executeInsertions): * wtf/IteratorAdaptors.h: (WTF::FilterIterator::FilterIterator): (WTF::TransformIterator::TransformIterator): (WTF::makeTransformIterator): * wtf/IteratorRange.h: (WTF::IteratorRange::IteratorRange): * wtf/ListHashSet.h: (WTF::U>::takeFirst): (WTF::U>::takeLast): * wtf/MainThread.cpp: (WTF::callOnMainThread): * wtf/MallocPtr.h: (WTF::MallocPtr::operator=): * wtf/MessageQueue.h: (WTF::MessageQueue::append): (WTF::MessageQueue::appendAndKill): (WTF::MessageQueue::appendAndCheckEmpty): (WTF::MessageQueue::prepend): * wtf/NakedPtr.h: (WTF::=): * wtf/OSObjectPtr.h: (WTF::OSObjectPtr::operator=): * wtf/Optional.h: (WTF::Optional::Optional): (WTF::Optional::operator=): * wtf/RefPtr.h: (WTF::=): * wtf/RetainPtr.h: (WTF::=): * wtf/RunLoop.cpp: (WTF::RunLoop::dispatch): * wtf/SharedTask.h: (WTF::createSharedTask): * wtf/StdLibExtras.h: (WTF::move): Deleted. * wtf/Threading.cpp: (WTF::threadEntryPoint): (WTF::createThread): * wtf/Vector.h: (WTF::Vector::takeLast): * wtf/efl/DispatchQueueEfl.cpp: (DispatchQueue::dispatch): (DispatchQueue::setSocketEventHandler): (DispatchQueue::performTimerWork): (DispatchQueue::insertTimerWorkItem): * wtf/efl/DispatchQueueWorkItemEfl.h: (WorkItem::WorkItem): (TimerWorkItem::create): (TimerWorkItem::TimerWorkItem): * wtf/efl/WorkQueueEfl.cpp: (WorkQueue::registerSocketEventHandler): (WorkQueue::dispatch): (WorkQueue::dispatchAfter): * wtf/glib/GRefPtr.h: (WTF::=): * wtf/glib/WorkQueueGLib.cpp: (WTF::DispatchAfterContext::DispatchAfterContext): (WTF::WorkQueue::dispatchAfter): * wtf/text/AtomicString.h: (WTF::AtomicString::AtomicString): (WTF::AtomicString::operator=): * wtf/text/StringConcatenate.h: (WTF::tryMakeString): * wtf/text/WTFString.cpp: (WTF::String::isolatedCopy): * wtf/text/WTFString.h: (WTF::String::String): (WTF::StringCapture::releaseString): * wtf/win/GDIObject.h: (WTF::=): 2015-12-31 David Kilzer Stop using USE(CFNETWORK) path on iOS Step 1/2: Do everything but turn off USE(CFNETWORK) internally. Original patch by Antti Koivisto on 2015-03-10 Reviewed by Daniel Bates. * wtf/SchedulePair.h: Update macros to match WebCore. 2015-12-31 Andy Estes Rename WTF_MOVE to WTFMove https://bugs.webkit.org/show_bug.cgi?id=152601 Reviewed by Daniel Bates. Our coding style guidelines say that macros that expand to function calls should be named like functions, so WTFMove() is a more appropriate name. * wtf/StdLibExtras.h: 2015-12-30 Andy Estes Use of WTF::move prevents clang's move diagnostics from warning about several classes of mistakes https://bugs.webkit.org/show_bug.cgi?id=152601 Reviewed by Brady Eidson. Clang has recently added warnings to catch certain classes of mistakes with the use of std::move(): -Wpessimizing-move (warns if moving prevents copy elision), -Wredundant-move (warns if a move is redundant), and -Wself-move (warns if moving to self). Enabling these warnings manually (by renaming WTF::move to std::move) have caught numerous mistakes in our codebase (see http://trac.webkit.org/changeset/194428). It would be nice to be able to take advantage of these warnings, but doing so requires that we use std::move, not WTF::move. But since WTF::move does provide useful checks for which clang does not yet have warnings, we should write a best-of-both-worlds move function. This patch adds a function that satisfies clang's criteria for a move function (in namespace std, named "move", and takes a single argument) but also retains WTF::move's compile-time checks. It also adds a convenience macro called WTF_MOVE for use by callers. * wtf/StdLibExtras.h: (std::move): 2015-12-25 Andy Estes Stop moving local objects in return statements https://bugs.webkit.org/show_bug.cgi?id=152557 Reviewed by Brady Eidson. * wtf/StdLibExtras.h: Added a FIXME about how using WTF::move() prevents several Clang diagnostics from emitting useful warnings. 2015-12-22 Filip Pizlo FTL B3 should be able to run richards https://bugs.webkit.org/show_bug.cgi?id=152514 Reviewed by Michael Saboff. Change the list dumping helpers to work with a broader set of list kinds. * wtf/ListDump.h: (WTF::ListDump::dump): (WTF::MapDump::dump): (WTF::sortedMapDump): (WTF::ListDumpInContext::dump): 2015-12-22 Filip Pizlo FTL B3 does not logicalNot correctly https://bugs.webkit.org/show_bug.cgi?id=152512 Reviewed by Saam Barati. This change introduces yet another use of SharedTask in JSC. While doing this, I noticed that SharedTask::run() always demands that whatever arguments the callback takes, they must be passed as rvalue references. This was a clear misuse of perfect forwarding. This change makes SharedTask's approach to forwarding match what we were already doing in ScopedLambda. * wtf/SharedTask.h: 2015-12-20 Michael Catanzaro [SOUP] Performs DNS prefetch when a proxy is configured (information leak) https://bugs.webkit.org/show_bug.cgi?id=145542 Reviewed by Darin Adler. Specialize GUniquePtr, using g_strfreev. * wtf/glib/GUniquePtr.h: 2015-12-19 Dan Bernstein [Mac] WebKit contains dead source code for OS X Mavericks and earlier https://bugs.webkit.org/show_bug.cgi?id=152462 Reviewed by Alexey Proskuryakov. * Configurations/DebugRelease.xcconfig: Removed definition of MACOSX_DEPLOYMENT_TARGET for OS X 10.9. - Simplified expressions involving __MAC_OS_X_VERSION_MIN_REQUIRED and removed code that was never getting compiled: * wtf/FeatureDefines.h: * wtf/MainThread.h: * wtf/OSObjectPtr.h: * wtf/Platform.h: * wtf/mac/DeprecatedSymbolsUsedBySafari.mm: * wtf/spi/darwin/XPCSPI.h: 2015-12-17 Sukolsak Sakshuwong [INTL] Implement Collator Compare Functions https://bugs.webkit.org/show_bug.cgi?id=147604 Reviewed by Darin Adler. * wtf/unicode/Collator.h: 2015-12-16 Andreas Kling Give kernel VM some hints about non-live memory-cached resources. Reviewed by Geoffrey Garen. Add an API to OSAllocator for hinting to the OS that a range of memory is not expected to be used anytime soon. * wtf/OSAllocator.h: * wtf/OSAllocatorPosix.cpp: (WTF::OSAllocator::hintMemoryNotNeededSoon): * wtf/OSAllocatorWin.cpp: (WTF::OSAllocator::hintMemoryNotNeededSoon): * wtf/Platform.h: 2015-12-16 Alex Christensen Fix internal Windows build https://bugs.webkit.org/show_bug.cgi?id=152364 rdar://problem/23928759 Reviewed by Tim Horton. * WTF.vcxproj/WTF.proj: 2015-12-16 Youenn Fablet [Fetch API] Add fetch API compile time flag https://bugs.webkit.org/show_bug.cgi?id=152254 Reviewed by Darin Adler. * wtf/FeatureDefines.h: 2015-12-14 Yusuke Suzuki Math.random should have an intrinsic thunk and it should be later handled as a DFG Node https://bugs.webkit.org/show_bug.cgi?id=152133 Reviewed by Geoffrey Garen. Change 64bit random to double logic to convert efficiently. * wtf/WeakRandom.h: (WTF::WeakRandom::get): (WTF::WeakRandom::lowOffset): (WTF::WeakRandom::highOffset): 2015-12-14 Sukolsak Sakshuwong Make UCharIterator createIterator(StringView) visible to other classes https://bugs.webkit.org/show_bug.cgi?id=151917 Reviewed by Darin Adler. Make UCharIterator createIterator(StringView) in CollatorICU.cpp visible to other classes so that future patches that will ucol_strcollIter (including Bug 147604) can use it. * wtf/unicode/Collator.h: * wtf/unicode/icu/CollatorICU.cpp: (WTF::createIterator): 2015-12-14 David Kilzer REGRESSION (r162777): Remove Boost Software License from WTF Reviewed by Darin Adler. The source code that the Boost Software License was referring to was removed in r162777 by switching to std::atomic. * wtf/Atomics.cpp: * wtf/Atomics.h: * wtf/ThreadSafeRefCounted.h: - Remove Boost Software License. - Update Apple Inc. copyright as needed. - Refresh Apple Inc. license text. 2015-12-10 Joseph Pecoraro Remote Inspector: Verify the identity of the other side of XPC connections https://bugs.webkit.org/show_bug.cgi?id=152153 Reviewed by Brian Burg. * WTF.xcodeproj/project.pbxproj: * wtf/spi/cocoa/SecuritySPI.h: Renamed from Source/WebCore/platform/spi/cocoa/SecuritySPI.h. Push this down into WTF from WebCore and add a new method. 2015-12-08 Filip Pizlo FTL B3 should have basic GetById support https://bugs.webkit.org/show_bug.cgi?id=152035 Reviewed by Saam Barati. When dealing with shared task lambdas, you often want to force a value to be allocated so that it has reference semantics, but you still want the lambda to execute OK when we pop stack. In PL we usually call this a "box". This is easy to do if the value that happened to be stack-allocated is also RefCounted, but that's rare, since stack-allocated values often have copy semantics. So, I've added a Box type to WTF. Behind the scenes, it allocates your object with fast malloc inside a ThreadSAfeRefCounted. When you pass Box, you're passing the reference. This makes it a lot easier to work with by-reference capture. * WTF.xcodeproj/project.pbxproj: * wtf/Box.h: Added. (WTF::Box::Box): (WTF::Box::create): (WTF::Box::get): (WTF::Box::operator*): (WTF::Box::operator->): (WTF::Box::operator bool): (WTF::Box::Data::Data): 2015-12-09 Andreas Kling [iOS] ResourceUsageOverlay should work on iOS. Reviewed by Antti Koivisto. * wtf/Platform.h: Enable RESOURCE_USAGE_OVERLAY for all COCOA platforms. 2015-12-08 Joseph Pecoraro Create a Sandbox SPI header https://bugs.webkit.org/show_bug.cgi?id=151981 Reviewed by Andy Estes. * WTF.xcodeproj/project.pbxproj: * wtf/spi/darwin/SandboxSPI.h: Added. 2015-12-07 Filip Pizlo FTL B3 should be able to flag the tag constants as being super important so that B3 can hoist them and Air can force them into registers https://bugs.webkit.org/show_bug.cgi?id=151955 Reviewed by Geoffrey Garen. Remove some remaining DFG-specific snippets from Dominators. This used to be a non-template DFG class, and some time ago I hoisted it into WTF and made it generic. But since the only user of the class was the DFG, this class still had a handful of DFG-specific snippets that didn't compile when I started using it from B3. Also renamed immediateDominatorOf() to idom(). This is the sort of abbreviation that we wouldn't ordinarily want to have in WebKit. But WebKit does allow for abbreviations that are "more canonical". The term "idom" is definitely more canonical than "immediateDominatorOf". * wtf/Dominators.h: (WTF::Dominators::dominates): (WTF::Dominators::idom): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::ValidationContext::handleErrors): 2015-12-03 Anders Carlsson Remove Objective-C GC support https://bugs.webkit.org/show_bug.cgi?id=151819 rdar://problem/23746991 Reviewed by Dan Bernstein. * Configurations/Base.xcconfig: * wtf/ThreadingPthreads.cpp: (WTF::initializeCurrentThreadInternal): Deleted. * wtf/text/cf/StringImplCF.cpp: (WTF::StringImpl::createCFString): (garbageCollectionEnabled): Deleted. (WTF::StringWrapperCFAllocator::create): Deleted. 2015-12-02 Filip Pizlo FTL B3 should support OSR exit https://bugs.webkit.org/show_bug.cgi?id=151710 Reviewed by Saam Barati. Make sure that this has perfect forwarding. * wtf/SegmentedVector.h: (WTF::SegmentedVector::append): (WTF::SegmentedVector::alloc): 2015-12-01 Yusuke Suzuki [ES6] Implement LLInt/Baseline Support for ES6 Generators and enable this feature https://bugs.webkit.org/show_bug.cgi?id=150792 Reviewed by Saam Barati. * wtf/FastBitVector.h: (WTF::FastBitVector::forEachSetBit): * wtf/FeatureDefines.h: 2015-12-01 Commit Queue Unreviewed, rolling out r192914. https://bugs.webkit.org/show_bug.cgi?id=151734 JSC tests for this change are failing on 32 and 64-bit bots (Requested by ryanhaddad on #webkit). Reverted changeset: "[ES6] Implement LLInt/Baseline Support for ES6 Generators and enable this feature" https://bugs.webkit.org/show_bug.cgi?id=150792 http://trac.webkit.org/changeset/192914 2015-12-01 Myles C. Maxfield Give String and AtomicString an existingHash() function https://bugs.webkit.org/show_bug.cgi?id=151717 Reviewed by Andreas Kling. Test: WTF.AtomicStringExistingHash WTF.StringExistingHash * wtf/text/AtomicString.h: (WTF::AtomicString::existingHash): * wtf/text/WTFString.h: (WTF::String::existingHash): 2015-12-01 Yusuke Suzuki [ES6] Implement LLInt/Baseline Support for ES6 Generators and enable this feature https://bugs.webkit.org/show_bug.cgi?id=150792 Reviewed by Saam Barati. * wtf/FastBitVector.h: (WTF::FastBitVector::forEachSetBit): * wtf/FeatureDefines.h: 2015-11-30 Geoffrey Garen Use a better RNG for Math.random() https://bugs.webkit.org/show_bug.cgi?id=151641 Reviewed by Anders Carlsson. Use 64 bits in the random number generator instead of 32 bit. (In the end, JavaScript, which uses doubles, will only see 52 bits.) This prevents programs that multiply a random number by a large constant from seeing non-random "banding" caused by zeroes in the low 20 bits. I also took the opportunity to upgrade from GameRandom to Xorshift+, since Xorshift+ passes more benchmarks for randomness, and is not any slower or more complicated. Now let us all remember the fateful words of Steve Weibe, who would be King of Kong: "The randomness went the opposite way that it usually goes." * wtf/WeakRandom.h: (WTF::WeakRandom::WeakRandom): (WTF::WeakRandom::setSeed): Use standard naming. (WTF::WeakRandom::seed): This function is safe now. "Unsafe" in function names makes me itch. (WTF::WeakRandom::get): (WTF::WeakRandom::getUint32): Update to 64bit. (WTF::WeakRandom::advance): The Xorshift+ algorithm. (WTF::WeakRandom::initializeSeed): Deleted. (WTF::WeakRandom::seedUnsafe): Deleted. 2015-11-30 Benjamin Poulain [JSC] Speed up Air Liveness Analysis on Tmps https://bugs.webkit.org/show_bug.cgi?id=151556 Reviewed by Filip Pizlo. * WTF.xcodeproj/project.pbxproj: * wtf/IndexSparseSet.h: Added. (WTF::IndexSparseSet::IndexSparseSet): (WTF::IndexSparseSet::add): (WTF::IndexSparseSet::remove): (WTF::IndexSparseSet::clear): (WTF::IndexSparseSet::size): (WTF::IndexSparseSet::isEmpty): (WTF::IndexSparseSet::contains): 2015-11-30 Tim Horton Get rid of the !USE(ASYNC_NSTEXTINPUTCLIENT) codepath https://bugs.webkit.org/show_bug.cgi?id=151673 Reviewed by Anders Carlsson. * wtf/Platform.h: 2015-11-30 Carlos Garcia Campos [GLIB] Remove GMainLoopSource and GThreadSafeMainLoopSource https://bugs.webkit.org/show_bug.cgi?id=151633 Reviewed by Csaba Osztrogonác. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * wtf/PlatformEfl.cmake: * wtf/PlatformGTK.cmake: * wtf/glib/GMainLoopSource.cpp: Removed. * wtf/glib/GMainLoopSource.h: Removed. * wtf/glib/GThreadSafeMainLoopSource.cpp: Removed. * wtf/glib/GThreadSafeMainLoopSource.h: Removed. 2015-11-27 Csaba Osztrogonác Fix build warning in bignum.cc https://bugs.webkit.org/show_bug.cgi?id=150797 Reviewed by Geoffrey Garen. * wtf/dtoa/bignum.cc: 2015-11-18 Daniel Bates [iOS] ASSERTION FAILED: temporaryFilePath.last() == '/' in WebCore::openTemporaryFile() https://bugs.webkit.org/show_bug.cgi?id=151392 Reviewed by Alexey Proskuryakov. Workaround where confstr(_CS_DARWIN_USER_TEMP_DIR, ..., ...) retrieves the path to the user temporary directory without a trailing slash in the iOS simulator. * wtf/DataLog.cpp: (WTF::initializeLogFileOnce): 2015-11-17 Filip Pizlo CheckAdd/Mul should have commutativity optimizations in B3->Air lowering https://bugs.webkit.org/show_bug.cgi?id=151214 Reviewed by Geoffrey Garen. Disable my failed attempts at perfect forwarding, since they were incorrect, and caused compile errors if you tried to pass an argument that bound to lvalue. This shouldn't affect performance of anything we care about, and performance tests seem to confirm that it's all good. * wtf/ScopedLambda.h: 2015-11-17 Filip Pizlo Air should lay out code optimally https://bugs.webkit.org/show_bug.cgi?id=150478 Reviewed by Geoffrey Garen. * wtf/GraphNodeWorklist.h: (WTF::GraphNodeWorklist::push): (WTF::GraphNodeWorklist::isEmpty): (WTF::GraphNodeWorklist::notEmpty): (WTF::GraphNodeWorklist::pop): 2015-11-11 Anders Carlsson Enable cross-platform context menus by default https://bugs.webkit.org/show_bug.cgi?id=151173 Reviewed by Tim Horton. * wtf/Platform.h: 2015-11-12 Csaba Osztrogonác Remove ENABLE(SATURATED_LAYOUT_ARITHMETIC) guards https://bugs.webkit.org/show_bug.cgi?id=150972 Reviewed by Darin Adler. * wtf/FeatureDefines.h: 2015-11-11 Filip Pizlo B3 should be able to compile and canonicalize Mul https://bugs.webkit.org/show_bug.cgi?id=151124 Reviewed by Geoffrey Garen. * wtf/MathExtras.h: (WTF::fastLog2): 2015-11-10 Filip Pizlo B3 should be able to compile a program with ChillDiv https://bugs.webkit.org/show_bug.cgi?id=151114 Reviewed by Benjamin Poulain. Needed to beef up some compiler algorithms. All of the hardening was about making them work with objects that have move semantics but not copy semantics. This arises in B3 basic block insertion sets. * wtf/BubbleSort.h: (WTF::bubbleSort): * wtf/Insertion.h: (WTF::Insertion::Insertion): (WTF::Insertion::index): (WTF::Insertion::element): (WTF::Insertion::operator<): (WTF::executeInsertions): 2015-11-10 Carlos Garcia Campos [GTK] Use CROSS_PLATFORM_CONTEXT_MENUS https://bugs.webkit.org/show_bug.cgi?id=150642 Reviewed by Martin Robinson. Enable CROSS_PLATFORM_CONTEXT_MENUS for GTK+ port. * wtf/Platform.h: 2015-11-09 Anders Carlsson Introspect reply block types as well https://bugs.webkit.org/show_bug.cgi?id=151048 Reviewed by Tim Horton. Fix operator-> implementation. * wtf/Optional.h: (WTF::Optional::operator->): 2015-11-05 Nikos Andronikos Add runtime and compile time flags for enabling Web Animations API and model. https://bugs.webkit.org/show_bug.cgi?id=150914 Reviewed by Benjamin Poulain. Add ENABLE_WEB_ANIMATIONS compile time flag, runtime flag webAnimationsEnabled and Expose WK2 preference for runtime flag. * wtf/FeatureDefines.h: 2015-11-05 Zan Dobersek [GLib] Avoid gint64, std::chrono::microseconds overflows in RunLoop::TimerBase https://bugs.webkit.org/show_bug.cgi?id=150930 Reviewed by Carlos Garcia Campos. In RunLoop::TimerBase::start(), avoid overflowing the std::chrono::microseconds value in case the passed-in fire interval (in seconds) is too large (e.g. when std::chrono::microseconds::max() is used as the desired interval). This is achieved by using the passed-in fire interval, converted in microseconds, only if the value of this interval is smaller than std::chrono::microseconds::max(). In RunLoop::TimerBase::updateReadyTime(), the zero-delay is still considered a short cut, but we use G_MAXINT64 in case the sum of the current time and the desired fire interval (now in microseconds) would overflow. * wtf/glib/RunLoopGLib.cpp: (WTF::RunLoop::TimerBase::updateReadyTime): (WTF::RunLoop::TimerBase::start): 2015-11-02 Filip Pizlo B3/Air should use bubble sort for their insertion sets, because it's faster than std::stable_sort https://bugs.webkit.org/show_bug.cgi?id=150828 Reviewed by Geoffrey Garen. Add a pretty good bubble sort implementation to WTF. This implementation has three common tricks: - Forward and backward scans. This reduces the severity of certain kinds of bubble sort pathologies. - Return if a scan finds the list to be sorted. This gives the algorithm one of its most attractive properties: it's super fast when the list is already sorted. - Each scan eliminates one element from future scans. This makes the algorithm no worse than insertion sort. Why do we want this? Because bubble sort is a really great stable sort for small lists, or large lists in which only a handful of elements are out of order. Compiler insertion sets tend to be one of those or somewhere in between: usually they are very small, and usually they are sorted. It's rare that an element will be out of order, and when it is, it's usually very close to where it's supposed to be. This is a significant speed-up for B3 compile times. * WTF.xcodeproj/project.pbxproj: * wtf/BubbleSort.h: Added. (WTF::bubbleSort): * wtf/CMakeLists.txt: 2015-11-02 Andy Estes [Cocoa] Add tvOS and watchOS to SUPPORTED_PLATFORMS https://bugs.webkit.org/show_bug.cgi?id=150819 Reviewed by Dan Bernstein. This tells Xcode to include these platforms in its Devices dropdown, making it possible to build in the IDE. * Configurations/Base.xcconfig: 2015-11-02 Carlos Garcia Campos [GLIB] Remove support for GSocket main loop sources from GMainLoopSource https://bugs.webkit.org/show_bug.cgi?id=150772 Reviewed by Žan Doberšek. It complicated the code just to make generic what is only used in one place. * wtf/glib/GMainLoopSource.cpp: (WTF::GMainLoopSource::cancel): Deleted. (WTF::GMainLoopSource::schedule): Deleted. (WTF::GMainLoopSource::scheduleTimeoutSource): Deleted. (WTF::GMainLoopSource::scheduleAfterDelay): Deleted. (WTF::GMainLoopSource::finishVoidCallback): Deleted. (WTF::GMainLoopSource::voidCallback): Deleted. (WTF::GMainLoopSource::prepareBoolCallback): Deleted. * wtf/glib/GMainLoopSource.h: (WTF::GMainLoopSource::Context::operator=): Deleted. 2015-11-02 Carlos Garcia Campos [GLIB] Remove delete on destroy GMainLoopSources https://bugs.webkit.org/show_bug.cgi?id=150771 Reviewed by Žan Doberšek. Delete on destroy sources made the GMainLoopSource implementation more complex and they are currently unused. * wtf/glib/GMainLoopSource.cpp: (WTF::GMainLoopSource::boolCallback): (WTF::GMainLoopSource::create): Deleted. (WTF::GMainLoopSource::GMainLoopSource): Deleted. (WTF::GMainLoopSource::cancel): Deleted. (WTF::GMainLoopSource::scheduleAndDeleteOnDestroy): Deleted. (WTF::GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy): Deleted. (WTF::GMainLoopSource::voidCallback): Deleted. * wtf/glib/GMainLoopSource.h: 2015-11-01 Carlos Garcia Campos [GTK] Use RunLoop in WorkQueue implementation https://bugs.webkit.org/show_bug.cgi?id=150770 Reviewed by Darin Adler. Instead of using GMainLoop directly. RunLoop already abstracts the GMainLoop details and uses persistent sources making it more efficient. For the dispatchAfter implementation we use a helper context class and a GSource directly, since we are going to get rid of delete on destroy GMainLoop soon and this is the only place where we still use them. * wtf/RunLoop.h: (WTF::RunLoop::mainContext): Return the GMainContext. * wtf/WorkQueue.h: * wtf/glib/WorkQueueGLib.cpp: (WTF::WorkQueue::platformInitialize): The RunLoop needs to be created in the worker thread now, so we now use a mutex to wait until the thread has started and the RunLoop has been created. (WTF::WorkQueue::platformInvalidate): Stop the RunLoop and wait until the thread finishes. (WTF::WorkQueue::dispatch): Use RunLoop::dispatch(). (WTF::DispatchAfterContext::DispatchAfterContext): (WTF::DispatchAfterContext::~DispatchAfterContext): (WTF::DispatchAfterContext::dispatch): (WTF::WorkQueue::dispatchAfter): 2015-11-01 Yusuke Suzuki [ES6] Support Generator Syntax https://bugs.webkit.org/show_bug.cgi?id=150769 Reviewed by Geoffrey Garen. Added ENABLE_ES6_GENERATORS flag. * wtf/FeatureDefines.h: 2015-11-01 Darin Adler ASCIICType refinements https://bugs.webkit.org/show_bug.cgi?id=150787 Reviewed by Geoffrey Garen. Refined ASCIICType.h by using narrower types. The most valuable part of this is the part where the result of toASCIIHexValue is uint8_t instead of int; that's slightly better for RGB values that the compiler needs to know fit into a byte (coming in some Color work I plan to do soon). * wtf/ASCIICType.h: Used CharacterType instead of CharType throughout, and also sorted the using declarations at the bottom of the header. (WTF::isASCII): Use the name "character" instead of "c". (WTF::isASCIIAlpha): Ditto. Also use isASCIILower and toASCIILowerUnchecked instead of writing it out. (WTF::isASCIIDigit): Ditto. (WTF::isASCIIAlphanumeric): Ditto. (WTF::isASCIIHexDigit): Ditto. Also use toASCIILowerUnchecked instead of writing it out. (WTF::isASCIILower): Ditto. (WTF::isASCIIBinaryDigit): Ditto. Also removed unneeded parentheses to match the style of the rest of the file. (WTF::isASCIIOctalDigit): Ditto. (WTF::isASCIIPrintable): Ditto. (WTF::isASCIISpace): Ditto. (WTF::isASCIIUpper): Ditto. (WTF::toASCIILower): Ditto. Also use isASCIIUpper instead of writing it out. (WTF::toASCIILowerUnchecked): Tweaked comment. (WTF::toASCIIUpper): Ditto. Also use isASCIILower instead of writing it out. (WTF::toASCIIHexValue): Ditto. Also change return type from int to uint8_t. Also broke a single assertion with && into two separate assertions and got rid of unnnecessary masking with 0xF0 after shifting left. Also renamed arguments for the two argument value so they are more sensible. (WTF::lowerNibbleToASCIIHexDigit): Changed argument type to uint8_t, since this function does not take a character. Also called it "value" instead of "c". Also slightly tweaked how the expression is written. (WTF::upperNibbleToASCIIHexDigit): Ditto. Using the more specific type also got rid of the need to explicitly mask in this function. (WTF::isASCIIAlphaCaselessEqual): Renamed the arguments for greater clarity. With the new clearer argument names, the comment was superfluous. 2015-11-01 Filip Pizlo Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): 2015-11-01 Darin Adler Remove some dead and unneeded code (ScrollbarThemeSafari, RenderThemeSafari, OPENCL, a little color space logic) https://bugs.webkit.org/show_bug.cgi?id=150783 Reviewed by Tim Horton. * wtf/FeatureDefines.h: Removed the OPENCL feature, no longer supported. 2015-10-31 Filip Pizlo B3::reduceStrength's DCE should be more agro and less wrong https://bugs.webkit.org/show_bug.cgi?id=150748 Reviewed by Geoffrey Garen. * wtf/GraphNodeWorklist.h: (WTF::GraphNodeWorklist::saw): This method is super useful. 2015-11-01 Philip Chimento [GTK] Fix combinations of PLATFORM(GTK) and OS(DARWIN) https://bugs.webkit.org/show_bug.cgi?id=144560 Reviewed by Darin Adler. * wtf/Platform.h: Don't USE(ACCELERATE) on PLATFORM(GTK). * wtf/WorkQueue.h: Change order of OS(DARWIN) and PLATFORM(GTK) checks so that GTK facilities are used even when building the GTK platform on Darwin. 2015-11-01 Carlos Garcia Campos [GTK] Use RunLoop::Timer in main thread shared timer GTK+ implementation https://bugs.webkit.org/show_bug.cgi?id=150754 Reviewed by Darin Adler. Add API to set the priority of a RunLoop::Timer for GLib. * wtf/RunLoop.h: * wtf/glib/RunLoopGLib.cpp: (WTF::RunLoop::TimerBase::setPriority): 2015-10-31 Andreas Kling Add a debug overlay with information about web process resource usage. Reviewed by Darin Adler. Add ENABLE(RESOURCE_USAGE_OVERLAY) flag, enabled on Mac by default. * wtf/Platform.h: 2015-10-30 Chris Dumez Regression(r191673): Crash in RunLoopTimer::schedule() https://bugs.webkit.org/show_bug.cgi?id=150723 Reviewed by Anders Carlsson. We were crashing in RunLoopTimer::schedule() when iterating over the SchedulePairHashSet. The reason is that we were passing this SchedulePairHashSet from the main thread to a background thread, which was not safe because the SchedulePair objects inside the HashSet were not ThreadSafeRefCounted. This patch makes them ThreadSafeRefCounted. * wtf/SchedulePair.h: 2015-10-30 Carlos Garcia Campos [GTK] Move the socket polling off the WorkQueue https://bugs.webkit.org/show_bug.cgi?id=150593 Reviewed by Anders Carlsson. It doesn't really belong to the WorkQueue, it's only used by the WebKit2 connection, so it can be moved there. * wtf/WorkQueue.h: * wtf/glib/WorkQueueGLib.cpp: (WTF::WorkQueue::registerSocketEventHandler): Deleted. (WTF::WorkQueue::unregisterSocketEventHandler): Deleted. 2015-10-29 Carlos Garcia Campos [GTK] Use a persistent main loop source in RunLoop glib implementation https://bugs.webkit.org/show_bug.cgi?id=150590 Reviewed by Žan Doberšek. It's more efficient than creating and destroying a new source for every dispatch and it simplifies the code. * wtf/RunLoop.h: * wtf/glib/MainThreadGLib.cpp: (WTF::scheduleDispatchFunctionsOnMainThread): Use RunLoop::dispatch() instead of GMainLoopSource::scheduleAndDeleteOnDestroy(). * wtf/glib/RunLoopGLib.cpp: (WTF::RunLoop::RunLoop): Create and setup the persistent source. (WTF::RunLoop::~RunLoop): Destroy the persistent source. (WTF::RunLoop::stop): Stop the persistent source before stopping the main loop. (WTF::RunLoop::wakeUp): Make the persistent source active. We no longer need to explicitly wakeup the context. (WTF::RunLoop::TimerBase::TimerBase): Create and setup the persistent source. (WTF::RunLoop::TimerBase::~TimerBase): Destroy the persistent source. (WTF::RunLoop::TimerBase::updateReadyTime): Set the ready time according to the fire interval. (WTF::RunLoop::TimerBase::start): Make the persistent source active. (WTF::RunLoop::TimerBase::stop): Stop the persistent source. (WTF::RunLoop::TimerBase::isActive): Return whether the persistent source is active. 2015-10-30 Philippe Normand [GTK][Mac] fix WTF build https://bugs.webkit.org/show_bug.cgi?id=150502 Reviewed by Alex Christensen. * wtf/CMakeLists.txt: Add CommonCryptoSPI.h in the headers. 2015-10-29 Alex Christensen Fix Mac CMake build https://bugs.webkit.org/show_bug.cgi?id=150686 Reviewed by Filip Pizlo. * wtf/CMakeLists.txt: * wtf/Platform.h: * wtf/PlatformMac.cmake: 2015-10-29 Commit Queue Unreviewed, rolling out r191728. https://bugs.webkit.org/show_bug.cgi?id=150668 Caused a lot of timeouts in layout tests (Requested by KaL on #webkit). Reverted changeset: "[GTK] Use a persistent main loop source in RunLoop glib implementation" https://bugs.webkit.org/show_bug.cgi?id=150590 http://trac.webkit.org/changeset/191728 2015-10-29 Carlos Garcia Campos [GTK] Use a persistent main loop source in RunLoop glib implementation https://bugs.webkit.org/show_bug.cgi?id=150590 Reviewed by Žan Doberšek. It's more efficient than creating and destroying a new source for every dispatch and it simplifies the code. * wtf/RunLoop.h: * wtf/glib/MainThreadGLib.cpp: (WTF::scheduleDispatchFunctionsOnMainThread): Use RunLoop::dispatch() instead of GMainLoopSource::scheduleAndDeleteOnDestroy(). * wtf/glib/RunLoopGLib.cpp: (WTF::RunLoop::RunLoop): Create and setup the persistent source. (WTF::RunLoop::~RunLoop): Destroy the persistent source. (WTF::RunLoop::stop): Stop the persistent source before stopping the main loop. (WTF::RunLoop::wakeUp): Make the persistent source active. We no longer need to explicitly wakeup the context. (WTF::RunLoop::TimerBase::TimerBase): Create and setup the persistent source. (WTF::RunLoop::TimerBase::~TimerBase): Destroy the persistent source. (WTF::RunLoop::TimerBase::updateReadyTime): Set the ready time according to the fire interval. (WTF::RunLoop::TimerBase::start): Make the persistent source active. (WTF::RunLoop::TimerBase::stop): Stop the persistent source. (WTF::RunLoop::TimerBase::isActive): Return whether the persistent source is active. 2015-10-28 Filip Pizlo Unreviewed, make sure B3 is disabled on iOS for now. * wtf/Platform.h: 2015-10-28 Filip Pizlo Create a super rough prototype of B3 https://bugs.webkit.org/show_bug.cgi?id=150280 Reviewed by Benjamin Poulain. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/HashSet.h: (WTF::copyToVector): (WTF::=): * wtf/ListDump.h: (WTF::PointerListDump::PointerListDump): (WTF::PointerListDump::dump): (WTF::MapDump::MapDump): (WTF::listDump): (WTF::pointerListDump): (WTF::sortedListDump): * wtf/MathExtras.h: (WTF::leftShiftWithSaturation): (WTF::rangesOverlap): * wtf/Platform.h: * wtf/ScopedLambda.h: Added. (WTF::scopedLambda): * wtf/SharedTask.h: (WTF::createSharedTask): 2015-10-28 Alberto Garcia [SOUP] Cannot build the network process in glibc-based BSD systems https://bugs.webkit.org/show_bug.cgi?id=150618 Reviewed by Carlos Garcia Campos. * wtf/Platform.h: Don't enable HAVE_STAT_BIRTHTIME if the system is using glibc. 2015-10-21 Filip Pizlo Factor out the graph node worklists from DFG into WTF https://bugs.webkit.org/show_bug.cgi?id=150411 Reviewed by Geoffrey Garen. The new GraphNodeWorklist.h file is basically just the functionality from the old DFGBlockWorklist.h, but templatized to work for any graph node type and any kind of graph node set. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/GraphNodeWorklist.h: Added. (WTF::GraphNodeWorklist::push): (WTF::GraphNodeWorklist::notEmpty): (WTF::GraphNodeWorklist::pop): (WTF::GraphNodeWith::GraphNodeWith): (WTF::GraphNodeWith::operator bool): (WTF::ExtendedGraphNodeWorklist::ExtendedGraphNodeWorklist): (WTF::ExtendedGraphNodeWorklist::forcePush): (WTF::ExtendedGraphNodeWorklist::push): (WTF::ExtendedGraphNodeWorklist::notEmpty): (WTF::ExtendedGraphNodeWorklist::pop): (WTF::GraphNodeWithOrder::GraphNodeWithOrder): (WTF::GraphNodeWithOrder::operator bool): (WTF::PostOrderGraphNodeWorklist::PostOrderGraphNodeWorklist): (WTF::PostOrderGraphNodeWorklist::~PostOrderGraphNodeWorklist): (WTF::PostOrderGraphNodeWorklist::pushPre): (WTF::PostOrderGraphNodeWorklist::pushPost): (WTF::PostOrderGraphNodeWorklist::push): (WTF::PostOrderGraphNodeWorklist::notEmpty): (WTF::PostOrderGraphNodeWorklist::pop): * wtf/HashTable.h: (WTF::HashTableAddResult::HashTableAddResult): (WTF::HashTableAddResult::operator bool): 2015-10-20 Tim Horton Try to fix the build by disabling MAC_GESTURE_EVENTS on 10.9 and 10.10 * wtf/FeatureDefines.h: 2015-10-20 Yoav Weiss Rename the PICTURE_SIZES flag to CURRENTSRC https://bugs.webkit.org/show_bug.cgi?id=150275 Reviewed by Dean Jackson. * wtf/FeatureDefines.h: 2015-10-19 Beth Dakin Build fix. * wtf/FeatureDefines.h: 2015-10-19 Tim Horton Add magnify and rotate gesture event support for Mac https://bugs.webkit.org/show_bug.cgi?id=150179 Reviewed by Darin Adler. * wtf/FeatureDefines.h: New feature flag. 2015-10-17 Mark Lam Add CPU(X86) to the supported MASM_PROBE CPUs. This was accidentally left out in r191197. Not reviewed. * wtf/Platform.h: 2015-10-16 Mark Lam Always enable MASM_PROBE for debug builds. https://bugs.webkit.org/show_bug.cgi?id=150190 Reviewed by Geoffrey Garen. * wtf/Platform.h: 2015-10-14 Andreas Kling REGRESSION(r190882): Concatenating a character array and an empty string is broken. Reviewed by Geoffrey Garen. StringAdapter templates for raw character arrays were always using 1 as the array length in toString(). * wtf/text/StringConcatenate.h: 2015-10-14 Per Arne Vollan [Win64] Enable concurrent JIT. https://bugs.webkit.org/show_bug.cgi?id=150098 Reviewed by Csaba Osztrogonác. * wtf/Platform.h: 2015-10-13 Simon Fraser Add helper funtion for checking pointer equivalency and use it https://bugs.webkit.org/show_bug.cgi?id=150022 Reviewed by Darin Adler. Add PointerComparison.h which contains the templated pointer comparison function. * WTF.xcodeproj/project.pbxproj: * wtf/PointerComparison.h: Added. (WTF::arePointingToEqualData): 2015-10-12 Andreas Kling "A + B" with strings shouldn't copy if A or B is empty. Reviewed by Anders Carlsson. Add a fast path to WTF's operator+ magic for concatenation of two strings where one of them is empty. In that case, try to avoid allocation altogether by returning the non-empty string. Spotted this while analyzing memory peaks during page load; it turns out we were duplicating whole text resources (JS, CSS) at the end of decoding, below TextResourceDecoder::decodeAndFlush(). That function effectively does: return decode() + flush(); Very often, flush() returns an empty string, so due to the naive operator+, we'd allocate a new StringImpl of length (decode().length() + flush().length()) and copy the return value from decode() into it. So silly! Had to make the tryMakeString() machinery use String as a return type instead of RefPtr to make all the right overloads gel. StringTypeAdapter templates are now required to provide a toString() function. * wtf/text/StringConcatenate.h: (WTF::StringTypeAdapter::toString): (WTF::StringTypeAdapter::toString): (WTF::StringTypeAdapter>::toString): (WTF::StringTypeAdapter::toString): (WTF::tryMakeString): (WTF::makeString): * wtf/text/StringOperators.h: (WTF::StringAppend::operator String): * wtf/text/StringView.h: (WTF::StringTypeAdapter::toString): 2015-10-12 Filip Pizlo Unreviewed, fix style in the hopes that it fixes Windows. * wtf/ParallelHelperPool.cpp: (WTF::ParallelHelperClient::~ParallelHelperClient): (WTF::ParallelHelperClient::setTask): (WTF::ParallelHelperClient::doSomeHelping): (WTF::ParallelHelperClient::runTaskInParallel): (WTF::ParallelHelperClient::finish): (WTF::ParallelHelperClient::claimTask): (WTF::ParallelHelperClient::runTask): (WTF::ParallelHelperPool::doSomeHelping): (WTF::ParallelHelperPool::helperThreadBody): * wtf/ParallelHelperPool.h: (WTF::ParallelHelperClient::setFunction): (WTF::ParallelHelperClient::runFunctionInParallel): (WTF::ParallelHelperClient::pool): 2015-10-10 Filip Pizlo FTL should generate code to call slow paths lazily https://bugs.webkit.org/show_bug.cgi?id=149936 Reviewed by Saam Barati. Enables SharedTask to handle any function type, not just void(). It's probably better to use SharedTask instead of std::function in performance-sensitive code. std::function uses the system malloc and has copy semantics. SharedTask uses FastMalloc and has aliasing semantics. So, you can just trust that it will have sensible performance characteristics. * wtf/ParallelHelperPool.cpp: (WTF::ParallelHelperClient::~ParallelHelperClient): (WTF::ParallelHelperClient::setTask): (WTF::ParallelHelperClient::doSomeHelping): (WTF::ParallelHelperClient::runTaskInParallel): (WTF::ParallelHelperClient::finish): (WTF::ParallelHelperClient::claimTask): (WTF::ParallelHelperClient::runTask): (WTF::ParallelHelperPool::doSomeHelping): (WTF::ParallelHelperPool::helperThreadBody): * wtf/ParallelHelperPool.h: (WTF::ParallelHelperClient::setFunction): (WTF::ParallelHelperClient::runFunctionInParallel): (WTF::ParallelHelperClient::pool): * wtf/SharedTask.h: (WTF::createSharedTask): (WTF::SharedTask::SharedTask): Deleted. (WTF::SharedTask::~SharedTask): Deleted. (WTF::SharedTaskFunctor::SharedTaskFunctor): Deleted. 2015-10-10 Dan Bernstein [iOS] Remove unnecessary iOS version checks https://bugs.webkit.org/show_bug.cgi?id=150002 Reviewed by Alexey Proskuryakov. * wtf/Platform.h: 2015-10-10 Dan Bernstein [iOS] Remove project support for iOS 8 https://bugs.webkit.org/show_bug.cgi?id=149993 Reviewed by Alexey Proskuryakov. * Configurations/Base.xcconfig: * Configurations/WTF.xcconfig: * Configurations/mbmalloc.xcconfig: 2015-10-08 Joseph Pecoraro Clean up Marked classes https://bugs.webkit.org/show_bug.cgi?id=149853 Reviewed by Darin Adler. * wtf/PageBlock.h: Remove duplicate using statement. 2015-10-08 Joseph Pecoraro Remove PageReservation.h clang fixme that has been fixed for a while https://bugs.webkit.org/show_bug.cgi?id=149908 Reviewed by Csaba Osztrogonác. * wtf/PageReservation.h: (WTF::PageReservation::operator bool): Deleted. 2015-10-06 Daniel Bates Enable XSLT when building WebKit for iOS using the public iOS SDK https://bugs.webkit.org/show_bug.cgi?id=149827 Reviewed by Alexey Proskuryakov. * wtf/FeatureDefines.h: 2015-10-04 Filip Pizlo Inline cache repatching should be throttled if it happens a lot https://bugs.webkit.org/show_bug.cgi?id=149796 rdar://problem/22674436 Reviewed by Saam Barati. Add some helpers for saturated math. * wtf/MathExtras.h: (WTF::incrementWithSaturation): (WTF::leftShiftWithSaturation): 2015-10-01 Brent Fulgham [Win] Unreviewed CMake build fixes. * wtf/CMakeLists.txt: Correct build flags to match the original project files. 2015-09-30 Commit Queue Unreviewed, rolling out r190324. https://bugs.webkit.org/show_bug.cgi?id=149671 Caused flaky crashes, rdar://problem/22916304 (Requested by ap on #webkit). Reverted changeset: "ParallelHelperPool::runFunctionInParallel() shouldn't allocate, and ParallelHelperPool.h shouldn't be included everywhere" https://bugs.webkit.org/show_bug.cgi?id=149635 http://trac.webkit.org/changeset/190324 2015-09-29 Filip Pizlo ParallelHelperPool::runFunctionInParallel() shouldn't allocate, and ParallelHelperPool.h shouldn't be included everywhere https://bugs.webkit.org/show_bug.cgi?id=149635 Reviewed by Saam Barati. * wtf/ParallelHelperPool.h: (WTF::ParallelHelperClient::runFunctionInParallel): Stack-allocate the task instead of heap-allocating it. 2015-09-29 Filip Pizlo GC copy phase spans too many files https://bugs.webkit.org/show_bug.cgi?id=149586 Reviewed by Andreas Kling. Extract the load balancing algorithm used by the GC's copy phase into a reusable template. The GC copy phase now uses this. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/ParallelVectorIterator.h: Added. (WTF::ParallelVectorIterator::ParallelVectorIterator): (WTF::ParallelVectorIterator::iterate): 2015-09-26 Filip Pizlo Unreviewed, fix Windows build by adding WTF_EXPORT_PRIVATE in various places. * wtf/ParallelHelperPool.h: (WTF::ParallelHelperClient::setFunction): (WTF::ParallelHelperPool::numberOfThreads): 2015-09-24 Filip Pizlo VMs should share GC threads https://bugs.webkit.org/show_bug.cgi?id=149433 rdar://problem/12859344 Reviewed by Geoffrey Garen. This adds two major things to WTF: WeakRandom and ParallelHelperPool. WeakRandom was already in JSC; we're just hoisting it into WTF. It's just a weak random number generator that's suitable for places where you need just a tiny bit of randomness. ParallelHelperPool is a new API that simplifies data-parallel algorithms like the JSC GC. In a data-parallel algorithm, we want to run one task on as many cores as possible and let the task worry about which subset of the input data to work on. In some cases, the algorithm will not need to do any load balancing - and if load balancing is required, it's up to the user. This is appropriate in contexts where the load balancing needs to be custom-tuned for performance, like the GC's marking phase. This new API has three concepts: task, client, and pool. A task is a reference counted object with a run() method, which may be run in parallel. It is usually used to wrap a functor. A pool is a pool of threads that can run things. A client is a placeholder for a task. A client can have zero or one tasks. A client must be registered with a pool. When a client has a task, the pool's threads may choose to run it. If a thread starts running a task, it will run it to completion. When the task returns on any thread, the client takes it to mean that the task should be removed. That means that any currently running instances of the task will finish but no new threads will attempt to run the task. You can easily ask a client to wait until a task finishes. You can also easily ask a client to run a task on the current thread in addition to possibly some helper threads from the pool. For some data-parallel algorithms, programming with ParallelHelperPool is as easy as: client.runFunctionInParallel( [=] () { do things; }); Note that you cannot tell ahead of time how many threads will join to help the task. Threads may become available after the task has already started running. Those threads may join after the other threads have already started. It's not advisable to make algorithmic decisions based on client.numberOfActiveThreads(), since that number may change. Usually the best way to use ParallelHelperPool is with an algorithm that has its own custom worklist. An example of a very simple custom worklist is the one in the JSC GC's copying phase - it's just a Vector and an index that indicates the next set of elements to process. This new API was initially designed to simplify how GCThread works, by replacing Phase with a callback that contains the phase's workload. I then realized that with a few tweaks, I could make this somewhat general enough that it might become interesting outside GC. I also realized that I could use this to enable thread sharing. So, although the API is kinda quirky, it's grounded in the reality of how the JSC GC does parallelism. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/ParallelHelperPool.cpp: Added. (WTF::ParallelHelperClient::ParallelHelperClient): (WTF::ParallelHelperClient::~ParallelHelperClient): (WTF::ParallelHelperClient::setTask): (WTF::ParallelHelperClient::finish): (WTF::ParallelHelperClient::doSomeHelping): (WTF::ParallelHelperClient::runTaskInParallel): (WTF::ParallelHelperClient::claimTask): (WTF::ParallelHelperClient::runTask): (WTF::ParallelHelperPool::ParallelHelperPool): (WTF::ParallelHelperPool::~ParallelHelperPool): (WTF::ParallelHelperPool::addThreads): (WTF::ParallelHelperPool::ensureThreads): (WTF::ParallelHelperPool::doSomeHelping): (WTF::ParallelHelperPool::didMakeWorkAvailable): (WTF::ParallelHelperPool::helperThreadBody): (WTF::ParallelHelperPool::hasClientWithTask): (WTF::ParallelHelperPool::getClientWithTask): (WTF::ParallelHelperPool::waitForClientWithTask): * wtf/ParallelHelperPool.h: Added. (WTF::ParallelHelperClient::setFunction): (WTF::ParallelHelperClient::runFunctionInParallel): (WTF::ParallelHelperClient::pool): (WTF::ParallelHelperClient::numberOfActiveThreads): (WTF::ParallelHelperPool::numberOfThreads): * wtf/SharedTask.h: Added. (WTF::SharedTask::SharedTask): (WTF::SharedTask::~SharedTask): (WTF::SharedTaskFunctor::SharedTaskFunctor): (WTF::createSharedTask): * wtf/WeakRandom.h: Copied from Source/JavaScriptCore/runtime/WeakRandom.h. (WTF::WeakRandom::WeakRandom): (WTF::WeakRandom::initializeSeed): (WTF::WeakRandom::seedUnsafe): (WTF::WeakRandom::getUint32): (WTF::WeakRandom::advance): (JSC::WeakRandom::WeakRandom): Deleted. (JSC::WeakRandom::seedUnsafe): Deleted. (JSC::WeakRandom::getUint32): Deleted. (JSC::WeakRandom::advance): Deleted. (JSC::WeakRandom::initializeSeed): Deleted. 2015-09-25 Alex Christensen Clean up CMake build on Mac https://bugs.webkit.org/show_bug.cgi?id=149573 Reviewed by Chris Dumez. * wtf/PlatformMac.cmake: 2015-09-25 Alex Christensen [Win] Switch to CMake https://bugs.webkit.org/show_bug.cgi?id=148111 Reviewed by Brent Fulgham. * WTF.vcxproj/WTF.proj: 2015-09-25 Joseph Pecoraro Simplify Stopwatch::elapsedTime https://bugs.webkit.org/show_bug.cgi?id=149538 Reviewed by Darin Adler. * wtf/Stopwatch.h: (WTF::Stopwatch::elapsedTime): Simplify by not starting/stopping but just computing without updating members. 2015-09-25 Brent Fulgham [Win] Unreviewed build fix. * wtf/FeatureDefines.h: Don't turn STREAMS_API on by default on Windows. 2015-09-24 Ryosuke Niwa Ran sort-Xcode-project-file. * WTF.xcodeproj/project.pbxproj: 2015-09-23 Andy Estes Disable QuickLook on watchOS https://bugs.webkit.org/show_bug.cgi?id=149508 Reviewed by Dan Bernstein. * wtf/Platform.h: 2015-09-22 Andy Estes Disable QuickLook on tvOS https://bugs.webkit.org/show_bug.cgi?id=149492 Reviewed by Dan Bernstein. * wtf/Platform.h: Stopped enabling QuickLook on tvOS. 2015-09-22 Filip Pizlo Get rid of ENABLE(PARALLEL_GC) https://bugs.webkit.org/show_bug.cgi?id=149436 Reviewed by Mark Lam. We always enable parallel GC everywhere but Windows, and it doesn't look like it was disabled there for any good reason. So, get rid of the flag. * wtf/MainThread.cpp: (WTF::canAccessThreadLocalDataForThread): (WTF::initializeGCThreads): (WTF::registerGCThread): (WTF::isMainThreadOrGCThread): * wtf/Platform.h: 2015-09-22 Filip Pizlo Get rid of ENABLE(GGC) https://bugs.webkit.org/show_bug.cgi?id=149472 Reviewed by Mark Hahnenberg and Mark Lam. * wtf/Platform.h: 2015-09-21 Filip Pizlo Always use the compiler's CAS implementation and get rid of ENABLE(COMPARE_AND_SWAP) https://bugs.webkit.org/show_bug.cgi?id=149438 Reviewed by Mark Lam. * wtf/Atomics.h: Make weakCompareAndSwap() just forward to the system CAS via WTF::Atomic. (WTF::weakCompareAndSwap): (WTF::weakCompareAndSwapUIntPtr): Deleted. (WTF::weakCompareAndSwapSize): Deleted. * wtf/Bitmap.h: Small changes to use the new API. (WTF::WordType>::concurrentTestAndSet): * wtf/Platform.h: Remove ENABLE(COMPARE_AND_SWAP) 2015-09-21 Csaba Osztrogonác Remove old GCC cruft from wtf/StdLibExtras.h https://bugs.webkit.org/show_bug.cgi?id=149401 Reviewed by Alex Christensen. * wtf/StdLibExtras.h: 2015-09-21 Andy Estes Disable Parental Controls on the Apple TV platform https://bugs.webkit.org/show_bug.cgi?id=149421 Reviewed by Darin Adler. * wtf/Platform.h: 2015-09-21 Filip Pizlo JSC should infer property types https://bugs.webkit.org/show_bug.cgi?id=148610 Reviewed by Geoffrey Garen. * wtf/HashTable.h: (WTF::HashTableAddResult::HashTableAddResult): Make it possible to say "HashMap::AddResult result" without assigning anything to it yet. * wtf/PrintStream.h: (WTF::printInternal): Beef up printing of some common WTF types, in particular RefPtr. 2015-09-20 Youenn Fablet Remove XHR_TIMEOUT compilation guard https://bugs.webkit.org/show_bug.cgi?id=149260 Reviewed by Benjamin Poulain. * wtf/FeatureDefines.h: 2015-09-17 Filip Pizlo Unreviewed, revert unintended change. * benchmarks/LockSpeedTest.cpp: (main): 2015-09-15 Ryosuke Niwa Add ShadowRoot interface and Element.prototype.attachShadow https://bugs.webkit.org/show_bug.cgi?id=149187 Reviewed by Antti Koivisto. * wtf/FeatureDefines.h: 2015-09-11 Keith Miller cryptographicallyRandomValuesFromOS should use CCRandomCopyBytes when available. https://bugs.webkit.org/show_bug.cgi?id=148439 Reviewed by Alexey Proskuryakov. Recently, we switched to using arc4random_buf on Darwin but further research indicates that arc4random_buf has the same behavior we had before and thus we were just pushing the problem further down the stack. CCRandomCopyBytes, however, appears to be more advanced and has much better error handling than we had before. * WTF.xcodeproj/project.pbxproj: * wtf/OSRandomSource.cpp: (WTF::cryptographicallyRandomValuesFromOS): * wtf/spi/darwin/CommonCryptoSPI.h: Added. 2015-09-08 Filip Pizlo There should be one stub hanging off an inline cache that contains code for all of the cases, rather than forming a linked list consisting of one stub per case https://bugs.webkit.org/show_bug.cgi?id=148717 Reviewed by Michael Saboff. Beef up dumping a bit. * wtf/PrintStream.h: (WTF::pointerDump): (WTF::printInternal): 2015-09-08 Mark Lam GC stack scan should include ABI red zone. https://bugs.webkit.org/show_bug.cgi?id=148976 Reviewed by Geoffrey Garen and Benjamin Poulain. * wtf/StackBounds.h: (WTF::StackBounds::origin): (WTF::StackBounds::end): (WTF::StackBounds::size): 2015-09-04 Csaba Osztrogonác Enable reference qualified functions for GCC https://bugs.webkit.org/show_bug.cgi?id=148526 Reviewed by Darin Adler. * wtf/Compiler.h: 2015-09-04 Csaba Osztrogonác webkit-unassigned@lists.webkit.org https://bugs.webkit.org/show_bug.cgi?id=148525 Reviewed by Darin Adler. * wtf/Compiler.h: 2015-08-29 Zan Dobersek [WTF] Improve a ParkingLot::parkConditionally() comment for a libstdc++ workaround https://bugs.webkit.org/show_bug.cgi?id=148571 Reviewed by Filip Pizlo. * wtf/ParkingLot.cpp: (WTF::ParkingLot::parkConditionally): Adjust the comment about the workaround for the libstdc++ std::condition_variable implementation, linking to the WebKit bug that dissected the problem and the GCC bug that originally reported the problem. 2015-08-28 Anders Carlsson Remove the #if PLATFORM(MAC) in DeprecatedSymbolsUsedBySafari.mm so we'll actually build it on iOS. Reviewed by Dan Bernstein. * wtf/mac/DeprecatedSymbolsUsedBySafari.mm: 2015-08-27 Anders Carlsson Define legacy main thread calling functions for iOS as well https://bugs.webkit.org/show_bug.cgi?id=148530 Reviewed by Tim Horton. * wtf/mac/DeprecatedSymbolsUsedBySafari.mm: 2015-08-26 Anders Carlsson Fix build. * wtf/WorkQueue.cpp: 2015-08-26 Anders Carlsson Add and implement WorkQueue::concurrentApply https://bugs.webkit.org/show_bug.cgi?id=148488 Reviewed by Geoffrey Garen. WorkQueue::concurrentApply is modeled after dispatch_apply, and on Cocoa it uses dispatch_apply directly. For other ports there's a generic concurrentApply implemented using our threading primitives. * wtf/NeverDestroyed.h: (WTF::LazyNeverDestroyed::operator->): * wtf/WorkQueue.cpp: (WTF::WorkQueue::concurrentApply): * wtf/WorkQueue.h: * wtf/cocoa/WorkQueueCocoa.cpp: (WTF::WorkQueue::concurrentApply): 2015-08-25 Filip Pizlo Node::origin should be able to tell you if it's OK to exit https://bugs.webkit.org/show_bug.cgi?id=145204 Reviewed by Geoffrey Garen. * wtf/Insertion.h: (WTF::executeInsertions): Add a useful assertion. This come into play because JSC will use UINT_MAX as "invalid index", and that ought to trigger this assertion. 2015-08-25 Csaba Osztrogonác Require GCC version at least 4.9 https://bugs.webkit.org/show_bug.cgi?id=148430 Reviewed by Darin Adler. * wtf/Compiler.h: 2015-08-22 Anders Carlsson std::once_flag needs to be static. * wtf/mac/DeprecatedSymbolsUsedBySafari.mm: (WTF::MainThreadFunctionTracker::singleton): 2015-08-21 Anders Carlsson Build fix. * wtf/MainThread.h: 2015-08-21 Anders Carlsson Address review feedback from Darin. * wtf/MainThread.h: * wtf/mac/DeprecatedSymbolsUsedBySafari.mm: (WTF::callOnMainThread): (WTF::cancelCallOnMainThread): 2015-08-21 Anders Carlsson Deprecate the old school callOnMainThread/cancelCallOnMainThread functions https://bugs.webkit.org/show_bug.cgi?id=148327 Reviewed by Sam Weinig. * wtf/MainThread.cpp: (WTF::functionQueue): (WTF::dispatchFunctionsFromMainThread): (WTF::callOnMainThread): Change the function queue to be a queue of std::function and get rid of dead code. * wtf/MainThread.h: Conditionalize callOnMainThread and cancelCallOnMainThread because Safari on Mavericks still expects to them to be declared in MainThread.h under 10.9. * wtf/mac/DeprecatedSymbolsUsedBySafari.mm: Add a MainThreadFunctionTracker singleton that keeps track of scheduled functions so we can ensure that they're not called if they're cancelled. (WTF::MainThreadFunctionTracker::singleton): Return the singleton. (WTF::MainThreadFunctionTracker::callOnMainThread): Add the function/context pair to our map and schedule the function to be run on the main thread. If the function has been removed, don't call it. (WTF::MainThreadFunctionTracker::cancelCallOnMainThread): Remove all entries with the given function/context pair. (WTF::MainThreadFunctionTracker::addFunction): Add the function/context pair to the map and return the unique identifier. (WTF::MainThreadFunctionTracker::removeIdentifier): Look up the identifier and remove it if it still exists. If it exists we know that it hasn't been canceled and that we can call it. (WTF::MainThreadFunctionTracker::removeFunctions): Remove all function identifiers matched by the function/context pair. (WTF::callOnMainThread): Implement using MainThreadFunctionTracker. (WTF::cancelCallOnMainThread): Implement using MainThreadFunctionTracker. 2015-08-21 Anders Carlsson Get rid of uses of the old callOnMainThread function that takes a function ptr + context https://bugs.webkit.org/show_bug.cgi?id=148324 Reviewed by Tim Horton. * wtf/text/cf/StringImplCF.cpp: (WTF::StringWrapperCFAllocator::deallocate): (WTF::StringWrapperCFAllocator::deallocateOnMainThread): Deleted. 2015-08-20 Commit Queue Unreviewed, rolling out r188717 and r188719. https://bugs.webkit.org/show_bug.cgi?id=148272 Broke the Mavericks build (Requested by andersca on #webkit). Reverted changesets: "Merge Lock and LockBase" https://bugs.webkit.org/show_bug.cgi?id=148266 http://trac.webkit.org/changeset/188717 "Merge ConditionBase and Condition" https://bugs.webkit.org/show_bug.cgi?id=148270 http://trac.webkit.org/changeset/188719 2015-08-20 Anders Carlsson Merge ConditionBase and Condition https://bugs.webkit.org/show_bug.cgi?id=148270 Reviewed by Filip Pizlo. * wtf/Condition.h: Direct initialize m_hasWaiters so Condition gets a constexpr constructor. * wtf/Lock.h: Remove a now outdated comment. 2015-08-20 Anders Carlsson Merge Lock and LockBase https://bugs.webkit.org/show_bug.cgi?id=148266 Reviewed by Filip Pizlo. * wtf/Atomics.h: (WTF::Atomic::Atomic): Add a default constructor as well as a constexpr constructor that takes a value. * wtf/Lock.cpp: (WTF::Lock::lockSlow): (WTF::Lock::unlockSlow): Rename LockBase to Lock. * wtf/Lock.h: Rename LockBase to Lock and direct-initialize Atomic to 0. Since the Atomic constructor is constexpr, Lock also gets a constexpr constructor. Change the LockBase -> StaticLock typedef and add a fixme. * wtf/WordLock.h: Direct initialize m_word to 0. 2015-08-19 Filip Pizlo Remove WTF::SpinLock https://bugs.webkit.org/show_bug.cgi?id=148208 Reviewed by Geoffrey Garen. Remove the SpinLock.h file and remove references to the SpinLock class. Put the old SpinLock algorithm in LockSpeedTest.cpp - which isn't compiled as part of a WTF or WebKit build - just so we can still benchmark our locking algorithms against a spinlock baseline. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * benchmarks/LockSpeedTest.cpp: * wtf/CMakeLists.txt: * wtf/Lock.h: * wtf/SpinLock.h: Removed. * wtf/WordLock.h: 2015-08-19 Alex Christensen CMake Windows build should not include files directly from other Source directories https://bugs.webkit.org/show_bug.cgi?id=148198 Reviewed by Brent Fulgham. * wtf/CMakeLists.txt: * wtf/PlatformWin.cmake: 2015-08-18 Filip Pizlo Replace all uses of std::mutex/std::condition_variable with WTF::Lock/WTF::Condition https://bugs.webkit.org/show_bug.cgi?id=148140 Reviewed by Geoffrey Garen. Also beef up Condition by giving it a StaticCondition variant. * wtf/Condition.h: (WTF::ConditionBase::notifyAll): (WTF::ConditionBase::waitForSecondsImpl): (WTF::ConditionBase::absoluteFromRelative): (WTF::Condition::Condition): (WTF::Condition::notifyAll): Deleted. (WTF::Condition::waitForSecondsImpl): Deleted. (WTF::Condition::absoluteFromRelative): Deleted. * wtf/CryptographicallyRandomNumber.cpp: * wtf/HashTable.cpp: (WTF::HashTableStats::recordCollisionAtCount): (WTF::HashTableStats::dumpStats): (WTF::hashTableStatsMutex): Deleted. * wtf/HashTable.h: (WTF::KeyTraits>::HashTable): (WTF::KeyTraits>::invalidateIterators): (WTF::addIterator): (WTF::removeIterator): * wtf/Lock.h: * wtf/MainThread.cpp: (WTF::functionQueue): (WTF::dispatchFunctionsFromMainThread): (WTF::callOnMainThread): (WTF::cancelCallOnMainThread): (WTF::mainThreadFunctionQueueMutex): Deleted. * wtf/StackStats.cpp: (WTF::StackStats::PerThreadStats::PerThreadStats): (WTF::StackStats::CheckPoint::CheckPoint): (WTF::StackStats::CheckPoint::~CheckPoint): (WTF::StackStats::probe): (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint): (WTF::StackStats::LayoutCheckPoint::~LayoutCheckPoint): (WTF::StackStats::initialize): Deleted. * wtf/StackStats.h: (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint): (WTF::StackStats::probe): (WTF::StackStats::initialize): Deleted. * wtf/ThreadingPthreads.cpp: (WTF::initializeThreading): * wtf/mac/DeprecatedSymbolsUsedBySafari.mm: (WTF::callOnMainThread): (WTF::lockAtomicallyInitializedStaticMutex): (WTF::unlockAtomicallyInitializedStaticMutex): (WTF::atomicallyInitializedStaticMutex): Deleted. * wtf/text/StringView.cpp: (WTF::StringView::UnderlyingString::UnderlyingString): (WTF::underlyingStrings): (WTF::StringView::invalidate): (WTF::StringView::adoptUnderlyingString): (WTF::StringView::setUnderlyingString): (WTF::underlyingStringsMutex): Deleted. * wtf/unicode/icu/CollatorICU.cpp: (WTF::Collator::Collator): (WTF::Collator::~Collator): (WTF::cachedCollatorMutex): Deleted. 2015-08-18 Zan Dobersek [GLib] GMainLoopSource should receive the std::function<> objects through rvalue references https://bugs.webkit.org/show_bug.cgi?id=147981 Reviewed by Carlos Garcia Campos. Scheduling methods on GMainLoopSource and GThreadSafeMainLoopSource should have the std::function<> objects passed through rvalue references, and should move the passed-in objects forward when required. * wtf/glib/GMainLoopSource.cpp: (WTF::GMainLoopSource::schedule): (WTF::GMainLoopSource::scheduleAfterDelay): (WTF::GMainLoopSource::scheduleAndDeleteOnDestroy): (WTF::GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy): * wtf/glib/GMainLoopSource.h: * wtf/glib/GThreadSafeMainLoopSource.cpp: (WTF::GThreadSafeMainLoopSource::schedule): (WTF::GThreadSafeMainLoopSource::scheduleAfterDelay): * wtf/glib/GThreadSafeMainLoopSource.h: 2015-08-18 Eric Carlson Remove "platform text track menu" https://bugs.webkit.org/show_bug.cgi?id=148139 Reviewed by Jer Noble. * wtf/Platform.h: Remove PLATFORM_TEXT_TRACK_MENU. 2015-08-18 Filip Pizlo WTF::Condition should have a fast path for notifyOne/notifyAll that avoids calling unparkOne/unparkAll https://bugs.webkit.org/show_bug.cgi?id=148090 Reviewed by Geoffrey Garen. This change makes notifyOne()/notifyAll() blazing fast when nobody is waiting, by using the various hooks that ParkingLot gives us to maintain a m_hasWaiters variable. When it's false, it means that any unpark operation would simply return immediately. This is a 45% speed-up for the 1-producer/1-consumer scenario with a 100-element queue when you use the notifyOne()-per-enqueue style. What's cool about this change is that you can now safely call notifyOne() (or notifyAll()) out of paranoia, just in case someone might be waiting. It's free to do so if nobody is waiting! * wtf/Condition.h: (WTF::Condition::Condition): (WTF::Condition::waitUntil): (WTF::Condition::notifyOne): (WTF::Condition::notifyAll): 2015-08-17 Filip Pizlo Replace all remaining uses of WTF::Mutex with WTF::Lock https://bugs.webkit.org/show_bug.cgi?id=148089 Reviewed by Geoffrey Garen. This also beefs up and rationalizes the Condition API, so that it can deal with units of time other than just steady_clock. This makes it easier to port ThreadCondition and std::condition_variable code over to Condition. This patch does not take a position on what kind of time is best; from reading a lot of the uses in WebCore, it seems like our use of double to measure seconds is often nicer than the many different classes in std::chrono. Also added a Condition speed test, to make sure that all of this is a good idea. And indeed it is. The 1-producer/1-consumer scenario with a 100-element queue runs 36x faster using Lock/Condition than Mutex/ThreadCondition when you use the notifyOne()-per-enqueue style. It runs 58x faster with Lock/Condition when you use the notifyAll()-at-boundary style. Note that I have a bug open for making the notifyOne()-per-enqueue style even faster: https://bugs.webkit.org/show_bug.cgi?id=148090. Also, the 10-consumer/10-producer scenario with a 100-element queue runs 20x faster with Lock/Condition for notifyOne()-per-enqueue and 30x faster with notifyAll()-at-boundary. The only way to tweak the test to get Mutex/ThreadCondition to win is to have one producer, one consumer, a 1-element queue, and use the notifyOne()-per-enqueue style. In that case, one of the two threads is going to be waiting most of the time and the test basically measures wake-up latency and nothing else. Because Condition::wait() does a little bit more work than ThreadCondition::wait(), Mutex/ThreadCondition end up running 3% faster in this test case. But if you vary any of the parameters of the test, Mutex/ThreadCondition ends up losing - all it takes is more threads or a queue size of 5 or more. To my knowledge, we never do producer/consumer with a queue bounded to one element precisely because that approach is the least efficient regardless of locking algorithm. For example, neither WTF::MessageQueue nor DFG::Worklist have any bounds on their queue size. So, it seems that replacing all uses of system mutexes and condition variables with our own thing is a great idea. * benchmarks/LockSpeedTest.cpp: * benchmarks/ConditionSpeedTest.cpp: Added. * wtf/Condition.h: (WTF::Condition::Condition): (WTF::Condition::waitUntil): (WTF::Condition::waitFor): (WTF::Condition::wait): (WTF::Condition::waitUntilWallClockSeconds): (WTF::Condition::waitUntilMonotonicClockSeconds): (WTF::Condition::notifyOne): (WTF::Condition::notifyAll): (WTF::Condition::waitForSecondsImpl): (WTF::Condition::waitForImpl): (WTF::Condition::absoluteFromRelative): * wtf/MessageQueue.h: (WTF::MessageQueue::infiniteTime): (WTF::MessageQueue::append): (WTF::MessageQueue::appendAndKill): (WTF::MessageQueue::appendAndCheckEmpty): (WTF::MessageQueue::prepend): (WTF::MessageQueue::removeIf): (WTF::MessageQueue::isEmpty): (WTF::MessageQueue::kill): (WTF::MessageQueue::killed): * wtf/ParallelJobsGeneric.cpp: (WTF::ParallelEnvironment::ThreadPrivate::execute): (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish): (WTF::ParallelEnvironment::ThreadPrivate::workerThread): * wtf/ParallelJobsGeneric.h: * wtf/ParkingLot.cpp: (WTF::ParkingLot::parkConditionally): * wtf/ParkingLot.h: (WTF::ParkingLot::compareAndPark): * wtf/ThreadingPthreads.cpp: (WTF::initializeThreading): * wtf/ThreadingWin.cpp: (WTF::initializeThreading): * wtf/dtoa.cpp: (WTF::pow5mult): * wtf/dtoa.h: 2015-08-17 Alex Christensen Build Debug Suffix on Windows with CMake https://bugs.webkit.org/show_bug.cgi?id=148083 Reviewed by Brent Fulgham. * wtf/PlatformWin.cmake: Add DEBUG_SUFFIX 2015-08-17 Myles C. Maxfield Implement IntegerHasher https://bugs.webkit.org/show_bug.cgi?id=147866 Reviewed by Darin Adler and Anders Carlsson. Rename StringHasher.h to Hasher.h, and include an IntegerHasher class. * WTF.vcxproj/WTF.vcxproj: Update to target new file. * WTF.vcxproj/WTF.vcxproj.filters: Ditto. * WTF.xcodeproj/project.pbxproj: Ditto. * wtf/CMakeLists.txt: Ditto. * wtf/Hasher.h: Renamed from Source/WTF/wtf/StringHasher.h. * wtf/text/CString.cpp: Use new #include * wtf/text/StringHash.h: Ditto. * wtf/text/StringImpl.h: Ditto. * wtf/unicode/UTF8.cpp: Ditto. 2015-08-17 Alex Christensen Move some commands from ./CMakeLists.txt to Source/cmake https://bugs.webkit.org/show_bug.cgi?id=148003 Reviewed by Brent Fulgham. * CMakeLists.txt: Added commands needed to build WTF by itself. 2015-08-14 Filip Pizlo Use WTF::Lock and WTF::Condition instead of WTF::Mutex, WTF::ThreadCondition, std::mutex, and std::condition_variable https://bugs.webkit.org/show_bug.cgi?id=147999 Reviewed by Geoffrey Garen. Relanding after fixing a deadlock on Linux. * wtf/Condition.h: "using WTF::Condition". * wtf/Lock.h: (WTF::LockBase::lock): (WTF::LockBase::tryLock): Add tryLock() because it turns out that we use it sometimes. (WTF::LockBase::try_lock): unique_lock needs this. (WTF::LockBase::unlock): * wtf/ParkingLot.cpp: (WTF::ParkingLot::parkConditionally): Work around a Linux C++ bug where wait_until with time_point::max() immediately returns and doesn't flash the lock. 2015-08-14 Keith Miller cryptographicallyRandomValuesFromOS should use arc4random_buf on Darwin. https://bugs.webkit.org/show_bug.cgi?id=148038 Reviewed by Geoffrey Garen. Currently, we open a file descriptor to /dev/urandom, which can sometimes fail to open. Using arc4random_buf instead should get around this issue. * wtf/OSRandomSource.cpp: (WTF::cryptographicallyRandomValuesFromOS): 2015-08-14 Commit Queue Unreviewed, rolling out r188444. https://bugs.webkit.org/show_bug.cgi?id=148029 Broke GTK and EFL (see bug #148027) (Requested by philn on #webkit). Reverted changeset: "Use WTF::Lock and WTF::Condition instead of WTF::Mutex, WTF::ThreadCondition, std::mutex, and std::condition_variable" https://bugs.webkit.org/show_bug.cgi?id=147999 http://trac.webkit.org/changeset/188444 2015-08-13 Filip Pizlo Use WTF::Lock and WTF::Condition instead of WTF::Mutex, WTF::ThreadCondition, std::mutex, and std::condition_variable https://bugs.webkit.org/show_bug.cgi?id=147999 Reviewed by Geoffrey Garen. * wtf/Condition.h: "using WTF::Condition". * wtf/Lock.h: (WTF::LockBase::lock): (WTF::LockBase::tryLock): Add tryLock() because it turns out that we use it sometimes. (WTF::LockBase::try_lock): unique_lock needs this. (WTF::LockBase::unlock): 2015-08-13 Commit Queue Unreviewed, rolling out r188428. https://bugs.webkit.org/show_bug.cgi?id=148015 broke cmake build (Requested by alexchristensen on #webkit). Reverted changeset: "Move some commands from ./CMakeLists.txt to Source/cmake" https://bugs.webkit.org/show_bug.cgi?id=148003 http://trac.webkit.org/changeset/188428 2015-08-13 Alex Christensen Move some commands from ./CMakeLists.txt to Source/cmake https://bugs.webkit.org/show_bug.cgi?id=148003 Reviewed by Brent Fulgham. * CMakeLists.txt: Added commands needed to build WTF by itself. 2015-08-13 Mark Lam WorkQueue::dispatchAfter() on Windows fires early. https://bugs.webkit.org/show_bug.cgi?id=147992 Reviewed by Brent Fulgham. The Windows implementation of WorkQueue::dispatchAfter() uses CreateTimerQueueTimer(). Unfortunately, CreateTimerQueueTimer() is sloppy and can fire early. We need to compensate for this slop to ensure that the specified duration does expire before the callback function is called. Otherwise, the JSC watchdog (which depends on this) can fail randomly. * wtf/win/WorkQueueWin.cpp: (WTF::WorkQueue::dispatchAfter): 2015-08-13 Filip Pizlo WTF should have a compact Condition object to use with Lock https://bugs.webkit.org/show_bug.cgi?id=147986 Reviewed by Geoffrey Garen. Adds a condition variable implementation based on ParkingLot, called simply WTF::Condition. It can be used with WTF::Lock or actually any lock implementation. It should even work with WTF::SpinLock, WTF::Mutex, or std::mutex. Best of all, Condition only requires one byte. ParkingLot almost contained all of the functionality needed to implemenet wait/notify. We could have implemented Condition using a 32-bit (or even 64-bit) version that protects against a notify that happens just before we park. But, this changes the ParkingLot API to give us the ability to run some code between when ParkingLot enqueues the current thread and when it actually sleeps. This callback is called with no locks held, so it can call unlock() on any kind of lock, so long as that lock's unlock() method doesn't recurse into ParkingLot::parkConditionally(). That seems unlikely; unlock() is more likely to call ParkingLot::unparkOne() or unparkAll(). WTF::Lock will never call parkConditionally() inside unlock(), so WTF::Lock is definitely appropriate for use with Condition. Condition supports most of the API that std::condition_variable supports. It does some things to try to reduce footgun potential. The preferred timeout form is waitUntil() which takes an absolute time from the steady_clock. The only relative timeout form also takes a predicate callback, so it's impossible to write the subtly incorrect "while (...) wait_for(...)" idiom. This patch doesn't actually introduce any uses of WTF::Condition other than the unit tests. I'll start switching code over to using WTF::Condition in another patch. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Condition.h: Added. (WTF::Condition::Condition): (WTF::Condition::waitUntil): (WTF::Condition::waitFor): (WTF::Condition::wait): (WTF::Condition::notifyOne): (WTF::Condition::notifyAll): * wtf/Lock.cpp: (WTF::LockBase::unlockSlow): Make this useful assertion be a release assertion. It catches cases where you unlock the lock even though you don't hold it. * wtf/ParkingLot.cpp: (WTF::ParkingLot::parkConditionally): Add the beforeSleep() callback. (WTF::ParkingLot::unparkOne): * wtf/ParkingLot.h: (WTF::ParkingLot::compareAndPark): 2015-08-12 Anders Carlsson Use WTF::Optional in WindowFeatures https://bugs.webkit.org/show_bug.cgi?id=147956 Reviewed by Sam Weinig. Add new operators to WTF::Optional to make it more like std::optional. * wtf/Optional.h: (WTF::Optional::operator->): (WTF::Optional::operator*): 2015-08-12 Filip Pizlo WTF::Lock should not suffer from the thundering herd https://bugs.webkit.org/show_bug.cgi?id=147947 Reviewed by Geoffrey Garen. This changes Lock::unlockSlow() to use unparkOne() instead of unparkAll(). The problem with doing this is that it's not obvious after calling unparkOne() if there are any other threads that are still parked on the lock's queue. If we assume that there are and leave the hasParkedBit set, then future calls to unlock() will take the slow path. We don't want that if there aren't actually any threads parked. On the other hand, if we assume that there aren't any threads parked and clear the hasParkedBit, then if there actually were some threads parked, then they may never be awoken since future calls to unlock() won't take slow path and so won't call unparkOne(). In other words, we need a way to be very precise about when we clear the hasParkedBit and we need to do it in a race-free way: it can't be the case that we clear the bit just as some thread gets parked on the queue. A similar problem arises in futexes, and one of the solutions is to have a thread that acquires a lock after parking sets the hasParkedBit. This is what Rusty Russel's usersem does. It's a subtle algorithm. Also, it means that if a thread barges in before the unparked thread runs, then that barging thread will not know that there are threads parked. This could increase the severity of barging. Since ParkingLot is a user-level API, we don't have to worry about the kernel-user security issues and so we can expose callbacks while ParkingLot is holding its internal locks. This change does exactly that for unparkOne(). The new variant of unparkOne() will call a user function while the queue from which we are unparking is locked. The callback is told basic stats about the queue: did we unpark a thread this time, and could there be more threads to unpark in the future. The callback runs while it's impossible for the queue state to change, since the ParkingLot's internal locks for the queue is held. This means that Lock::unlockSlow() can either clear, or leave, the hasParkedBit while releasing the lock inside the callback from unparkOne(). This takes care of the thundering herd problem while also reducing the greed that arises from barging threads. This required some careful reworking of the ParkingLot algorithm. The first thing I noticed was that the ThreadData::shouldPark flag was useless, since it's set exactly when ThreadData::address is non-null. Then I had to make sure that dequeue() could lazily create both hashtables and buckets, since the "callback is called while queue is locked" invariant requires that we didn't exit early due to the hashtable or bucket not being present. Note that all of this is done in such a way that the old unparkOne() and unparkAll() don't have to create any buckets, though they now may create the hashtable. We don't care as much about the hashtable being created by unpark since it's just such an unlikely scenario and it would only happen once. This change reduces the kernel CPU usage of WTF::Lock for the long critical section test by about 8x and makes it always perform as well as WTF::WordLock and WTF::Mutex for that benchmark. * benchmarks/LockSpeedTest.cpp: * wtf/Lock.cpp: (WTF::LockBase::unlockSlow): * wtf/Lock.h: (WTF::LockBase::isLocked): (WTF::LockBase::isFullyReset): * wtf/ParkingLot.cpp: (WTF::ParkingLot::parkConditionally): (WTF::ParkingLot::unparkOne): (WTF::ParkingLot::unparkAll): * wtf/ParkingLot.h: * wtf/WordLock.h: (WTF::WordLock::isLocked): (WTF::WordLock::isFullyReset): 2015-08-11 Filip Pizlo Always use a byte-sized lock implementation https://bugs.webkit.org/show_bug.cgi?id=147908 Reviewed by Geoffrey Garen. At the start of my locking algorithm crusade, I implemented Lock, which is a sizeof(void*) lock implementation with some nice theoretical properties and good performance. Then I added the ParkingLot abstraction and ByteLock. ParkingLot uses Lock in its implementation. ByteLock uses ParkingLot to create a sizeof(char) lock implementation that performs like Lock. It turns out that ByteLock is always at least as good as Lock, and sometimes a lot better: it requires 8x less memory on 64-bit systems. It's hard to construct a benchmark where ByteLock is significantly slower than Lock, and when you do construct such a benchmark, tweaking it a bit can also create a scenario where ByteLock is significantly faster than Lock. So, the thing that we call "Lock" should really use ByteLock's algorithm, since it is more compact and just as fast. That's what this patch does. But we still need to keep the old Lock algorithm, because it's used to implement ParkingLot, which in turn is used to implement ByteLock. So this patch does this transformation: - Move the algorithm in Lock into files called WordLock.h|cpp. Make ParkingLot use WordLock. - Move the algorithm in ByteLock into Lock.h|cpp. Make everyone who used ByteLock use Lock instead. All other users of Lock now get the byte-sized lock implementation. - Remove the old ByteLock files. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * benchmarks/LockSpeedTest.cpp: (main): * wtf/WordLock.cpp: Added. (WTF::WordLock::lockSlow): (WTF::WordLock::unlockSlow): * wtf/WordLock.h: Added. (WTF::WordLock::WordLock): (WTF::WordLock::lock): (WTF::WordLock::unlock): (WTF::WordLock::isHeld): (WTF::WordLock::isLocked): * wtf/ByteLock.cpp: Removed. * wtf/ByteLock.h: Removed. * wtf/CMakeLists.txt: * wtf/Lock.cpp: (WTF::LockBase::lockSlow): (WTF::LockBase::unlockSlow): * wtf/Lock.h: (WTF::LockBase::lock): (WTF::LockBase::unlock): (WTF::LockBase::isHeld): (WTF::LockBase::isLocked): (WTF::Lock::Lock): * wtf/ParkingLot.cpp: 2015-08-11 Filip Pizlo Remove ByteSpinLock https://bugs.webkit.org/show_bug.cgi?id=147900 Rubber stamped by Mark Lam. * WTF.xcodeproj/project.pbxproj: * wtf/ByteSpinLock.h: Removed. 2015-08-11 Brent Fulgham [Win] Switch Windows build to Visual Studio 2015 https://bugs.webkit.org/show_bug.cgi?id=147887 Reviewed by Alex Christensen. Update Visual Studio project file settings to use the current Visual Studio and compiler. Continue targeting binaries to run on our minimum supported configuration of Windows 7. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTFGenerated.vcxproj: 2015-08-10 Filip Pizlo WTF should have a ParkingLot for parking sleeping threads, so that locks can fit in 1.6 bits https://bugs.webkit.org/show_bug.cgi?id=147665 Reviewed by Mark Lam. This change adds a major new abstraction for concurrency algorithms in WebKit. It's called a ParkingLot, and it makes available a thread parking queue for each virtual address in memory. The queues are maintained by a data-access-parallel concurrent hashtable implementation. The memory usage is bounded at around half a KB per thread. The ParkingLot makes it easy to turn any spinlock-based concurrency protocol into one that parks threads after a while. Because queue state management is up to the ParkingLot and not the user's data structure, this patch uses it to implement a full adaptive mutex in one byte. In fact, only three states of that byte are used (0 = available, 1 = locked, 2 = locked and there are parked threads). Hence the joke that ParkingLot allows locks that fit in 1.6 bits. ByteLock is used as a replacement for ByteSpinLock in JavaScriptCore. The API tests for this also demo how to create a completely fair (FIFO) binary semamphore. The comment in Lock.h shows how we could accelerate Lock performance using ParkingLot. After we are sure that this code works, we can expand the use of ParkingLot. That's covered by https://bugs.webkit.org/show_bug.cgi?id=147841. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * benchmarks/LockSpeedTest.cpp: (main): * wtf/Atomics.h: (WTF::Atomic::compareExchangeWeak): (WTF::Atomic::compareExchangeStrong): * wtf/ByteLock.cpp: Added. (WTF::ByteLock::lockSlow): (WTF::ByteLock::unlockSlow): * wtf/ByteLock.h: Added. (WTF::ByteLock::ByteLock): (WTF::ByteLock::lock): (WTF::ByteLock::unlock): (WTF::ByteLock::isHeld): (WTF::ByteLock::isLocked): * wtf/CMakeLists.txt: * wtf/Lock.h: * wtf/ParkingLot.cpp: Added. (WTF::ParkingLot::parkConditionally): (WTF::ParkingLot::unparkOne): (WTF::ParkingLot::unparkAll): (WTF::ParkingLot::forEach): * wtf/ParkingLot.h: Added. (WTF::ParkingLot::compareAndPark): 2015-08-11 Brent Fulgham [Win] Unreviewed gardening. * WTF.vcxproj/WTF.vcxproj.filters: Place file references so that files appear in correct folders in IDE. 2015-08-10 Youenn Fablet Compile warning (-Wsign-compare) on 32-bits at WebCore/platform/FileSystem.cpp https://bugs.webkit.org/show_bug.cgi?id=146414 Reviewed by Darin Adler. Added convertSafely routine based on isInBounds routine. Updated BoundChecker by adding a third boolean parameter to this template giving whether Target has greater or equal precision than Source. Removed BoundCheckElider, which is no longer necessary and had some issues. * wtf/CheckedArithmetic.h: (WTF::isInBounds): (WTF::convertSafely): 2015-08-07 Filip Pizlo Lightweight locks should be adaptive https://bugs.webkit.org/show_bug.cgi?id=147545 Reviewed by Geoffrey Garen. A common idiom in WebKit is to use spinlocks. We use them because the lock acquisition overhead is lower than system locks and because they take dramatically less space than system locks. The speed and space advantages of spinlocks can be astonishing: an uncontended spinlock acquire is up to 10x faster and under microcontention - short critical section with two or more threads taking turns - spinlocks are up to 100x faster. Spinlocks take only 1 byte or 4 bytes depending on the flavor, while system locks take 64 bytes or more. Clearly, WebKit should continue to avoid system locks - they are just far too slow and far too big. But there is a problem with this idiom. System lock implementations will sleep a thread when it attempts to acquire a lock that is held, while spinlocks will cause the thread to burn CPU. In WebKit spinlocks, the thread will repeatedly call sched_yield(). This is awesome for microcontention, but awful when the lock will not be released for a while. In fact, when critical sections take tens of microseconds or more, the CPU time cost of our spinlocks is almost 100x more than the CPU time cost of a system lock. This case doesn't arise too frequently in our current uses of spinlocks, but that's probably because right now there are places where we make a conscious decision to use system locks - even though they use more memory and are slower - because we don't want to waste CPU cycles when a thread has to wait a while to acquire the lock. The solution is to just implement a modern adaptive mutex in WTF. Luckily, this isn't a new concept. This patch implements a mutex that is reminiscent of the kinds of low-overhead locks that JVMs use. The actual implementation here is inspired by some of the ideas from [1]. The idea is simple: the fast path is an inlined CAS to immediately acquire a lock that isn't held, the slow path tries some number of spins to acquire the lock, and if that fails, the thread is put on a queue and put to sleep. The queue is made up of statically allocated thread nodes and the lock itself is a tagged pointer: either it is just bits telling us the complete lock state (not held or held) or it is a pointer to the head of a queue of threads waiting to acquire the lock. This approach gives WTF::Lock three different levels of adaptation: an inlined fast path if the lock is not contended, a short burst of spinning for microcontention, and a full-blown queue for critical sections that are held for a long time. On a locking microbenchmark, this new Lock exhibits the following performance characteristics: - Lock+unlock on an uncontended no-op critical section: 2x slower than SpinLock and 3x faster than a system mutex. - Lock+unlock on a contended no-op critical section: 2x slower than SpinLock and 100x faster than a system mutex. - CPU time spent in lock() on a lock held for a while: same as system mutex, 90x less than a SpinLock. - Memory usage: sizeof(void*), so on 64-bit it's 8x less than a system mutex but 2x worse than a SpinLock. This patch replaces all uses of SpinLock with Lock, since our critical sections are not no-ops so if you do basically anything in your critical section, the Lock overhead will be invisible. Also, in all places where we used SpinLock, we could tolerate 8 bytes of overhead instead of 4. Performance benchmarking using JSC macrobenchmarks shows no difference, which is as it should be: the purpose of this change is to reduce CPU time wasted, not wallclock time. This patch doesn't replace any uses of ByteSpinLock, since we expect that the space benefits of having a lock that just uses a byte are still better than the CPU wastage benefits of Lock. But, this work will enable some future work to create locks that will fit in just 1.6 bits: https://bugs.webkit.org/show_bug.cgi?id=147665. Rolling this back in after fixing Lock::unlockSlow() for architectures that have a truly weak CAS. Since the Lock::unlock() fast path can go to slow path spuriously, it may go there even if there aren't any threads on the Lock's queue. So, unlockSlow() must be able to deal with the possibility of a null queue head. [1] http://www.filpizlo.com/papers/pizlo-pppj2011-fable.pdf * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * benchmarks: Added. * benchmarks/LockSpeedTest.cpp: Added. (main): * wtf/Atomics.h: (WTF::Atomic::compareExchangeWeak): (WTF::Atomic::compareExchangeStrong): * wtf/CMakeLists.txt: * wtf/Lock.cpp: Added. (WTF::LockBase::lockSlow): (WTF::LockBase::unlockSlow): * wtf/Lock.h: Added. (WTF::LockBase::lock): (WTF::LockBase::unlock): (WTF::LockBase::isHeld): (WTF::LockBase::isLocked): (WTF::Lock::Lock): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::release): (WTF::MetaAllocatorHandle::shrink): (WTF::MetaAllocator::allocate): (WTF::MetaAllocator::currentStatistics): (WTF::MetaAllocator::addFreshFreeSpace): (WTF::MetaAllocator::debugFreeSpaceSize): * wtf/MetaAllocator.h: * wtf/SpinLock.h: * wtf/ThreadingPthreads.cpp: * wtf/ThreadingWin.cpp: * wtf/text/AtomicString.cpp: * wtf/text/AtomicStringImpl.cpp: (WTF::AtomicStringTableLocker::AtomicStringTableLocker): 2015-08-05 Filip Pizlo Unreviewed, roll out http://trac.webkit.org/changeset/187972. * wtf/Atomics.cpp: (WTF::getSwapLock): (WTF::atomicStep): * wtf/MessageQueue.h: (WTF::MessageQueue::infiniteTime): (WTF::MessageQueue::append): (WTF::MessageQueue::appendAndKill): (WTF::MessageQueue::appendAndCheckEmpty): (WTF::MessageQueue::prepend): (WTF::MessageQueue::removeIf): (WTF::MessageQueue::isEmpty): (WTF::MessageQueue::kill): (WTF::MessageQueue::killed): * wtf/ParallelJobsGeneric.cpp: (WTF::ParallelEnvironment::ThreadPrivate::execute): (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish): (WTF::ParallelEnvironment::ThreadPrivate::workerThread): * wtf/ParallelJobsGeneric.h: * wtf/RunLoop.cpp: (WTF::RunLoop::performWork): (WTF::RunLoop::dispatch): * wtf/RunLoop.h: * wtf/ThreadSpecificWin.cpp: (WTF::destructorsList): (WTF::destructorsMutex): (WTF::threadSpecificKeyCreate): (WTF::threadSpecificKeyDelete): (WTF::ThreadSpecificThreadExit): * wtf/Threading.cpp: (WTF::threadEntryPoint): (WTF::createThread): * wtf/ThreadingPrimitives.h: * wtf/ThreadingPthreads.cpp: (WTF::threadMapMutex): (WTF::initializeThreading): (WTF::identifierByPthreadHandle): (WTF::establishIdentifierForPthreadHandle): (WTF::changeThreadPriority): (WTF::waitForThreadCompletion): (WTF::detachThread): (WTF::threadDidExit): (WTF::currentThread): (WTF::Mutex::Mutex): (WTF::Mutex::~Mutex): (WTF::Mutex::lock): (WTF::Mutex::tryLock): (WTF::Mutex::unlock): (WTF::ThreadCondition::~ThreadCondition): (WTF::ThreadCondition::wait): (WTF::ThreadCondition::timedWait): (WTF::DeprecatedMutex::DeprecatedMutex): Deleted. (WTF::DeprecatedMutex::~DeprecatedMutex): Deleted. (WTF::DeprecatedMutex::lock): Deleted. (WTF::DeprecatedMutex::tryLock): Deleted. (WTF::DeprecatedMutex::unlock): Deleted. * wtf/ThreadingWin.cpp: (WTF::initializeCurrentThreadInternal): (WTF::threadMapMutex): (WTF::initializeThreading): (WTF::storeThreadHandleByIdentifier): (WTF::threadHandleForIdentifier): (WTF::clearThreadHandleForIdentifier): (WTF::currentThread): (WTF::Mutex::Mutex): (WTF::Mutex::~Mutex): (WTF::Mutex::lock): (WTF::Mutex::tryLock): (WTF::Mutex::unlock): (WTF::ThreadCondition::~ThreadCondition): (WTF::ThreadCondition::wait): (WTF::ThreadCondition::timedWait): (WTF::DeprecatedMutex::DeprecatedMutex): Deleted. (WTF::DeprecatedMutex::~DeprecatedMutex): Deleted. (WTF::DeprecatedMutex::lock): Deleted. (WTF::DeprecatedMutex::tryLock): Deleted. (WTF::DeprecatedMutex::unlock): Deleted. * wtf/WorkQueue.h: * wtf/dtoa.cpp: * wtf/dtoa.h: * wtf/efl/DispatchQueueEfl.cpp: (DispatchQueue::dispatch): (DispatchQueue::performWork): (DispatchQueue::performTimerWork): (DispatchQueue::insertTimerWorkItem): (DispatchQueue::wakeUpThread): (DispatchQueue::getNextTimeOut): * wtf/efl/DispatchQueueEfl.h: * wtf/efl/RunLoopEfl.cpp: (WTF::RunLoop::wakeUpEvent): (WTF::RunLoop::wakeUp): * wtf/threads/BinarySemaphore.cpp: (WTF::BinarySemaphore::signal): (WTF::BinarySemaphore::wait): * wtf/threads/BinarySemaphore.h: * wtf/win/WorkQueueWin.cpp: (WTF::WorkQueue::handleCallback): (WTF::WorkQueue::platformInvalidate): (WTF::WorkQueue::dispatch): (WTF::WorkQueue::timerCallback): (WTF::WorkQueue::dispatchAfter): 2015-08-05 Filip Pizlo Unreviewed, fix Windows. * wtf/ThreadSpecificWin.cpp: (WTF::destructorsList): (WTF::destructorsMutex): (WTF::threadSpecificKeyCreate): (WTF::threadSpecificKeyDelete): (WTF::ThreadSpecificThreadExit): 2015-08-04 Filip Pizlo Rename Mutex to DeprecatedMutex https://bugs.webkit.org/show_bug.cgi?id=147675 Reviewed by Geoffrey Garen. * wtf/Atomics.cpp: (WTF::getSwapLock): (WTF::atomicStep): * wtf/MessageQueue.h: (WTF::MessageQueue::infiniteTime): (WTF::MessageQueue::append): (WTF::MessageQueue::appendAndKill): (WTF::MessageQueue::appendAndCheckEmpty): (WTF::MessageQueue::prepend): (WTF::MessageQueue::removeIf): (WTF::MessageQueue::isEmpty): (WTF::MessageQueue::kill): (WTF::MessageQueue::killed): * wtf/ParallelJobsGeneric.cpp: (WTF::ParallelEnvironment::ThreadPrivate::execute): (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish): (WTF::ParallelEnvironment::ThreadPrivate::workerThread): * wtf/ParallelJobsGeneric.h: * wtf/RunLoop.cpp: (WTF::RunLoop::performWork): (WTF::RunLoop::dispatch): * wtf/RunLoop.h: * wtf/Threading.cpp: (WTF::threadEntryPoint): (WTF::createThread): * wtf/ThreadingPrimitives.h: * wtf/ThreadingPthreads.cpp: (WTF::threadMapMutex): (WTF::initializeThreading): (WTF::identifierByPthreadHandle): (WTF::establishIdentifierForPthreadHandle): (WTF::changeThreadPriority): (WTF::waitForThreadCompletion): (WTF::detachThread): (WTF::threadDidExit): (WTF::currentThread): (WTF::DeprecatedMutex::DeprecatedMutex): (WTF::DeprecatedMutex::~DeprecatedMutex): (WTF::DeprecatedMutex::lock): (WTF::DeprecatedMutex::tryLock): (WTF::DeprecatedMutex::unlock): (WTF::ThreadCondition::~ThreadCondition): (WTF::ThreadCondition::wait): (WTF::ThreadCondition::timedWait): (WTF::Mutex::Mutex): Deleted. (WTF::Mutex::~Mutex): Deleted. (WTF::Mutex::lock): Deleted. (WTF::Mutex::tryLock): Deleted. (WTF::Mutex::unlock): Deleted. * wtf/ThreadingWin.cpp: (WTF::initializeCurrentThreadInternal): (WTF::threadMapMutex): (WTF::initializeThreading): (WTF::storeThreadHandleByIdentifier): (WTF::threadHandleForIdentifier): (WTF::clearThreadHandleForIdentifier): (WTF::currentThread): (WTF::DeprecatedMutex::DeprecatedMutex): (WTF::DeprecatedMutex::~DeprecatedMutex): (WTF::DeprecatedMutex::lock): (WTF::DeprecatedMutex::tryLock): (WTF::DeprecatedMutex::unlock): (WTF::ThreadCondition::~ThreadCondition): (WTF::ThreadCondition::wait): (WTF::ThreadCondition::timedWait): (WTF::Mutex::Mutex): Deleted. (WTF::Mutex::~Mutex): Deleted. (WTF::Mutex::lock): Deleted. (WTF::Mutex::tryLock): Deleted. (WTF::Mutex::unlock): Deleted. * wtf/WorkQueue.h: * wtf/dtoa.cpp: * wtf/dtoa.h: * wtf/efl/DispatchQueueEfl.cpp: (DispatchQueue::dispatch): (DispatchQueue::performWork): (DispatchQueue::performTimerWork): (DispatchQueue::insertTimerWorkItem): (DispatchQueue::wakeUpThread): (DispatchQueue::getNextTimeOut): * wtf/efl/DispatchQueueEfl.h: * wtf/efl/RunLoopEfl.cpp: (WTF::RunLoop::wakeUpEvent): (WTF::RunLoop::wakeUp): * wtf/threads/BinarySemaphore.cpp: (WTF::BinarySemaphore::signal): (WTF::BinarySemaphore::wait): * wtf/threads/BinarySemaphore.h: * wtf/win/WorkQueueWin.cpp: (WTF::WorkQueue::handleCallback): (WTF::WorkQueue::platformInvalidate): (WTF::WorkQueue::dispatch): (WTF::WorkQueue::timerCallback): (WTF::WorkQueue::dispatchAfter): 2015-08-04 Alex Christensen Fix quirks with CMake and VS2015 https://bugs.webkit.org/show_bug.cgi?id=147663 Reviewed by Brent Fulgham. * wtf/Platform.h: Build fix after r187908 2015-08-04 Brent Fulgham [Win] Update Apple Windows build for VS2015 https://bugs.webkit.org/show_bug.cgi?id=147653 Reviewed by Dean Jackson. * WTF.vcxproj/WTF.vcxproj.filters: Drive-by-fix to place files in proper project locations in the IDE. * wtf/Platform.h: Don't define the _HAS_EXCEPTIONS macro when building with Visual Studio 2015. 2015-08-04 Commit Queue Unreviewed, rolling out r187815 and r187817. https://bugs.webkit.org/show_bug.cgi?id=147644 Caused lots of Windows crashes (Requested by smfr on #webkit). Reverted changesets: "[WTF] Turn tryMakeString(), makeString() into variadic templates" https://bugs.webkit.org/show_bug.cgi?id=147142 http://trac.webkit.org/changeset/187815 "Unreviewed build fix." http://trac.webkit.org/changeset/187817 2015-08-04 Alex Christensen Enable WebGL on Windows CMake build. https://bugs.webkit.org/show_bug.cgi?id=143311 Reviewed by Csaba Osztrogonác. * wtf/FeatureDefines.h: Made the CMake feature defines the same as the non-CMake feature defines. 2015-08-03 Csaba Osztrogonác Introduce COMPILER(GCC_OR_CLANG) guard and make COMPILER(GCC) true only for GCC https://bugs.webkit.org/show_bug.cgi?id=146833 Reviewed by Alexey Proskuryakov. * wtf/Assertions.cpp: * wtf/Assertions.h: Removed redundant COMPILER(CLANG) guard. * wtf/Atomics.cpp: * wtf/Atomics.h: (WTF::weakCompareAndSwap): (WTF::compilerFence): * wtf/Compiler.h: - Renamed COMPILER(GCC) to COMPILER(GCC_OR_CLANG), because it is true for both compiler. - Added COMPILER(GCC) which is true only for GCC. - Moved all GCC related stuff to one block and removed redundant guards accordingly. - Removed the unused default false definition of GCC_VERSION_AT_LEAST for non GCC compilers. * wtf/ExportMacros.h: * wtf/FastMalloc.h: * wtf/Platform.h: * wtf/StdLibExtras.h: * wtf/Vector.h: * wtf/text/ASCIIFastPath.h: (WTF::copyLCharsFromUCharSource): 2015-08-03 Zan Dobersek Unreviewed build fix. * wtf/text/StringConcatenate.h: Include to avoid missing std::tuple<> class definitions. 2015-08-03 Zan Dobersek [WTF] Turn tryMakeString(), makeString() into variadic templates https://bugs.webkit.org/show_bug.cgi?id=147142 Reviewed by Sam Weinig. Built upon the original work by Anders Carlsson, Mark Rowe and Sam Weinig. Implement tryMakeString() and makeString() as variadic templates, replacing the argument count-based overloads. tryMakeString() now constructs a stack-based tuple of necessary StringTypeAdapter objects and utilizes the StringAdapterTuple struct template to operate on that tuple, recursively calling the necessary operations on each element in the tuple. This effectively mimics the process of previous tryMakeString() implementation, but makes it scalable to a tuple of elements that are to be concatenated. StringAppend class template now stores two StringTypeAdapter objects for the two passed-in string objects, packed in a tuple, calling StringAdapterTuple<>::createString() directly when concatenating the two objects into one String. * wtf/text/StringConcatenate.h: (WTF::StringTypeAdapter::length): (WTF::StringTypeAdapter::is8Bit): (WTF::StringAdapterTuple::sumWithOverflow): (WTF::StringAdapterTuple::is8Bit): (WTF::StringAdapterTuple::writeTo): (WTF::StringAdapterTuple::createString): (WTF::tryMakeString): (WTF::makeString): (WTF::sumWithOverflow): Deleted. * wtf/text/StringOperators.h: (WTF::StringAppend::StringAppend): (WTF::StringAppend::operator String): (WTF::StringAppend::is8Bit): (WTF::StringAppend::writeTo): (WTF::StringAppend::length): (WTF::StringAppend::string1): (WTF::StringAppend::string2): 2015-08-03 Anders Carlsson Make it possible to use String::utf8() in the debugger https://bugs.webkit.org/show_bug.cgi?id=147566 Reviewed by Tim Horton. Add a new utf8() overload that doesn't take any parameters and just calls utf8(LenientConversion), since lldb doesn't support evaluating function calls with default parameters at the moment. * wtf/text/WTFString.cpp: (WTF::String::utf8): * wtf/text/WTFString.h: 2015-08-02 Benjamin Poulain Investigate HashTable::HashTable(const HashTable&) and HashTable::operator=(const HashTable&) performance for hash-based static analyses https://bugs.webkit.org/show_bug.cgi?id=118455 Reviewed by Filip Pizlo. Previously, when copying a HashTable, we would start from scratch with an empty table and insert elements one by one, growing-rehashing the table as needed. With this patch, we have 2 improvements to remove most of the cost. First, we compute a good size from the start. This removes all the reallocations and rehashs. This is where the biggest gain comes from. The second part is a simpler version of add() when we know that we cannot find a bucket with the same key and there cannot be any deleted bucket. This removes most branches from the hot loop, cutting another 25% of the time. * wtf/HashTable.h: (WTF::KeyTraits>::addUniqueForInitialization): (WTF::KeyTraits>::HashTable): 2015-08-01 Myles C. Maxfield HashTraits can use SimpleClassHashTraits https://bugs.webkit.org/show_bug.cgi?id=147528 Reviewed by Andreas Kling. No point in duplicating the code inside SimpleClassHashTraits. * wtf/text/AtomicStringHash.h: (WTF::HashTraits::constructDeletedValue): Deleted. (WTF::HashTraits::isDeletedValue): Deleted. 2015-08-01 Alex Christensen Fix compile errors with VS2015 https://bugs.webkit.org/show_bug.cgi?id=147526 Reviewed by Myles Maxfield. * wtf/StringExtras.h: (snprintf): (wtf_vsnprintf): VS2015 has an implementation of snprintf. 2015-07-31 Alex Christensen Prepare for VS2015 https://bugs.webkit.org/show_bug.cgi?id=146579 Reviewed by Jon Honeycutt. * wtf/StdLibExtras.h: (std::exchange): Added preprocessor macros around functions implemented in VS2015's standard library. 2015-07-30 Chris Dumez Mark more classes as fast allocated https://bugs.webkit.org/show_bug.cgi?id=147440 Reviewed by Sam Weinig. Mark more classes as fast allocated for performance. We heap-allocate objects of those types throughout the code base. * wtf/Bag.h: * wtf/SegmentedVector.h: * wtf/SentinelLinkedList.h: 2015-07-29 Basile Clement Remove native call inlining https://bugs.webkit.org/show_bug.cgi?id=147417 Rubber-stamped by Filip Pizlo. * wtf/Platform.h: 2015-07-28 Yusuke Suzuki [ES6] Add ENABLE_ES6_MODULES compile time flag with the default value "false" https://bugs.webkit.org/show_bug.cgi?id=147350 Reviewed by Sam Weinig. * wtf/FeatureDefines.h: 2015-07-28 Filip Pizlo Unreviewed, fix Windows build. * wtf/MetaAllocatorHandle.h: (WTF::MetaAllocatorHandle::key): 2015-07-27 Filip Pizlo Add logging when executable code gets deallocated https://bugs.webkit.org/show_bug.cgi?id=147355 Reviewed by Mark Lam. * wtf/MetaAllocator.cpp: (WTF::MetaAllocatorHandle::dump): It's useful to be able to dump these. * wtf/MetaAllocatorHandle.h: 2015-07-28 Benjamin Poulain Speed up StringBuilder::appendQuotedJSONString() https://bugs.webkit.org/show_bug.cgi?id=147352 Reviewed by Andreas Kling. * wtf/text/StringBuilder.cpp: (WTF::appendQuotedJSONStringInternal): The cases '"' and '\\' are not that uncommon, and they can easily be handled in the original branch testing for them. This is about 2.5% better on the JSON.stringify test. 2015-07-27 Alex Christensen Progress towards building AppleWin with CMake https://bugs.webkit.org/show_bug.cgi?id=147325 Reviewed by Martin Robinson. * wtf/PlatformWin.cmake: Link with CoreFoundation.lib. 2015-07-25 Carlos Alberto Lopez Perez REGRESSION (bmalloc): WebKit performance tests don't report memory stats. https://bugs.webkit.org/show_bug.cgi?id=141247 Reviewed by Geoffrey Garen. Meanwhile a better way of getting memory stats with bmalloc is not found (see bug 136592), we can report as memory stats the resident set size information that the operating system provides to us. This at least should be good enough to get back the memory stats on the performance tests and being able to track down memory usage regressions at https://perf.webkit.org * wtf/FastMalloc.cpp: (WTF::fastMallocStatistics): Report maxrss data as committedVMBytes. 2015-07-24 Csaba Osztrogonác Remove the unused GCC workaround - std::is_trivially_destructible https://bugs.webkit.org/show_bug.cgi?id=147226 Reviewed by Darin Adler. * wtf/StdLibExtras.h: 2015-07-23 Alex Christensen Remove compile and runtime flags for promises. https://bugs.webkit.org/show_bug.cgi?id=147244 Reviewed by Yusuke Suzuki. * wtf/FeatureDefines.h: 2015-07-22 Sukolsak Sakshuwong Add ENABLE_WEBASSEMBLY feature flag for WebAssembly https://bugs.webkit.org/show_bug.cgi?id=147212 Reviewed by Filip Pizlo. * wtf/FeatureDefines.h: 2015-07-22 Filip Pizlo Introduce release assert for using threads before threading is initialized https://bugs.webkit.org/show_bug.cgi?id=147200 Reviewed by Michael Saboff. This will help bugs where you use createThread() before calling initializeThreading(). * wtf/ThreadIdentifierDataPthreads.cpp: (WTF::ThreadIdentifierData::initialize): 2015-07-21 Daniel Bates WTFCrash() in WebKit::WebProcess::networkConnection() https://bugs.webkit.org/show_bug.cgi?id=147112 Reviewed by Gavin Barraclough. Add explicit boolean conversion function and remove overload of operator! to support checking whether an activity token is valid more directly than using the overloaded operator!. * wtf/RefCounter.h: (WTF::RefCounter::Token::operator bool): Added. (WTF::RefCounter::Token::operator!): Deleted. 2015-07-20 Mark Lam Rollout r187020 and r187021: breaks JSC API tests on debug builds. https://bugs.webkit.org/show_bug.cgi?id=147110 * wtf/WTFThreadData.cpp: (WTF::WTFThreadData::WTFThreadData): * wtf/WTFThreadData.h: (WTF::WTFThreadData::stack): 2015-07-20 Alex Christensen Resurrect CMake build on Windows. https://bugs.webkit.org/show_bug.cgi?id=147083 Reviewed by Gyuyoung Kim. * wtf/PlatformWin.cmake: 2015-07-20 Per Arne Vollan JavaScriptCore performance is very bad on Windows https://bugs.webkit.org/show_bug.cgi?id=146448 Reviewed by Mark Lam. Updating the stack bounds is time consuming. Only update the stack bounds when a new fiber is running. * wtf/WTFThreadData.cpp: (WTF::WTFThreadData::WTFThreadData): * wtf/WTFThreadData.h: (WTF::WTFThreadData::stack): 2015-07-20 Julien Brianceau Use isnan from std namespace in Stopwatch.h. https://bugs.webkit.org/show_bug.cgi?id=146911 Reviewed by Žan Doberšek. * wtf/Stopwatch.h: (WTF::Stopwatch::isActive): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): 2015-07-16 Benjamin Poulain [Content extensions] Combine suffixes when generating NFAs https://bugs.webkit.org/show_bug.cgi?id=146961 Reviewed by Alex Christensen. * wtf/Vector.h: (WTF::minCapacity>::Vector): (WTF::=): Copying a vector with a different inline capacity was broken due to the addition of MinimumCapacity. This feature was needed by this patch so I fixed WTF. 2015-07-15 Anders Carlsson Make JavaScriptCore SPI headers used by WebCore SPI headers self-contained https://bugs.webkit.org/show_bug.cgi?id=146978 Reviewed by Dan Bernstein. * wtf/ExportMacros.h: 2015-07-14 Anders Carlsson Assertions.h should include ExportMacros.h https://bugs.webkit.org/show_bug.cgi?id=146948 Reviewed by Tim Horton. * wtf/Assertions.h: 2015-07-11 Joseph Pecoraro Unreviewed build fix, restrict APP_LINKS to just iOS. * wtf/Platform.h: 2015-07-09 Tim Horton Use CoreAnimation fences instead of synchronous IPC to synchronize resize https://bugs.webkit.org/show_bug.cgi?id=146294 Reviewed by Anders Carlsson. * wtf/Platform.h: Add HAVE(COREANIMATION_FENCES) 2015-07-04 Chris Dumez Drop RefPtr::clear() method https://bugs.webkit.org/show_bug.cgi?id=146556 Reviewed by Brady Eidson. Drop RefPtr::clear() method in favor of "= nullptr;" pattern. Also made the "= nullptr;" pattern as efficient as clear() by providing a operator=(nullptr_t) overload. Local micro- benchmarking showed that "= nullptr;" used to be ~1.7% slower than clear(). 2015-07-03 Dan Bernstein [Xcode] Update some build settings as recommended by Xcode 7 https://bugs.webkit.org/show_bug.cgi?id=146597 Reviewed by Sam Weinig. * Configurations/Base.xcconfig: Enabled CLANG_WARN_UNREACHABLE_CODE and GCC_NO_COMMON_BLOCKS. Removed GCC_MODEL_TUNING. * WTF.xcodeproj/project.pbxproj: Updated LastUpgradeCheck. 2015-07-01 Alex Christensen Re-enable WebGL on WinCairo https://bugs.webkit.org/show_bug.cgi?id=146537 Reviewed by Csaba Osztrogonác. * wtf/FeatureDefines.h: Enable WebGL on WinCairo again. 2015-07-01 Alex Christensen Ignore Visual Studio warning in SegmentedVector https://bugs.webkit.org/show_bug.cgi?id=146514 Reviewed by Andreas Kling. * wtf/SegmentedVector.h: (WTF::SegmentedVector::deleteAllSegments): Use pragmas to ignore the 0 element array warning. 2015-07-01 Dean Jackson Disable the experimental WebGL2 implementation https://bugs.webkit.org/show_bug.cgi?id=146526 Reviewed by Myles Maxfield. Add (and disable) an ENABLE_WEBGL2 flag. * wtf/FeatureDefines.h: 2015-06-30 Alex Christensen [Win] Unreviewed build fix after r186169. * wtf/FeatureDefines.h: Temporarily disable WebGL on WinCairo. It was already temporarily disabled on AppleWin. 2015-06-30 Andy VanWagoner Implement ECMAScript Internationalization API https://bugs.webkit.org/show_bug.cgi?id=90906 Reviewed by Benjamin Poulain. * wtf/FeatureDefines.h: add ENABLE_INTL flag 2015-06-30 Keith Miller Errors in read() are not handled in WTF::cryptographicallyRandomValuesFromOS. https://bugs.webkit.org/show_bug.cgi?id=146473 Reviewed by Filip Pizlo. We were not checking if errors occurred in WTF::cryptographicallyRandomValuesFromOS. We now buffer the data until enough bits of entropy exist to fill the buffer rather than crash. Additionally, added two crash functions so we can distinguish between the two reasons why we crashed in traces. * wtf/OSRandomSource.cpp: (WTF::crashUnableToOpenFD): (WTF::crashUnableToReadFromFD): (WTF::cryptographicallyRandomValuesFromOS): 2015-06-29 Dean Jackson Temporarily disable PICTURE_SIZES https://bugs.webkit.org/show_bug.cgi?id=146435 Reviewed by Tim Horton. Temporarily disable PICTURE_SIZES because it causes problems with out of date polyfills. * wtf/FeatureDefines.h: 2015-06-26 Antti Koivisto Network process hangs fetching disk cache entries https://bugs.webkit.org/show_bug.cgi?id=146348 Reviewed by Anders Carlsson. RunLoop::dispatch may deadlock if invoked with std::function that captures an object that calls RunLoop::dispatch in destructor. * wtf/RunLoop.cpp: (WTF::RunLoop::performWork): Don't reuse std::function variable in loop. We may end up destroying previously held std::function in assignment while holding the runloop mutex. With this change std::function is always destroyed with mutex unlocked. 2015-06-24 Commit Queue Unreviewed, rolling out r185906. https://bugs.webkit.org/show_bug.cgi?id=146276 MSVC doesn't yet provide a const-qualified std::array::size(), failing to compile the static_assert (Requested by zdobersek on #webkit). Reverted changeset: "Improve the source code generated by make_names.pl" https://bugs.webkit.org/show_bug.cgi?id=146208 http://trac.webkit.org/changeset/185906 2015-06-24 Zan Dobersek Improve the source code generated by make_names.pl https://bugs.webkit.org/show_bug.cgi?id=146208 Reviewed by Darin Adler. * wtf/text/StringImpl.h: (WTF::StringImpl::assertHashIsCorrect): Make this method const-qualified. 2015-06-22 Darin Adler Make Array.join work directly on substrings without reifying them https://bugs.webkit.org/show_bug.cgi?id=146191 Reviewed by Andreas Kling. * wtf/Vector.h: Added an overload of uncheckedAppend like the one we added a while back, a non-template function that forwards through to the function template. This lets us call uncheckedAppend on an argument list and have it properly convert it to the Vector's element type. * wtf/text/StringView.h: (WTF::StringView::getCharactersWithUpconvert): Changed to not use memcpy; saw some indication the hand-written loop was faster when profiling. Also use m_length directly when we know we are dealing with an 8-bit string, since the masking that the index function does is not needed in that case. (WTF::StringView::UpconvertedCharacters::UpconvertedCharacters): Ditto. (WTF::StringView::toString): Ditto. (WTF::StringView::toFloat): Ditto. (WTF::StringView::toInt): Ditto. (WTF::StringView::toStringWithoutCopying): Ditto. (WTF::StringView::find): Ditto. 2015-06-22 YunQiang Su [WTF] Platform.h: use _ABI64 instead of _MIPS_SIM_ABI64 to determine MIPS N64 https://bugs.webkit.org/show_bug.cgi?id=145113 Reviewed by Csaba Osztrogonác. * wtf/Platform.h: 2015-06-22 Anders Carlsson Fix build. * wtf/threads/BinarySemaphore.cpp: 2015-06-22 Anders Carlsson Get rid of the Windows specific BinarySemaphore implementation https://bugs.webkit.org/show_bug.cgi?id=146216 Reviewed by Andreas Kling. The fact that the Windows implementation uses a HEVENT internally was only useful to the Windows port of WebKit2; we can get rid of it now. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * wtf/threads/BinarySemaphore.h: (WTF::BinarySemaphore::event): Deleted. * wtf/threads/win/BinarySemaphoreWin.cpp: Removed. (WTF::BinarySemaphore::BinarySemaphore): Deleted. (WTF::BinarySemaphore::~BinarySemaphore): Deleted. (WTF::BinarySemaphore::signal): Deleted. (WTF::BinarySemaphore::wait): Deleted. 2015-06-21 Gavin Barraclough Page load performance regression due to bugs.webkit.org/show_bug.cgi?id=145542 https://bugs.webkit.org/show_bug.cgi?id=146198 Unreviewed rollout. * wtf/glib/GUniquePtr.h: 2015-06-20 Michael Catanzaro [EFL][GTK] Define GLIB_VERSION_MIN_REQUIRED and require glib 2.36 for GTK https://bugs.webkit.org/show_bug.cgi?id=146181 Reviewed by Martin Robinson. Define GLIB_VERSION_MIN_REQUIRED to avoid deprecation warnings. * wtf/Platform.h: 2015-06-19 Michael Catanzaro [SOUP] Define SOUP_VERSION_MIN_REQUIRED https://bugs.webkit.org/show_bug.cgi?id=146165 Reviewed by Martin Robinson. Define SOUP_VERSION_MIN_REQUIRED to avoid deprecation warnings. * wtf/Platform.h: 2015-06-19 Mark Lam Gardening: build fixes for GTK and EFL for CheckedArithmetic change. Not reviewed. * wtf/CheckedArithmetic.h: (WTF::Checked::operator<): (WTF::Checked::operator<=): (WTF::Checked::operator>): (WTF::Checked::operator>=): 2015-06-19 Mark Lam CheckedArithmetic's operator bool() and operator==() is broken. https://bugs.webkit.org/show_bug.cgi?id=146129 Reviewed by Geoffrey Garen and Oliver Hunt. The existing operator UnspecifiedBoolType*() in CheckedArithmetic is erroneously allowing the Checked value to be implicitly casted into pointer types. This is because it is doing a reinterpret_cast(1) whereas the idiom relies on the address of a member e.g. &Checked::m_value. As a result, ImageBufferData::putData() was getting an implicit cast of a Checked value to (void*)1 and doing incorrect pointer comparisons on it. Also, 2 of CheckedArithmetic's operator==() will crash if used on an overflowed value, while a 3rd one does not. The 3rd one should be consistent and also crash if used on an overflowed Checked value. In this fix, we replace operator UnspecifiedBoolType*() with an explicit operator bool(). We also add the missing operators <, <=, >, and >=. That takes care of the comparisons in ImageBufferData::putData(). * wtf/CheckedArithmetic.h: (WTF::CrashOnOverflow::overflowed): (WTF::CrashOnOverflow::crash): (WTF::RecordOverflow::crash): (WTF::Checked::operator!): (WTF::Checked::operator bool): (WTF::Checked::unsafeGet): - Don't call CRASH() directly. Delegate to the handler. (WTF::Checked::operator==): - Should call the handler's crash() to be consistent with the other 2 versions of operator== which will crash in unsafeGet() if used on an overflowed Checked value. (WTF::Checked::operator<): (WTF::Checked::operator<=): (WTF::Checked::operator>): (WTF::Checked::operator>=): - Add missing operators. (WTF::Checked::operator UnspecifiedBoolType*): Deleted. 2015-06-19 Csaba Osztrogonác [WK2] Fix unused-private-field warning in WebProcess/Plugins/PluginView. https://bugs.webkit.org/show_bug.cgi?id=145252 Reviewed by Tim Horton. * wtf/FeatureDefines.h: Moved the definition of ENABLE_PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC here from Source/WebKit2/WebProcess/WebPage/WebPage.h 2015-06-17 Andreas Kling SegmentedVector should waste less memory. Reviewed by Anders Carlsson. We were wasting sizeof(Vector) on every segment in SegmentVector. The segments were using inline capacity, and would never go beyond it, so all the size/capacity/out-of-line-buffer metadata was useless. Change the internal representation to Vector instead. This saves 16 bytes per segment, so lower SegmentSize -> bigger savings! * wtf/SegmentedVector.h: (WTF::SegmentedVectorIterator::operator*): (WTF::SegmentedVectorIterator::operator->): (WTF::SegmentedVectorIterator::operator++): (WTF::SegmentedVectorIterator::operator==): (WTF::SegmentedVectorIterator::operator!=): (WTF::SegmentedVectorIterator::SegmentedVectorIterator): (WTF::SegmentedVector::at): (WTF::SegmentedVector::append): (WTF::SegmentedVector::removeLast): (WTF::SegmentedVector::grow): (WTF::SegmentedVector::begin): (WTF::SegmentedVector::end): (WTF::SegmentedVector::deleteAllSegments): (WTF::SegmentedVector::ensureSegmentsFor): (WTF::SegmentedVector::ensureSegment): (WTF::SegmentedVector::allocateSegment): (WTF::SegmentedVectorIterator::operator=): Deleted. (WTF::SegmentedVector::SegmentedVector): Deleted. 2015-06-16 Andreas Kling Remove unused template parameter InlineCapacity from SegmentedVector. Reviewed by Anders Carlsson. * wtf/SegmentedVector.h: (WTF::SegmentedVectorIterator::operator=): (WTF::SegmentedVectorIterator::SegmentedVectorIterator): (WTF::SegmentedVector::at): 2015-06-16 Mark Lam Use NakedPtr& to return exception results. https://bugs.webkit.org/show_bug.cgi?id=145870 Reviewed by Anders Carlsson and Filip Pizlo. Introducing the NakedPtr class. * WTF.xcodeproj/project.pbxproj: * wtf/NakedPtr.h: Added. (WTF::NakedPtr::NakedPtr): (WTF::NakedPtr::get): (WTF::NakedPtr::clear): (WTF::NakedPtr::operator*): (WTF::NakedPtr::operator->): (WTF::NakedPtr::operator T*): (WTF::NakedPtr::operator!): (WTF::NakedPtr::operator bool): (WTF::=): (WTF::NakedPtr::swap): (WTF::swap): 2015-06-12 Zan Dobersek [GLib] Move files under Source/WTF/wtf/gobject to Source/WTF/wtf/glib https://bugs.webkit.org/show_bug.cgi?id=145799 Reviewed by Carlos Garcia Campos. Move the GLib-specific files to the Source/WTF/wtf/glib/ directory. 'gobject' wasn't the most appropriate name for the directory since GObject is a submodule of GLib, but a lot of the code there didn't have much to do with GObject specifically. Build rules for the moved files are also updated. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * wtf/Platform.h: * wtf/PlatformEfl.cmake: * wtf/PlatformGTK.cmake: * wtf/RunLoop.h: * wtf/WorkQueue.h: * wtf/glib/GLibUtilities.cpp: Renamed from Source/WTF/wtf/gobject/GlibUtilities.cpp. (getCurrentExecutablePath): * wtf/glib/GLibUtilities.h: Renamed from Source/WTF/wtf/gobject/GlibUtilities.h. * wtf/glib/GMainLoopSource.cpp: Renamed from Source/WTF/wtf/gobject/GMainLoopSource.cpp. (WTF::GMainLoopSource::create): (WTF::GMainLoopSource::GMainLoopSource): (WTF::GMainLoopSource::~GMainLoopSource): (WTF::GMainLoopSource::isScheduled): (WTF::GMainLoopSource::isActive): (WTF::GMainLoopSource::cancel): (WTF::GMainLoopSource::scheduleIdleSource): (WTF::GMainLoopSource::schedule): (WTF::GMainLoopSource::scheduleTimeoutSource): (WTF::GMainLoopSource::scheduleAfterDelay): (WTF::createMicrosecondsTimeoutSource): (WTF::GMainLoopSource::scheduleAndDeleteOnDestroy): (WTF::GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy): (WTF::GMainLoopSource::prepareVoidCallback): (WTF::GMainLoopSource::finishVoidCallback): (WTF::GMainLoopSource::voidCallback): (WTF::GMainLoopSource::prepareBoolCallback): (WTF::GMainLoopSource::finishBoolCallback): (WTF::GMainLoopSource::boolCallback): (WTF::GMainLoopSource::socketCallback): (WTF::GMainLoopSource::voidSourceCallback): (WTF::GMainLoopSource::boolSourceCallback): (WTF::GMainLoopSource::socketSourceCallback): (WTF::GMainLoopSource::Context::destroySource): * wtf/glib/GMainLoopSource.h: Renamed from Source/WTF/wtf/gobject/GMainLoopSource.h. (WTF::GMainLoopSource::Context::operator=): * wtf/glib/GMutexLocker.h: Renamed from Source/WTF/wtf/gobject/GMutexLocker.h. (WTF::MutexWrapper::lock): (WTF::MutexWrapper::unlock): (WTF::MutexWrapper::lock): (WTF::MutexWrapper::unlock): (WTF::GMutexLocker::GMutexLocker): (WTF::GMutexLocker::~GMutexLocker): (WTF::GMutexLocker::lock): (WTF::GMutexLocker::unlock): * wtf/glib/GRefPtr.cpp: Renamed from Source/WTF/wtf/gobject/GRefPtr.cpp. (WTF::refGPtr): (WTF::derefGPtr): * wtf/glib/GRefPtr.h: Renamed from Source/WTF/wtf/gobject/GRefPtr.h. (WTF::GRefPtr::GRefPtr): (WTF::GRefPtr::~GRefPtr): (WTF::GRefPtr::clear): (WTF::GRefPtr::outPtr): (WTF::GRefPtr::isHashTableDeletedValue): (WTF::GRefPtr::get): (WTF::GRefPtr::operator*): (WTF::GRefPtr::operator->): (WTF::GRefPtr::operator!): (WTF::GRefPtr::operator UnspecifiedBoolType): (WTF::GRefPtr::hashTableDeletedValue): (WTF::=): (WTF::GRefPtr::swap): (WTF::swap): (WTF::operator==): (WTF::operator!=): (WTF::static_pointer_cast): (WTF::const_pointer_cast): (WTF::adoptGRef): (WTF::refGPtr): (WTF::derefGPtr): * wtf/glib/GThreadSafeMainLoopSource.cpp: Renamed from Source/WTF/wtf/gobject/GThreadSafeMainLoopSource.cpp. (WTF::GThreadSafeMainLoopSource::GThreadSafeMainLoopSource): (WTF::GThreadSafeMainLoopSource::~GThreadSafeMainLoopSource): (WTF::GThreadSafeMainLoopSource::cancel): (WTF::GThreadSafeMainLoopSource::schedule): (WTF::GThreadSafeMainLoopSource::scheduleAfterDelay): (WTF::GThreadSafeMainLoopSource::prepareVoidCallback): (WTF::GThreadSafeMainLoopSource::finishVoidCallback): (WTF::GThreadSafeMainLoopSource::voidCallback): (WTF::GThreadSafeMainLoopSource::prepareBoolCallback): (WTF::GThreadSafeMainLoopSource::finishBoolCallback): (WTF::GThreadSafeMainLoopSource::boolCallback): * wtf/glib/GThreadSafeMainLoopSource.h: Renamed from Source/WTF/wtf/gobject/GThreadSafeMainLoopSource.h. * wtf/glib/GTypedefs.h: Renamed from Source/WTF/wtf/gobject/GTypedefs.h. * wtf/glib/GUniquePtr.h: Renamed from Source/WTF/wtf/gobject/GUniquePtr.h. (WTF::GPtrDeleter::operator()): (WTF::GUniqueOutPtr::GUniqueOutPtr): (WTF::GUniqueOutPtr::~GUniqueOutPtr): (WTF::GUniqueOutPtr::outPtr): (WTF::GUniqueOutPtr::release): (WTF::GUniqueOutPtr::operator*): (WTF::GUniqueOutPtr::operator->): (WTF::GUniqueOutPtr::get): (WTF::GUniqueOutPtr::operator!): (WTF::GUniqueOutPtr::operator UnspecifiedBoolType): (WTF::GUniqueOutPtr::reset): * wtf/glib/MainThreadGLib.cpp: * wtf/gobject/GMainLoopSource.cpp: (WTF::GMainLoopSource::create): Deleted. (WTF::GMainLoopSource::GMainLoopSource): Deleted. (WTF::GMainLoopSource::~GMainLoopSource): Deleted. (WTF::GMainLoopSource::isScheduled): Deleted. (WTF::GMainLoopSource::isActive): Deleted. (WTF::GMainLoopSource::cancel): Deleted. (WTF::GMainLoopSource::scheduleIdleSource): Deleted. (WTF::GMainLoopSource::schedule): Deleted. (WTF::GMainLoopSource::scheduleTimeoutSource): Deleted. (WTF::GMainLoopSource::scheduleAfterDelay): Deleted. (WTF::createMicrosecondsTimeoutSource): Deleted. (WTF::GMainLoopSource::scheduleAndDeleteOnDestroy): Deleted. (WTF::GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy): Deleted. (WTF::GMainLoopSource::prepareVoidCallback): Deleted. (WTF::GMainLoopSource::finishVoidCallback): Deleted. (WTF::GMainLoopSource::voidCallback): Deleted. (WTF::GMainLoopSource::prepareBoolCallback): Deleted. (WTF::GMainLoopSource::finishBoolCallback): Deleted. (WTF::GMainLoopSource::boolCallback): Deleted. (WTF::GMainLoopSource::socketCallback): Deleted. (WTF::GMainLoopSource::voidSourceCallback): Deleted. (WTF::GMainLoopSource::boolSourceCallback): Deleted. (WTF::GMainLoopSource::socketSourceCallback): Deleted. (WTF::GMainLoopSource::Context::destroySource): Deleted. * wtf/gobject/GMainLoopSource.h: (WTF::GMainLoopSource::Context::operator=): Deleted. * wtf/gobject/GMutexLocker.h: (WTF::MutexWrapper::lock): Deleted. (WTF::MutexWrapper::unlock): Deleted. (WTF::MutexWrapper::lock): Deleted. (WTF::MutexWrapper::unlock): Deleted. (WTF::GMutexLocker::GMutexLocker): Deleted. (WTF::GMutexLocker::~GMutexLocker): Deleted. (WTF::GMutexLocker::lock): Deleted. (WTF::GMutexLocker::unlock): Deleted. * wtf/gobject/GRefPtr.cpp: (WTF::refGPtr): Deleted. (WTF::derefGPtr): Deleted. * wtf/gobject/GRefPtr.h: (WTF::GRefPtr::GRefPtr): Deleted. (WTF::GRefPtr::~GRefPtr): Deleted. (WTF::GRefPtr::clear): Deleted. (WTF::GRefPtr::outPtr): Deleted. (WTF::GRefPtr::isHashTableDeletedValue): Deleted. (WTF::GRefPtr::get): Deleted. (WTF::GRefPtr::operator*): Deleted. (WTF::GRefPtr::operator->): Deleted. (WTF::GRefPtr::operator!): Deleted. (WTF::GRefPtr::operator UnspecifiedBoolType): Deleted. (WTF::GRefPtr::hashTableDeletedValue): Deleted. (WTF::=): Deleted. (WTF::GRefPtr::swap): Deleted. (WTF::swap): Deleted. (WTF::operator==): Deleted. (WTF::operator!=): Deleted. (WTF::static_pointer_cast): Deleted. (WTF::const_pointer_cast): Deleted. (WTF::adoptGRef): Deleted. (WTF::refGPtr): Deleted. (WTF::derefGPtr): Deleted. * wtf/gobject/GThreadSafeMainLoopSource.cpp: (WTF::GThreadSafeMainLoopSource::GThreadSafeMainLoopSource): Deleted. (WTF::GThreadSafeMainLoopSource::~GThreadSafeMainLoopSource): Deleted. (WTF::GThreadSafeMainLoopSource::cancel): Deleted. (WTF::GThreadSafeMainLoopSource::schedule): Deleted. (WTF::GThreadSafeMainLoopSource::scheduleAfterDelay): Deleted. (WTF::GThreadSafeMainLoopSource::prepareVoidCallback): Deleted. (WTF::GThreadSafeMainLoopSource::finishVoidCallback): Deleted. (WTF::GThreadSafeMainLoopSource::voidCallback): Deleted. (WTF::GThreadSafeMainLoopSource::prepareBoolCallback): Deleted. (WTF::GThreadSafeMainLoopSource::finishBoolCallback): Deleted. (WTF::GThreadSafeMainLoopSource::boolCallback): Deleted. * wtf/gobject/GUniquePtr.h: (WTF::GPtrDeleter::operator()): Deleted. (WTF::GUniqueOutPtr::GUniqueOutPtr): Deleted. (WTF::GUniqueOutPtr::~GUniqueOutPtr): Deleted. (WTF::GUniqueOutPtr::outPtr): Deleted. (WTF::GUniqueOutPtr::release): Deleted. (WTF::GUniqueOutPtr::operator*): Deleted. (WTF::GUniqueOutPtr::operator->): Deleted. (WTF::GUniqueOutPtr::get): Deleted. (WTF::GUniqueOutPtr::operator!): Deleted. (WTF::GUniqueOutPtr::operator UnspecifiedBoolType): Deleted. (WTF::GUniqueOutPtr::reset): Deleted. * wtf/gobject/GlibUtilities.cpp: (getCurrentExecutablePath): Deleted. 2015-06-10 Basile Clement Unreviewed, fix an typo in unused template code. * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::iterator::operator*): s/at(index)/at(m_index)/ 2015-06-09 Csaba Osztrogonác [cmake] Fix the style issues in cmake project files https://bugs.webkit.org/show_bug.cgi?id=145755 Reviewed by Darin Adler. * wtf/CMakeLists.txt: 2015-06-08 Alexey Proskuryakov Build fix. * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::isEmpty): s/poointer/pointer/ 2015-06-07 Filip Pizlo The tiny set magic in StructureSet should be available in WTF https://bugs.webkit.org/show_bug.cgi?id=145722 Reviewed by Geoffrey Garen. As the management of structure sets evolved in JSC, the StructureSet data structure grew increasingly smart. It's got some smart stuff for managing small sets of pointers. I wanted to take the generic logic out of JSC and put it into a reusable templatized class in WTF. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/TinyPtrSet.h: Added. (WTF::TinyPtrSet::TinyPtrSet): (WTF::TinyPtrSet::operator=): (WTF::TinyPtrSet::~TinyPtrSet): (WTF::TinyPtrSet::clear): (WTF::TinyPtrSet::onlyEntry): (WTF::TinyPtrSet::isEmpty): (WTF::TinyPtrSet::add): (WTF::TinyPtrSet::remove): (WTF::TinyPtrSet::contains): (WTF::TinyPtrSet::merge): (WTF::TinyPtrSet::forEach): (WTF::TinyPtrSet::genericFilter): (WTF::TinyPtrSet::filter): (WTF::TinyPtrSet::exclude): (WTF::TinyPtrSet::isSubsetOf): (WTF::TinyPtrSet::isSupersetOf): (WTF::TinyPtrSet::overlaps): (WTF::TinyPtrSet::size): (WTF::TinyPtrSet::at): (WTF::TinyPtrSet::operator[]): (WTF::TinyPtrSet::last): (WTF::TinyPtrSet::iterator::iterator): (WTF::TinyPtrSet::iterator::operator*): (WTF::TinyPtrSet::iterator::operator++): (WTF::TinyPtrSet::iterator::operator==): (WTF::TinyPtrSet::iterator::operator!=): (WTF::TinyPtrSet::begin): (WTF::TinyPtrSet::end): (WTF::TinyPtrSet::operator==): (WTF::TinyPtrSet::addOutOfLine): (WTF::TinyPtrSet::containsOutOfLine): (WTF::TinyPtrSet::copyFrom): (WTF::TinyPtrSet::copyFromOutOfLine): (WTF::TinyPtrSet::OutOfLineList::create): (WTF::TinyPtrSet::OutOfLineList::destroy): (WTF::TinyPtrSet::OutOfLineList::list): (WTF::TinyPtrSet::OutOfLineList::OutOfLineList): (WTF::TinyPtrSet::deleteListIfNecessary): (WTF::TinyPtrSet::isThin): (WTF::TinyPtrSet::pointer): (WTF::TinyPtrSet::singleEntry): (WTF::TinyPtrSet::list): (WTF::TinyPtrSet::set): (WTF::TinyPtrSet::setEmpty): (WTF::TinyPtrSet::getReservedFlag): (WTF::TinyPtrSet::setReservedFlag): 2015-06-05 Chris Dumez [WK2][iOS] Limit the number of vnodes used by the WebContent processes https://bugs.webkit.org/show_bug.cgi?id=145672 Reviewed by Antti Koivisto. * wtf/RefCounter.h: (WTF::RefCounter::value): Expose the actual refcount instead of a boolean value. 2015-06-05 Alex Christensen [Web Timing] Use new SPI to enable data collection. https://bugs.webkit.org/show_bug.cgi?id=145650 rdar://problem/21203358 Reviewed by Chris Dumez. * wtf/Platform.h: Added HAVE_TIMINGDATAOPTIONS for platform and version dependent feature. 2015-06-05 Xabier Rodriguez Calvar and Youenn Fablet [Streams API] ReadableStream should store callbacks as a Deque https://bugs.webkit.org/show_bug.cgi?id=145641 Reviewed by Darin Adler. * wtf/Deque.h: (WTF::Deque::append): Adding not templated append method, forwarding to templated append method. 2015-06-02 Xabier Rodriguez Calvar and Youenn Fablet [Streams API] Delegate ReadableStreamReader reference counting to ReadableStream https://bugs.webkit.org/show_bug.cgi?id=144907 Reviewed by Darin Adler. * wtf/Vector.h: (WTF::Vector::append): Adding not templated append method, forwarding to ValueType templated append method. 2015-06-02 Yusuke Suzuki Heap-use-after-free read of size 4 in JavaScriptCore: WTF::StringImpl::isSymbol() (StringImpl.h:496) https://bugs.webkit.org/show_bug.cgi?id=145532 Reviewed by Geoffrey Garen. Return `RefPtr` instead of `AtomicStringImpl*`. * wtf/text/AtomicStringImpl.cpp: (WTF::AtomicStringImpl::lookUpSlowCase): (WTF::AtomicStringImpl::lookUpInternal): * wtf/text/AtomicStringImpl.h: (WTF::AtomicStringImpl::lookUp): 2015-06-01 Anders Carlsson Use xpc_connection_set_oneshot_instance where possible https://bugs.webkit.org/show_bug.cgi?id=145535 rdar://problem/21109994 Reviewed by Sam Weinig. Add SPI declaration. * wtf/spi/darwin/XPCSPI.h: 2015-05-29 Anders Carlsson Missing #import of Platform.h in several WTF headers https://bugs.webkit.org/show_bug.cgi?id=145475 rdar://problem/21161818 Reviewed by Darin Adler. Add Platform.h #includes. * wtf/Assertions.h: * wtf/RetainPtr.h: 2015-05-29 Commit Queue Unreviewed, rolling out r184949. https://bugs.webkit.org/show_bug.cgi?id=145458 Ends up generating worse code for HashTable move constructors (Requested by zdobersek on #webkit). Reverted changeset: "Clean up HashTable constructors" https://bugs.webkit.org/show_bug.cgi?id=145369 http://trac.webkit.org/changeset/184949 2015-05-28 Gyuyoung Kim Purge PassRefPtr in StringConcatenate.h https://bugs.webkit.org/show_bug.cgi?id=145376 Reviewed by Darin Adler. Replace PassRefPtr with RefPtr. Additionally use nullptr instead of 0. * wtf/text/StringConcatenate.h: (WTF::tryMakeString): (WTF::makeString): 2015-05-28 Zan Dobersek Clean up HashTable constructors https://bugs.webkit.org/show_bug.cgi?id=145369 Reviewed by Andreas Kling. Use nullptr to initialize pointer member variables in the HashTable default constructor. Copy and move constructors can use constructor delegation instead of replicating all member initializations. Move constructor should simply call HashTable::swap() instead of replicating all the swap operations. * wtf/HashTable.h: (WTF::KeyTraits>::HashTable): 2015-05-27 Alexey Proskuryakov [Mac] Fix clang static analyzer build https://bugs.webkit.org/show_bug.cgi?id=145426 rdar://problem/20947408 Reviewed by Dan Bernstein. * wtf/spi/darwin/XPCSPI.h: Correct declarations of xpc_retain and xpc_release. 2015-05-27 Dean Jackson img.currentSrc problem in strict mode with old picturefill https://bugs.webkit.org/show_bug.cgi?id=144095 Reviewed by Simon Fraser. Add a PICTURE_SIZES flag. * wtf/FeatureDefines.h: 2015-05-26 Andreas Kling StringView should have find(StringView, start). Reviewed by Darin Adler. Move the class agnostic guts of StringImpl's find() implementation from StringImpl to StringCommon.h and templatize the code into a findCommon() helper. StringImpl::find() and StringView::find() now both call findCommon(). * wtf/text/StringCommon.h: (WTF::findInner): (WTF::find): (WTF::findCommon): * wtf/text/StringImpl.cpp: (WTF::StringImpl::find): (WTF::findInner): Deleted. * wtf/text/StringImpl.h: (WTF::find): Deleted. * wtf/text/StringView.cpp: (WTF::StringView::find): * wtf/text/StringView.h: 2015-05-26 Dan Bernstein Update build settings Reviewed by Anders Carlsson. * Configurations/DebugRelease.xcconfig: 2015-05-23 Dan Bernstein Remove unused definitions of WEBKIT_VERSION_MIN_REQUIRED https://bugs.webkit.org/show_bug.cgi?id=145345 Reviewed by Sam Weinig. * Configurations/Base.xcconfig: Also changed to use $(inherited). 2015-05-23 Yusuke Suzuki Introduce UniquedStringImpl and SymbolImpl to separate symbolic strings from AtomicStringImpl https://bugs.webkit.org/show_bug.cgi?id=144848 Reviewed by Darin Adler. he current AtomicStringImpl accidentally means the symbol OR atomic StringImpl. t's not correct to its name and it's error prone. In this patch, we'll introduce/changes classes into WTF. 1. UniquedStringImpl It's derived class from StringImpl. And it represents symbol || atomic StringImpl. 2. SymbolImpl It's derived class from UniquedStringImpl. Only symbol strings can become this. It ensures the given StringImpl is symbol in compile time. 3. AtomicStringImpl It's derived class from UniquedStringImpl. Only atomic (non-normal && non-symbol) strings can become this. It ensures the given StringImpl is atomic in compile time. And, in this time, I just accept UniqueStringImpl in AtomicString. As the result, 1. Now AtomicStringImpl issue is fixed. Its SymbolImpl is separated and UniquedStringImpl is introduced. 2. But AtomicString still have both symbol and atomic strings. This should be solved in the separated patch. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PrintStream.cpp: * wtf/PrintStream.h: (WTF::printInternal): * wtf/text/AtomicString.h: (WTF::AtomicString::AtomicString): * wtf/text/AtomicStringImpl.h: * wtf/text/StringImpl.cpp: (WTF::StringImpl::~StringImpl): (WTF::StringImpl::createSymbol): (WTF::StringImpl::createSymbolEmpty): * wtf/text/StringImpl.h: * wtf/text/SymbolImpl.h: Copied from Source/JavaScriptCore/runtime/PrivateName.h. * wtf/text/SymbolRegistry.cpp: (WTF::SymbolRegistry::symbolForKey): (WTF::SymbolRegistry::keyForSymbol): (WTF::SymbolRegistry::remove): * wtf/text/SymbolRegistry.h: * wtf/text/UniquedStringImpl.h: Copied from Source/JavaScriptCore/runtime/PrivateName.h. 2015-05-20 Zan Dobersek [GTK] Move MainThreadGtk, RunLoopGtk, WorkQueueGtk under Source/WTF/wtf/glib/ https://bugs.webkit.org/show_bug.cgi?id=145117 Reviewed by Csaba Osztrogonác. Move the MainThreadGtk, RunLoopGtk and WorkQueueGtk implementation files from Source/WTF/wtf/gtk/ to Source/WTF/wtf/glib/. These implementations are not GTK-specific and only depend on GLib, so they are renamed as well. There are other such implementations under Source/WTF/wtf/gobject/ (GObject is just a subset of GLib) that will be moved under the new directory in future patches. * wtf/PlatformGTK.cmake: * wtf/glib/MainThreadGLib.cpp: Renamed from Source/WTF/wtf/gtk/MainThreadGtk.cpp. (WTF::initializeMainThreadPlatform): (WTF::scheduleDispatchFunctionsOnMainThread): * wtf/glib/RunLoopGLib.cpp: Renamed from Source/WTF/wtf/gtk/RunLoopGtk.cpp. (WTF::RunLoop::RunLoop): (WTF::RunLoop::~RunLoop): (WTF::RunLoop::run): (WTF::RunLoop::stop): (WTF::RunLoop::wakeUp): (WTF::RunLoop::TimerBase::TimerBase): (WTF::RunLoop::TimerBase::~TimerBase): (WTF::RunLoop::TimerBase::start): (WTF::RunLoop::TimerBase::stop): (WTF::RunLoop::TimerBase::isActive): * wtf/glib/WorkQueueGLib.cpp: Renamed from Source/WTF/wtf/gtk/WorkQueueGtk.cpp. (WTF::WorkQueue::platformInitialize): (WTF::WorkQueue::platformInvalidate): (WTF::WorkQueue::registerSocketEventHandler): (WTF::WorkQueue::unregisterSocketEventHandler): (WTF::WorkQueue::dispatch): (WTF::WorkQueue::dispatchAfter): 2015-05-19 Andreas Kling Give StringView a utf8() API. Reviewed by Anders Carlsson Added an LChar version of StringImpl::utf8ForCharacters() and use that to give StringView a utf8() API just like String has. * wtf/text/StringImpl.cpp: (WTF::StringImpl::utf8ForCharacters): * wtf/text/StringImpl.h: * wtf/text/StringView.cpp: (WTF::StringView::utf8): * wtf/text/StringView.h: 2015-05-19 Yusuke Suzuki Move AtomicStringImpl table related operations from AtomicString to AtomicStringImpl https://bugs.webkit.org/show_bug.cgi?id=145109 Reviewed by Darin Adler. Now AtomicStringImpl table operations are located in AtomicString. But they should be under AtomicStringImpl. This patch simply moves these operations to AtomicStringImpl. And this patch renames static AtomicString::find to static AtomicStringImpl::lookUp because it conflicts with AtomicStringImpl's member function name. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.vcxproj/copy-files.cmd: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PlatformMac.cmake: * wtf/PlatformWin.cmake: * wtf/text/AtomicString.cpp: (WTF::AtomicString::lower): (WTF::AtomicString::convertToASCIILowercase): (WTF::AtomicString::fromUTF8Internal): (WTF::AtomicStringTableLocker::AtomicStringTableLocker): Deleted. (WTF::stringTable): Deleted. (WTF::addToStringTable): Deleted. (WTF::CStringTranslator::hash): Deleted. (WTF::CStringTranslator::equal): Deleted. (WTF::CStringTranslator::translate): Deleted. (WTF::AtomicString::add): Deleted. (WTF::UCharBufferTranslator::hash): Deleted. (WTF::UCharBufferTranslator::equal): Deleted. (WTF::UCharBufferTranslator::translate): Deleted. (WTF::HashAndCharactersTranslator::hash): Deleted. (WTF::HashAndCharactersTranslator::equal): Deleted. (WTF::HashAndCharactersTranslator::translate): Deleted. (WTF::HashAndUTF8CharactersTranslator::hash): Deleted. (WTF::HashAndUTF8CharactersTranslator::equal): Deleted. (WTF::HashAndUTF8CharactersTranslator::translate): Deleted. (WTF::SubstringTranslator::translate): Deleted. (WTF::SubstringTranslator8::hash): Deleted. (WTF::SubstringTranslator8::equal): Deleted. (WTF::SubstringTranslator16::hash): Deleted. (WTF::SubstringTranslator16::equal): Deleted. (WTF::LCharBufferTranslator::hash): Deleted. (WTF::LCharBufferTranslator::equal): Deleted. (WTF::LCharBufferTranslator::translate): Deleted. (WTF::CharBufferFromLiteralDataTranslator::hash): Deleted. (WTF::CharBufferFromLiteralDataTranslator::equal): Deleted. (WTF::CharBufferFromLiteralDataTranslator::translate): Deleted. (WTF::AtomicString::addFromLiteralData): Deleted. (WTF::AtomicString::addSlowCase): Deleted. (WTF::AtomicString::remove): Deleted. (WTF::AtomicString::findSlowCase): Deleted. (WTF::AtomicString::findInternal): Deleted. (WTF::AtomicString::isInAtomicStringTable): Deleted. * wtf/text/AtomicString.h: (WTF::AtomicString::AtomicString): (WTF::AtomicString::fromUTF8): (WTF::AtomicString::find): Deleted. (WTF::AtomicString::add): Deleted. (WTF::AtomicString::addWithStringTableProvider): Deleted. * wtf/text/AtomicStringImpl.cpp: Copied from Source/WTF/wtf/text/AtomicString.cpp. (WTF::AtomicStringTableLocker::AtomicStringTableLocker): (WTF::stringTable): (WTF::addToStringTable): (WTF::CStringTranslator::hash): (WTF::CStringTranslator::equal): (WTF::CStringTranslator::translate): (WTF::AtomicStringImpl::add): (WTF::UCharBufferTranslator::hash): (WTF::UCharBufferTranslator::equal): (WTF::UCharBufferTranslator::translate): (WTF::HashAndCharactersTranslator::hash): (WTF::HashAndCharactersTranslator::equal): (WTF::HashAndCharactersTranslator::translate): (WTF::HashAndUTF8CharactersTranslator::hash): (WTF::HashAndUTF8CharactersTranslator::equal): (WTF::HashAndUTF8CharactersTranslator::translate): (WTF::SubstringTranslator::translate): (WTF::SubstringTranslator8::hash): (WTF::SubstringTranslator8::equal): (WTF::SubstringTranslator16::hash): (WTF::SubstringTranslator16::equal): (WTF::LCharBufferTranslator::hash): (WTF::LCharBufferTranslator::equal): (WTF::LCharBufferTranslator::translate): (WTF::CharBufferFromLiteralDataTranslator::hash): (WTF::CharBufferFromLiteralDataTranslator::equal): (WTF::CharBufferFromLiteralDataTranslator::translate): (WTF::AtomicStringImpl::addLiteral): (WTF::AtomicStringImpl::addSlowCase): (WTF::AtomicStringImpl::remove): (WTF::AtomicStringImpl::lookUpSlowCase): (WTF::AtomicStringImpl::addUTF8): (WTF::AtomicStringImpl::lookUpInternal): (WTF::AtomicStringImpl::isInAtomicStringTable): * wtf/text/AtomicStringImpl.h: (WTF::AtomicStringImpl::lookUp): (WTF::AtomicStringImpl::add): (WTF::AtomicStringImpl::addWithStringTableProvider): (WTF::AtomicStringImpl::AtomicStringImpl): Deleted. * wtf/text/StringImpl.cpp: (WTF::StringImpl::~StringImpl): * wtf/text/StringImpl.h: * wtf/text/WTFString.h: (WTF::String::String): * wtf/text/cf/AtomicStringCF.cpp: (WTF::AtomicString::add): Deleted. * wtf/text/cf/AtomicStringImplCF.cpp: Renamed from Source/WTF/wtf/text/cf/AtomicStringCF.cpp. (WTF::AtomicStringImpl::add): 2015-05-19 Ting-Wei Lan [SOUP] Use st_birthtime to get creation time of files on systems support it https://bugs.webkit.org/show_bug.cgi?id=144989 Reviewed by Carlos Garcia Campos. Define HAVE(STAT_BIRTHTIME) as 1 on operating systems supporting getting creation time of files using st_birthtime in stat. * wtf/Platform.h: 2015-05-19 Chris Dumez Mark static variables as const when possible https://bugs.webkit.org/show_bug.cgi?id=145161 Reviewed by Andreas Kling. * wtf/dtoa.cpp: (WTF::pow5mult): 2015-05-19 Gyuyoung Kim [EFL] Remove unnecessary PLATFORM(EFL) macro in EFL specific files https://bugs.webkit.org/show_bug.cgi?id=145160 Reviewed by Csaba Osztrogonác. * wtf/efl/EflTypedefs.h: Remove PLATFORM(EFL). * wtf/efl/UniquePtrEfl.h: ditto. 2015-05-18 Michael Catanzaro [CMake] Ignore warnings in system headers https://bugs.webkit.org/show_bug.cgi?id=144747 Reviewed by Darin Adler. Separate include directories into WebKit project includes and system includes. Suppress all warnings from headers in system include directories using the SYSTEM argument to the include_directories command. * wtf/CMakeLists.txt: * wtf/PlatformEfl.cmake: * wtf/PlatformGTK.cmake: 2015-05-18 Myles C. Maxfield Addressing post-review comments on r184353 https://bugs.webkit.org/show_bug.cgi?id=145146 Reviewed by Benjamin Poulain. Create an overload for equalIgnoringASCIICase() for AtomicString and string literals. * wtf/text/AtomicString.h: (WTF::equalIgnoringASCIICase): 2015-05-18 Skachkov Alexandr [ES6] Arrow function syntax. Feature flag for arrow function https://bugs.webkit.org/show_bug.cgi?id=145108 Reviewed by Ryosuke Niwa. Added feature flag ENABLE_ES6_ARROWFUNCTION_SYNTAX for arrow function * wtf/FeatureDefines.h: 2015-05-17 Benjamin Poulain Do not use fastMallocGoodSize anywhere https://bugs.webkit.org/show_bug.cgi?id=145103 Reviewed by Michael Saboff. It is silly we see fastMallocGoodSize in profiles, it does absolutely nothing. This patch keeps fastMallocGoodSize() around for older code linking with newer WebKit, but remove any use of it inside WebKit. * wtf/FastMalloc.cpp: (WTF::fastMallocGoodSize): * wtf/FastMalloc.h: * wtf/Vector.h: (WTF::VectorBufferBase::allocateBuffer): (WTF::VectorBufferBase::tryAllocateBuffer): (WTF::VectorBufferBase::reallocateBuffer): 2015-05-15 Dan Bernstein Build fix for some versions of clang. * wtf/SaturatedArithmetic.h: (signedAddOverflows): (signedSubtractOverflows): 2015-05-14 Dan Bernstein Reverted r177753, now that is fixed. Rubber-stamped by Benjamin Poulain. * wtf/SaturatedArithmetic.h: (signedAddOverflows): (signedSubtractOverflows): 2015-05-14 Myles C. Maxfield Add String literal overloads to equalIgnoringASCIICase() https://bugs.webkit.org/show_bug.cgi?id=145008 Reviewed by Benjamin Poulain. Create an overload for equalIgnoringASCIICase for string literals. * wtf/text/StringImpl.h: (WTF::equalIgnoringASCIICase): Use a non-templated helper function. * wtf/text/StringImpl.cpp: (WTF::equalIgnoringASCIICase): Implement it. * wtf/text/StringView.h: (WTF::equalIgnoringASCIICase): Use a non-templated helper function. * wtf/text/StringView.cpp: (WTF::equalIgnoringASCIICase): Implement it. * wtf/text/WTFString.h: (WTF::equalIgnoringASCIICase): Delegate to StringImpl's implementation. 2015-05-14 Žan Doberšek [GTK] RunLoop constructor should properly retrieve or establish the thread-default GMainContext https://bugs.webkit.org/show_bug.cgi?id=144732 Reviewed by Carlos Garcia Campos. RunLoop constructor in the GTK implementation should use the existing thread-default context, create a new one if not on the main thread, or use the global-default one if on the main thread. In RunLoop::run(), the GMainContext should then be pushed as the thread-default before calling g_main_loop_run(), and popped off when the main loop stops. * wtf/gtk/RunLoopGtk.cpp: (WTF::RunLoop::RunLoop): (WTF::RunLoop::run): 2015-05-13 Oliver Hunt Ensure that all the smart pointer types in WTF clear their pointer before deref https://bugs.webkit.org/show_bug.cgi?id=143789 Reviewed by Ryosuke Niwa. In order to prevent use after free bugs caused by destructors that end up trying to access the smart pointer itself, we should make sure we always clear the m_ptr field before calling deref. Essentially the UaF path is: struct Foo : RefCounted { Wibble* m_wibble; void doSomething(); ~Foo() { m_wibble->doSomethingLikeCleanup(); } }; struct Wibble { void doSomethingLikeCleanup() { if (m_foo) { /* if this branch is not here we get a null deref */ m_foo->doSomething(); } } void replaceFoo(Foo* foo) { m_foo = foo; } RefPtr m_foo; }; Wibble* someWibble = /* a Wibble with m_foo->m_refCount == 1 */; /* and m_foo points to someWibble */; someWibble->replaceFoo(someOtherFoo); + someWibble->m_foo->m_ptr->deref(); + someWibble->m_foo->m_ptr->~Foo() + someWibble->m_foo->m_ptr->m_wibble->doSomethingLikeCleanup() + someWibble->m_foo->m_ptr->m_wibble /* someWibble */ ->m_foo->m_ptr /*logically dead*/ ->doSomething() By clearing m_ptr first we either force a null pointer deref or we force our code down a path that does not use the dead smart pointer. * wtf/PassRefPtr.h: (WTF::PassRefPtr::~PassRefPtr): * wtf/Ref.h: (WTF::Ref::~Ref): (WTF::Ref::operator=): * wtf/RefPtr.h: (WTF::RefPtr::~RefPtr): * wtf/RetainPtr.h: (WTF::RetainPtr::~RetainPtr): (WTF::RetainPtr::clear): 2015-05-12 Michael Saboff If JSC cannot get executable memory, it shouldn't call madvise https://bugs.webkit.org/show_bug.cgi?id=144931 Reviewed by Mark Lam. Made calling madvise conditional on really getting mmapped memory. * wtf/OSAllocatorPosix.cpp: (WTF::OSAllocator::reserveUncommitted): 2015-05-11 Brent Fulgham [Win] Move Windows build target to Windows 7 (or newer) https://bugs.webkit.org/show_bug.cgi?id=144890 Reviewed by Anders Carlsson. Update linked SDK and minimal Windows level to be compatible with Windows 7 or newer. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTFGenerated.vcxproj: * config.h: 2015-05-11 Carlos Garcia Campos [GTK] WorkQueue objects are not released https://bugs.webkit.org/show_bug.cgi?id=144824 Reviewed by Žan Doberšek. Do not keep a reference of the WorkQueue for the entire life of its worker thread, since every task scheduled on the WorkQueue already takes a reference. Instead, take a reference of the main loop to make sure that when the worker thread starts, the main loop hasn't been released to avoid runtime warnings (see webkit.org/b/140998). Also removed the g_main_context_pop_thread_default() from the thread body, since the thread-specific context queue will be freed anyway when the thread exits. If the WorkQueue is released early, before the thread has started, schedule a main loop quit in the context, to make sure it will be the first thing run by the main loop and the thread will exit. * wtf/WorkQueue.h: Remove unused event loop mutex. * wtf/gtk/WorkQueueGtk.cpp: (WTF::WorkQueue::platformInitialize): (WTF::WorkQueue::platformInvalidate): 2015-05-09 Yoav Weiss Remove the PICTURE_SIZES build flag https://bugs.webkit.org/show_bug.cgi?id=144679 Reviewed by Benjamin Poulain. Removed the PICTURE_SIZES build time flag. * wtf/FeatureDefines.h: 2015-05-08 Myles C. Maxfield Remove convenience constructors for TextRun https://bugs.webkit.org/show_bug.cgi?id=144752 Reviewed by Anders Carlsson. No reason why StringView shouldn't have a StringImpl* constructor. Test: StringView8Bit in TestWebKitAPI * wtf/text/StringView.h: Add the constructor. 2015-05-08 Commit Queue Unreviewed, rolling out r183996. https://bugs.webkit.org/show_bug.cgi?id=144806 ASan detected use-after free (Requested by ap on #webkit). Reverted changeset: "Remove convenience constructors for TextRun" https://bugs.webkit.org/show_bug.cgi?id=144752 http://trac.webkit.org/changeset/183996 2015-05-08 Myles C. Maxfield Remove convenience constructors for TextRun https://bugs.webkit.org/show_bug.cgi?id=144752 Reviewed by Anders Carlsson. No reason why StringView shouldn't have a StringImpl* constructor. Test: StringView8Bit in TestWebKitAPI * wtf/text/StringView.h: Add the constructor. 2015-05-08 Andreas Kling Optimize serialization of quoted JSON strings. Reviewed by Darin Adler. Add a StringBuilder API for appending a quoted JSON string. This is used by JSON.stringify() to implement efficient appending of strings while escaping quotes, control characters and \uNNNN-style characters. The main benefit comes from only doing a single buffer expansion up front, instead of doing it every time we append something. The fudge factor is pretty large, since the maximum number of output characters per input character is 6. The first landing of this patch had two bugs in it: - Made \uNNNN escapes uppercase hexadecimal instead of lowercase. - Didn't preallocate enough space for 8-bit input strings. Both were caught by existing tests on our bots, and both were due to last-minute changes before landing. :/ * wtf/text/StringBuilder.cpp: (WTF::appendQuotedJSONStringInternal): (WTF::StringBuilder::appendQuotedJSONString): * wtf/text/StringBuilder.h: 2015-05-07 Commit Queue Unreviewed, rolling out r183961. https://bugs.webkit.org/show_bug.cgi?id=144784 Broke js/dom/JSON-stringify.html (Requested by kling on #webkit). Reverted changeset: "Optimize serialization of quoted JSON strings." https://bugs.webkit.org/show_bug.cgi?id=144754 http://trac.webkit.org/changeset/183961 2015-05-07 Andreas Kling Optimize serialization of quoted JSON strings. Reviewed by Darin Adler. Add a StringBuilder API for appending a quoted JSON string. This is used by JSON.stringify() to implement efficient appending of strings while escaping quotes, control characters and \uNNNN-style characters. The main benefit comes from only doing a single buffer expansion up front, instead of doing it every time we append something. The fudge factor is pretty large for 16-bit strings, since the maximum number of output characters per input character is 6. * wtf/text/StringBuilder.cpp: (WTF::appendQuotedJSONStringInternal): (WTF::StringBuilder::appendQuotedJSONString): * wtf/text/StringBuilder.h: 2015-05-07 Martin Robinson [GTK] All spell checking layout tests fail https://bugs.webkit.org/show_bug.cgi?id=144648 Reviewed by Carlos Garcia Campos. * wtf/Platform.h: Activate UNIFIED_TEXT_CHECKING for GTK+. 2015-05-07 Dan Bernstein [Xcode] Remove usage of AspenFamily.xcconfig in Source/ https://bugs.webkit.org/show_bug.cgi?id=144727 Reviewed by Darin Adler. * Configurations/Base.xcconfig: Don’t include AspenFamily.xcconfig, and define INSTALL_PATH_PREFIX and LD_DYLIB_INSTALL_NAME for the iOS 8.x Simulator. 2015-05-07 Žan Doberšek [GTK] Clean up RunLoop implementation https://bugs.webkit.org/show_bug.cgi?id=144729 Reviewed by Carlos Garcia Campos. Clean up the RunLoop implementation for the GTK port, removing unnecessary methods and using simpler variable names. Nested GMainLoops in RunLoop::run() are now created for the RunLoop's GMainContext, and not for the default context (enforced through the null argument to g_main_loop_new()). * wtf/RunLoop.h: * wtf/gtk/RunLoopGtk.cpp: (WTF::RunLoop::RunLoop): (WTF::RunLoop::~RunLoop): (WTF::RunLoop::run): (WTF::RunLoop::stop): (WTF::RunLoop::wakeUp): (WTF::RunLoop::TimerBase::start): (WTF::RunLoop::innermostLoop): Deleted. (WTF::RunLoop::pushNestedMainLoop): Deleted. (WTF::RunLoop::popNestedMainLoop): Deleted. 2015-05-05 Carlos Garcia Campos [GTK] Async operations running in the WorkQueue thread should schedule their sources to the WorkQueue main lopp https://bugs.webkit.org/show_bug.cgi?id=144541 Reviewed by Žan Doberšek. They are currently sent to the main thread run loop, because we are not setting the WorkQueue main context as the default one in the worker thread. * wtf/gtk/WorkQueueGtk.cpp: (WTF::WorkQueue::platformInitialize): Call g_main_context_push_thread_default() to set the WorkQueue main context as the default of the thread before running the main loop, and g_main_context_pop_thread_default() when the main loop quits. 2015-05-04 Commit Queue Unreviewed, rolling out r183661. https://bugs.webkit.org/show_bug.cgi?id=144594 Caused ~3.5MB regression on membuster(!) (Requested by kling_ on #webkit). Reverted changeset: "Decrease minimum Vector size." https://bugs.webkit.org/show_bug.cgi?id=144453 http://trac.webkit.org/changeset/183661 2015-05-04 Zan Dobersek [WTF] Remove Functional.h inclusions https://bugs.webkit.org/show_bug.cgi?id=144400 Reviewed by Darin Adler. Remove most of the Functional.h header inclusions. The header is preserved since it's still used by older versions of Safari, and for the callOnMainThread() stub in DeprecatedSymbolsUsedBySafari.mm. * wtf/MainThread.cpp: * wtf/RunLoop.h: * wtf/WorkQueue.cpp: * wtf/WorkQueue.h: * wtf/efl/DispatchQueueEfl.h: * wtf/efl/DispatchQueueWorkItemEfl.h: 2015-05-02 Commit Queue Unreviewed, rolling out r183722. https://bugs.webkit.org/show_bug.cgi?id=144534 Made all the tests assert (Requested by ap on #webkit). Reverted changeset: "Generated static StringImpls should have static flag set." https://bugs.webkit.org/show_bug.cgi?id=144516 http://trac.webkit.org/changeset/183722 2015-05-02 Andreas Kling Generated static StringImpls should have static flag set. Reviewed by Darin Adler. Discovered this while tracking down a string ref leak. Turns out that the strings generated by StaticString.pm were not getting the static flag set on them. The only practical difference from this AFAICT is that now the garbage collector will correctly see that these strings have no extra memory cost to worry about. * wtf/text/StringImpl.h: 2015-05-01 Martin Robinson USE(...) macro should expect unprefixed variables https://bugs.webkit.org/show_bug.cgi?id=144454 Reviewed by Daniel Bates. * wtf/Assertions.cpp: Replace all occurrences WTF_USE with USE. * wtf/Platform.h: Replace all occurrences WTF_USE with USE. Modify the USE macro to look for unprefixed variables. * wtf/WTFThreadData.h: Replace all occurrences WTF_USE with USE. 2015-05-01 Joseph Pecoraro Enable ENABLE_ES6_TEMPLATE_LITERAL_SYNTAX by default on all ports (Windows was missed) https://bugs.webkit.org/show_bug.cgi?id=144495 Reviewed by Csaba Osztrogonác. * wtf/FeatureDefines.h: This covers all ports that haven't defined the flag otherwise. 2015-04-30 Alex Christensen Decrease minimum Vector size. https://bugs.webkit.org/show_bug.cgi?id=144453 Reviewed by Andreas Kling. * wtf/Vector.h: Make the default min size 4 to save memory on small Vectors. 2015-04-30 Yusuke Suzuki Use the default hash value for Symbolized StringImpl https://bugs.webkit.org/show_bug.cgi?id=144347 Reviewed by Darin Adler. Use a default hash value calculation for symbolized StringImpl. * wtf/text/StringImpl.cpp: (WTF::StringImpl::createSymbol): * wtf/text/StringImpl.h: (WTF::StringImpl::StringImpl): (WTF::StringImpl::symbolAwareHash): (WTF::StringImpl::existingSymbolAwareHash): (WTF::StringImpl::hashForSymbol): * wtf/text/StringStatics.cpp: (WTF::StringImpl::nextHashForSymbol): (WTF::StringImpl::hashAndFlagsForSymbol): Deleted. 2015-04-29 Alexey Proskuryakov LazyNeverDestroyed is not thread safe in debug builds, causing assertions https://bugs.webkit.org/show_bug.cgi?id=144378 Reviewed by Darin Adler. * wtf/NeverDestroyed.h: 2015-04-28 Geoffrey Garen It shouldn't take 1846 lines of code and 5 FIXMEs to sort an array. https://bugs.webkit.org/show_bug.cgi?id=144013 Reviewed by Mark Lam. Remove this custom tree implementation because it is unused. (It was previously used to achieve a stable array sort in certain cases.) * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/AVLTree.h: Removed. * wtf/CMakeLists.txt: 2015-04-29 Myles C. Maxfield [OS X] Use CTFontCreateForCSS instead of doing font search ourselves https://bugs.webkit.org/show_bug.cgi?id=132159 Reviewed by Darin Adler. * wtf/Platform.h: Opt-in using ENABLE(PLATFORM_FONT_LOOKUP) 2015-04-29 Yusuke Suzuki REGRESSION (r183373): ASSERT failed in wtf/SHA1.h https://bugs.webkit.org/show_bug.cgi?id=144257 Reviewed by Darin Adler. * wtf/SHA1.h: (WTF::SHA1::addBytes): 2015-04-29 Martin Robinson [CMake] [GTK] Organize and clean up unused CMake variables https://bugs.webkit.org/show_bug.cgi?id=144364 Reviewed by Gyuyoung Kim. * wtf/PlatformGTK.cmake: Add variables specific to this project. 2015-04-28 Michael Catanzaro Fully replace ENABLE_LLINT_C_LOOP with ENABLE_JIT https://bugs.webkit.org/show_bug.cgi?id=144304 Reviewed by Geoffrey Garen. No longer check ENABLE_LLINT_C_LOOP to determine the value of ENABLE_JIT. * wtf/Platform.h: 2015-04-28 Commit Queue Unreviewed, rolling out r183514. https://bugs.webkit.org/show_bug.cgi?id=144359 It broke cloop test bots (Requested by mcatanzaro on #webkit). Reverted changeset: "Fully replace ENABLE_LLINT_C_LOOP with ENABLE_JIT" https://bugs.webkit.org/show_bug.cgi?id=144304 http://trac.webkit.org/changeset/183514 2015-04-28 Michael Catanzaro Fully replace ENABLE_LLINT_C_LOOP with ENABLE_JIT https://bugs.webkit.org/show_bug.cgi?id=144304 Reviewed by Geoffrey Garen. No longer check ENABLE_LLINT_C_LOOP to determine the value of ENABLE_JIT. * wtf/Platform.h: 2015-04-28 Alex Christensen Properly reset deleted count when clearing HashTables. https://bugs.webkit.org/show_bug.cgi?id=144343 Reviewed by Andreas Kling. * wtf/HashTable.h: (WTF::KeyTraits>::clear): Reset m_deletedCount, which appears to have been forgotten. 2015-04-28 Alex Christensen [Content Extensions] Use less memory for CombinedURLFilters. https://bugs.webkit.org/show_bug.cgi?id=144290 Reviewed by Andreas Kling. * wtf/Forward.h: * wtf/Vector.h: Added a minCapacity template parameter to allow changing the minimum size of an allocated buffer. The default minCapacity is kept at 16 unless otherwise specified to have no change on existing code, but this could be changed later. A smaller default minCapacity would use less memory with small Vectors but spend more time copying when expanding to large Vectors. 2015-04-27 Brent Fulgham [Win] Deactivate WebGL until Windows tests work properly https://bugs.webkit.org/show_bug.cgi?id=144291 Reviewed by Zalan Bujtas. * wtf/FeatureDefines.h: Force WebGL off for Windows builds. 2015-04-27 Michael Catanzaro Rename WTF_USE_3D_GRAPHICS to ENABLE_GRAPHICS_CONTEXT_3D https://bugs.webkit.org/show_bug.cgi?id=144193 Reviewed by Darin Adler. * wtf/FeatureDefines.h: * wtf/Platform.h: 2015-04-22 Martin Robinson [CMake] Autogenerate cmakeconfig.h.cmake https://bugs.webkit.org/show_bug.cgi?id=143997 Reviewed by Csaba Osztrogonác. * wtf/Platform.h: Move a GTK-specific setting from cmakeconfig.h to here. 2015-04-25 Martin Robinson Rename ENABLE_3D_RENDERING to ENABLE_3D_TRANSFORMS https://bugs.webkit.org/show_bug.cgi?id=144182 Reviewed by Simon Fraser. * wtf/FeatureDefines.h: Replace all instances of 3D_RENDERING with 3D_TRANSFORMS. 2015-04-24 Commit Queue Unreviewed, rolling out r183288. https://bugs.webkit.org/show_bug.cgi?id=144189 Made js/sort-with-side-effecting-comparisons.html time out in debug builds (Requested by ap on #webkit). Reverted changeset: "It shouldn't take 1846 lines of code and 5 FIXMEs to sort an array." https://bugs.webkit.org/show_bug.cgi?id=144013 http://trac.webkit.org/changeset/183288 2015-04-21 Geoffrey Garen It shouldn't take 1846 lines of code and 5 FIXMEs to sort an array. https://bugs.webkit.org/show_bug.cgi?id=144013 Reviewed by Mark Lam. Remove this custom tree implementation because it is unused. (It was previously used to achieve a stable array sort in certain cases.) * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/AVLTree.h: Removed. * wtf/CMakeLists.txt: 2015-04-24 Darin Adler Convert OwnPtr and PassOwnPtr uses to std::unique_ptr https://bugs.webkit.org/show_bug.cgi?id=128007 Reviewed by Anders Carlsson. * WTF.vcxproj/WTF.vcxproj: Removed OwnPtr source files. * WTF.vcxproj/WTF.vcxproj.filters: Ditto. * WTF.xcodeproj/project.pbxproj: Ditto. * wtf/CMakeLists.txt: Ditto. * wtf/Forward.h: Removed OwnPtr and PassOwnPtr. * wtf/HashTraits.h: Ditto. * wtf/OwnPtr.h: Removed. * wtf/OwnPtrCommon.h: Removed. * wtf/PassOwnPtr.h: Removed. * wtf/SizeLimits.cpp: Removed OwnPtr. * wtf/VectorTraits.h: Removed OwnPtr specialization. 2015-04-23 Jer Noble Disable HAVE_AVKIT on AppleTV https://bugs.webkit.org/show_bug.cgi?id=144142 Reviewed by Dan Bernstein. * wtf/Platform.h: 2015-04-23 Alexey Proskuryakov [iOS] WebKit services should inherit environment variables for home https://bugs.webkit.org/show_bug.cgi?id=144078 rdar://problem/20571678 Reviewed by Dan Bernstein. * wtf/spi/darwin/XPCSPI.h: Added xpc_copy_bootstrap and xpc_dictionary_apply. 2015-04-23 Alexey Proskuryakov Undo the WTF part of the previous build fix, we don't use private headers in WTF. * WTF.xcodeproj/project.pbxproj: 2015-04-23 Alexey Proskuryakov Build fix. * WTF.xcodeproj/project.pbxproj: Make RAMSize.h a private header, now that it's used from outside WTF. 2015-04-23 Andreas Kling There should only be one way to get the system memory size. Reviewed by Antti Koivisto. Merge all the logic from other RAM size fetcher helpers into WTF's. Darwin ports now use host_info() instead of sysctl(), since that was the more common way of doing this. Also bumped the fallback answer from 128 MB to 512 MB to bring it closer to today's hardware. Finally, the number is rounded up to the next multiple of 128 MB, to avoid misunderstandings on some systems where the number returned by the kernel is slightly lower than the marketing number. Removed the "fudging" that was used in some places, since this fixes that cleanly. * wtf/RAMSize.cpp: (WTF::computeRAMSize): 2015-04-22 Darin Adler Eliminate remaining uses of OwnPtr and PassOwnPtr in WebCore outside the editing and platform directories https://bugs.webkit.org/show_bug.cgi?id=143949 Reviewed by Andreas Kling. * wtf/MathExtras.h: (wtf_ceil): Deleted. This was a workaround for a bug that was introduced in Leopard and fixed in Snow Leopard , so we don't need the workaround any more. 2015-04-22 Alexey Proskuryakov [Mac] In nightlies and local builds, WebKit services can get terminated under memory pressure https://bugs.webkit.org/show_bug.cgi?id=144052 rdar://problem/19754404 Build fix. Landing a forward declaration that should have been part of the original patch. * wtf/spi/darwin/XPCSPI.h: 2015-04-21 Chris Dumez Make Vector(const Vector&) constructor explicit https://bugs.webkit.org/show_bug.cgi?id=143970 Reviewed by Darin Adler. Make Vector(const Vector&) constructor explicit as it copies the vector and it is easy to call it by mistake. * wtf/RefCountedArray.h: (WTF::RefCountedArray::RefCountedArray): * wtf/Vector.h: 2015-04-21 Darin Adler Remove some stray uses of OwnPtr and PassOwnPtr in WTF (outside of the template definitions and traits) https://bugs.webkit.org/show_bug.cgi?id=143944 Reviewed by Andreas Kling. * wtf/FilePrintStream.h: Removed unneeded include. * wtf/HashTable.h: Fixed class template name in comment. * wtf/HashTraits.h: Removed unneeded forward declaration. * wtf/ListHashSet.h: Removed unneeded includes. * wtf/ThreadingWin.cpp: Removed unneeded includes. (WTF::wtfThreadEntryPoint): Changed code to use unique_ptr. (WTF::createThreadInternal): Changed code to use make_unique and release. * wtf/efl/RunLoopEfl.cpp: Removed unneeded includes. 2015-04-19 Darin Adler Update RefPtr documentation and deprecation https://bugs.webkit.org/show_bug.cgi?id=143936 Reviewed by Andreas Kling. * WTF.vcxproj/WTF.vcxproj: Removed PassRef.h * WTF.vcxproj/WTF.vcxproj.filters: Ditto. * WTF.xcodeproj/project.pbxproj: Ditto. * wtf/CMakeLists.txt: Ditto. 2015-04-17 Alexey Proskuryakov Use ASan poisoning to taint moved-out-of Refs https://bugs.webkit.org/show_bug.cgi?id=143894 rdar://problem/19443723 Reviewed by Darin Adler. * wtf/Ref.h: (WTF::Ref::~Ref): 2015-04-17 Alexey Proskuryakov Remove unused BoundsCheckedPointer https://bugs.webkit.org/show_bug.cgi?id=143896 Reviewed by Geoffrey Garen. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/BoundsCheckedPointer.h: Removed. * wtf/CMakeLists.txt: 2015-04-16 Yusuke Suzuki [ES6] Implement Symbol.for and Symbol.keyFor https://bugs.webkit.org/show_bug.cgi?id=143404 Reviewed by Geoffrey Garen. When we register symbolized StringImpl* into SymbolRegistry, symbolized StringImpl* is aware of that. And when destructing it, it removes its reference from SymbolRegistry as if atomic StringImpl do so with AtomicStringTable. While AtomicStringTable (in WebCore case) exists in thread local storage, SymbolRegistry exists per VM and StringImpl* has a reference to the registered SymbolRegistry. Since StringImpl has isSymbol etc. members, it's class is aware of Symbol use cases. So introduce SymbolRegistry in WTF layers as if AtomicStringTable. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/text/AtomicString.cpp: (WTF::AtomicString::addSlowCase): (WTF::AtomicString::findSlowCase): (WTF::AtomicString::findInternal): (WTF::AtomicString::find): Deleted. * wtf/text/AtomicString.h: (WTF::AtomicString::find): * wtf/text/StringImpl.cpp: (WTF::StringImpl::~StringImpl): (WTF::StringImpl::createSymbol): (WTF::StringImpl::createSymbolEmpty): * wtf/text/StringImpl.h: (WTF::StringImpl::StringImpl): (WTF::StringImpl::extractFoldedStringInSymbol): (WTF::StringImpl::symbolRegistry): (WTF::StringImpl::createSymbolEmpty): Deleted. * wtf/text/SymbolRegistry.cpp: Copied from Source/JavaScriptCore/runtime/SymbolConstructor.h. (WTF::SymbolRegistry::~SymbolRegistry): (WTF::SymbolRegistry::symbolForKey): (WTF::SymbolRegistry::keyForSymbol): (WTF::SymbolRegistry::remove): * wtf/text/SymbolRegistry.h: Added. (WTF::SymbolRegistryKey::hash): (WTF::SymbolRegistryKey::impl): (WTF::SymbolRegistryKey::isHashTableDeletedValue): (WTF::SymbolRegistryKey::hashTableDeletedValue): (WTF::DefaultHash::Hash::hash): (WTF::DefaultHash::Hash::equal): (WTF::HashTraits::isEmptyValue): (WTF::SymbolRegistryKey::SymbolRegistryKey): 2015-04-16 Antti Koivisto Use CommonCrypto for SHA1 and MD5 https://bugs.webkit.org/show_bug.cgi?id=143826 Reviewed by Anders Carlsson. CommonCrypto SHA1 implementation is ~4x faster than the naive WTF one. Use it when available. These are covered by existing API tests. * wtf/MD5.cpp: (WTF::MD5::MD5): (WTF::MD5::addBytes): (WTF::MD5::checksum): * wtf/MD5.h: * wtf/SHA1.cpp: (WTF::SHA1::SHA1): (WTF::SHA1::addBytes): (WTF::SHA1::computeHash): Remove the side effect where computeHash resets the state. No one relies on it. (WTF::SHA1::hexDigest): (WTF::SHA1::computeHexDigest): * wtf/SHA1.h: 2015-04-16 Csaba Osztrogonác Remove the unnecessary WTF_CHANGES define https://bugs.webkit.org/show_bug.cgi?id=143825 Reviewed by Andreas Kling. * config.h: 2015-04-15 Руслан Ижбулатов Harmonize binary semaphore ifdefs They should be either OS(WINDOWS) (in which case we'd need BinarySemaphoreWin.cpp, which is not shipped by WebKitGTK) or PLATFORM(WIN) (in which case Mutex/ThreadCondition-based implementation is used). This fixes errors like: CXX Source/WTF/wtf/threads/libWTF_la-BinarySemaphore.lo ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp: In constructor 'WTF::BinarySemaphore::BinarySemaphore()': ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:34:7: error: class 'WTF::BinarySemaphore' does not have any field named 'm_isSet' : m_isSet(false) ^ ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp: In member function 'void WTF::BinarySemaphore::signal()': ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:44:24: error: 'm_mutex' was not declared in this scope MutexLocker locker(m_mutex); ^ ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:46:5: error: 'm_isSet' was not declared in this scope m_isSet = true; ^ ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:47:5: error: 'm_condition' was not declared in this scope m_condition.signal(); ^ ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp: In member function 'bool WTF::BinarySemaphore::wait(double)': ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:52:24: error: 'm_mutex' was not declared in this scope MutexLocker locker(m_mutex); ^ ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:55:13: error: 'm_isSet' was not declared in this scope while (!m_isSet) { ^ ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:56:21: error: 'm_condition' was not declared in this scope timedOut = !m_condition.timedWait(m_mutex, absoluteTime); ^ ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:62:5: error: 'm_isSet' was not declared in this scope m_isSet = false; ^ GNUmakefile:52762: recipe for target 'Source/WTF/wtf/threads/libWTF_la-BinarySemaphore.lo' failed [W32] Inconsistent ifdefs in BinarySemaphore.h and BinarySemaphore.cpp https://bugs.webkit.org/show_bug.cgi?id=143756 Reviewed by Darin Adler. * wtf/threads/BinarySemaphore.h: 2015-04-12 Michael Catanzaro Fix -Wparentheses warning with GCC 5 in SaturatedArithmetic.h https://bugs.webkit.org/show_bug.cgi?id=143457 Reviewed by Benjamin Poulain. Tested by WTF.SaturatedArithmeticAddition and WTF.SaturatedArithmeticSubtraction. * wtf/SaturatedArithmetic.h: (signedAddOverflows): Use && instead of & to avoid triggering -Wparentheses in newer versions of GCC and Clang, and to improve the clarity of the function. (signedSubtractOverflows): Changed correspondingly, although there was no warning here. 2015-04-08 Sam Weinig Allow LaunchServices to handle URLs on link navigations https://bugs.webkit.org/show_bug.cgi?id=143544 Reviewed by Anders Carlsson. * wtf/Platform.h: Add HAVE macro for this functionality. 2015-04-09 Andy Estes [Cocoa] Add a HAVE(AVKIT) and use it https://bugs.webkit.org/show_bug.cgi?id=143593 Reviewed by David Kilzer. * wtf/Platform.h: Defined HAVE(AVKIT) to be true on all Cocoa platforms except Watch OS. 2015-04-09 Andy Estes [Content Filtering] Add a HAVE(PARENTAL_CONTROLS) and use it https://bugs.webkit.org/show_bug.cgi?id=143559 Reviewed by David Kilzer. Added PLATFORM(WATCHOS). Used PLATFORM() since Watch OS is just a variant of OS(IOS). Defined HAVE(PARENTAL_CONTROLS) to be true on all Cocoa platforms except Watch OS. * wtf/Platform.h: 2015-04-08 Alex Christensen and Patrick Gansterer Add CMake build system for WinCairo port. https://bugs.webkit.org/show_bug.cgi?id=115944 Reviewed by Chris Dumez. * wtf/FeatureDefines.h: * wtf/PlatformWin.cmake: 2015-04-05 Antti Koivisto Bloom filter should support longer hashes https://bugs.webkit.org/show_bug.cgi?id=143419 Reviewed by Dan Bernstein. It currently supports 'unsigned' hash only which is inconvenient and doesn't have enough independent bits for larger filters. Support arbitrarily sized hashes of type std::array (like SHA1::Digest and MD5::Digest). * wtf/BloomFilter.h: (WTF::BloomFilter::keysFromHash): (WTF::BloomFilter::mayContain): (WTF::BloomFilter::add): 2015-04-03 Antti Koivisto Add non-counting Bloom filter implementation https://bugs.webkit.org/show_bug.cgi?id=143366 Reviewed by Sam Weinig. Add a traditional single-bit-per-bucket Bloom filter in addition to the existing counting implementation. - rename BloomFilter -> CountingBloomFilter. - add a new basic BloomFilter type. - update some terminology to match http://en.wikipedia.org/wiki/Bloom_filter and modernize the code a bit. - add API tests. * wtf/BloomFilter.h: (WTF::BloomFilter::BloomFilter): (WTF::BloomFilter::add): Also support merging. (WTF::BloomFilter::mayContain): (WTF::BloomFilter::arrayIndex): (WTF::BloomFilter::bitMask): (WTF::BloomFilter::mayContain): (WTF::BloomFilter::add): (WTF::BloomFilter::isBitSet): (WTF::BloomFilter::setBit): (WTF::BloomFilter::clear): (WTF::CountingBloomFilter::CountingBloomFilter): (WTF::CountingBloomFilter::mayContain): (WTF::CountingBloomFilter::firstBucket): (WTF::CountingBloomFilter::secondBucket): (WTF::CountingBloomFilter::add): (WTF::CountingBloomFilter::remove): (WTF::CountingBloomFilter::clear): (WTF::CountingBloomFilter::likelyEmpty): (WTF::CountingBloomFilter::isClear): (WTF::BloomFilter::maximumCount): Deleted. (WTF::BloomFilter::firstSlot): Deleted. (WTF::BloomFilter::secondSlot): Deleted. (WTF::BloomFilter::remove): Deleted. (WTF::BloomFilter::likelyEmpty): Deleted. (WTF::BloomFilter::isClear): Deleted. 015-04-01 Antti Koivisto Value assignment operator of Optional should be stricter https://bugs.webkit.org/show_bug.cgi?id=143303 Reviewed by Andreas Kling. struct Foo { mutable Optional s; }; Foo foo, foo2; foo = foo2; doesn't build because it tries to use wrong operator=. * wtf/Optional.h: Add enable_if test similar to std::experimental::optional. 2015-04-01 Alex Christensen Progress towards CMake on Windows and Mac. https://bugs.webkit.org/show_bug.cgi?id=143293 Reviewed by Filip Pizlo. * wtf/CMakeLists.txt: Don't use bmalloc on Windows yet. * wtf/FeatureDefines.h: Temporarily disabled WebGL on Windows CMake builds. * wtf/PlatformMac.cmake: Tell open source builders where to find unicode headers. 2015-03-31 Alexey Proskuryakov Fix the build after . * wtf/text/StringImpl.h: (WTF::StringImpl::extractFoldedStringInSymbol): A function cannot be both exported and inline. 2015-03-31 Yusuke Suzuki Clean up Identifier factories to clarify the meaning of StringImpl* https://bugs.webkit.org/show_bug.cgi?id=143146 Reviewed by Filip Pizlo. Introduce StringKind into `StringImpl`. There's 3 kinds 1. StringNormal (non-atomic, non-symbol) 2. StringAtomic (atomic, non-symbol) 3. StringSymbol (non-atomic, symbol) They are mutually exclusive. * wtf/text/AtomicString.cpp: (WTF::AtomicString::addSlowCase): (WTF::AtomicString::findSlowCase): When registering a string into AtomicStringTable, it should not be a symbol string because symbol and atomic types are mutually exclusive. When a symbol string comes, we extract an owner string from a symbol string by using `StringImpl::extractFoldedStringInSymbol()`. It always succeeds because a symbol (non empty) string is always BufferSubstring and has an owner string. Empty symbol string doesn't have an owner string. This case is filtered by `!string.length()` guard. * wtf/text/AtomicString.h: (WTF::AtomicString::add): (WTF::AtomicString::addWithStringTableProvider): * wtf/text/StringImpl.cpp: (WTF::StringImpl::~StringImpl): (WTF::StringImpl::createSymbol): (WTF::StringImpl::createUnique): Deleted. * wtf/text/StringImpl.h: (WTF::StringImpl::StringImpl): (WTF::StringImpl::createSymbolEmpty): (WTF::StringImpl::flagIsAtomic): (WTF::StringImpl::flagIsSymbol): (WTF::StringImpl::maskStringKind): (WTF::StringImpl::stringKind): (WTF::StringImpl::isSymbol): (WTF::StringImpl::isAtomic): (WTF::StringImpl::setIsAtomic): (WTF::StringImpl::extractFoldedStringInSymbol): (WTF::StringImpl::createUniqueEmpty): Deleted. (WTF::StringImpl::flagIsUnique): Deleted. (WTF::StringImpl::isUnique): Deleted. * wtf/text/StringStatics.cpp: (WTF::StringImpl::hashAndFlagsForSymbol): (WTF::StringImpl::hashAndFlagsForUnique): Deleted. 2015-03-30 Gyuyoung Kim [CMake][EFL] Remove redundant library link and include path https://bugs.webkit.org/show_bug.cgi?id=143221 Reviewed by Csaba Osztrogonác. * wtf/PlatformEfl.cmake: Remove unnecessary library link and include path. 2015-03-27 Myles C. Maxfield Support building WTF on Windows without Cygwin https://bugs.webkit.org/show_bug.cgi?id=143084 Reviewed by Brent Fulgham. Windows doesn't have "touch". * WTF.vcxproj/WTFGenerated.make: 2015-03-26 Alex Christensen Progress towards CMake on Mac. https://bugs.webkit.org/show_bug.cgi?id=143112 Reviewed by Chris Dumez. * wtf/PlatformMac.cmake: 2015-03-25 Filip Pizlo Unreviewed, we have edited this file in 2015. * wtf/Platform.h: 2015-03-25 Filip Pizlo Heap variables shouldn't end up in the stack frame https://bugs.webkit.org/show_bug.cgi?id=141174 Reviewed by Geoffrey Garen. * wtf/FastBitVector.h: (WTF::FastBitVector::resize): Small change: don't resize if you don't have to resize. 2015-03-25 Filip Pizlo Change Atomic methods from using the_wrong_naming_conventions to using theRightNamingConventions. Also make seq_cst the default. Rubber stamped by Geoffrey Garen. * wtf/Atomics.h: (WTF::Atomic::load): (WTF::Atomic::store): (WTF::Atomic::compareExchangeWeak): (WTF::Atomic::compareExchangeStrong): (WTF::Atomic::compare_exchange_weak): Deleted. (WTF::Atomic::compare_exchange_strong): Deleted. * wtf/ByteSpinLock.h: (WTF::ByteSpinLock::lock): * wtf/SpinLock.h: (WTF::SpinLockBase::lock): 2015-03-24 Beth Dakin Add events related to force click gesture https://bugs.webkit.org/show_bug.cgi?id=142836 -and corresponding- rdar://problem/20210239 Reviewed by Dean Jackson. New enable flag for the events. * wtf/FeatureDefines.h: 2015-03-23 Filip Pizlo JSC should have a low-cost asynchronous disassembler https://bugs.webkit.org/show_bug.cgi?id=142997 Reviewed by Mark Lam. * wtf/StringPrintStream.h: 2015-03-22 Benjamin Poulain CSS Selectors: fix attribute case-insensitive matching of Contain and List https://bugs.webkit.org/show_bug.cgi?id=142932 Reviewed by Darin Adler. Add some utility functions to the string classes to find substrings using ASCII case-insensitive comparisons. * wtf/text/AtomicString.h: (WTF::AtomicString::contains): Add the light version that only lock one register. (WTF::AtomicString::containsIgnoringASCIICase): (WTF::AtomicString::findIgnoringASCIICase): * wtf/text/StringCommon.h: (WTF::findIgnoringASCIICase): This is the common implementation used by StringView and StringImpl. * wtf/text/StringImpl.cpp: (WTF::StringImpl::findIgnoringASCIICase): * wtf/text/StringImpl.h: * wtf/text/StringView.cpp: (WTF::StringView::containsIgnoringASCIICase): (WTF::StringView::findIgnoringASCIICase): * wtf/text/StringView.h: * wtf/text/WTFString.h: (WTF::String::findIgnoringASCIICase): (WTF::String::contains): (WTF::String::containsIgnoringASCIICase): 2015-03-19 Andreas Kling DFGAllocator should use bmalloc's aligned allocator. Reviewed by Geoffrey Garen. Remove PageAllocationAligned since it has no more clients. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PageAllocationAligned.cpp: Removed. * wtf/PageAllocationAligned.h: Removed. 2015-03-18 Dhi Aurrahman Fix StringView misplaced implementations after r181525 and r181558 https://bugs.webkit.org/show_bug.cgi?id=142772 Reviewed by Darin Adler. Fix misplaced implementations in StringView::startsWithIgnoringASCIICase and StringView::endsWith. Add some tests in [1] to cover the StringView::startsWith, StringView::startsWithIgnoringASCIICase, StringView::endsWith and StringView::endsWithIgnoringASCIICase implementations. [1] Tools/TestWebKitAPI/Tests/WTF/StringView.cpp. * wtf/text/StringView.cpp: (WTF::StringView::startsWithIgnoringASCIICase): (WTF::StringView::endsWith): (WTF::StringView::endsWithIgnoringASCIICase): 2015-03-17 Michael Saboff Windows X86-64 should use the fixed executable allocator https://bugs.webkit.org/show_bug.cgi?id=142749 Reviewed by Filip Pizlo. Set ENABLE_EXECUTABLE_ALLOCATOR_FIXED for Windows. Needed to export MetaAllocator::currentStatistics() for use in JavaScriptCore. * wtf/MetaAllocator.h: * wtf/Platform.h: 2015-03-16 Ryosuke Niwa Enable ES6 classes by default https://bugs.webkit.org/show_bug.cgi?id=142774 Reviewed by Gavin Barraclough. * wtf/FeatureDefines.h: 2015-03-16 Csaba Osztrogonác [ARM] Enable generating idiv instructions if it is supported https://bugs.webkit.org/show_bug.cgi?id=142725 Reviewed by Michael Saboff. * wtf/Platform.h: Set HAVE_ARM_IDIV_INSTRUCTIONS based on GCC macro too. 2015-03-16 Benjamin Poulain Fix StringView after r181525 Unreviewed. Fix 2 silly mistakes I made in r181525. * wtf/text/StringView.cpp: (WTF::StringView::startsWith): (WTF::StringView::startsWithIgnoringASCIICase): (WTF::StringView::endsWith): (WTF::StringView::endsWithIgnoringASCIICase): The implementation was inside the #ifdef. * wtf/text/StringView.h: The symbols were not exported. 2015-03-16 Max Stepin Add APNG support https://bugs.webkit.org/show_bug.cgi?id=17022 Reviewed by Carlos Garcia Campos. * wtf/FeatureDefines.h: 2015-03-15 Benjamin Poulain CSS: fix the case-insensitive matching of the attribute selectors Begin, End and Hyphen https://bugs.webkit.org/show_bug.cgi?id=142715 Reviewed by Brent Fulgham. Add the necessary infrastructure to test startsWith() and endsWith() with ASCII case-insentive comparisons. * wtf/text/AtomicString.h: (WTF::AtomicString::startsWith): (WTF::AtomicString::startsWithIgnoringASCIICase): (WTF::AtomicString::endsWith): (WTF::AtomicString::endsWithIgnoringASCIICase): * wtf/text/StringCommon.h: (WTF::loadUnaligned): (WTF::equal): I moved the low level equal() code from StringImpl to StringCommon since it is used by both StringImpl and StringView. (WTF::equalCommon): (WTF::equalIgnoringASCIICaseCommon): Ideally we should drop the "Common" part of the name but StringView wants this inline for some reason. I prefered keeping the current behavior since I don't know how StringView's matching performance was evaluated. (WTF::startsWith): (WTF::startsWithIgnoringASCIICase): (WTF::endsWith): (WTF::endsWithIgnoringASCIICase): Make all that code shared between StringView and Stringimpl. * wtf/text/StringImpl.cpp: (WTF::StringImpl::startsWith): (WTF::StringImpl::startsWithIgnoringASCIICase): (WTF::StringImpl::endsWith): (WTF::StringImpl::endsWithIgnoringASCIICase): (WTF::equal): (WTF::stringImplContentEqual): Deleted. * wtf/text/StringImpl.h: (WTF::loadUnaligned): Deleted. (WTF::equal): Deleted. * wtf/text/StringView.cpp: (WTF::StringView::startsWith): (WTF::StringView::startsWithIgnoringASCIICase): (WTF::StringView::endsWith): (WTF::StringView::endsWithIgnoringASCIICase): * wtf/text/StringView.h: Since those are new, we can safely make them out-of-line and evaluate the inlining impact as needed. * wtf/text/WTFString.h: (WTF::String::startsWithIgnoringASCIICase): (WTF::String::endsWith): (WTF::String::endsWithIgnoringASCIICase): 2015-03-15 Benjamin Poulain Change the exact attribute matching to be ASCII case-insensitive https://bugs.webkit.org/show_bug.cgi?id=142609 Reviewed by Darin Adler. Add support for ASCII case insensitive comparisons to all the string classes. The new file StringCommon.h has the common algorithm to avoid repeating the same code with different types. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * wtf/ASCIICType.h: (WTF::toASCIILower): * wtf/CMakeLists.txt: * wtf/text/AtomicString.h: (WTF::equalIgnoringASCIICase): * wtf/text/StringCommon.h: Added. (WTF::equalIgnoringASCIICase): (WTF::equalIgnoringASCIICaseCommon): * wtf/text/StringImpl.cpp: (WTF::equalIgnoringASCIICase): (WTF::equalIgnoringASCIICaseNonNull): (WTF::StringImpl::utf8Impl): (WTF::StringImpl::defaultWritingDirection): Deleted. (WTF::StringImpl::adopt): Deleted. (WTF::StringImpl::sizeInBytes): Deleted. (WTF::putUTF8Triple): Deleted. (WTF::StringImpl::utf8): Deleted. * wtf/text/StringImpl.h: (WTF::StringImpl::isSubString): Deleted. (WTF::find): Deleted. 2015-03-14 Michael Saboff Disable Yarr JIT for ARMv7k https://bugs.webkit.org/show_bug.cgi?id=142645 Rubber stamped by Geoffrey Garen. Changed the setting of ENABLE_YARR_JIT to be predicated on ENABLED_JIT. * wtf/Platform.h: 2015-03-14 Michael Saboff ES6: Add binary and octal literal support https://bugs.webkit.org/show_bug.cgi?id=142681 Reviewed by Ryosuke Niwa. * wtf/ASCIICType.h: (WTF::isASCIIBinaryDigit): New support function. (WTF::isASCIIOctalDigit): Updated to use logical and (&&) instead of binary and (&). 2015-03-13 Mark Lam Replace TCSpinLock with a new WTF::SpinLock based on WTF::Atomic. Reviewed by Filip Pizlo. We no longer use TCMalloc in our code, and we now have C++11. This replaces the TCMalloc_SpinLock with a new WTF::SpinLock based on WTF::Atomic (which is a wrapper around std::atomic). Note that there is a StaticSpinLock and a SpinLock: 1. StaticSpinLock is an alias for SpinLockBase, and its initialization relies on static / global std:atomic being automatically initialized to 0 at compile time. Hence, StaticSpinLock should only be used for statics / globals (including static members of classes / structs). 2. SpinLock is derived from SpinLockBase, and adds a default constructor to initialize its internal atomic value to 0. Because SpinLock has a constructor, it cannot be used for statics / globals. Objects that want to embed a spin lock as an instance field should use SpinLock so that it is initialized properly. std::atomic will not automatically initialize instance fields to 0. Hence, StaticSpinLock will not work correctly as instance fields of a class / struct. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::~MetaAllocator): (WTF::MetaAllocator::MetaAllocator): * wtf/MetaAllocator.h: * wtf/SpinLock.h: Added. (WTF::SpinLockBase::lock): (WTF::SpinLockBase::unlock): (WTF::SpinLockBase::isLocked): (WTF::SpinLockBase::slowLock): (WTF::SpinLock::SpinLock): * wtf/TCSpinLock.h: Removed. * wtf/text/AtomicString.cpp: 2015-03-13 Mark Lam Introduce WTF::Atomic to wrap std::atomic for a friendlier CAS. Reviewed by Filip Pizlo. The CAS functions provided by std::atomic takes a reference to the expected value and modifies it if the CAS fails. However, in a lot of our CAS usage, we don't want the expected value to change. The solution to this is to provide a WTF::Atomic struct that wraps std::atomic, and provide CAS methods that won't alter the expected value if the CAS fails. The method names in WTF::Atomic are chosen to be identical to those in std::atomic so that WTF::Atomic can be a simple drop in replacement for std::atomic. Also changed ByteSpinLock to use WTF::Atomic instead of std::atomic. * wtf/Atomics.h: (WTF::Atomic::load): (WTF::Atomic::store): (WTF::Atomic::compare_exchange_weak): (WTF::Atomic::compare_exchange_strong): * wtf/ByteSpinLock.h: (WTF::ByteSpinLock::ByteSpinLock): (WTF::ByteSpinLock::lock): 2015-03-12 Filip Pizlo Bytecode liveness analysis should have more lambdas and fewer sets https://bugs.webkit.org/show_bug.cgi?id=142647 Reviewed by Mark Lam. Add a method for iterating each set bit in a FastBitVector. Uses a functor as a callback since this allows for a more efficient algorithm. * wtf/FastBitVector.h: (WTF::FastBitVector::forEachSetBit): 2015-03-12 Michael Saboff Disable Yarr JIT for ARMv7k https://bugs.webkit.org/show_bug.cgi?id=142645 Reviewed by Oliver Hunt. Make the setting of ENABLE_YARR_JIT match ENABLE_JIT for ARMv7k. * wtf/Platform.h: 2015-03-12 Mark Lam Change WTF::ByteSpinLock to use std::atomic. Reviewed by Filip Pizlo. * wtf/ByteSpinLock.h: (WTF::ByteSpinLock::ByteSpinLock): (WTF::ByteSpinLock::lock): (WTF::ByteSpinLock::unlock): (WTF::ByteSpinLock::isHeld): 2015-03-12 Csaba Osztrogonác [ARM][Linux] GC sometimes stuck in an infinite loop if parallel GC is enabled https://bugs.webkit.org/show_bug.cgi?id=141290 Reviewed by Carlos Garcia Campos. * wtf/Platform.h: Enable parallel GC after r181319. 2015-03-11 Myles C. Maxfield Use out-of-band messaging for RenderBox::firstLineBaseline() and RenderBox::inlineBlockBaseline() https://bugs.webkit.org/show_bug.cgi?id=142569 Reviewed by David Hyatt. Provide a callback to Optional::valueOrCompute() which is evaluated only if necessary. * wtf/Optional.h: (WTF::Optional::valueOrCompute): 2015-03-10 Brent Fulgham [Win] 17 different JSC tests started to fail in DST https://bugs.webkit.org/show_bug.cgi?id=142531 Reviewed by Chris Dumez. The stock 'GetTimeZoneInformation' call does not always match the actual Daylight Savings calendar. This results in a period of time when these tests fail. If available, we should take advantage of the new 'GetTimeZoneInformationForYear', which accesses a dynamic calendar of DST dates, which is presumbably updated by Microsoft from year-to-year. * wtf/DateMath.cpp: (WTF::timeZoneInformationForYearFunction): New function to conditionally access some Vista (and newer) functionality. (WTF::calculateUTCOffset): Call new function (if available) to calculate proper UTC time offset. 2015-03-10 Alex Christensen Use unsigned for HashSet size. https://bugs.webkit.org/show_bug.cgi?id=142518 Reviewed by Benjamin Poulain. * wtf/HashCountedSet.h: (WTF::Traits>::size): (WTF::Traits>::capacity): * wtf/HashMap.h: (WTF::X>::size): (WTF::X>::capacity): * wtf/HashSet.h: (WTF::V>::size): (WTF::V>::capacity): * wtf/HashTable.h: (WTF::HashTable::Stats::recordCollisionAtCount): (WTF::HashTable::Stats::dumpStats): (WTF::HashTable::size): (WTF::HashTable::capacity): (WTF::KeyTraits>::deallocateTable): (WTF::KeyTraits>::checkTableConsistencyExceptSize): * wtf/HashTraits.h: * wtf/ListHashSet.h: (WTF::U>::size): (WTF::U>::capacity): 2015-03-10 Said Abou-Hallawa Remove PassRefPtr from svg/properties classes. https://bugs.webkit.org/show_bug.cgi?id=142063. Reviewed by Darin Adler. * wtf/Ref.h: (WTF::static_reference_cast): Add a stat_cast function to Ref<>. 2015-03-10 Mark Lam [Win] JSC Build Warnings Need to be Resolved. Reviewed by Brent Fulgham. * wtf/Compiler.h: - MSVC also does not have the CONSIDERS_UNREACHABLE_CODE quirk. 2015-03-10 Geoffrey Garen bmalloc: tryFastMalloc shouldn't crash https://bugs.webkit.org/show_bug.cgi?id=142443 Reviewed by Sam Weinig. Rolling back in r181307 with a check for whether bmalloc is enabled, to avoid crashes when running with ASan and GuardMalloc. * wtf/FastMalloc.cpp: (WTF::fastMalloc): (WTF::fastRealloc): (WTF::fastAlignedMalloc): (WTF::tryFastMalloc): (WTF::tryFastRealloc): Deleted. * wtf/FastMalloc.h: 2015-03-10 Michael Catanzaro GCC: CRASH() should be annotated with NORETURN https://bugs.webkit.org/show_bug.cgi?id=142524 Reviewed by Anders Carlsson. Add COMPILER(GCC) to #ifdefs that already exist for Clang. * wtf/Assertions.cpp: * wtf/Assertions.h: 2015-03-09 Commit Queue Unreviewed, rolling out r181307. https://bugs.webkit.org/show_bug.cgi?id=142525 Broke ASan tests (Requested by ap on #webkit). Reverted changeset: "bmalloc: tryFastMalloc shouldn't crash" https://bugs.webkit.org/show_bug.cgi?id=142443 http://trac.webkit.org/changeset/181307 2015-03-09 Geoffrey Garen bmalloc: tryFastMalloc shouldn't crash https://bugs.webkit.org/show_bug.cgi?id=142443 Reviewed by Darin Adler. * wtf/FastMalloc.cpp: (WTF::fastMalloc): (WTF::fastRealloc): (WTF::fastAlignedMalloc): Don't check for null. bmalloc automatically crashes on allocation failure, and we'd rather not pay for an extra check. (WTF::tryFastMalloc): Added an opt-out API to return null rather than crashing, since some clients need this. (WTF::tryFastRealloc): Deleted. Unused. * wtf/FastMalloc.h: 2015-03-09 Mark Lam 8-bit version of weakCompareAndSwap() can cause an infinite loop. https://webkit.org/b/142513> Reviewed by Filip Pizlo. Presently, Bitmap::concurrentTestAndSet() uses the 8-bit version of weakCompareAndSwap() (which compares and swaps an uint8_t value). Bitmap::concurrentTestAndSet() has a loop that checks if a bit in the byte of interest has been set. If not, it will call the 8-bit CAS function to set the bit. Under the covers, for ARM, the 8-bit CAS function actually works with a 32-bit CAS. The 8-bit CAS will first fetch the 32-bit value in memory that should contain the 8-bit value, and check if it contains the expected byte. If the value in memory doesn't have the expected byte, it will return early to its caller. The expectation is that the caller will reload the byte from memory and call the 8-bit CAS again. Unfortunately, this code path that returns early does not have a compiler fence. Without a compiler fence, the C++ compiler can optimize away the reloading of the expected byte value, leaving it unchanged. As a result, we'll have a infinite loop here that checks a value that will never change, and the loop will not terminate until the value changes. The fix is to eliminate the early return check in the 8-bit CAS, and have it always call down to the 32-bit CAS. The 32-bit CAS has a compiler fence which will prevent this issue. * wtf/Atomics.h: (WTF::weakCompareAndSwap): 2015-03-09 Martin Robinson [EFL] Move DispatchQueue to WTF https://bugs.webkit.org/show_bug.cgi?id=142493 Reviewed by Csaba Osztrogonác. * wtf/PlatformEfl.cmake: Add DispatchQueue to the source list. * wtf/efl/DispatchQueueEfl.cpp: Renamed from Source/WebKit2/Platform/efl/DispatchQueueEfl.cpp. * wtf/efl/DispatchQueueEfl.h: Renamed from Source/WebKit2/Platform/efl/DispatchQueueEfl.h. * wtf/efl/DispatchQueueWorkItemEfl.h: Renamed from Source/WebKit2/Platform/efl/DispatchQueueWorkItemEfl.h. 2015-03-08 Brent Fulgham [Win] WTF::WorkQueue does not balance ref/deref properly https://bugs.webkit.org/show_bug.cgi?id=142471 Reviewed by Antti Koivisto. Make sure we deref the count when we execute a function in the WorkQueue. * wtf/win/WorkQueueWin.cpp: (WTF::WorkQueue::performWorkOnRegisteredWorkThread): 2015-03-07 Brent Fulgham [Win] Revive WTF::WorkQueue on Windows https://bugs.webkit.org/show_bug.cgi?id=142432 Reviewed by Darin Adler. Revive the Windows implementation of WTF::WorkQueue. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * wtf/WorkQueue.h: * wtf/win/WorkItemWin.cpp: Added. * wtf/win/WorkItemWin.h: Added. * wtf/win/WorkQueueWin.cpp: Added. 2015-03-06 Geoffrey Garen Fix crashes seen on the the Windows buildbots after my last patch. Unreviewed. * wtf/FastMalloc.cpp: (WTF::fastAlignedMalloc): Let's pass these arguments in the right order. 2015-03-06 Myles C. Maxfield Crash in -[WebCascadeList objectAtIndex:] + 195 https://bugs.webkit.org/show_bug.cgi?id=141274 Reviewed by David Kilzer. * wtf/WeakPtr.h: (WTF::WeakPtrFactory::createWeakPtr): WebCascadeList uses a const FontCascade, and it calls createWeakPtr() on it. Therefore, createWeakPtr has to be marked const. (WTF::WeakPtrFactory::operator=): Removed because it was broken and had no callers 2015-03-06 Simon Fraser Allow tree dumping functions to be used in release builds by switching a flag https://bugs.webkit.org/show_bug.cgi?id=142379 Reviewed by Zalan Bujtas. There are various tree dumping functions that are useful for debugging, and sometimes you want to be able to use them in release builds. Currently they are surrounded by #ifndef NDEBUG. Change this to #if ENABLE(TREE_DEBUGGING), which is defined to 0 or 1 in wtf/Platform.h * wtf/Platform.h: 2015-03-05 Chris Dumez Regression(r173761): ASSERTION FAILED: !is8Bit() in StringImpl::characters16() https://bugs.webkit.org/show_bug.cgi?id=142350 Reviewed by Michael Saboff and Benjamin Poulain. Fix ASSERTION FAILED: !is8Bit() in StringImpl::characters16() from WTF::equalInner() after r173761. The code was incorrectly assuming that if stringImpl is 16-bit, then matchString is 16-bit too, which is not correct. Also rename WTFString::startsWith() / endsWith() taking an offset to hasInfixStartingAt() / hasInfixEndingAt() for clarity. It seems odd to call it startsWith even though it won't technically *start* with the pattern if the input offset is greater than zero. Also drop the caseSensitive argument as it is never used (always true at call sites. * wtf/text/StringImpl.cpp: (WTF::equalInner): (WTF::StringImpl::hasInfixStartingAt): (WTF::StringImpl::hasInfixEndingAt): (WTF::StringImpl::startsWith): Deleted. (WTF::StringImpl::endsWith): Deleted. * wtf/text/StringImpl.h: * wtf/text/WTFString.h: (WTF::String::hasInfixStartingAt): (WTF::String::hasInfixEndingAt): (WTF::String::startsWith): Deleted. (WTF::String::endsWith): Deleted. 2015-03-05 Chris Dumez NetworkCache efficacy logging is using too much CPU https://bugs.webkit.org/show_bug.cgi?id=142186 Reviewed by Antti Koivisto. * wtf/HashMap.h: (WTF::copyToVector): Add copyToVector() utility function for HashMap that uses an std::pair as element type. * wtf/text/WTFString.h: (WTF::StringCapture::StringCapture): (WTF::StringCapture::operator=): Add default constructor and assignment operator to StringCapture so that it can be used in a Vector. 2015-03-05 Antti Koivisto Support WorkQueue QOS classes on Mavericks https://bugs.webkit.org/show_bug.cgi?id=142328 Reviewed by Anders Carlsson. "The priority of a dispatch queue is inherited from its target queue. In order to change the priority of a queue created with dispatch_queue_create(), use the dispatch_get_global_queue() function to obtain a target queue of the desired prior- ity." * wtf/cocoa/WorkQueueCocoa.cpp: (WTF::targetQueueForQOSClass): (WTF::WorkQueue::platformInitialize): 2015-03-03 Anders Carlsson Remove unused compression code https://bugs.webkit.org/show_bug.cgi?id=142237 Reviewed by Geoffrey Garen. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Compression.cpp: Removed. * wtf/Compression.h: Removed. 2015-03-02 Gyuyoung Kim [WK2] Remove unnecessary create() factory functions. https://bugs.webkit.org/show_bug.cgi?id=142161 Reviewed by Chris Dumez. We can replace some create() factory functions with std::make_unique(). Because it just returns new instance. Even some of those functions have used std::unique_ptr<> instead of std::make_unique<>. Fixed all. * wtf/efl/WorkQueueEfl.cpp: (WorkQueue::dispatch): 2015-03-02 Filip Pizlo DFG compile time measurements should really report milliseconds https://bugs.webkit.org/show_bug.cgi?id=142209 Reviewed by Benjamin Poulain. This bug was introduced because currentTimeMS() calls were converted to monotonicallyIncreasingTime() calls. Perhaps this bug would be less likely if there was a monotonicallyIncreasingTimeMS() function available, so this patch adds it. * wtf/CurrentTime.h: (WTF::monotonicallyIncreasingTimeMS): 2015-02-27 Darin Adler Remove unused PossiblyNull https://bugs.webkit.org/show_bug.cgi?id=142124 Reviewed by Andreas Kling. * WTF.vcxproj/WTF.vcxproj: Removed the file. * WTF.vcxproj/WTF.vcxproj.filters: Ditto. * WTF.xcodeproj/project.pbxproj: Ditto. * wtf/CMakeLists.txt: Ditto. * wtf/PossiblyNull.h: Removed. * wtf/FastMalloc.h: Moved everything to the left. Moved member functions out of the TryMallocReturnValue class definition. (WTF::TryMallocReturnValue::operator PossiblyNull): Deleted. (WTF::TryMallocReturnValue::getValue): Marked inline, changed to work only with pointer types, not arbitrary non-pointer types. 2015-02-26 Brent Fulgham [Win] Make build logs more legible by reducing noise https://bugs.webkit.org/show_bug.cgi?id=142034 Reviewed by Alexey Proskuryakov. Modify batch files, makefiles, and DOS commands to remove uninteresting/unhelpful output. * WTF.vcxproj/WTFGenerated.make: * WTF.vcxproj/WTFPreBuild.cmd: * WTF.vcxproj/copy-files.cmd: 2015-02-26 Landry Breuil Revert bug 19975, now that gcc 4.7 is required. https://bugs.webkit.org/show_bug.cgi?id=129927 Reviewed by Andreas Kling. isfinite() and signbit() are provided by gcc's cmath header. * wtf/MathExtras.h: 2015-02-26 Csaba Osztrogonác UNREACHABLE_FOR_PLATFORM() should be release assert https://bugs.webkit.org/show_bug.cgi?id=141904 Reviewed by Darin Adler. * wtf/Assertions.h: (UNREACHABLE_FOR_PLATFORM): 2015-02-25 Filip Pizlo Enable concurrent JIT on GTK https://bugs.webkit.org/show_bug.cgi?id=142007 Reviewed by Benjamin Poulain. Seems weird that GTK keeps it off. No good reason for that as far as I can tell. * wtf/Platform.h: 2015-02-23 Brent Fulgham WTF::WeakPtr should rename 'forgot' to 'clear' and support nullptr assignment https://bugs.webkit.org/show_bug.cgi?id=141935 Reviewed by Myles C. Maxfield. * wtf/WeakPtr.h: (WTF::WeakPtr::operator=): Added 'nullptr_t' overload. (WTF::WeakPtr::clear): Renamed from 'forget' (WTF::WeakPtr::forget): Deleted. 2015-02-23 Brent Fulgham WTF::WeakPtr should have a 'forget' method https://bugs.webkit.org/show_bug.cgi?id=141923 Reviewed by Myles C. Maxfield. * wtf/WeakPtr.h: (WTF::WeakPtr::forget): Added. 2015-02-20 Geoffrey Garen Remove TCMalloc https://bugs.webkit.org/show_bug.cgi?id=141844 Reviewed by Andreas Kling. It's unused. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/FastMalloc.cpp: (WTF::EntropySource<4>::value): Deleted. (WTF::EntropySource<8>::value): Deleted. (WTF::internalEntropyValue): Deleted. (WTF::freedObjectStartPoison): Deleted. (WTF::freedObjectEndPoison): Deleted. (WTF::ClassIndex): Deleted. (WTF::HardenedSLL::create): Deleted. (WTF::HardenedSLL::null): Deleted. (WTF::HardenedSLL::setValue): Deleted. (WTF::HardenedSLL::value): Deleted. (WTF::HardenedSLL::operator!): Deleted. (WTF::HardenedSLL::operator UnspecifiedBoolType): Deleted. (WTF::HardenedSLL::operator!=): Deleted. (WTF::HardenedSLL::operator==): Deleted. (WTF::LgFloor): Deleted. (WTF::SLL_Next): Deleted. (WTF::SLL_SetNext): Deleted. (WTF::SLL_Push): Deleted. (WTF::SLL_Pop): Deleted. (WTF::SLL_PopRange): Deleted. (WTF::SLL_PushRange): Deleted. (WTF::SizeClass): Deleted. (WTF::ByteSizeForClass): Deleted. (WTF::NumMoveSize): Deleted. (WTF::InitSizeClasses): Deleted. (WTF::MetaDataAlloc): Deleted. (WTF::PageHeapAllocator::Init): Deleted. (WTF::PageHeapAllocator::New): Deleted. (WTF::PageHeapAllocator::Delete): Deleted. (WTF::PageHeapAllocator::inuse): Deleted. (WTF::pages): Deleted. (WTF::AllocationSize): Deleted. (WTF::spanInitializerCookie): Deleted. (WTF::Span::next): Deleted. (WTF::Span::remoteNext): Deleted. (WTF::Span::prev): Deleted. (WTF::Span::setNext): Deleted. (WTF::Span::setPrev): Deleted. (WTF::Span::initCookie): Deleted. (WTF::Span::clearCookie): Deleted. (WTF::Span::isValid): Deleted. (WTF::Event): Deleted. (WTF::NewSpan): Deleted. (WTF::DeleteSpan): Deleted. (WTF::DLL_Init): Deleted. (WTF::DLL_Remove): Deleted. (WTF::DLL_IsEmpty): Deleted. (WTF::DLL_Length): Deleted. (WTF::DLL_Print): Deleted. (WTF::DLL_Prepend): Deleted. (WTF::TCMalloc_Central_FreeList::length): Deleted. (WTF::TCMalloc_Central_FreeList::tc_length): Deleted. (WTF::TCMalloc_Central_FreeList::enumerateFreeObjects): Deleted. (WTF::TCMalloc_Central_FreeList::entropy): Deleted. (WTF::FastMallocZone::goodSize): Deleted. (WTF::FastMallocZone::check): Deleted. (WTF::FastMallocZone::print): Deleted. (WTF::FastMallocZone::log): Deleted. (WTF::FastMallocZone::forceLock): Deleted. (WTF::FastMallocZone::forceUnlock): Deleted. (WTF::FastMallocZone::statistics): Deleted. (WTF::FastMallocZone::zoneValloc): Deleted. (WTF::FastMallocZone::zoneDestroy): Deleted. (WTF::MallocHook::record): Deleted. (WTF::MallocHook::recordAllocation): Deleted. (WTF::MallocHook::recordDeallocation): Deleted. (WTF::MallocHook::init): Deleted. (WTF::MallocHook::InvokeNewHook): Deleted. (WTF::MallocHook::InvokeDeleteHook): Deleted. (WTF::KernelSupportsTLS): Deleted. (WTF::CheckIfKernelSupportsTLS): Deleted. (WTF::TCMalloc_PageHeap::GetDescriptor): Deleted. (WTF::TCMalloc_PageHeap::GetDescriptorEnsureSafe): Deleted. (WTF::TCMalloc_PageHeap::SystemBytes): Deleted. (WTF::TCMalloc_PageHeap::FreeBytes): Deleted. (WTF::TCMalloc_PageHeap::GetSizeClassIfCached): Deleted. (WTF::TCMalloc_PageHeap::CacheSizeClass): Deleted. (WTF::TCMalloc_PageHeap::RecordSpan): Deleted. (WTF::TCMalloc_PageHeap::init): Deleted. (WTF::TCMalloc_PageHeap::initializeScavenger): Deleted. (WTF::TCMalloc_PageHeap::isScavengerSuspended): Deleted. (WTF::TCMalloc_PageHeap::scheduleScavenger): Deleted. (WTF::TCMalloc_PageHeap::rescheduleScavenger): Deleted. (WTF::TCMalloc_PageHeap::suspendScavenger): Deleted. (WTF::TCMalloc_PageHeap::scavengerTimerFired): Deleted. (WTF::TCMalloc_PageHeap::runScavengerThread): Deleted. (WTF::TCMalloc_PageHeap::signalScavenger): Deleted. (WTF::TCMalloc_PageHeap::scavenge): Deleted. (WTF::TCMalloc_PageHeap::shouldScavenge): Deleted. (WTF::TCMalloc_PageHeap::New): Deleted. (WTF::TCMalloc_PageHeap::AllocLarge): Deleted. (WTF::TCMalloc_PageHeap::Split): Deleted. (WTF::TCMalloc_PageHeap::Carve): Deleted. (WTF::mergeDecommittedStates): Deleted. (WTF::TCMalloc_PageHeap::Delete): Deleted. (WTF::TCMalloc_PageHeap::IncrementalScavenge): Deleted. (WTF::TCMalloc_PageHeap::RegisterSizeClass): Deleted. (WTF::TCMalloc_PageHeap::ReturnedBytes): Deleted. (WTF::PagesToMB): Deleted. (WTF::TCMalloc_PageHeap::Dump): Deleted. (WTF::TCMalloc_PageHeap::GrowHeap): Deleted. (WTF::TCMalloc_PageHeap::Check): Deleted. (WTF::TCMalloc_PageHeap::CheckList): Deleted. (WTF::TCMalloc_PageHeap::ReleaseFreeList): Deleted. (WTF::TCMalloc_PageHeap::ReleaseFreePages): Deleted. (WTF::TCMalloc_ThreadCache_FreeList::Init): Deleted. (WTF::TCMalloc_ThreadCache_FreeList::length): Deleted. (WTF::TCMalloc_ThreadCache_FreeList::empty): Deleted. (WTF::TCMalloc_ThreadCache_FreeList::lowwatermark): Deleted. (WTF::TCMalloc_ThreadCache_FreeList::clear_lowwatermark): Deleted. (WTF::TCMalloc_ThreadCache_FreeList::Push): Deleted. (WTF::TCMalloc_ThreadCache_FreeList::PushRange): Deleted. (WTF::TCMalloc_ThreadCache_FreeList::PopRange): Deleted. (WTF::TCMalloc_ThreadCache_FreeList::Pop): Deleted. (WTF::TCMalloc_ThreadCache_FreeList::Validate): Deleted. (WTF::TCMalloc_ThreadCache_FreeList::enumerateFreeObjects): Deleted. (WTF::TCMalloc_ThreadCache::freelist_length): Deleted. (WTF::TCMalloc_ThreadCache::Size): Deleted. (WTF::TCMalloc_ThreadCache::enumerateFreeObjects): Deleted. (WTF::getPageHeap): Deleted. (WTF::fastMallocGoodSize): Deleted. (WTF::TCMalloc_PageHeap::periodicScavenge): Deleted. (WTF::TCMalloc_PageHeap::scavengerThread): Deleted. (WTF::setThreadHeap): Deleted. (WTF::TCMalloc_Central_FreeList::Init): Deleted. (WTF::TCMalloc_Central_FreeList::ReleaseListToSpans): Deleted. (WTF::TCMalloc_Central_FreeList::ReleaseToSpans): Deleted. (WTF::TCMalloc_Central_FreeList::EvictRandomSizeClass): Deleted. (WTF::TCMalloc_Central_FreeList::MakeCacheSpace): Deleted. (WTF::TCMalloc_Central_FreeList::ShrinkCache): Deleted. (WTF::TCMalloc_Central_FreeList::InsertRange): Deleted. (WTF::TCMalloc_Central_FreeList::RemoveRange): Deleted. (WTF::TCMalloc_Central_FreeList::FetchFromSpansSafe): Deleted. (WTF::TCMalloc_Central_FreeList::FetchFromSpans): Deleted. (WTF::TCMalloc_Central_FreeList::Populate): Deleted. (WTF::TCMalloc_ThreadCache::SampleAllocation): Deleted. (WTF::TCMalloc_ThreadCache::Init): Deleted. (WTF::TCMalloc_ThreadCache::Cleanup): Deleted. (WTF::TCMalloc_ThreadCache::Allocate): Deleted. (WTF::TCMalloc_ThreadCache::Deallocate): Deleted. (WTF::TCMalloc_ThreadCache::FetchFromCentralCache): Deleted. (WTF::TCMalloc_ThreadCache::ReleaseToCentralCache): Deleted. (WTF::TCMalloc_ThreadCache::Scavenge): Deleted. (WTF::TCMalloc_ThreadCache::PickNextSample): Deleted. (WTF::TCMalloc_ThreadCache::InitModule): Deleted. (WTF::TCMalloc_ThreadCache::NewHeap): Deleted. (WTF::TCMalloc_ThreadCache::GetThreadHeap): Deleted. (WTF::TCMalloc_ThreadCache::GetCache): Deleted. (WTF::TCMalloc_ThreadCache::GetCacheIfPresent): Deleted. (WTF::TCMalloc_ThreadCache::InitTSD): Deleted. (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): Deleted. * wtf/TCPackedCache.h: Removed. * wtf/TCPageMap.h: Removed. * wtf/TCSystemAlloc.cpp: Removed. * wtf/TCSystemAlloc.h: Removed. 2015-02-20 Alexey Proskuryakov Remove svn:keywords property. As far as I can tell, the property had no effect on any of these files, but also, when it has effect it's likely harmful. * wtf/DecimalNumber.cpp: Removed property svn:keywords. * wtf/spi/darwin/XPCSPI.h: Removed property svn:keywords. 2015-02-20 Csaba Osztrogonác EFL URTBF * wtf/PlatformEfl.cmake: 2015-02-20 Simon Fraser RunLoop::dispatch() should drop the mutex before calling wakeUp(). https://bugs.webkit.org/show_bug.cgi?id=141820 Reviewed by Alexey Proskuryakov. RunLoop::wakeUp() calls into CoreFoundation which could take time, so scope the mutex just to protect m_functionQueue. * wtf/RunLoop.cpp: (WTF::RunLoop::dispatch): 2015-02-20 Gyuyoung Kim Unreviewed, EFL build fix since r180410. * wtf/PlatformEfl.cmake: Add WEBKIT2/Platform/efl path in order to include DispatchQueueEfl.h. 2015-02-20 Antti Koivisto Move WorkQueue from WK2 to WTF https://bugs.webkit.org/show_bug.cgi?id=141797 Reviewed by Anders Carlsson. It may be useful in WebCore. Windows implementation is still missing. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PlatformGTK.cmake: * wtf/WorkQueue.cpp: Copied from Source/WebKit2/Platform/WorkQueue.cpp. * wtf/WorkQueue.h: Copied from Source/WebKit2/Platform/WorkQueue.h. * wtf/cocoa: Added. * wtf/cocoa/WorkQueueCocoa.cpp: Copied from Source/WebKit2/Platform/mac/WorkQueueMac.cpp. * wtf/efl/WorkQueueEfl.cpp: Copied from Source/WebKit2/Platform/efl/WorkQueueEfl.cpp. * wtf/gtk/WorkQueueGtk.cpp: Copied from Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp. 2015-02-13 Gyuyoung Kim [EFL] Enable bmalloc for EFL port https://bugs.webkit.org/show_bug.cgi?id=141459 Reviewed by Csaba Osztrogonác. * wtf/CMakeLists.txt: Remove TCSystemAlloc.cpp/h. * wtf/FastMalloc.cpp: Enable BMALLOC for EFL port. 2015-02-13 Anders Carlsson Add a move constructor and move assignment operator to Deque https://bugs.webkit.org/show_bug.cgi?id=141571 Reviewed by Andreas Kling. * wtf/Deque.h: (WTF::inlineCapacity>::Deque): (WTF::=): Deleted. 2015-02-13 Anders Carlsson Add an initializer list constructor to Deque https://bugs.webkit.org/show_bug.cgi?id=141565 Reviewed by Andreas Kling. * wtf/Deque.h: (WTF::inlineCapacity>::Deque): 2015-02-13 Anders Carlsson Re-indent Deque.h Rubber-stamped by Antti Koivisto. * wtf/Deque.h: 2015-02-11 Brent Fulgham [Win] [64-bit] Work around MSVC2013 Runtime Bug https://bugs.webkit.org/show_bug.cgi?id=141498 Reviewed by Anders Carlsson. Disable FMA3 instruction use in the MSVC math library to work around a VS2013 runtime crash. We can remove this workaround when we switch to VS2015. * WTF.vcxproj/WTF.vcxproj: Add new files. * WTF.vcxproj/WTF.vcxproj.filters: Ditto. * wtf/win/WTFDLL.cpp: Added. 2015-02-11 Gyuyoung Kim [EFL][GTK] Use bmalloc instead of tcmalloc https://bugs.webkit.org/show_bug.cgi?id=140162 Reviewed by Carlos Garcia Campos. * wtf/CMakeLists.txt: * wtf/FastMalloc.cpp: Enable bmalloc on GTK ports, but EFL port will enable it when bmalloc supports memory statistics. 2015-02-10 Darin Adler Add the crash-on-failure behavior to bmalloc-based fastMalloc https://bugs.webkit.org/show_bug.cgi?id=141434 Reviewed by Alexey Proskuryakov. * wtf/FastMalloc.cpp: Removed unneeded includes. (WTF::fastMalloc): Added null check and CRASH. (WTF::fastCalloc): Added overflow checking, null check, and CRASH. (WTF::fastRealloc): Added null check and CRASH. (WTF::fastMallocSize): Added FIXME comment. (WTF::fastMallocGoodSize): Added FIXME comment. (WTF::fastAlignedMalloc): Added null check and CRASH. (WTF::tryFastMalloc): Changed to call bmalloc directly instead of calling fastMalloc, since fastMalloc will now crash on failure. (WTF::tryFastRealloc): Changed to call bmalloc directly instead of calling fastRealloc, since fastRealloc will now crash on failure. (WTF::tryFastCalloc): Added overflow checking. (WTF::fastMallocStatistics): Added FIXME comment. 2015-02-10 Carlos Garcia Campos [GTK] GMutexLocker build issue https://bugs.webkit.org/show_bug.cgi?id=141381 Reviewed by Žan Doberšek. Remove using WTF::GMutexLocker from the header, since newer glib versions have a GMutexLocker in the public API. * wtf/gobject/GMutexLocker.h: 2015-02-09 Alexey Proskuryakov REGRESSION: tryFastCalloc is no longer "try" https://bugs.webkit.org/show_bug.cgi?id=141406 Reviewed by Darin Adler. This causes crashes on some WebKit regression test bots. * wtf/FastMalloc.cpp: (WTF::tryFastCalloc): Fix what looks like a copy/paste mistake. 2015-02-07 Csaba Osztrogonác [ARM] GC sometimes stuck in an infinite loop if parallel GC is enabled https://bugs.webkit.org/show_bug.cgi?id=141290 Reviewed by Anders Carlsson. * wtf/Platform.h: 2015-02-07 Chris Dumez Add Vector::removeFirstMatching() / removeAllMatching() methods taking lambda functions https://bugs.webkit.org/show_bug.cgi?id=141321 Reviewed by Darin Adler. Add Vector::removeFirstMatching() / removeAllMatching() methods taking lambda functions to match the element(s) to remove. This simplifies the code a bit. Vector::removeAllMatching() is also more efficient than the manual removal alternative. * wtf/Vector.h: 2015-02-06 Commit Queue Unreviewed, rolling out r179743. https://bugs.webkit.org/show_bug.cgi?id=141335 caused missing symbols in non-WebKit clients of WTF::Vector (Requested by kling on #webkit). Reverted changeset: "Remove WTF::fastMallocGoodSize()." https://bugs.webkit.org/show_bug.cgi?id=141020 http://trac.webkit.org/changeset/179743 2015-02-06 Andreas Kling Remove WTF::fastMallocGoodSize(). Reviewed by Anders Carlsson. bmalloc's good-size API just returns exactly whatever you pass it, so it's of no utility to us anymore. This gets rid of a bunch of pointless out-of-line calls in Vector construction and growth. * wtf/Compression.cpp: (WTF::GenericCompressedData::create): * wtf/FastMalloc.cpp: (WTF::fastMallocGoodSize): Deleted. * wtf/FastMalloc.h: * wtf/Vector.h: (WTF::VectorBufferBase::allocateBuffer): (WTF::VectorBufferBase::tryAllocateBuffer): (WTF::VectorBufferBase::reallocateBuffer): 2015-02-05 Youenn Fablet and Xabier Rodriguez Calvar [Streams API] Implement a barebone ReadableStream interface https://bugs.webkit.org/show_bug.cgi?id=141045 Reviewed by Benjamin Poulain. * wtf/FeatureDefines.h: 2015-02-04 Alexey Proskuryakov Optimized equal() functions in StringImpl.h are not ASan compatible https://bugs.webkit.org/show_bug.cgi?id=141258 Reviewed by Daniel Bates. * wtf/text/StringImpl.h: (WTF::equal): Add custom implementations for ASan. 2015-02-04 Chris Dumez Add removeFirst(value) / removeAll(value) methods to WTF::Vector https://bugs.webkit.org/show_bug.cgi?id=141192 Reviewed by Benjamin Poulain. Add removeFirst(value) / removeAll(value) convenience methods to WTF::Vector to reduce complexity a bit at call sites. I am planning to add overloads for these taking a lambda function for matching in a follow-up patch as well. I have seen quite a few Vector::remove(index) call sites that would benefit from it. * wtf/Vector.h: (WTF::OverflowHandler>::removeFirst): (WTF::OverflowHandler>::removeAll): 2015-02-02 Dhi Aurrahman Optimize matchesLangPseudoClass() of :lang() https://bugs.webkit.org/show_bug.cgi?id=140873 Reviewed by Darin Adler. Add some basic equality comparison operators. * wtf/text/StringView.h: (WTF::operator==): (WTF::operator!=): (WTF::equal): (WTF::equalIgnoringASCIICase): 2015-02-02 Geoffrey Garen Use FastMalloc (bmalloc) instead of BlockAllocator for GC pages https://bugs.webkit.org/show_bug.cgi?id=140900 Reviewed by Mark Hahnenberg. Re-landing just the HandleBlock piece of this patch. * wtf/FastMalloc.cpp: (WTF::fastAlignedMalloc): (WTF::fastAlignedFree): (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): * wtf/FastMalloc.h: 2015-02-02 Daniel Bates [iOS] ASSERTION FAILED: m_scriptExecutionContext->isContextThread() in ContextDestructionObserver::observeContext https://bugs.webkit.org/show_bug.cgi?id=141057 Reviewed by Alexey Proskuryakov. * wtf/MainThread.h: * wtf/mac/MainThreadMac.mm: (WTF::callOnWebThreadOrDispatchAsyncOnMainThread): Added. 2015-01-31 Sam Weinig Remove even more Mountain Lion support https://bugs.webkit.org/show_bug.cgi?id=141124 Reviewed by Alexey Proskuryakov. * Configurations/Base.xcconfig: * Configurations/DebugRelease.xcconfig: * wtf/Assertions.cpp: * wtf/FeatureDefines.h: * wtf/Platform.h: 2015-01-31 Commit Queue Unreviewed, rolling out r179426. https://bugs.webkit.org/show_bug.cgi?id=141119 "caused a memory use regression" (Requested by Guest45 on #webkit). Reverted changeset: "Use FastMalloc (bmalloc) instead of BlockAllocator for GC pages" https://bugs.webkit.org/show_bug.cgi?id=140900 http://trac.webkit.org/changeset/179426 2015-01-31 Commit Queue Unreviewed, rolling out r179408. https://bugs.webkit.org/show_bug.cgi?id=141117 This didn't fully fix the issue (Requested by anttik on #webkit). Reverted changeset: "OSObjectPtr does not work with dispatch_data_t on Maverics" https://bugs.webkit.org/show_bug.cgi?id=141081 http://trac.webkit.org/changeset/179408 2015-01-30 Yusuke Suzuki Implement ES6 Symbol https://bugs.webkit.org/show_bug.cgi?id=140435 Reviewed by Geoffrey Garen. Introduce new unique string mechanizm into StringImpl. It is used for implementing Symbol which holds a [[Description]] value. * wtf/text/AtomicString.h: (WTF::AtomicString::add): (WTF::AtomicString::addWithStringTableProvider): Previously, we checked `isAtomic()` or `!length()`. This guard can filter out EmptyUnique. But now, we introduced new unique StringImpl. Since it has an actual string value, we need to check `isUnique()`. * wtf/text/StringImpl.cpp: (WTF::StringImpl::~StringImpl): (WTF::StringImpl::createUnique): In createUnique, we leverage Substring mechanizm to produce a new unique string from an existing string. * wtf/text/StringImpl.h: (WTF::StringImpl::StringImpl): (WTF::StringImpl::createUniqueEmpty): (WTF::StringImpl::flagIsUnique): (WTF::StringImpl::isUnique): (WTF::StringImpl::setIsAtomic): (WTF::StringImpl::createEmptyUnique): Deleted. (WTF::StringImpl::isEmptyUnique): Deleted. Instead of EmptyUnique, we introduced new flag to StringImpl, `isUnique`. While EmptyUnique cannot hold any string values except for empty string, the unique StringImpl can hold any String values. We fold the Symbol's descriptiveString value here. * wtf/text/StringStatics.cpp: (WTF::StringImpl::hashAndFlagsForUnique): (WTF::StringImpl::hashAndFlagsForEmptyUnique): Deleted. 2015-01-30 Geoffrey Garen Use FastMalloc (bmalloc) instead of BlockAllocator for GC pages https://bugs.webkit.org/show_bug.cgi?id=140900 Reviewed by Mark Hahnenberg. Re-landing just the HandleBlock piece of this patch. * wtf/FastMalloc.cpp: (WTF::fastAlignedMalloc): (WTF::fastAlignedFree): (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): * wtf/FastMalloc.h: 2015-01-30 Namhoon Kim Call vsnprintf instead of _vsnprintf in vprintf_stderr_common https://bugs.webkit.org/show_bug.cgi?id=141078 In windows _vsnprintf api does not place null character automatically. Simply replace it with vsnprintf. Which is polyfill to call wtf_vsnprintf in windows. Reviewed by Brent Fulgham. * wtf/Assertions.cpp: 2015-01-30 Brian J. Burg Web Inspector: ASSERT in InspectorTimelineAgent::internalStop https://bugs.webkit.org/show_bug.cgi?id=141039 Reviewed by Timothy Hatcher. Add messages to Stopwatch assertions, and clean up constructor. * wtf/Stopwatch.h: (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): 2015-01-30 Chris Dumez Add match_constness helper struct https://bugs.webkit.org/show_bug.cgi?id=140905 Reviewed by Benjamin Poulain. Add match_constness helper struct to simplify downcast<>() a bit. The purpose of this helper is to update T's constness to match Reference's. * wtf/TypeCasts.h: (WTF::downcast): 2015-01-30 Chris Dumez Add assertion in RefPtr's operator*() to make sure we don't dereference nullptr https://bugs.webkit.org/show_bug.cgi?id=141092 Reviewed by Anders Carlsson. Add assertion in RefPtr's operator*() to make sure we don't dereference nullptr. * wtf/RefPtr.h: (WTF::RefPtr::operator*): 2015-01-30 Geoffrey Garen GC marking threads should clear malloc caches https://bugs.webkit.org/show_bug.cgi?id=141097 Reviewed by Andreas Kling. Split the scavenging API into per-thread vs global, so that you can request to scavenge your own thread without scavenging the whole heap. * wtf/FastMalloc.cpp: (WTF::releaseFastMallocFreeMemoryForThisThread): (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): * wtf/FastMalloc.h: 2015-01-30 Antti Koivisto OSObjectPtr does not work with dispatch_data_t on Maverics https://bugs.webkit.org/show_bug.cgi?id=141081 Reviewed by Pratik Solanki. Trying to use OSObjectPtr throws -[OS_dispatch_data _xref_dispose]: unrecognized selector sent to instance 0 * wtf/OSObjectPtr.h: (WTF::retainOSObject): (WTF::releaseOSObject): Add specialization for dispatch_data_t on Maverics. 2015-01-29 Santosh Mahto Refactor String::format to handle unreached va_end. https://bugs.webkit.org/show_bug.cgi?id=140938 Reviewed by Alexey Proskuryakov. Now va_end is called for all platform after getting length of formatted string and again va_start/va_end is called to write formatted string in buffer. This way it ensure va_end is always reached for each va_start. * wtf/text/WTFString.cpp: 2015-01-29 Csaba Osztrogonác Move HAVE_DTRACE definition back to Platform.h https://bugs.webkit.org/show_bug.cgi?id=141033 Reviewed by Dan Bernstein. * wtf/Platform.h: 2015-01-28 Namhoon Kim Windows return -1 when calling vsnprintf with arguments that exceed target buffer size https://bugs.webkit.org/show_bug.cgi?id=140917 Reviewed by Brent Fulgham. Fix return value of vsnprintf when windows API return -1 to denote requested buffer exceeded. Replace return value by calling vscprintf. * wtf/StringExtras.h: (snprintf): Fix return value by calling vscprintf when buffer exceeded. (wtf_vsnprintf): Ditto. 2015-01-28 Geoffrey Garen Removed fastMallocForbid / fastMallocAllow https://bugs.webkit.org/show_bug.cgi?id=141012 Reviewed by Mark Hahnenberg. Removed the forbid / allow API because it is no longer used. * wtf/FastMalloc.cpp: (WTF::tryFastMalloc): (WTF::fastMalloc): (WTF::tryFastCalloc): (WTF::fastCalloc): (WTF::fastFree): (WTF::tryFastRealloc): (WTF::fastRealloc): (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): (WTF::isForbidden): Deleted. (WTF::fastMallocForbid): Deleted. (WTF::fastMallocAllow): Deleted. (WTF::initializeIsForbiddenKey): Deleted. * wtf/FastMalloc.h: 2015-01-28 Dana Burkart Move ASan flag settings from DebugRelease.xcconfig to Base.xcconfig https://bugs.webkit.org/show_bug.cgi?id=136765 Reviewed by Alexey Proskuryakov. * Configurations/Base.xcconfig: * Configurations/DebugRelease.xcconfig: 2015-01-28 Darin Adler Fix small leak in Collator https://bugs.webkit.org/show_bug.cgi?id=140990 Reviewed by Andreas Kling. * wtf/unicode/icu/CollatorICU.cpp: (WTF::Collator::Collator): Use fastStrDup instead of strdup. (WTF::Collator::~Collator): Use fastFree on the collator locale that we are abandoning. The old code instead just called free on a null pointer. 2015-01-27 Geoffrey Garen Removed WTF_MALLOC_VALIDATION https://bugs.webkit.org/show_bug.cgi?id=140958 Reviewed by Anders Carlsson. I don't think anyone has been using this, and the #ifdefs were driving me crazy. We have other options for validation -- like MallocGuardEdges, MallocCheckHeapEach, MallocScribble, and GuardMalloc. * wtf/FastMalloc.cpp: (WTF::tryFastMalloc): (WTF::fastMalloc): (WTF::tryFastCalloc): (WTF::fastCalloc): (WTF::fastFree): (WTF::tryFastRealloc): (WTF::fastRealloc): (WTF::fastMallocSize): (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): (WTF::Internal::fastMallocMatchFailed): Deleted. * wtf/FastMalloc.h: (WTF::Internal::fastMallocValidationHeader): Deleted. (WTF::Internal::fastMallocValidationSuffix): Deleted. (WTF::Internal::fastMallocMatchValidationType): Deleted. (WTF::Internal::setFastMallocMatchValidationType): Deleted. (WTF::fastMallocMatchValidateMalloc): Deleted. (WTF::fastMallocMatchValidateFree): Deleted. (WTF::fastMallocValidate): Deleted. 2015-01-27 Commit Queue Unreviewed, rolling out r179192. https://bugs.webkit.org/show_bug.cgi?id=140953 Caused numerous layout test failures (Requested by mattbaker_ on #webkit). Reverted changeset: "Use FastMalloc (bmalloc) instead of BlockAllocator for GC pages" https://bugs.webkit.org/show_bug.cgi?id=140900 http://trac.webkit.org/changeset/179192 2015-01-26 Geoffrey Garen Use FastMalloc (bmalloc) instead of BlockAllocator for GC pages https://bugs.webkit.org/show_bug.cgi?id=140900 Reviewed by Mark Hahnenberg. New interface for aligned allocation: fastAlignedMalloc / fastAlignedFree. We require a special function call on free because Windows. * wtf/FastMalloc.cpp: (WTF::fastAlignedMalloc): (WTF::fastAlignedFree): Do it. (WTF::do_memalign): Un-ifdef this, since we use it now. * wtf/FastMalloc.h: Make our new function names visible like the rest of fastMalloc. 2015-01-26 Brent Fulgham [Win] ASSERTION FAILED !m_ptr under AccessibilityController::winAddNotificationListener https://bugs.webkit.org/show_bug.cgi?id=87426 Reviewed by Darin Adler. Revise internal containers to use std::addressof in preference to to using the '&' operator. * wtf/Deque.h: (WTF::inlineCapacity>::append): (WTF::inlineCapacity>::prepend): (WTF::inlineCapacity>::removeFirst): (WTF::inlineCapacity>::removeLast): (WTF::inlineCapacity>::remove): (WTF::inlineCapacity>::after): (WTF::inlineCapacity>::before): * wtf/GetPtr.h: * wtf/HashTable.h: (WTF::HashTableBucketInitializer::initialize): * wtf/HashTraits.h: (WTF::SimpleClassHashTraits::constructDeletedValue): (WTF::CustomHashTraits::constructDeletedValue): * wtf/ListHashSet.h: (WTF::ListHashSetConstIterator::get): * wtf/Vector.h: (WTF::Vector::swap): (WTF::OverflowHandler>::append): (WTF::OverflowHandler>::tryAppend): (WTF::OverflowHandler>::insert): 2015-01-24 Chris Dumez Provide implementation for WTF::DefaultHash https://bugs.webkit.org/show_bug.cgi?id=140848 Reviewed by Anders Carlsson. Provide implementation for WTF::DefaultHash so that we can use HashMap> in the code base. Right now, we need to use some integer type to work around the issue. * wtf/HashFunctions.h: 2015-01-23 Carlos Garcia Campos [GTK] Add missing null check in some derefGPtr implementations https://bugs.webkit.org/show_bug.cgi?id=140822 Reviewed by Sergio Villar Senin. It's missing in GHashTable and GVariant implementations. * wtf/gobject/GRefPtr.cpp: (WTF::derefGPtr): 2015-01-23 Carlos Garcia Campos [GTK] Add initial database process support https://bugs.webkit.org/show_bug.cgi?id=139491 Reviewed by Sergio Villar Senin. Add support for using GRefPtr with GVariantBuilder. * wtf/gobject/GRefPtr.cpp: (WTF::refGPtr): (WTF::derefGPtr): * wtf/gobject/GRefPtr.h: * wtf/gobject/GTypedefs.h: 2015-01-22 Ryosuke Niwa Add a build flag for ES6 class syntax https://bugs.webkit.org/show_bug.cgi?id=140760 Reviewed by Michael Saboff. * wtf/FeatureDefines.h: 2015-01-21 Csaba Osztrogonác Remove ENABLE(INSPECTOR) ifdef guards https://bugs.webkit.org/show_bug.cgi?id=140668 Reviewed by Darin Adler. * wtf/FeatureDefines.h: 2015-01-20 YunQiang Su Fix failed to build for Linux/MIPS64EL https://bugs.webkit.org/show_bug.cgi?id=124370 Reviewed by Darin Adler. Add MIPS64EL support. * wtf/Platform.h: * wtf/dtoa/utils.h: 2015-01-19 Alexey Proskuryakov Make ASan do bounds checks for WTF::Vector https://bugs.webkit.org/show_bug.cgi?id=140631 rdar://problem/19437718 Reviewed by Darin Adler. * wtf/SizeLimits.cpp: Disable Vector object size checks for ASan enabled builds. * wtf/Vector.h: (WTF::VectorBuffer::endOfBuffer): (WTF::Vector::Vector): (WTF::Vector::~Vector): (WTF::Vector::swap): (WTF::OverflowHandler>::Vector): (WTF::=): (WTF::OverflowHandler>::fill): (WTF::OverflowHandler>::resize): (WTF::OverflowHandler>::shrink): (WTF::OverflowHandler>::grow): (WTF::OverflowHandler>::asanSetInitialBufferSizeTo): (WTF::OverflowHandler>::asanSetBufferSizeToFullCapacity): (WTF::OverflowHandler>::asanBufferSizeWillChangeTo): (WTF::OverflowHandler>::reserveCapacity): (WTF::OverflowHandler>::tryReserveCapacity): (WTF::OverflowHandler>::shrinkCapacity): (WTF::OverflowHandler>::append): (WTF::OverflowHandler>::tryAppend): (WTF::OverflowHandler>::appendSlowCase): (WTF::OverflowHandler>::uncheckedAppend): (WTF::OverflowHandler>::insert): (WTF::OverflowHandler>::remove): (WTF::OverflowHandler>::releaseBuffer): * wtf/Compiler.h: Changed ASAN_ENABLED macro fallback value from false to 0, MSVC was not happy with false. 2015-01-20 Csaba Osztrogonác Remove non-Windows cruft from WebKit/win/Plugins https://bugs.webkit.org/show_bug.cgi?id=140675 Reviewed by Anders Carlsson. * wtf/FeatureDefines.h: 2015-01-16 Myles C. Maxfield WeakPtr functions crash when created with default constructor https://bugs.webkit.org/show_bug.cgi?id=140479 Reviewed by Andreas Kling. This patch rearranges how WeakPtr works, and has the following ideas behind it: 1. WeakPtr should use Ref internally. This solves the crash by always having a valid WeakReference. 2. Clients should not be able to construct WeakReferences directly. Instead, only WeakPtrFactory (and WeakPtr's default constructor) should be able to construct them. They are considered an implementation detail of WeakPtr. 3. Except for the default constructor, clients should not be able to construct WeakPtrs directly. Instead, the WeakPtrFactory must construct them. This guarantees that the WeakPtrs all reference the same WeakReference. 4. Clients can construct a WeakPtr using its default constructor, and then use the assignment operator to make it non-null. (Or they could use WeakPtrFactory to make it non-null at creation-time.) 5. No one was using WeakReference::bindTo(), and it doesn't seem useful, so I removed it. Tests: WTF_WeakPtr API tests * wtf/Ref.h: (WTF::Ref::Ref): Added extra ASSERT()s, and explicitly deleted copy constructors with a comment. (WTF::Ref::operator=): Added extra ASSERT()s, and explicitly deleted copy assignment operators with a comment. * wtf/WeakPtr.h: (WTF::WeakReference::clear): Used nullptr. (WTF::WeakReference::create): Moved to private: (WTF::WeakPtr::WeakPtr): For the default constructor, initialized the Ref with a new WeakReference. For the other constructor, moved it to private:. Also added copy constructors and copy assignment operators (since Ref doesn't have them but RefPtr does). These constructors/operators are relied upon in various places throughout WebCore. (WTF::WeakPtr::operator bool): Made non-explicit. (WTF::WeakReference::createUnbound): Deleted. (WTF::WeakReference::bindTo): Deleted. (WTF::WeakReference::WeakReference): Deleted. (WTF::WeakPtrFactory::WeakPtrFactory): Deleted. 2015-01-16 Yusuke Suzuki std::all_of requires complete C++ iterators in GCC 4.8 https://bugs.webkit.org/show_bug.cgi?id=140530 Reviewed by Darin Adler. In the WebKit2/UIProcess/WebProcessLifetimeObserver.cpp, std::all_of is used for HashIterators. However, std::all_of requires the complete C++ iterator interface including iterator_category typedef member and it raises compile error in GCC 4.8 (and libstdc++) environment. This patch inherits std::iterator with appropriate type parameters. It automatically defines required typedefs including iterator_category. * wtf/HashIterators.h: 2015-01-15 Csaba Osztrogonác Remove ENABLE(SQL_DATABASE) guards https://bugs.webkit.org/show_bug.cgi?id=140434 Reviewed by Darin Adler. * wtf/FeatureDefines.h: 2015-01-14 Csaba Osztrogonác Unreviewed fix after r163330. * wtf/Platform.h: Use C style comment. 2015-01-14 Marc Juul C++ style comment was preventing compile if CPU(ARM_NEON) https://bugs.webkit.org/show_bug.cgi?id=133827 Reviewed by Csaba Osztrogonác. * wtf/Platform.h: 2015-01-13 Chris Dumez Make WTF::Optional work with msvc 2013 https://bugs.webkit.org/show_bug.cgi?id=140401 Reviewed by Anders Carlsson. Update the WTF::Optional implementation to use std::aligned_memory and placement new instead of an unrestricted union because msvc 2013 still doesn't support unrestricted unions. This change is a pre-requirement to fix Bug 140347 as this change uses WTF::Optional with types that have non-trivial copy constructors. This change is covered by the existing Optional WTF test. * wtf/Optional.h: 2015-01-11 Sam Weinig Remove support for SharedWorkers https://bugs.webkit.org/show_bug.cgi?id=140344 Reviewed by Anders Carlsson. * wtf/FeatureDefines.h: 2015-01-12 Darin Adler Modernize and streamline HTMLTokenizer https://bugs.webkit.org/show_bug.cgi?id=140166 Reviewed by Sam Weinig. * wtf/Forward.h: Removed PassRef, added OrdinalNumber and TextPosition. 2015-01-09 Commit Queue Unreviewed, rolling out r178154, r178163, and r178164. https://bugs.webkit.org/show_bug.cgi?id=140292 Still multiple assertion failures on tests (Requested by ap on #webkit). Reverted changesets: "Modernize and streamline HTMLTokenizer" https://bugs.webkit.org/show_bug.cgi?id=140166 http://trac.webkit.org/changeset/178154 "Unreviewed speculative buildfix after r178154." http://trac.webkit.org/changeset/178163 "One more unreviewed speculative buildfix after r178154." http://trac.webkit.org/changeset/178164 2015-01-08 Darin Adler Modernize and streamline HTMLTokenizer https://bugs.webkit.org/show_bug.cgi?id=140166 Reviewed by Sam Weinig. * wtf/Forward.h: Removed PassRef, added OrdinalNumber and TextPosition. 2015-01-08 Benjamin Poulain [WK2] Start a prototype for declarative site specific extensions https://bugs.webkit.org/show_bug.cgi?id=140160 Reviewed by Andreas Kling. * wtf/FeatureDefines.h: 2015-01-07 Daniel Bates [iOS] Make WebKit2 build with public iOS SDK and more build fixes for DRT https://bugs.webkit.org/show_bug.cgi?id=137371 As pointed out by Tim Horton, use C-style comment instead of C++-style comment as wtf/Compiler.h is included in the sandbox profile and the sandbox profile compiler doesn't understand C++-style comments. * wtf/Compiler.h: 2015-01-07 Daniel Bates [iOS] Make WebKit2 build with public iOS SDK and more build fixes for DRT https://bugs.webkit.org/show_bug.cgi?id=137371 Reviewed by David Kilzer. Move EXTERN_C_BEGIN and EXTERN_C_END macros from file WebKit2/config.h to here and rename them to WTF_EXTERN_C_BEGIN and WTF_EXTERN_C_END, respectively, so that we can make use of these macros in SPI wrapper headers (e.g. UIKitSPI.h). I'll look to transition existing code to WTF_EXTERN_C_BEGIN/WTF_EXTERN_C_END and remove EXTERN_C in a subsequent commit(s). * wtf/Compiler.h: 2015-01-07 Commit Queue Unreviewed, rolling out r178068. https://bugs.webkit.org/show_bug.cgi?id=140235 Breaks the iOS build (Requested by enrica on #webkit). Reverted changeset: "[iOS] Make WebKit2 build with public iOS SDK and more build fixes for DRT" https://bugs.webkit.org/show_bug.cgi?id=137371 http://trac.webkit.org/changeset/178068 2015-01-07 Daniel Bates [iOS] Make WebKit2 build with public iOS SDK and more build fixes for DRT https://bugs.webkit.org/show_bug.cgi?id=137371 Reviewed by David Kilzer. Move EXTERN_C_BEGIN and EXTERN_C_END macros from file WebKit2/config.h to here and rename them to WTF_EXTERN_C_BEGIN and WTF_EXTERN_C_END, respectively, so that we can make use of these macros in SPI wrapper headers (e.g. UIKitSPI.h). I'll look to transition existing code to WTF_EXTERN_C_BEGIN/WTF_EXTERN_C_END and remove EXTERN_C in a subsequent commit(s). * wtf/Compiler.h: 2015-01-07 Brian J. Burg Web Inspector: purge PassRefPtr from Inspector code and use Ref for typed and untyped protocol objects https://bugs.webkit.org/show_bug.cgi?id=140053 Reviewed by Andreas Kling. * wtf/Stopwatch.h: (WTF::Stopwatch::create): Return a Ref. 2015-01-07 Commit Queue Unreviewed, rolling out r178039. https://bugs.webkit.org/show_bug.cgi?id=140187 Breaks ObjC Inspector Protocol (Requested by JoePeck on #webkit). Reverted changeset: "Web Inspector: purge PassRefPtr from Inspector code and use Ref for typed and untyped protocol objects" https://bugs.webkit.org/show_bug.cgi?id=140053 http://trac.webkit.org/changeset/178039 2015-01-06 Brian J. Burg Web Inspector: purge PassRefPtr from Inspector code and use Ref for typed and untyped protocol objects https://bugs.webkit.org/show_bug.cgi?id=140053 Reviewed by Andreas Kling. * wtf/Stopwatch.h: (WTF::Stopwatch::create): Return a Ref. 2015-01-06 Alexey Proskuryakov ADDRESS_SANITIZER macro is overloaded https://bugs.webkit.org/show_bug.cgi?id=140130 Reviewed by Anders Carlsson. * wtf/Compiler.h: Added an ASAN_ENABLED macro. The abbreviation should become well known - we already use it in tools. * wtf/Assertions.h: * wtf/RefCounted.h: * wtf/SizeLimits.cpp: Change the conditional to ENABLE(SECURITY_ASSERTIONS). These checks will be used in debug builds, and also when one explicitly passes -DENABLE_SECURITY_ASSERTIONS. 2015-01-05 Andreas Kling Purge PassRefPtr from Page. Reviewed by Anders Carlsson. Make SchedulePair::create() return Ref since it never fails. * wtf/SchedulePair.h: (WTF::SchedulePair::create): 2015-01-01 Darin Adler Rework code that hides characters in password fields to streamline a little https://bugs.webkit.org/show_bug.cgi?id=140035 Reviewed by Sam Weinig. * wtf/text/StringImpl.cpp: (WTF::StringImpl::fill): Deleted. * wtf/text/StringImpl.h: Deleted StringImpl::fill. * wtf/text/WTFString.h: (WTF::String::fill): Deleted. 2014-12-26 Dan Bernstein Build fix. Removed use of __builtin_s{add,sub}_overflow introduced in r177729 that was causing a compiler used at Apple to crash because of . * wtf/SaturatedArithmetic.h: (signedAddOverflows): (signedSubtractOverflows): 2014-12-26 Dan Bernstein REGRESSION (r177027): iOS builds use the wrong toolchain https://bugs.webkit.org/show_bug.cgi?id=139950 Reviewed by David Kilzer. * Configurations/Base.xcconfig: Only define TOOLCHAINS when building for OS X, doing so in a manner that works with Xcode 5.1.1. 2014-12-25 Dan Bernstein Try to fix the Windows build after r177733. * wtf/Ref.h: 2014-12-25 Alexey Proskuryakov Simplify saturated integer add/sub https://bugs.webkit.org/show_bug.cgi?id=139854 Address Darin's post-commit feedback to fix API tests. * wtf/SaturatedArithmetic.h: (saturatedSubtraction): 2014-12-24 Benjamin Poulain Simplify saturated integer add/sub https://bugs.webkit.org/show_bug.cgi?id=139854 Reviewed by Darin Adler. * wtf/Compiler.h: Make a wrapper for __has_builtin for compilers that do not support it. * wtf/SaturatedArithmetic.h: (saturatedAddition): (saturatedSubtraction): Use the builtins when possible instead of reinventing the wheel. On ARMv7, use the saturated math instructions. 2014-12-23 Anders Carlsson Move dynamic_objc_cast to RetainPtr.h https://bugs.webkit.org/show_bug.cgi?id=139915 Reviewed by Sam Weinig. * wtf/RetainPtr.h: (WTF::dynamic_objc_cast): 2014-12-23 Anders Carlsson Re-indent RefPtr.h and RetainPtr.h. Rubber-stamped by Sam Weinig. * wtf/RefPtr.h: * wtf/RetainPtr.h: 2014-12-20 Eric Carlson [iOS] add optimized fullscreen API https://bugs.webkit.org/show_bug.cgi?id=139833 Reviewed by Simon Fraser. * wtf/Platform.h: Define ENABLE_VIDEO_PRESENTATION_MODE. 2014-12-18 Gyuyoung Kim Fix build break on EFL and GTK since r177523 https://bugs.webkit.org/show_bug.cgi?id=139805 Reviewed by Csaba Osztrogonác. * wtf/Ref.h: Include to use std::exchange(). 2014-12-18 Gavin Barraclough Add strong typing to RefCounter interface, return value as a bool. https://bugs.webkit.org/show_bug.cgi?id=139776 Unreviewed style fixes. * wtf/RefCounter.h: (WTF::=): 2014-12-18 Brent Fulgham [Win] Build correction after r177541. * wtf/RefCounter.h: (WTF::RefCounter::Token::Token): Revise constructor inlines to correct syntax error. 2014-12-18 Gavin Barraclough Add strong typing to RefCounter interface, return value as a bool. https://bugs.webkit.org/show_bug.cgi?id=139776 Reviewed by Geoff Garen. Currently all token vended by a RefCounter have the same type - Ref. This means there is no compile time type checking to prevent mistakes. Update the count() method to token<>(), templated on type used to identify the token being returned. Calls to token() will return a result of type RefCounter::Token. There are a few problems with the fact the counter will return you an exact count of the number of outstanding tokens: - It is desirable to only fire the callback on zero-edge changes; it is more consistent to do so if the value is only readable as a boolean. - It is desirable to provide the value as an argument to the callback, however to make this useful for integer values it is also necessary to indicate the direction of change (0->1 is often interesting where 2->1 is not). - There is a mismatch between the precision of returning a count, and the inherent imprecision of a token based mechanism, where it may be difficult to guarantee absolutely no unnecessary refcount churn, and thus unintentional counter values. * wtf/RefCounter.cpp: (WTF::RefCounter::Count::ref): (WTF::RefCounter::Count::deref): - only call the callback on zero-edge changes; provide the value. (WTF::RefCounter::RefCounter): - callback now takes a bool argument. * wtf/RefCounter.h: (WTF::RefCounter::Token::Token): - New opaque type to reference the RefCounter::Count. (WTF::RefCounter::Token::operator!): - ! operator checks for null / anasigned Tokens. (WTF::RefCounter::RefCounter): - callback now takes a bool argument. (WTF::RefCounter::token): - renamed from count(), templated on type of token returned. (WTF::RefCounter::value): - now returns a bool. (WTF::RefCounter::Token::Token): (WTF::=): - Tokens can be copied & assigned. (WTF::RefCounter::count): Deleted. - renamed to token<>(). 2014-12-18 Anders Carlsson Simplify smart pointer classes by using std::exchange https://bugs.webkit.org/show_bug.cgi?id=139790 Reviewed by Andreas Kling. * wtf/MallocPtr.h: * wtf/OSObjectPtr.h: * wtf/OwnPtr.h: (WTF::OwnPtr::clear): (WTF::OwnPtr::release): (WTF::OwnPtr::leakPtr): (WTF::=): * wtf/PassOwnPtr.h: (WTF::PassOwnPtr::leakPtr): * wtf/PassRefPtr.h: (WTF::PassRefPtr::leakRef): * wtf/Ref.h: * wtf/RefPtr.h: (WTF::RefPtr::clear): (WTF::RefPtr::leakRef): * wtf/RetainPtr.h: (WTF::RetainPtr::leakRef): 2014-12-18 Anders Carlsson Clean up MachSendRight and add a copySendRight member function https://bugs.webkit.org/show_bug.cgi?id=139788 Reviewed by Tim Horton. * wtf/StdLibExtras.h: (std::exchange): Add an implementation of std::exchange. 2014-12-17 Chris Dumez [iOS] Make it possible to toggle FeatureCounter support at runtime https://bugs.webkit.org/show_bug.cgi?id=139688 Reviewed by Andreas Kling. Remove FeatureCounter API from WTF and move it to WebCore/platform instead so that it can log conditionally based on a WebCore setting. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: 2014-12-17 Brent Fulgham [Win] Correct DebugSuffix builds under MSBuild https://bugs.webkit.org/show_bug.cgi?id=139733 Reviewed by Simon Fraser. * WTF.vcxproj/WTF.proj: Make sure to use the '_debug' suffix when building the DebugSuffix target. 2014-12-17 Anders Carlsson Make Ref::copyRef const and ref-qualified https://bugs.webkit.org/show_bug.cgi?id=139730 Reviewed by Andreas Kling. * wtf/Ref.h: 2014-12-16 Daniel Bates [iOS] WTF fails to build with public SDK due to missing header CPAggregateDictionary.h https://bugs.webkit.org/show_bug.cgi?id=139695 Reviewed by Chris Dumez. Add USE(APPLE_INTERNAL_SDK)-guard around iOS-specific feature counter implementation as we are only interested in counting features in builds of iOS WebKit that were built with the Apple Internal SDK. * wtf/FeatureCounter.cpp: * wtf/ios/FeatureCounter.mm: 2014-12-16 Geoffrey Garen Enable FastMalloc in debug builds https://bugs.webkit.org/show_bug.cgi?id=139692 Reviewed by Alexey Proskuryakov. This will give debug builds greater fidelity to the real thing. FastMalloc now transparently supports all the malloc debugging APIs I know of by disabling itself at runtime -- and it should be easy to add support for any APIs I missed -- so there's no need to turn it off in debug builds. * wtf/FastMalloc.cpp: 2014-12-16 Anders Carlsson RefPtr::copyRef should be const https://bugs.webkit.org/show_bug.cgi?id=139689 Reviewed by Andreas Kling. copyRef() doesn't modify the original object so it should be const. Also, add a && qualified overload and mark it deleted so that calls to copyRef() where the object is an rvalue will fail to compile. * wtf/RefPtr.h: 2014-12-15 Chris Dumez [iOS] Add feature counting support https://bugs.webkit.org/show_bug.cgi?id=139652 Reviewed by Gavin Barraclough. Add a FeatureCounter API for to log / count when a feature is used. For now, this is only implementated on iOS. * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/FeatureCounter.cpp: Added. (WTF::incrementFeatureCounterKey): (WTF::setFeatureCounterKey): * wtf/FeatureCounter.h: Added. * wtf/ios/FeatureCounter.mm: Added. (WTF::incrementFeatureCounterKey): (WTF::setFeatureCounterKey): 2014-12-12 Anders Carlsson Get rid of the DONT_FINALIZE_ON_MAIN_THREAD #define https://bugs.webkit.org/show_bug.cgi?id=139613 Reviewed by Sam Weinig. * wtf/Platform.h: Remove the #define. 2014-12-15 Commit Queue Unreviewed, rolling out r177284. https://bugs.webkit.org/show_bug.cgi?id=139658 "Breaks API tests and LayoutTests on Yosemite Debug" (Requested by msaboff on #webkit). Reverted changeset: "Make sure range based iteration of Vector<> still receives bounds checking" https://bugs.webkit.org/show_bug.cgi?id=138821 http://trac.webkit.org/changeset/177284 2014-12-15 Andreas Kling Purge PassRefPtr from FocusEvent code. Reviewed by Anders Carlsson. Add a RefPtr::copyRef() to use when passing a RefPtr to a RefPtr&& without transferring the ownership. * wtf/RefPtr.h: 2014-12-15 Oliver Hunt Make sure range based iteration of Vector<> still receives bounds checking https://bugs.webkit.org/show_bug.cgi?id=138821 Reviewed by Mark Lam. Add a new IndexedIterator struct to WTF that wraps a Vector type and index to provide pointer like semantics while still performing runtime bounds checking, even in release builds. We store a simple index into the vector which means that this iterator allows vector resizing during iteration. If the vector is resized such that the iterator is out of bounds, then any attempt to dereference the iterator will crash safely. For the purpose of retaining semantically equivalent behaviour, the iterator can be moved to m_index == size() as that is the standard "end" terminator for these types. Attempting to dereference at that point will still crash rather than perform an unsafe memory operation. By necessity there are many overrides for operator + and - as we otherwise hit many different type promotion ambiguities when performing arithmetic with iterators. These ambiguities are also different for 32- vs. 64-bit, so duplicating the functions and then forwarding to the core implementations that performed the bounds checking and mutation seemed like the right call. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/IndexedIterator.h: Added. (WTF::IndexedIterator::IndexedIterator): (WTF::IndexedIterator::operator->): (WTF::IndexedIterator::operator*): (WTF::IndexedIterator::get): (WTF::IndexedIterator::operator++): (WTF::IndexedIterator::operator--): (WTF::IndexedIterator::operator UnspecifiedBoolType): (WTF::IndexedIterator::operator-): (WTF::IndexedIterator::operator=): (WTF::IndexedIterator::operator==): (WTF::IndexedIterator::operator!=): (WTF::IndexedIterator::operator<): (WTF::IndexedIterator::operator<=): (WTF::IndexedIterator::operator>): (WTF::IndexedIterator::operator>=): (WTF::IndexedIterator::operator const_iterator): (WTF::IndexedIterator::unsafeGet): (WTF::getPtr): (WTF::operator-): (WTF::operator==): (WTF::operator!=): (WTF::operator<=): (WTF::operator>=): (WTF::operator<): (WTF::operator>): (WTF::IndexedIteratorSelector::makeIterator): (WTF::IndexedIteratorSelector::makeConstIterator): * wtf/RefCountedArray.h: (WTF::RefCountedArray::RefCountedArray): * wtf/Vector.h: (WTF::Vector::Vector): (WTF::Vector::begin): (WTF::Vector::end): (WTF::OverflowHandler>::Vector): (WTF::=): (WTF::OverflowHandler>::fill): (WTF::OverflowHandler>::expandCapacity): (WTF::OverflowHandler>::tryExpandCapacity): (WTF::OverflowHandler>::resize): (WTF::OverflowHandler>::shrink): (WTF::OverflowHandler>::grow): (WTF::OverflowHandler>::reserveCapacity): (WTF::OverflowHandler>::tryReserveCapacity): (WTF::OverflowHandler>::shrinkCapacity): (WTF::OverflowHandler>::append): (WTF::OverflowHandler>::tryAppend): (WTF::OverflowHandler>::appendSlowCase): (WTF::OverflowHandler>::uncheckedAppend): (WTF::OverflowHandler>::appendVector): (WTF::OverflowHandler>::insert): (WTF::OverflowHandler>::insertVector): (WTF::OverflowHandler>::remove): 2014-12-14 Andreas Kling Minor follow-up tweaks suggested by Darin on bug 139587. * wtf/text/WTFString.h: (WTF::String::String): 2014-12-14 Andreas Kling Replace PassRef with Ref/Ref&& across the board. Reviewed by Darin Adler. Kill the PassRef class and replace it by Ref/Ref&&. Usage is simple: - For locals and members, keep using Ref. - For return types, use Ref. - For (ownership-transferring) arguments, use Ref&&. When passing to a Ref&&, use WTF::move() to mobilize the value at the call site, e.g: void myFunction(Ref&&); Ref myFoo(Foo::create()); myFunction(WTF::move(myFoo)); // 'myFoo' is invalid from this point forward. As you can see, it works a lot like PassRefPtr, but unlike PassRefPtr it won't surprise you by becoming null *unless* you WTF::move it. I've also added a Ref::copyRef() for instances where you want to return a Ref *without* transferring ownership, e.g code like: Ref foo() { return m_foo; } ... now becomes ... Ref foo() { return m_foo.copyRef(); } This makes it explicit that a refcount bump will occur. Finally, do note that unlike last year's PassRef, Ref&& does not require you to move it to avoid leaking; it will clean itself up. * wtf/PassRef.h: (WTF::adopted): Deleted. (WTF::PassRef::PassRef): Deleted. (WTF::PassRef::~PassRef): Deleted. (WTF::PassRef::get): Deleted. (WTF::PassRef::ptr): Deleted. (WTF::PassRef::leakRef): Deleted. (WTF::adoptRef): Deleted. (WTF::createRefCounted): Deleted. * wtf/PassRefPtr.h: (WTF::PassRefPtr::PassRefPtr): * wtf/Ref.h: (WTF::adopted): (WTF::Ref::~Ref): (WTF::Ref::Ref): (WTF::Ref::operator=): (WTF::Ref::operator->): (WTF::Ref::ptr): (WTF::Ref::get): (WTF::Ref::operator T&): (WTF::Ref::operator const T&): (WTF::Ref::replace): (WTF::adoptRef): * wtf/RefCounter.h: (WTF::RefCounter::count): * wtf/RefPtr.h: (WTF::RefPtr::releaseNonNull): (WTF::RefPtr::RefPtr): (WTF::=): * wtf/text/AtomicString.cpp: (WTF::addToStringTable): (WTF::AtomicString::add): (WTF::AtomicString::addFromLiteralData): (WTF::AtomicString::addSlowCase): * wtf/text/AtomicString.h: * wtf/text/StringImpl.cpp: (WTF::StringImpl::createFromLiteral): (WTF::StringImpl::createWithoutCopying): (WTF::StringImpl::createUninitializedInternal): (WTF::StringImpl::createUninitializedInternalNonEmpty): (WTF::StringImpl::createUninitialized): (WTF::StringImpl::reallocateInternal): (WTF::StringImpl::reallocate): (WTF::StringImpl::createInternal): (WTF::StringImpl::create): (WTF::StringImpl::create8BitIfPossible): (WTF::StringImpl::substring): (WTF::StringImpl::lower): (WTF::StringImpl::upper): (WTF::StringImpl::fill): (WTF::StringImpl::foldCase): (WTF::StringImpl::convertToASCIILowercase): (WTF::StringImpl::stripMatchedCharacters): (WTF::StringImpl::stripWhiteSpace): (WTF::StringImpl::removeCharacters): (WTF::StringImpl::simplifyMatchedCharactersToSpace): (WTF::StringImpl::simplifyWhiteSpace): (WTF::StringImpl::replace): (WTF::StringImpl::adopt): * wtf/text/StringImpl.h: (WTF::StringImpl::create8BitIfPossible): (WTF::StringImpl::create): (WTF::StringImpl::createSubstringSharingImpl8): (WTF::StringImpl::createSubstringSharingImpl): (WTF::StringImpl::createFromLiteral): (WTF::StringImpl::createEmptyUnique): (WTF::StringImpl::adopt): (WTF::StringImpl::replace): (WTF::StringImpl::constructInternal): (WTF::StringImpl::constructInternal): (WTF::StringImpl::isolatedCopy): * wtf/text/WTFString.h: (WTF::String::String): 2014-12-10 Geoffrey Garen Please disable the webkitFirstVersionWithInitConstructorSupport check on Apple TV https://bugs.webkit.org/show_bug.cgi?id=139501 Reviewed by Gavin Barraclough. Added a platform definition for APPLETV. (It's not an OS because it's not mutually exclusive with other OS definitions.) * wtf/Platform.h: 2014-12-10 Martin Robinson [GTK] Add support for text-decoration-skip https://bugs.webkit.org/show_bug.cgi?id=131540 Reviewed by Gustavo Noronha Silva. * wtf/Platform.h: Enable text decoration skip by default. 2014-12-09 David Kilzer Switch from using PLATFORM_NAME to SDK selectors in ANGLE, bmalloc, gtest, JavaScriptCore, WTF Reviewed by Joseph Pecoraro. * Configurations/Base.xcconfig: - Only set GCC_ENABLE_OBJC_GC, GCC_MODEL_TUNING and TOOLCHAINS on OS X. * Configurations/DebugRelease.xcconfig: - Only set MACOSX_DEPLOYMENT_TARGET and SDKROOT on OS X. 2014-12-09 Dean Jackson [Apple] Use Accelerate framework to speed-up FEGaussianBlur https://bugs.webkit.org/show_bug.cgi?id=139310 Unreviewed followup, after comments by Andreas Kling. It was pointed out that we already have a USE(ACCELERATE), so we don't need a HAVE(ACCELERATE) :) * wtf/Platform.h: 2014-12-09 Alberto Garcia Undefined Symbol build error "_objc_registerThreadWithCollector" when building WebKit GTK Mac OS X on Snow Leopard https://bugs.webkit.org/show_bug.cgi?id=58737 Reviewed by Darin Adler. Replace OS(MAC_OS_X) with PLATFORM(MAC) to prevent using osx-specific code in WebKitGTK+ builds. * wtf/ThreadingPthreads.cpp: (WTF::initializeCurrentThreadInternal): 2014-12-08 Dean Jackson [Apple] Use Accelerate framework to speed-up FEGaussianBlur https://bugs.webkit.org/show_bug.cgi?id=139310 Reviewed by Simon Fraser. Add a HAVE_ACCELERATE flag, true on Apple platforms. * wtf/Platform.h: 2014-12-08 Myles C. Maxfield Fix iOS build after r176971. I had previously modified the WTF forwarding header instead of modifying the real source. * wtf/unicode/CharacterNames.h: 2014-12-08 Anders Carlsson Change WTF::currentCPUTime to return std::chrono::microseconds and get rid of currentCPUTimeMS https://bugs.webkit.org/show_bug.cgi?id=139410 Reviewed by Andreas Kling. * wtf/CurrentTime.cpp: (WTF::currentCPUTime): (WTF::currentCPUTimeMS): Deleted. * wtf/CurrentTime.h: 2014-12-08 Chris Dumez Revert r176293 & r176275 Unreviewed, revert r176293 & r176275 changing the Vector API to use unsigned type instead of size_t. There is some disagreement regarding the long-term direction of the API and we shouldn’t leave the API partly transitioned to unsigned type while making a decision. * wtf/Forward.h: * wtf/Vector.h: (WTF::VectorTypeOperations::compare): (WTF::VectorBufferBase::allocateBuffer): (WTF::VectorBufferBase::tryAllocateBuffer): (WTF::VectorBufferBase::shouldReallocateBuffer): (WTF::VectorBufferBase::reallocateBuffer): (WTF::VectorBufferBase::capacity): (WTF::VectorBufferBase::VectorBufferBase): (WTF::VectorBuffer::VectorBuffer): (WTF::VectorBuffer::allocateBuffer): (WTF::VectorBuffer::tryAllocateBuffer): (WTF::VectorBuffer::shouldReallocateBuffer): (WTF::VectorBuffer::reallocateBuffer): (WTF::VectorBuffer::swap): (WTF::VectorBuffer::swapInlineBuffer): (WTF::VectorBuffer::swapInlineBuffers): (WTF::Vector::Vector): (WTF::Vector::capacity): (WTF::Vector::at): (WTF::Vector::operator[]): (WTF::OverflowHandler>::find): (WTF::OverflowHandler>::reverseFind): (WTF::OverflowHandler>::fill): (WTF::OverflowHandler>::expandCapacity): (WTF::OverflowHandler>::tryExpandCapacity): (WTF::OverflowHandler>::resize): (WTF::OverflowHandler>::resizeToFit): (WTF::OverflowHandler>::shrink): (WTF::OverflowHandler>::grow): (WTF::OverflowHandler>::reserveCapacity): (WTF::OverflowHandler>::tryReserveCapacity): (WTF::OverflowHandler>::reserveInitialCapacity): (WTF::OverflowHandler>::shrinkCapacity): (WTF::OverflowHandler>::append): (WTF::OverflowHandler>::tryAppend): (WTF::OverflowHandler>::insert): (WTF::OverflowHandler>::insertVector): (WTF::OverflowHandler>::remove): (WTF::OverflowHandler>::reverse): (WTF::OverflowHandler>::checkConsistency): * wtf/text/AtomicString.h: * wtf/text/StringImpl.h: (WTF::StringImpl::adopt): (WTF::equalIgnoringNullity): * wtf/text/StringView.h: (WTF::append): * wtf/text/WTFString.h: 2014-12-07 Andreas Kling Use more PassRef in AtomicString. Reviewed by Antti Koivisto. Make a pass over AtomicString and convert functions that return PassRefPtr into returning RefPtr (where it may be null) and PassRef otherwise. This allows the compiler to skip null checks in many places. * wtf/text/AtomicString.cpp: (WTF::addToStringTable): (WTF::AtomicString::add): (WTF::AtomicString::addFromLiteralData): (WTF::AtomicString::addSlowCase): * wtf/text/AtomicString.h: (WTF::AtomicString::add): (WTF::AtomicString::addWithStringTableProvider): * wtf/text/cf/AtomicStringCF.cpp: (WTF::AtomicString::add): 2014-12-05 Roger Fong [Win] proj files copying over too many resources.. https://bugs.webkit.org/show_bug.cgi?id=139315. Reviewed by Brent Fulgham. * WTF.vcxproj/WTF.proj: Only copy WTF.dll. 2014-12-05 Andreas Kling PassRef should deref on destruction if pointee was not moved. Reviewed by Antti Koivisto. Let PassRef become nullptr internally after having WTF::move()'d the pointee. This means that PassRef is now essentially a PassRefPtr that can only be constructed with a non-null pointee. This should make it possible for all ::create()-style construction helpers to return PassRef, removing a branch in each case. * wtf/PassRef.h: (WTF::PassRef::PassRef): (WTF::PassRef::~PassRef): (WTF::PassRef::get): (WTF::PassRef::ptr): (WTF::PassRef::leakRef): (WTF::PassRef::dropRef): Deleted. 2014-12-05 Jer Noble [WTF] MediaTime should support round-tripping from and to doubles. https://bugs.webkit.org/show_bug.cgi?id=139248 Reviewed by Eric Carlson. MediaTimes should be able to return precisely the same double value as was used when the MediaTime was created, so long as that MediaTime was not modified in a non-destructive way. This will allow API which accepts floating-point values to return the exact same value when asked, but still be able to store that value as a MediaTime. * wtf/MediaTime.cpp: (WTF::MediaTime::createWithFloat): Added; store the floating-point value in a union. (WTF::MediaTime::createWithDouble): Ditto. (WTF::MediaTime::toFloat): If the value is a double, just return it. (WTF::MediaTime::toDouble): Ditto. (WTF::MediaTime::operator+): Special case when one or both sides are doubles. (WTF::MediaTime::operator-): Ditto. (WTF::MediaTime::operator*): Ditto. (WTF::MediaTime::compare): Ditto. (WTF::abs): Ditto. (WTF::MediaTime::setTimeScale): Convert the MediaTime from a double. 2014-12-05 peavo@outlook.com [WinCairo] WTF project is missing a GStreamer source file. https://bugs.webkit.org/show_bug.cgi?id=139296 Reviewed by Philippe Normand. The WTF project file is missing a GStreamer source file, causing a link error when compiling with GStreamer enabled. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: 2014-12-04 David Kilzer REGRESSION (r176683): RefCounter.h is installed outside SDKROOT * WTF.xcodeproj/project.pbxproj: Don't mark RefCounter.h as a private header. WTF headers use a special build phase script to be installed. 2014-12-04 Anders Carlsson Make API::String copy the underlying strings if needed, for thread safety https://bugs.webkit.org/show_bug.cgi?id=139261 Reviewed by Sam Weinig. * wtf/RefPtr.h: (WTF::RefPtr::leakRef): Add a leakRef() to RefPtr so we don't have to go through PassRefPtr. * wtf/text/WTFString.cpp: (WTF::String::isSafeToSendToAnotherThread): Check if the string is empty before checking whether it's in an atomic string table. It's safe to send empty strings to other threads even if they're in the atomic string table since they will never be deallocated. 2014-12-04 Csaba Osztrogonác Fix cast-align warning in StringImpl.h https://bugs.webkit.org/show_bug.cgi?id=139222 Reviewed by Anders Carlsson. * wtf/text/StringImpl.h: (WTF::StringImpl::tailPointer): 2014-12-02 Mark Lam Rolling out r176592, r176603, r176616, and r176705 until build and perf issues are resolved. https://bugs.webkit.org/show_bug.cgi?id=138821 Not reviewed. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/IndexedIterator.h: Removed. * wtf/RefCountedArray.h: (WTF::RefCountedArray::RefCountedArray): * wtf/Vector.h: (WTF::Vector::Vector): (WTF::Vector::begin): (WTF::Vector::end): (WTF::OverflowHandler>::Vector): (WTF::=): (WTF::OverflowHandler>::fill): (WTF::OverflowHandler>::expandCapacity): (WTF::OverflowHandler>::tryExpandCapacity): (WTF::OverflowHandler>::resize): (WTF::OverflowHandler>::shrink): (WTF::OverflowHandler>::grow): (WTF::OverflowHandler>::reserveCapacity): (WTF::OverflowHandler>::tryReserveCapacity): (WTF::OverflowHandler>::shrinkCapacity): (WTF::OverflowHandler>::append): (WTF::OverflowHandler>::tryAppend): (WTF::OverflowHandler>::appendSlowCase): (WTF::OverflowHandler>::uncheckedAppend): (WTF::OverflowHandler>::appendVector): (WTF::OverflowHandler>::insert): (WTF::OverflowHandler>::insertVector): (WTF::OverflowHandler>::remove): 2014-12-02 Oliver Hunt Fix IOS builds. * wtf/IndexedIterator.h: 2014-12-02 Gavin Barraclough Generalize PageActivityAssertionToken https://bugs.webkit.org/show_bug.cgi?id=139106 Reviewed by Sam Weinig. PageActivityAssertionToken is a RAII mechanism implementing a counter, used by PageThrottler to count user visible activity in progress on the page (currently page load and media playback). Use of an RAII type is prevents a number of possible errors, including double counting a single media element, or failing to decrement the count after a media element has been deallocated. The current implementation has a number of drawbacks that have been addressed by this refactoring: - specific to single use in PageThrottler class - not reusable. - incomplete encapsulation - the counter and WeakPtrFactory that comprise the current implementation are not encapsulated (are in the client type, PageThrottler). - tokens are not shared - PageActivityAssertionToken instances are managed by std::unique, every increment requires an object allocation. - redundancy - the current implementation uses a WeakPtr to safely reference the PageThrottler, this is internally implemented using a reference counted type, resulting in two counters being incremented (one in the PageActivityAssertionToken, one in the PageThrottler). In the reimplementation: - a callback is provided via a lambda function, which allows for easy reuse without a lot of boilerplate code. - the counter, callback and ownership of the otherwise weakly-owned token is encapsulated within the RefCounter type. - a single count within RefCounter::Count stores the counter value, and also manage the lifetime of this object. - standard RefPtrs are used to manage references to the RefCounter::Count. * WTF.xcodeproj/project.pbxproj: - added RefCounter.cpp/.h * wtf/RefCounter.cpp: Added. (WTF::RefCounter::Count::ref): - increment the counter. (WTF::RefCounter::Count::deref): - decrement the counter, and delete as necessary. (WTF::RefCounter::RefCounter): - create a RefCounter::Count. (WTF::RefCounter::~RefCounter): - eagerly delete the Counter if it has no references, otherwise let it be deleted on last deref. * wtf/RefCounter.h: Added. (WTF::RefCounter::Count::Count): - initialize count to 0. (WTF::RefCounter::RefCounter): - takes a lambda to be called when the value changes. (WTF::RefCounter::count): - reference the counter (and in doing so increment the count). (WTF::RefCounter::value): - access the current value of the counter. 2014-12-01 Andreas Kling Optimize constructing JSC::Identifier from AtomicString. Reviewed by Michael Saboff. Make AtomicString::isInAtomicStringTable() public so it can be used in some Identifier assertions. * wtf/text/AtomicString.h: 2014-12-01 Oliver Hunt Fix non-mac builds. * wtf/IndexedIterator.h: 2014-12-01 Oliver Hunt Fix 32-bit build. * wtf/IndexedIterator.h: 2014-11-17 Oliver Hunt Make sure range based iteration of Vector<> still receives bounds checking https://bugs.webkit.org/show_bug.cgi?id=138821 Reviewed by Mark Lam. Add a new IndexedIterator struct to WTF that wraps a Vector type and index to provide pointer like semantics while still performing runtime bounds checking, even in release builds. We store a simple index into the vector which means that this iterator allows vector resizing during iteration. If the vector is resized such that the iterator is out of bounds, then any attempt to dereference the iterator will crash safely. Any other errors, including overflows, and over extending the iterator will likewise crash. For the purpose of retaining semantically equivalent behaviour, the iterator can be moved to m_index == size() as that is the standard "end" terminator for these types. Attempting to dereference at that point will still crash rather than perform an unsafe memory operation. In order to maintain the validity of all the bounds checking, we perform full integer range checking prior to any mutation of the iterator location. If we detect an arithmetic overflow we will crash rather than attempting to carry on. By necessity there are many overrides for operator + and - as we otherwise hit many different type promotion ambiguities when performing arithmetic with iterators. These ambiguities are also different for 32- vs. 64-bit, so duplicating the functions and then forwarding to the core implementations that performed the bounds checking and mutation seemed like the right call. * WTF.xcodeproj/project.pbxproj: * wtf/IndexedIterator.h: Added. (WTF::IndexedIterator::IndexedIterator): (WTF::IndexedIterator::operator->): (WTF::IndexedIterator::operator*): (WTF::IndexedIterator::get): (WTF::IndexedIterator::operator++): (WTF::IndexedIterator::operator--): (WTF::IndexedIterator::operator UnspecifiedBoolType): (WTF::IndexedIterator::operator+=): (WTF::IndexedIterator::operator-=): (WTF::IndexedIterator::operator+): (WTF::IndexedIterator::operator-): (WTF::IndexedIterator::operator=): (WTF::IndexedIterator::operator==): (WTF::IndexedIterator::operator!=): (WTF::IndexedIterator::operator<): (WTF::IndexedIterator::operator<=): (WTF::IndexedIterator::operator>): (WTF::IndexedIterator::operator>=): (WTF::IndexedIterator::operator const_iterator): (WTF::IndexedIterator::isSafeToCompare): (WTF::IndexedIterator::unsafeGet): (WTF::getPtr): (WTF::operator-): (WTF::operator==): (WTF::operator!=): (WTF::operator<=): (WTF::operator>=): (WTF::operator<): (WTF::operator>): (WTF::IndexedIteratorSelector::makeIterator): (WTF::IndexedIteratorSelector::makeConstIterator): * wtf/RefCountedArray.h: (WTF::RefCountedArray::RefCountedArray): * wtf/Vector.h: (WTF::Vector::Vector): (WTF::Vector::begin): (WTF::Vector::end): (WTF::OverflowHandler>::Vector): (WTF::=): (WTF::OverflowHandler>::fill): (WTF::OverflowHandler>::expandCapacity): (WTF::OverflowHandler>::tryExpandCapacity): (WTF::OverflowHandler>::resize): (WTF::OverflowHandler>::shrink): (WTF::OverflowHandler>::grow): (WTF::OverflowHandler>::reserveCapacity): (WTF::OverflowHandler>::tryReserveCapacity): (WTF::OverflowHandler>::shrinkCapacity): (WTF::OverflowHandler>::append): (WTF::OverflowHandler>::tryAppend): (WTF::OverflowHandler>::appendSlowCase): (WTF::OverflowHandler>::uncheckedAppend): (WTF::OverflowHandler>::appendVector): (WTF::OverflowHandler>::insert): (WTF::OverflowHandler>::insertVector): (WTF::OverflowHandler>::remove): 2014-11-30 Ryuan Choi [EFL] Drop support for the EFL 1.7 https://bugs.webkit.org/show_bug.cgi?id=139114 Reviewed by Gyuyoung Kim. * wtf/efl/EflTypedefs.h: Removed old definitions which EFL 1.7 used. 2014-11-21 Anders Carlsson Remove the Timer parameters from timer callbacks https://bugs.webkit.org/show_bug.cgi?id=138974 Reviewed by Antti Koivisto. * wtf/RunLoopTimer.h: (WTF::RunLoopTimer::RunLoopTimer): (WTF::RunLoopTimer::fired): 2014-11-18 Chris Dumez Have Vector::capacity() return an unsigned instead of a size_t https://bugs.webkit.org/show_bug.cgi?id=138842 Reviewed by Andreas Kling. Have Vector::capacity() return an unsigned instead of a size_t as capacity is stored as an unsigned internally. * wtf/Vector.h: (WTF::Vector::capacity): (WTF::OverflowHandler>::expandCapacity): (WTF::OverflowHandler>::tryExpandCapacity): 2014-11-18 Geoffrey Garen Removed the custom allocator for ListHashSet nodes https://bugs.webkit.org/show_bug.cgi?id=138841 Reviewed by Andreas Kling. bmalloc is fast, so we don't need a custom allocator. The MallocBench test for linked list node allocation (list_allocate) is 4.09X faster in bmalloc than TCMalloc. Also, I wrote a stress test to add/remove link elements, which modify a ListHashSet on insertion and removal, and it was 1% faster / in the noise with bmalloc enabled. * wtf/ListHashSet.h: (WTF::ListHashSetNode::ListHashSetNode): (WTF::ListHashSetTranslator::translate): (WTF::U>::ListHashSet): (WTF::=): (WTF::U>::swap): (WTF::U>::~ListHashSet): (WTF::U>::size): (WTF::U>::capacity): (WTF::U>::isEmpty): (WTF::U>::first): (WTF::U>::removeFirst): (WTF::U>::takeFirst): (WTF::U>::last): (WTF::U>::removeLast): (WTF::U>::takeLast): (WTF::U>::contains): (WTF::U>::remove): (WTF::U>::clear): (WTF::U>::unlink): (WTF::U>::unlinkAndDelete): (WTF::U>::appendNode): (WTF::U>::prependNode): (WTF::U>::insertNodeBefore): (WTF::U>::deleteAllNodes): (WTF::ListHashSetNodeAllocator::ListHashSetNodeAllocator): Deleted. (WTF::ListHashSetNodeAllocator::allocate): Deleted. (WTF::ListHashSetNodeAllocator::deallocate): Deleted. (WTF::ListHashSetNodeAllocator::pool): Deleted. (WTF::ListHashSetNodeAllocator::pastPool): Deleted. (WTF::ListHashSetNodeAllocator::inPool): Deleted. (WTF::ListHashSetNode::operator new): Deleted. (WTF::ListHashSetNode::destroy): Deleted. 2014-11-18 Chris Dumez Update the Vector API to deal with unsigned types instead of size_t https://bugs.webkit.org/show_bug.cgi?id=138824 Reviewed by Andreas Kling. Update part of the Vector API to deal with unsigned types instead of size_t. The Vector class is already using unsigned type for its capacity and size data members. However, the Vector API was never updated accordingly. The rest of the Vector API will be ported in follow-up patches to make the change smaller and more easily reviewable. * wtf/Forward.h: * wtf/Vector.h: (WTF::VectorTypeOperations::compare): (WTF::VectorBufferBase::allocateBuffer): (WTF::VectorBufferBase::tryAllocateBuffer): (WTF::VectorBufferBase::shouldReallocateBuffer): (WTF::VectorBufferBase::reallocateBuffer): (WTF::VectorBufferBase::capacity): (WTF::VectorBufferBase::VectorBufferBase): (WTF::VectorBuffer::VectorBuffer): (WTF::VectorBuffer::allocateBuffer): (WTF::VectorBuffer::tryAllocateBuffer): (WTF::VectorBuffer::shouldReallocateBuffer): (WTF::VectorBuffer::reallocateBuffer): (WTF::VectorBuffer::swap): (WTF::VectorBuffer::swapInlineBuffer): (WTF::VectorBuffer::swapInlineBuffers): (WTF::Vector::Vector): (WTF::Vector::at): (WTF::Vector::operator[]): (WTF::OverflowHandler>::find): (WTF::OverflowHandler>::reverseFind): (WTF::OverflowHandler>::fill): (WTF::OverflowHandler>::expandCapacity): (WTF::OverflowHandler>::tryExpandCapacity): (WTF::OverflowHandler>::resize): (WTF::OverflowHandler>::resizeToFit): (WTF::OverflowHandler>::shrink): (WTF::OverflowHandler>::grow): (WTF::OverflowHandler>::reserveCapacity): (WTF::OverflowHandler>::tryReserveCapacity): (WTF::OverflowHandler>::reserveInitialCapacity): (WTF::OverflowHandler>::shrinkCapacity): (WTF::OverflowHandler>::append): (WTF::OverflowHandler>::tryAppend): (WTF::OverflowHandler>::insert): (WTF::OverflowHandler>::insertVector): (WTF::OverflowHandler>::remove): (WTF::OverflowHandler>::reverse): (WTF::OverflowHandler>::checkConsistency): * wtf/text/AtomicString.h: * wtf/text/StringImpl.h: (WTF::StringImpl::adopt): (WTF::equalIgnoringNullity): * wtf/text/StringView.h: (WTF::append): * wtf/text/WTFString.h: 2014-11-18 peavo@outlook.com [WinCairo] Compile errors when GStreamer is enabled. https://bugs.webkit.org/show_bug.cgi?id=137000 Reviewed by Philippe Normand. MSVC does not allow the keyword default on move constructors and move assignment operators. * wtf/gobject/GMainLoopSource.cpp: (WTF::GMainLoopSource::cancel): (WTF::GMainLoopSource::socketCallback): * wtf/gobject/GMainLoopSource.h: (WTF::GMainLoopSource::Context::operator=): 2014-11-17 Anders Carlsson Fix WTF build with newer versions of clang. * wtf/HashTable.h: (WTF::removeIterator): * wtf/dtoa/utils.h: (WTF::double_conversion::BitCast): 2014-11-13 Myles C. Maxfield Allow constructing a base PassRef with a derived Ref https://bugs.webkit.org/show_bug.cgi?id=138701 Reviewed by Andreas Kling * wtf/PassRef.h: (WTF::PassRef::PassRef): 2014-11-12 Ryuan Choi [EFL] Fix the build with EFL 1.12 https://bugs.webkit.org/show_bug.cgi?id=138245 Reviewed by Gyuyoung Kim. * wtf/efl/UniquePtrEfl.h: Removed Evas_GL.h from UniquePtrEfl.h, which is commonly included, because it should not be included with official GL headers. 2014-11-12 Mark Lam Rename USE(MASM_PROBE) to ENABLE(MASM_PROBE). Reviewed by Michael Saboff. Also move the switch for enabling the use of MASM_PROBE from JavaScriptCore's config.h to WTF's Platform.h. This ensures that the setting is consistently applied even when building WebCore parts as well. * wtf/Platform.h: 2014-11-09 Antti Koivisto Remove BloomFilter size limit https://bugs.webkit.org/show_bug.cgi?id=138549 Reviewed by Andreas Kling. * wtf/BloomFilter.h: Remove the static_assert, the code works fine with somewhat larger sizes. 2014-11-09 Chris Dumez Add a more correct way to compare floating point numbers and use it https://bugs.webkit.org/show_bug.cgi?id=138527 Reviewed by Darin Adler. To compare floating point numbers in the code base, we would often rely on the following check: std::abs(a - b) <= std::numeric_limits::epsilon() However, this is not correct for arbitrary floating point values, and will fail for values that are not close to zero. This patch introduces a WTF::areEssentiallyEqual() templated function that can only be called with floating point types and relies on the following formula from [1][2] that defines u as being "essentially equal" to v if: | u - v | / |u| <= e and | u - v | / |v| <= e [1] Knuth, D. E. "Accuracy of Floating Point Arithmetic." The Art of Computer Programming. 3rd ed. Vol. 2. Boston: Addison-Wesley, 1998. 229-45. [2] http://www.boost.org/doc/libs/1_34_0/libs/test/doc/components/test_tools/floating_point_comparison.html * wtf/MathExtras.h: (WTF::safeFPDivision): (WTF::areEssentiallyEqual): (WTF::withinEpsilon): Deleted. 2014-11-08 Darin Adler Replace FileThread class with a single function https://bugs.webkit.org/show_bug.cgi?id=138282 Reviewed by Alexey Proskuryakov. * wtf/MessageQueue.h: Made queue work on any type and not require wrapping everything in a unique_ptr. * wtf/Threading.cpp: (WTF::threadEntryPoint): Changed to use a std::function instead of a function pointer. (WTF::createThread): Add a version that takes a std::function. Reimplemented the old version using lambdas. Removed the obsolete versions that were there just to support binary compatibility with very old versions of Safari. * wtf/Threading.h: Removed an incorrect license header that covers code that was long ago moved to a different file. Changed createThread to take a std::function instead of a function pointer and data pointer. Moved internal functions after public functions. 2014-11-05 Chris Dumez Assertion hit DOMTimer::updateTimerIntervalIfNecessary() https://bugs.webkit.org/show_bug.cgi?id=138440 Reviewed by Geoffrey Garen. Move the withinEpsilon() function to WTF to avoid code duplication. * wtf/MathExtras.h: (WTF::withinEpsilon): 2014-11-05 Chris Dumez Allow constructing a PassRef from a Ref https://bugs.webkit.org/show_bug.cgi?id=138389 Reviewed by Andreas Kling. Allow constructing a PassRef from a Ref, similarly to PassRefPtr that can be constructed from a RefPtr already. This avoids having to call Ref::get() and simplifies the code a bit. * wtf/PassRef.h: (WTF::PassRef::PassRef): 2014-11-05 Dan Bernstein Remove the unused deletion UI feature https://bugs.webkit.org/show_bug.cgi?id=138442 Rubber-stamped by Alexey Proskuryakov. * wtf/FeatureDefines.h: Removed definition of ENABLE_DELETION_UI. 2014-11-03 Dean Jackson Add ENABLE_FILTERS_LEVEL_2 feature guard. https://bugs.webkit.org/show_bug.cgi?id=138362 Reviewed by Tim Horton. Add a new feature define for Level 2 of CSS Filters. http://dev.w3.org/fxtf/filters-2/ * wtf/FeatureDefines.h: 2014-11-05 Csaba Osztrogonác Enable ARMv7 disassembler for all platforms https://bugs.webkit.org/show_bug.cgi?id=138415 Reviewed by Darin Adler. * wtf/Platform.h: 2014-11-04 Chris Dumez Add ptr() method to Ref class https://bugs.webkit.org/show_bug.cgi?id=138361 Reviewed by Darin Adler. It is a very common pattern in our code base to get a pointer from a Ref object. Previously, we have to call Ref.get() and take its address which is not very nice. This patch adds a ptr() method to Ref class to simplify the code a bit. * wtf/PassRef.h: (WTF::PassRef::ptr): * wtf/Ref.h: (WTF::Ref::ptr): (WTF::GetPtrHelper>::getPtr): 2014-11-04 Dániel Bátyai ATTR_USED incorrectly applying to Clang https://bugs.webkit.org/show_bug.cgi?id=138313 Reviewed by Csaba Osztrogonác. ATTR_USED was only intended for GCC. Also limit it to ENABLE(FTL_NATIVE_CALL_INLINING) since that's the only thing it's needed for. * wtf/Platform.h: 2014-11-03 Chris Dumez Allow implicit conversion from Ref to T& https://bugs.webkit.org/show_bug.cgi?id=138331 Reviewed by Andreas Kling. Allow implicit conversion from Ref to T& to reduce the amount of Ref<>::get() calls in the code and increase readability. Unlike for RefPtr, doing this for Ref should not be error prone. * wtf/Ref.h: (WTF::Ref::operator T&): (WTF::Ref::operator const T&): * wtf/RunLoop.cpp: (WTF::RunLoop::Holder::runLoop): 2014-10-31 Jeffrey Pfau Unreviewed, fix ASan build after r175382 * wtf/SizeLimits.cpp: 2014-10-31 Geoffrey Garen Rolled in r175389. WebKit was failing to build 32bit on some Apple internal systems because those systems were configured to build bmalloc 64-bit-only. Those systems have been updated to build bmalloc as a universal binary, so everything should work fine now. The relevant setting is controlled by an environment variable on the build system, and not by the project file in the source tree, so there's no new code change here. Enable bmalloc in 32bit builds https://bugs.webkit.org/show_bug.cgi?id=138232 Reviewed by Andreas Kling. * wtf/FastMalloc.cpp: 2014-10-31 Lucas Forschler Unreviewed rollout r175389. 2014-10-30 Dana Burkart Prepare for the mysterious future Reviewed by Lucas Forschler. * Configurations/Base.xcconfig: * Configurations/DebugRelease.xcconfig: 2014-10-30 Geoffrey Garen Enable bmalloc in 32bit builds https://bugs.webkit.org/show_bug.cgi?id=138232 Reviewed by Andreas Kling. Seems to work fine. * wtf/FastMalloc.cpp: 2014-10-30 Jeffrey Pfau ASSERT(!m_deletionHasBegun) in RefCounted.h should be ASSERT_WITH_SECURITY_IMPLICATION https://bugs.webkit.org/show_bug.cgi?id=138141 Reviewed by Alexey Proskuryakov. * wtf/RefCounted.h: (WTF::RefCountedBase::ref): (WTF::RefCountedBase::relaxAdoptionRequirement): (WTF::RefCountedBase::derefBase): (WTF::adopted): 2014-10-28 Milan Crha Use constants from wtf/MathExtras.h https://bugs.webkit.org/show_bug.cgi?id=137967 Reviewed by Darin Adler. * wtf/MathExtras.h: 2014-10-28 Tibor Meszaros [EFL] Remove unnecessary defines from OptionsEfl.cmake https://bugs.webkit.org/show_bug.cgi?id=138132 Reviewed by Csaba Osztrogonác. * wtf/Platform.h: 2014-10-27 Chris Dumez Use separate HashMaps for common and uncommon headers in HTTPHeaderMap https://bugs.webkit.org/show_bug.cgi?id=138079 Reviewed by Anders Carlsson. Add HashTraits for C++11 strong enum types. Using integer HashTraits for strong enums would be inconvenient as it would require casting between integer and strong enum types. * wtf/HashTraits.h: (WTF::StrongEnumHashTraits::emptyValue): (WTF::StrongEnumHashTraits::constructDeletedValue): (WTF::StrongEnumHashTraits::isDeletedValue): 2014-10-25 Brian J. Burg Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Unreviewed, follow-up fix after r175203. The debugger agent should not assume that the inspector environment's stopwatch has already been started. * wtf/Stopwatch.h: (WTF::Stopwatch::isActive): Added. Allow peeking at the stopwatch state. 2014-10-18 Brian J. Burg Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): 2014-10-23 Joseph Pecoraro Web Inspector: Provide a way to have alternate inspector agents https://bugs.webkit.org/show_bug.cgi?id=137901 Reviewed by Brian Burg. * wtf/FeatureDefines.h: 2014-10-23 Alberto Garcia [GTK] Fix build on Hurd https://bugs.webkit.org/show_bug.cgi?id=138003 Reviewed by Carlos Garcia Campos. * wtf/InlineASM.h: * wtf/Platform.h: 2014-10-22 Byungseon Shin String(new Date(Mar 30 2014 01:00:00)) is wrong in CET https://bugs.webkit.org/show_bug.cgi?id=130967 Reviewed by Mark Lam. By definition of calculateLocalTimeOffset, input time should be UTC time. But there are many cases when input time is based on local time. So, it gives erroneous results while calculating offset of DST boundary time. By adding a argument to distinguish UTC and local time, we can get the correct offset. * wtf/DateMath.cpp: (WTF::calculateLocalTimeOffset): (WTF::parseDateFromNullTerminatedCharacters): Compensate time offset depends on UTC time or local time. * wtf/DateMath.h: Add argument to differenciate UTC or local time. 2014-10-21 Dániel Bátyai Fix FTL Native Inlining for EFL https://bugs.webkit.org/show_bug.cgi?id=137774 Reviewed by Michael Saboff. Updated guard definition for Native Inlining, and added an attribute define for marking functions that should not be left out of the symbol table. * wtf/Platform.h: 2014-10-20 Chris Dumez Use is<>() / downcast<>() for Accessibility objects https://bugs.webkit.org/show_bug.cgi?id=137286 Reviewed by Darin Adler. Remove the legacy TYPE_CASTS_BASE() macro now that it is no longer used. * wtf/Assertions.h: 2014-10-18 Dan Bernstein WorkQueue dispatches functions but isn’t a FunctionDispatcher https://bugs.webkit.org/show_bug.cgi?id=137853 Reviewed by Anders Carlsson. * wtf/FunctionDispatcher.h: Added header guards. 2014-10-17 Carlos Garcia Campos [GLIB] Add API to GMainLoopSource to schedule sources after a delay in microseconds https://bugs.webkit.org/show_bug.cgi?id=137782 Reviewed by Sergio Villar Senin. In some cases when we have a double with the time in seconds, the conversion to milliseconds ends up truncating the value to 0, and the source scheduled immediately. * wtf/gobject/GMainLoopSource.cpp: (WTF::createMicrosecondsTimeoutSource): Use a custom timeout source that handles the interval in microseconds instead of milliseconds. (WTF::GMainLoopSource::scheduleAfterDelay): Use MicrosecondsTimeoutSource. (WTF::GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy): Ditto. * wtf/gobject/GMainLoopSource.h: 2014-10-17 Dan Bernstein Reverted incorrect build fix attempt. * wtf/Threading.cpp: 2014-10-17 Dan Bernstein Tried to fix the Yosemite build. * wtf/Threading.cpp: 2014-10-16 Dan Bernstein OSObjectPtr is missing leakRef() https://bugs.webkit.org/show_bug.cgi?id=137798 Reviewed by Sam Weinig. * wtf/OSObjectPtr.h: 2014-10-14 Brent Fulgham [Win] Unreviewed gardening. Ignore Visual Studio *.sdf files. * WTF.vcxproj: Modified property svn:ignore. 2014-10-13 Antti Koivisto Add StringCapture helper for thread-safe lambda capture https://bugs.webkit.org/show_bug.cgi?id=137664 Reviewed by Anders Carlsson. There is currently no clean way to capture a String in a thread-safe manner. This will now work: StringCapture stringCapture(string); auto lambdaThatRunsInAnotherThread = [stringCapture] { String string = stringCapture.string(); ... } This type won't be necessary with C++14 initialized lambda capture: [string = string.isolatedCopy()]. * wtf/text/WTFString.h: (WTF::StringCapture::StringCapture): Create isolated copy in copy-constructor. (WTF::StringCapture::string): 2014-10-11 KwangHyuk Kim [EFL] Enable WebP support. https://bugs.webkit.org/show_bug.cgi?id=136156 Reviewed by Gyuyoung Kim. Enable WTF_USE_WEBP macro for WK2 Efl. * wtf/Platform.h: 2014-10-11 Carlos Garcia Campos [GLIB] Split GMainLoopSource moving thread safe implementation to its own class GThreadSafeMainLoopSource https://bugs.webkit.org/show_bug.cgi?id=137485 Reviewed by Sergio Villar Senin. We made GMainLoopSource thread safe, but in most of the cases we know the sources are used by a single thread, which has an impact in the performance (mutex, GCancellable, etc.). The new class GThreadSafeMainLoopSource inherits from GMainLoopSource overriding the new virtual methods and calling the parent for the common code. GMutexLocker now supports recursive mutexes, it's a template that can wrap a GMutex or a GRecMutex. GThreadSafeMainLoopSource uses a recursive mutex using the new GMutexLocker API. * wtf/PlatformEfl.cmake: Add new file to compilation. * wtf/PlatformGTK.cmake: Ditto. * wtf/gobject/GMainLoopSource.cpp: (WTF::GMainLoopSource::GMainLoopSource): (WTF::GMainLoopSource::~GMainLoopSource): (WTF::GMainLoopSource::cancel): (WTF::GMainLoopSource::schedule): (WTF::GMainLoopSource::scheduleAfterDelay): (WTF::GMainLoopSource::prepareVoidCallback): (WTF::GMainLoopSource::finishVoidCallback): (WTF::GMainLoopSource::voidCallback): (WTF::GMainLoopSource::prepareBoolCallback): (WTF::GMainLoopSource::finishBoolCallback): (WTF::GMainLoopSource::boolCallback): (WTF::GMainLoopSource::socketCallback): (WTF::GMainLoopSource::cancelWithoutLocking): Deleted. * wtf/gobject/GMainLoopSource.h: * wtf/gobject/GMutexLocker.h: (WTF::MutexWrapper::lock): (WTF::MutexWrapper::unlock): (WTF::MutexWrapper::lock): (WTF::MutexWrapper::unlock): (WTF::GMutexLocker::GMutexLocker): (WTF::GMutexLocker::lock): (WTF::GMutexLocker::unlock): * wtf/gobject/GThreadSafeMainLoopSource.cpp: Added. (WTF::GThreadSafeMainLoopSource::GThreadSafeMainLoopSource): (WTF::GThreadSafeMainLoopSource::~GThreadSafeMainLoopSource): (WTF::GThreadSafeMainLoopSource::cancel): (WTF::GThreadSafeMainLoopSource::schedule): (WTF::GThreadSafeMainLoopSource::scheduleAfterDelay): (WTF::GThreadSafeMainLoopSource::prepareVoidCallback): (WTF::GThreadSafeMainLoopSource::finishVoidCallback): (WTF::GThreadSafeMainLoopSource::voidCallback): (WTF::GThreadSafeMainLoopSource::prepareBoolCallback): (WTF::GThreadSafeMainLoopSource::finishBoolCallback): (WTF::GThreadSafeMainLoopSource::boolCallback): * wtf/gobject/GThreadSafeMainLoopSource.h: Added. 2014-10-09 Dean Jackson Remove ENABLE_CSS3_CONDITIONAL_RULES https://bugs.webkit.org/show_bug.cgi?id=137571 Reviewed by Simon Fraser. * wtf/FeatureDefines.h: 2014-10-09 Akos Kiss Enable ARM64 disassembler for all platforms https://bugs.webkit.org/show_bug.cgi?id=137560 Reviewed by Michael Saboff. Remove PLATFORM conditions from around WTF_USE_ARM64_DISASSEMBLER since the ARM64 disassembler has no platform dependencies anymore. * wtf/Platform.h: 2014-10-08 peavo@outlook.com [WinCairo] Enable JIT on 32-bit. https://bugs.webkit.org/show_bug.cgi?id=137521 Reviewed by Mark Lam. Enable JIT on Windows 32-bit, but disable it at runtime if SSE2 is not present. * wtf/Platform.h: 2014-10-08 Brent Fulgham [Win] Resolve warnings about missing __has_include macro under MSVC https://bugs.webkit.org/show_bug.cgi?id=137524 Reviewed by Anders Carlsson. * wtf/Compiler.h: Provide a dummy implementation of __has_include that avoids the warning without changing compile behavior. 2014-10-07 Brent Fulgham [Win] Resolve some MSVC static analyzer warnings https://bugs.webkit.org/show_bug.cgi?id=137504 Reviewed by Dean Jackson. * wtf/GregorianDateTime.cpp: (WTF::GregorianDateTime::setToCurrentLocalTime): Properly handle possible timezone error case. * wtf/OSAllocatorWin.cpp: (WTF::OSAllocator::decommit): Silence a spurious warning about using MEM_DECOMMIT instead of MEM_RELEASE. * wtf/ThreadingWin.cpp: Silence a spurious warning about how the tryLock method is implemented. 2014-10-07 Christophe Dumez [WK2] Use is<>() / downcast<>() for DrawingAreaProxy subclasses https://bugs.webkit.org/show_bug.cgi?id=137477 Reviewed by Andreas Kling. Rename wtf/cf/TypeCasts.h to wtf/cf/TypeCastsCF.h to avoid conflict with wtf/TypeCasts.h. They were using the same #ifndef guard and it was causing problems when both were included in the same context. * WTF.xcodeproj/project.pbxproj: * wtf/cf/TypeCastsCF.h: Renamed from Source/WTF/wtf/cf/TypeCasts.h. (WTF::dynamic_cf_cast): (WTF::checked_cf_cast): 2014-10-07 Anders Carlsson Try to fix the Mountain Lion build. * wtf/text/StringView.h: (WTF::StringView::underlyingStringIsValid): (WTF::StringView::setUnderlyingString): (WTF::StringView::invalidate): 2014-10-07 Anders Carlsson Use "1", not "true". * wtf/text/StringView.h: 2014-10-07 Anders Carlsson Temporarily disable the StringView lifetime checking. * wtf/text/StringView.h: 2014-10-07 Anders Carlsson Another build fix attempt. * wtf/text/StringView.cpp: (WTF::StringView::UnderlyingString::UnderlyingString): 2014-10-07 Anders Carlsson Try to fix the Windows build. * wtf/text/StringView.cpp: (WTF::StringView::UnderlyingString::UnderlyingString): 2014-10-06 Darin Adler Make StringView check the lifetime of the StringImpl it's created from https://bugs.webkit.org/show_bug.cgi?id=137202 Reviewed by Anders Carlsson. * WTF.vcxproj/WTF.vcxproj: Added StringView.cpp. * WTF.vcxproj/WTF.vcxproj.filters: Added StringView.cpp. * WTF.xcodeproj/project.pbxproj: Added StringView.cpp. * wtf/CMakeLists.txt: Added StringView.cpp. * wtf/text/StringImpl.cpp: (WTF::StringImpl::~StringImpl): Call StringView::invalidate. * wtf/text/StringView.cpp: Added. (WTF::underlyingStrings): Returns map from StringImpl to the underlying string object used by StringView to track validity. (WTF::StringView::invalidate): Mark the underlying string object invalid, and remove it from the map, so any future StringImpl will get a new one, even if it has the same pointer. (WTF::StringView::underlyingStringIsValid): Return true only if the underlying string is still valid. (WTF::StringView::setUnderlyingString): Create and manage reference counts of underlying string objects as needed. * wtf/text/StringView.h: Moved function bodies out of the class definition, so we can now read a clean class definition to see the class design and what functions it offers. (WTF::StringView::StringView): Added a comment to the default constructor. Also added copy and move constructors so they can call setUnderlyingString and assert the underlying string is valid as needed, replacing the compiler-generated ones. (WTF::StringView::~StringView): Added a call to setUnderlyingString. (WTF::StringView::operator=): Added these assignment operators with the same job as the constructors above. (WTF::StringView::initialize): Added a comment. (WTF::StringView::characters8): Added an assertion that the underlying string is valid. (WTF::StringView::characters16): Ditto. (WTF::StringView::substring): Added code to propagate the underlying string from the original string to the substring. (WTF::StringView::invalidate): Inline empty version of this function for non-debug builds. (WTF::StringView::underlyingStringIsValid): Ditto. (WTF::StringView::setUnderlyingString): Ditto. 2014-10-06 Brent Fulgham [Win] DateMath's calculateUTFOffset does not account for DST. https://bugs.webkit.org/show_bug.cgi?id=137458 Reviewed by Geoffrey Garen. Check the return value of GetTimeZoneInformation and use the proper bias against UTC (depending on whether we are in daylight savings time, or standard time). Also, handle possible error cases in the FileTimeToSystemTime and SystemTimeToTzSpecificLocalTime, rather than using potentially uninitialized values. * wtf/DateMath.cpp: (WTF::calculateUTCOffset): Use proper daylight-savings-time state. (WTF::calculateDSTOffset): Avoid uninitialized data due to failing API calls. 2014-10-06 Christophe Dumez Add is<>() / downcast<>() support for RenderObject subclasses https://bugs.webkit.org/show_bug.cgi?id=137424 Reviewed by Benjamin Poulain. Handle correctly calling TypeCastTraits::isOfType(ArgType&) with ExpectedType being a base class of ArgType (or the same as ArgType). The previous template specialization was only meant to support the case where ExpectedType is the same as ArgType but even that wasn't working as the compiler would complain about ambiguous partial specializations. Since this is needed by RenderTraversal functions, this patch adds an extra isBaseType template parameter to TypeCastTraits to resolve the ambiguity and relies on std::is_base_of for the detection. * wtf/TypeCasts.h: 2014-10-06 Brent Fulgham [Win] Project file gardening. * WTF.vcxproj/WTF.vcxproj.filters: Move HashMethod.h and FastBitVector.cpp to proper places in hierarchy. 2014-10-04 Brian J. Burg Unreviewed, rolling out r174319. Causes assertions in fast/profiler tests. Needs nontrivial investigation, will take offline. Reverted changeset: "Web Inspector: timelines should not count time elapsed while paused in the debugger" https://bugs.webkit.org/show_bug.cgi?id=136351 http://trac.webkit.org/changeset/174319 2014-10-04 Brian J. Burg Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): 2014-10-04 Filip Pizlo FTL should sink PutLocals https://bugs.webkit.org/show_bug.cgi?id=137168 Reviewed by Oliver Hunt. Make the set bits of a BitVector iterable. * wtf/BitVector.h: (WTF::BitVector::SetBitsIterable::SetBitsIterable): (WTF::BitVector::SetBitsIterable::iterator::iterator): (WTF::BitVector::SetBitsIterable::iterator::operator*): (WTF::BitVector::SetBitsIterable::iterator::operator++): (WTF::BitVector::SetBitsIterable::iterator::operator==): (WTF::BitVector::SetBitsIterable::iterator::operator!=): (WTF::BitVector::SetBitsIterable::begin): (WTF::BitVector::SetBitsIterable::end): (WTF::BitVector::setBits): 2014-10-03 Commit Queue Unreviewed, rolling out r174275. https://bugs.webkit.org/show_bug.cgi?id=137408 Build failures on the internal bots. (Requested by dethbakin on #webkit). Reverted changeset: "FTL should sink PutLocals" https://bugs.webkit.org/show_bug.cgi?id=137168 http://trac.webkit.org/changeset/174275 2014-10-03 Christophe Dumez Add TypeCasts.h to xcodeproject https://bugs.webkit.org/show_bug.cgi?id=137403 Reviewed by Benjamin Poulain. Add TypeCasts.h to xcodeproject. * WTF.xcodeproj/project.pbxproj: 2014-09-28 Filip Pizlo FTL should sink PutLocals https://bugs.webkit.org/show_bug.cgi?id=137168 Reviewed by Oliver Hunt. Make the set bits of a BitVector iterable. * wtf/BitVector.h: (WTF::BitVector::SetBitsIterable::SetBitsIterable): (WTF::BitVector::SetBitsIterable::iterator::iterator): (WTF::BitVector::SetBitsIterable::iterator::operator*): (WTF::BitVector::SetBitsIterable::iterator::operator++): (WTF::BitVector::SetBitsIterable::iterator::operator==): (WTF::BitVector::SetBitsIterable::iterator::operator!=): (WTF::BitVector::SetBitsIterable::begin): (WTF::BitVector::SetBitsIterable::end): (WTF::BitVector::setBits): 2014-10-03 Myles C. Maxfield Support modern for loops over StringViews https://bugs.webkit.org/show_bug.cgi?id=137165 Reviewed by Darin Adler. This patch adds two functions, codePoints() and codeUnits(), on StringView. These two functions return small objects which have begin() and end() functions, which means it can be used by the modern for loop style. This small class also has an inner iterator class which can be incremented, dereferenced, and compared. Using these new objects looks like this: for (UChar codeunit : stringView.codeUnits()) { } and for (UChar32 codepoint : stringView.codePoints()) { }. * wtf/text/StringView.h: (WTF::StringView::codepoints): (WTF::StringView::codeunits): (WTF::StringViewCodePointIterator::StringViewCodePointIterator): (WTF::StringViewCodePointIterator::Iterator::Iterator): (WTF::StringViewCodePointIterator::Iterator::operator*): (WTF::StringViewCodePointIterator::Iterator::operator!=): (WTF::StringViewCodeUnitIterator::StringViewCodeUnitIterator): (WTF::StringViewCodeUnitIterator::Iterator::Iterator): (WTF::StringViewCodeUnitIterator::Iterator::operator*): (WTF::StringViewCodeUnitIterator::Iterator::operator!=): 2014-09-28 Sam Weinig Remove RefPtrHashMap https://bugs.webkit.org/show_bug.cgi?id=137200 Reviewed by Darin Adler. HashMap now has all the features of the RefPtr specialization of HashMap (which lived in RefPtrHashMap.h) and is in fact more efficient when moving items into it. For instance: For HashMap, Bar> map: RefPtr foo = ...; map.add(WTF::move(foo), Bar()); will now not cause a ref() / deref(), but will successfully move the item in without churn. The same is true if foo.release() was used. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Remove references to RefPtrHashMap.h. * wtf/RefPtrHashMap.h: Removed. * wtf/HashMap.h: Remove #include of RefPtrHashMap.h and add inlineGet to match the interface exposed by the RefPtrHashMap specialization. 2014-10-02 Anders Carlsson Add back debugging/testing code that I accidentally removed. * wtf/text/StringConcatenate.h: (WTF::StringTypeAdapter::writeTo): 2014-10-02 Anders Carlsson Simplify StringTypeAdapter templates https://bugs.webkit.org/show_bug.cgi?id=137356 Reviewed by Andreas Kling. * wtf/text/StringConcatenate.h: Use StringView for copying characters. Use inheritance for char* vs const char* etc. Make all StringAdapter member functions const. * wtf/text/StringView.h: Move enough functions out of line so we can include WTFString.h after the StringView class definition. 2014-10-01 Christophe Dumez Have is<>(T*) function do a null check on the pointer argument https://bugs.webkit.org/show_bug.cgi?id=137333 Reviewed by Gavin Barraclough. Have is<>(T*) function do a null check on the argument instead of a simple assertion. This makes sense for 2 reasons: 1. It is more consistent with downcast<>(T*), which will succeed even if the argument is a nullptr. 2. It simplifies the code a bit as it gets rid of a lot of explicit null checks. * wtf/TypeCasts.h: (WTF::is): 2014-10-02 Daniel Bates Clean up: Move XPC forward declarations in JavaScriptCore to WTF SPI wrapper header https://bugs.webkit.org/show_bug.cgi?id=137277 Reviewed by Alexey Proskuryakov. Towards centralizing the declarations of XPC functions used in JavaScriptCore and WebKit2, add a header that wraps these function declarations called XPCSPI.h and use it instead of including the corresponding XPC API/SPI headers/forward declaring XPC functions. This will also aid in the effort to make WebKit2 build for iOS with the public iOS SDK. * WTF.xcodeproj/project.pbxproj: * wtf/spi/darwin/XPCSPI.h: Added. 2014-10-01 Christophe Dumez Unreviewed build fix after r174193. Adding a return statement as that function is returning a boolean. * wtf/TypeCasts.h: (WTF::TypeCastTraits::isOfType): 2014-10-01 Christophe Dumez Fail better when is<>() / downcast<>() is used for an unsupported type https://bugs.webkit.org/show_bug.cgi?id=137323 Reviewed by Benjamin Poulain. We should fail better when is<>() / downcast<>() is used for an unsupported type (i.e. a type that doesn't have the needed TypeCastTraits template specialization). Previously, we would get an obscure linking error, which was sub-optimal. With this patch, you would now hit a static_assert() at build time if you tried to use is<>() / downcast<>() for a type that did not have the needed template specialization. There is also a helpful comment above the assertion letting the developer know how to add the needed template specialization. * wtf/TypeCasts.h: (WTF::TypeCastTraits::isOfType): 2014-10-01 Commit Queue Unreviewed, rolling out r174180, r174183, and r174186. https://bugs.webkit.org/show_bug.cgi?id=137320 Broke the Mac MountainLion build. Will investigate offline. (Requested by dydz on #webkit). Reverted changesets: "Clean up: Move XPC forward declarations in JavaScriptCore to WTF SPI wrapper header" https://bugs.webkit.org/show_bug.cgi?id=137277 http://trac.webkit.org/changeset/174180 "Attempt to fix the build after " https://bugs.webkit.org/show_bug.cgi?id=137277 http://trac.webkit.org/changeset/174183 "Another attempt to fix the Mac build after " https://bugs.webkit.org/show_bug.cgi?id=137277 http://trac.webkit.org/changeset/174186 2014-10-01 Daniel Bates Another attempt to fix the Mac build after (https://bugs.webkit.org/show_bug.cgi?id=137277) Include header AvailabilityMacros.h instead of Availability.h, which actually defines the macro __MAC_OS_X_VERSION_MIN_REQUIRED. * wtf/spi/darwin/XPCSPI.h: 2014-10-01 Daniel Bates Attempt to fix the build after (https://bugs.webkit.org/show_bug.cgi?id=137277) Include header for the definition of __MAC_OS_X_VERSION_MIN_REQUIRED. Also, we want to define CONST_ON_OR_AFTER_MAC_OS_X_VERSION_1090 to be const when building on iOS. * wtf/spi/darwin/XPCSPI.h: 2014-10-01 Daniel Bates Clean up: Move XPC forward declarations in JavaScriptCore to WTF SPI wrapper header https://bugs.webkit.org/show_bug.cgi?id=137277 Reviewed by Alexey Proskuryakov. Towards centralizing the declarations of XPC functions used in JavaScriptCore and WebKit2, add a header that wraps these function declarations called XPCSPI.h and use it instead of including the corresponding XPC API/SPI headers/forward declaring XPC functions. This will also aid in the effort to make WebKit2 build for iOS with the public iOS SDK. * WTF.xcodeproj/project.pbxproj: * wtf/spi/darwin/XPCSPI.h: Added. 2014-10-01 Brent Fulgham [Win] 32-bit JavaScriptCore should limit itself to the C loop https://bugs.webkit.org/show_bug.cgi?id=137304 Reviewed by Michael Saboff. * wtf/Platform.h: Force the C loop when building for 32-bit Windows. 2014-09-30 Christophe Dumez Generalize is<>() / downcast<>() support to all types https://bugs.webkit.org/show_bug.cgi?id=137243 Reviewed by Benjamin Poulain. Generalize is<>() / downcast<>() support to all types, not just Nodes. * wtf/Assertions.h: * wtf/TypeCasts.h: Added. (WTF::is): (WTF::downcast): 2014-09-30 Anders Carlsson Get the STRING_STATS codepath compiling again, and add calls to ref/deref https://bugs.webkit.org/show_bug.cgi?id=137259 Reviewed by Andreas Kling. * wtf/text/StringImpl.cpp: (WTF::StringStats::removeString): (WTF::StringStats::printStats): (WTF::StringImpl::~StringImpl): * wtf/text/StringImpl.h: (WTF::StringImpl::StringImpl): (WTF::StringImpl::isSubString): (WTF::StringImpl::ref): (WTF::StringImpl::deref): (WTF::StringStats::addUpconvertedString): Deleted. 2014-09-30 Daniel Bates REGRESSION (r172532): JSBase.h declares NSMapTable functions that are SPI https://bugs.webkit.org/show_bug.cgi?id=137170 Reviewed by Geoffrey Garen. Add SPI wrapper header, NSMapTableSPI.h. Additionally, define convenience macro EXTERN_C that can be used to specify the C linkage convention for a declaration. For example, the declaration "EXTERN_C const int x;" will expand to: extern const int x; and extern "C" const int x; when used in a C and C++ file, respectively. * WTF.xcodeproj/project.pbxproj: * wtf/Compiler.h: * wtf/spi/cocoa/NSMapTableSPI.h: Added. 2014-09-29 Commit Queue Unreviewed, rolling out r174045. https://bugs.webkit.org/show_bug.cgi?id=137231 Introduced a crash during page loading tests on Mac (Requested by rniwa on #webkit). Reverted changeset: "Replace OSObjectPtr with RetainPtr/adoptOS" https://bugs.webkit.org/show_bug.cgi?id=137158 http://trac.webkit.org/changeset/174045 2014-09-26 Sam Weinig Replace OSObjectPtr with RetainPtr/adoptOS https://bugs.webkit.org/show_bug.cgi?id=137158 Reviewed by Dan Bernstein. * WTF.xcodeproj/project.pbxproj: * wtf/OSObjectPtr.h: Removed. * wtf/RetainPtr.h: (WTF::adoptOS): Added. This adopt function is slightly different than both adoptCF and adoptNS, in that unlike adoptCF(), it can be passed an Objective-C type (since OS objects are sometimes Objective-C objects, but not always), and unlike adoptNS() it doesn't require us to jump through hoops to appease GC (since OS objects are not Objective-C objects if GC is enabled). 2014-09-24 Filip Pizlo FTL should sink object allocations https://bugs.webkit.org/show_bug.cgi?id=136330 Reviewed by Oliver Hunt. Make it possible to reset a Bag. * wtf/Bag.h: (WTF::Bag::Bag): (WTF::Bag::~Bag): (WTF::Bag::clear): 2014-09-25 Roger Fong [Windows] Unreviewed build fix. Ensure that python2.7 is used for Windows builds. * WTF.vcxproj/WTFGenerated.make: 2014-09-25 Csaba Osztrogonác Remove WinCE port from trunk https://bugs.webkit.org/show_bug.cgi?id=136951 Reviewed by Alex Christensen. * config.h: * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Atomics.h: (WTF::weakCompareAndSwap): * wtf/CurrentTime.cpp: (WTF::lowResUTCTime): * wtf/DataLog.cpp: * wtf/DateMath.cpp: (WTF::getLocalTime): (WTF::calculateDSTOffset): * wtf/FastMalloc.cpp: * wtf/FeatureDefines.h: * wtf/OSAllocator.h: (WTF::OSAllocator::decommitAndRelease): * wtf/Platform.h: * wtf/PlatformWin.cmake: * wtf/RAMSize.cpp: (WTF::computeRAMSize): * wtf/RandomNumberSeed.h: (WTF::initializeRandomNumberGenerator): * wtf/StackBounds.cpp: (WTF::StackBounds::initialize): * wtf/StackBounds.h: (WTF::StackBounds::isGrowingDownward): * wtf/StdLibExtras.h: (wtf_bsearch): Deleted. * wtf/StringExtras.h: (strnicmp): Deleted. (stricmp): Deleted. (strdup): Deleted. * wtf/ThreadSpecific.h: * wtf/ThreadingWin.cpp: (WTF::createThreadInternal): * wtf/WindowsExtras.h: (WTF::getRegistryValue): (WTF::getWindowPointer): (WTF::setWindowPointer): * wtf/dtoa/utils.h: * wtf/text/WTFString.cpp: (WTF::String::format): 2014-09-24 Geoffrey Garen Do the bmalloc. https://bugs.webkit.org/show_bug.cgi?id=132629 Reviewed by Gavin Barraclough. 64-bit only for now, just to try it out. * wtf/FastMalloc.cpp: 2014-09-23 Geoffrey Garen Rolled out r173346. bmalloc should honor the FastMalloc statistics API https://bugs.webkit.org/show_bug.cgi?id=136592 This didn't really work. Because we allow ranges with and without physical pages to merge, and we allow double-committing and double-decommitting, we can't rely on commit actions to track memory footprint. * wtf/FastMalloc.cpp: (WTF::fastMallocStatistics): 2014-09-23 Joseph Pecoraro Web Inspector: Should be able to attach a debugger to a JSContext before anything is executed https://bugs.webkit.org/show_bug.cgi?id=136893 Reviewed by Timothy Hatcher. Currently automatic inspection only happens in processes that have a debugger attached. That condition may change in the future, but this function can stand on its own in WTF. It may be useful in the future to perhaps continue though ASSERTs if you have a debugger attached. * wtf/Assertions.cpp: * wtf/Assertions.h: 2014-09-22 Sam Weinig Eliminate redundant PtrHash specializations https://bugs.webkit.org/show_bug.cgi?id=136990 Reviewed by Darin Adler. Now that we have IsSmartPtr, we can eliminate all the specializations of PtrHash that we had (for RefPtr, OwnPtr, RetainPtr, and std::unique_ptr) and instead just have one that uses GetPtrHelper. No changes of behavior intended. * wtf/GetPtr.h: Remove unnecessary const_cast that Darin noticed. * wtf/HashFunctions.h: (WTF::PtrHash::hash): Deleted. (WTF::PtrHash::equal): Deleted. (WTF::PtrHash>::hash): Deleted. (WTF::PtrHash>::equal): Deleted. Specialize PtrHash based on whether the type is a smart pointer, and use GetPtrHelper to implement the smart pointer specialized variant. * wtf/HashMap.h: Remove include of GetPtr.h that is now included by HashFunctions.h * wtf/OwnPtr.h: (WTF::PtrHash>::hash): Deleted. (WTF::PtrHash>::equal): Deleted. Remove unnecessary specialization of PtrHash. * wtf/RetainPtr.h: (WTF::PtrHash>::hash): Deleted. (WTF::PtrHash>::equal): Deleted. Specialize IsSmartPointer for RetainPtr and remove the then unnecessary specialization of PtrHash. (This is already tested in the API test WTF/cf/RetainPtrHashing). 2014-09-20 Sam Weinig Make possible HashSet> https://bugs.webkit.org/show_bug.cgi?id=136166 Reviewed by Darin Adler. * wtf/GetPtr.h: (WTF::getPtr): (WTF::GetPtrHelper>::getPtr): Make specializing GetPtrHelper a bit cleaner (you don't have to put IsSmartPtr::value everywhere any more) and add specializations for std::unique_ptr. * wtf/HashFunctions.h: (WTF::PtrHash>): Add specialization for PtrHash for std::unique_ptr and set it as the DefaultHash for it as well. * wtf/HashMap.h: * wtf/HashSet.h: Add overloads of find(), contains(), remove(), take() (and get() for HashMap) for "smart pointers" that take the raw pointer type as the parameter. These use SFINAE to make themselves only available when the IsSmartPtr::value is true. * wtf/HashTraits.h: Override constructDeletedValue() and isDeletedValue() in the std::unique_ptr specialization since the default implementation depends on the type having a constructor that takes a HashTableDeletedValue and function named isHashTableDeletedValue(). * wtf/OwnPtr.h: (WTF::OwnPtr::OwnPtr): (WTF::OwnPtr::isHashTableDeletedValue): (WTF::OwnPtr::hashTableDeletedValue): Add HashTableDeletedValue constructor/functions to allow the constructDeletedValue() and isDeletedValue() hash traits to work. (WTF::PtrHash>::hash): (WTF::PtrHash>::equal): Add specialization for PtrHash for OwnPtr and set it as the DefaultHash for it as well. * wtf/Ref.h: Update for the less verbose GetPtrHelper specialization. 2014-09-19 Chris Dumez Allow DOM methods to return references instead of pointers https://bugs.webkit.org/show_bug.cgi?id=136931 Add support for having WTF::getPtr() transform reference arguments into raw pointers so that DOM methods can now return references when appropriate and so that the generated bindings code can handle this via WTF::getPtr(). This patch had to alter the way getPtr() was overloaded for smart pointer types so that we don't call &p on smart pointers but p.get(). This was needed because the new WTF::getPtr(T&) was being called for RefPtr arguments instead of the getPtr(const RefPtr&) overload. This was addressed using traits and template specialization to distinguish WTF smart pointers from other types. Reviewed by Sam Weinig. * wtf/GetPtr.h: (WTF::getPtr): * wtf/OwnPtr.h: (WTF::getPtr): Deleted. * wtf/PassOwnPtr.h: (WTF::getPtr): Deleted. * wtf/PassRefPtr.h: (WTF::getPtr): Deleted. * wtf/Ref.h: * wtf/RefPtr.h: (WTF::getPtr): Deleted. * wtf/gobject/GRefPtr.h: (WTF::getPtr): Deleted. 2014-09-19 Daniel Bates Always assume internal SDK when building configuration Production https://bugs.webkit.org/show_bug.cgi?id=136925 Reviewed by Dan Bernstein. * Configurations/Base.xcconfig: 2014-09-19 Diego Pino Garcia Simple ES6 feature:String prototype additions https://bugs.webkit.org/show_bug.cgi?id=131704 Reviewed by Darin Adler. * wtf/text/StringImpl.cpp: (WTF::StringImpl::find): (WTF::equalInner): Added. (WTF::StringImpl::startsWith): Add implementation that supports 'startOffset' parameter. (WTF::StringImpl::endsWith): Add implementation that supports 'endOffset' parameter. * wtf/text/StringImpl.h: * wtf/text/WTFString.h: (WTF::String::contains): Modify current implementation to allow setting a startOffset, 0 by default. (WTF::String::startsWith): (WTF::String::endsWith): 2014-09-18 Carlos Garcia Campos [GTK] Dot not allow to create delete-on-destroy GMainLoopSources https://bugs.webkit.org/show_bug.cgi?id=136923 Reviewed by Gustavo Noronha Silva. We have several asserts to ensure that delete-on-destroy sources are not misused, like not scheduling socket sources on a delete-on-destroy GMainLoopSource or not allowing to cancel them before they have been dispatched. It's better to ensure all those things at compile time, using static methods to schedule sources creating a delete-on-destroy GMainLoopSource that is not returned to the user. * wtf/gobject/GMainLoopSource.cpp: (WTF::GMainLoopSource::create): Private static method to create a delete-on-destroy GMainLoopSource. (WTF::GMainLoopSource::cancelWithoutLocking): Return early in case of delete-on-destroy source, since they can't be cancelled. (WTF::GMainLoopSource::schedule): Remove assertion to ensure socket sources are not scheduled on a delete-on-destroy GMainLoopSource. (WTF::GMainLoopSource::scheduleAndDeleteOnDestroy): (WTF::GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy): (WTF::GMainLoopSource::createAndDeleteOnDestroy): Deleted. * wtf/gobject/GMainLoopSource.h: * wtf/gtk/MainThreadGtk.cpp: (WTF::scheduleDispatchFunctionsOnMainThread): Use GMainLoopSource::scheduleAndDeleteOnDestroy() * wtf/gtk/RunLoopGtk.cpp: (WTF::RunLoop::wakeUp): Ditto. 2014-09-18 Joseph Pecoraro Unreviewed rollout r173731. Broke multiple builds. * wtf/Assertions.cpp: * wtf/Assertions.h: 2014-09-18 Joseph Pecoraro Web Inspector: Should be able to attach a debugger to a JSContext before anything is executed https://bugs.webkit.org/show_bug.cgi?id=136893 Reviewed by Timothy Hatcher. Currently automatic inspection only happens in processes that have a debugger attached. That condition may change in the future, but this function can stand on its own in WTF. It may be useful in the future to perhaps continue though ASSERTs if you have a debugger attached. * wtf/Assertions.cpp: * wtf/Assertions.h: 2014-09-18 Zan Dobersek GMainLoopSource is exposed to race conditions https://bugs.webkit.org/show_bug.cgi?id=135800 Reviewed by Carlos Garcia Campos. GMainLoopSource objects can be dispatching tasks on one thread while having a new task scheduled on a different thread. This can for instance occur in WebKitVideoSink, where the timeout callback can be called on main thread while at the same time it is being rescheduled on a different thread (created through GStreamer). The initial solution is to use GMutex to prevent parallel data access from different threads. In the future I plan to look at the possibility of creating thread-specific GMainLoopSource objects that wouldn't require the use of GMutex. GSource, GCancellable and std::function<> objects are now packed into an internal Context structure. Using the C++11 move semantics it's simple to, at the time of dispatch, move the current context out of the GMainLoopSource object in case the dispatch causes a rescheduling on that same object. Also added in the Context struct is a new GCancellable. The pointer of that object is shared with the GMainLoopSource before the Context is moved out for the callback dispatch. This makes it safe to cancel or even delete the GMainLoopSource during the dispatch and prevents use-after-delete on GMainLoopSource once the dispatch is done in the GMainLoopSource::*Callback() methods. All the schedule*() methods and the cancelWithoutLocking() method callers now lock the GMutex to ensure no one else is accessing the data at that moment. Similar goes for the dispatch methods, but those do the dispatch and possible destruction duties with the mutex unlocked. The dispatch can cause rescheduling on the same GMainLoopSource object, which must not be done with a locked mutex. * wtf/gobject/GMainLoopSource.cpp: (WTF::GMainLoopSource::GMainLoopSource): (WTF::GMainLoopSource::~GMainLoopSource): (WTF::GMainLoopSource::cancel): (WTF::GMainLoopSource::cancelWithoutLocking): (WTF::GMainLoopSource::scheduleIdleSource): (WTF::GMainLoopSource::schedule): (WTF::GMainLoopSource::scheduleTimeoutSource): (WTF::GMainLoopSource::scheduleAfterDelay): (WTF::GMainLoopSource::voidCallback): (WTF::GMainLoopSource::boolCallback): (WTF::GMainLoopSource::socketCallback): (WTF::GMainLoopSource::socketSourceCallback): (WTF::GMainLoopSource::Context::destroySource): (WTF::GMainLoopSource::reset): Deleted. (WTF::GMainLoopSource::destroy): Deleted. * wtf/gobject/GMainLoopSource.h: 2014-09-17 Daniel Bates Unreviewed, rolling out r173695. Broke building third-party Legacy WebKit apps; will investigate offline Reverted changeset: "[iOS] Make WebCore build with public iOS SDK" https://bugs.webkit.org/show_bug.cgi?id=136487 http://trac.webkit.org/changeset/173695 2014-09-17 Benjamin Poulain CSS value in whitespace-separated list attribute selector (~=) mishandles tab/newline/etc. https://bugs.webkit.org/show_bug.cgi?id=136807 Reviewed by Antti Koivisto. * wtf/text/AtomicString.h: (WTF::AtomicString::find): 2014-09-17 Daniel Bates [iOS] Make WebCore build with public iOS SDK https://bugs.webkit.org/show_bug.cgi?id=136487 Reviewed by David Kilzer. Define convenience macro EXTERN_C that can be used to specify the C linkage convention for a declaration. For example, the declaration "EXTERN_C const int x;" will expand to: extern const int x; and extern "C" const int x; when used in a C and C++ file, respectively. * wtf/Compiler.h: 2014-09-16 Filip Pizlo Unreviewed, disable native inlining because it causes build failures. * wtf/Platform.h: 2014-09-15 Jer Noble [Mac] Support audioSourceProvider() in MediaPlayerPrivateAVFoundationObjC https://bugs.webkit.org/show_bug.cgi?id=135042 Reviewed by Eric Carlson. * wtf/Platform.h: Add WTF_USE_MEDIATOOLBOX. 2014-09-15 peavo@outlook.com [WinCairo] Make it easier to enable/disable GStreamer. https://bugs.webkit.org/show_bug.cgi?id=135766 Reviewed by Brent Fulgham. Make it possible to enable/disable GStreamer by editing the new user macro ENABLE_GSTREAMER_WINCAIRO. * WTF.vcxproj/WTFDebugWinCairo.props: Import GStreamer property file. * WTF.vcxproj/WTFReleaseWinCairo.props: Ditto. * wtf/Platform.h: Enable GStreamer if ENABLE(GSTREAMER_WINCAIRO) is true, otherwise use Media Foundation. 2014-09-10 Jon Honeycutt Re-add the request autocomplete feature This feature was rolled out in r148731 because it was only used by Chromium. As we consider supporting this feature, roll it back in, but leave it disabled. This rolls out r148731 (which removed the feature) with small changes needed to make the code build in ToT, to make the tests run, and to remove unused code. Reviewed by Andy Estes. * wtf/FeatureDefines.h: 2014-09-12 Tim Horton Swiping back from a Twitter image to Twitter flashes to the wrong position https://bugs.webkit.org/show_bug.cgi?id=136798 Reviewed by Darin Adler and Sam Weinig. * wtf/RunLoop.h: (WTF::RunLoop::TimerBase::startRepeating): Add a std::chrono veresion of RunLoop::TimerBase::startRepeating. 2014-09-12 Geoffrey Garen Rolled out r173540. It broke the Membuster performance bot, and it's still slightly profligate with memory. Do the bmalloc. https://bugs.webkit.org/show_bug.cgi?id=132629 * wtf/FastMalloc.cpp: 2014-09-11 Geoffrey Garen Do the bmalloc. https://bugs.webkit.org/show_bug.cgi?id=132629 Reviewed by Michael Saboff. 64-bit only for now, just to try it out. * wtf/FastMalloc.cpp: 2014-09-09 Benjamin Poulain Disable the "unreachable-code" warning https://bugs.webkit.org/show_bug.cgi?id=136677 Reviewed by Darin Adler. The warning causes various build errors depending on which Clang you are using. For example, with recent clangs, it breaks all the ARCHS dependent code like this: if (sizeof(uintptr_t) == 4) // Something for 32 bits. else // Somethign for 64 bits. * Configurations/Base.xcconfig: 2014-09-07 Filip Pizlo DFG should have a reusable SSA builder https://bugs.webkit.org/show_bug.cgi?id=136331 Reviewed by Oliver Hunt. Update the alloc() method to use variadic templates. This makes it more natural to use. * wtf/SegmentedVector.h: (WTF::SegmentedVector::alloc): 2014-09-08 Eva Balazsfalvi Remove FILTERS flag https://bugs.webkit.org/show_bug.cgi?id=136571 Reviewed by Darin Adler. * wtf/FeatureDefines.h: 2014-09-08 Dan Bernstein HAVE(VOUCHERS) is not available outside of WebKit2 https://bugs.webkit.org/show_bug.cgi?id=136637 Reviewed by Tim Horton. * wtf/Platform.h: Moved the definition of HAVE_VOUCHERS from WebKit2’s config.h here. 2014-09-08 Tim Horton Try to fix the build after r173383, part 2. * wtf/OSObjectPtr.h: 2014-09-08 Tim Horton Try to fix the build after r173383. * wtf/OSObjectPtr.h: 2014-09-07 Sam Weinig Make OSObjectPtr a bit more like RefPtr https://bugs.webkit.org/show_bug.cgi?id=136613 Reviewed by Darin Adler. Address some of Darin's feedback by: - Making the adopting constructor private and friending adoptOSObject(). - Implementing the assignment operator using swap. - Adding a move assignment operator. * wtf/OSObjectPtr.h: (WTF::OSObjectPtr::operator=): (WTF::OSObjectPtr::swap): (WTF::OSObjectPtr::OSObjectPtr): 2014-09-08 Jessie Berlin More build fixes after r173374. * wtf/dtoa/strtod.cc: 2014-09-08 Jessie Berlin Build fix after r173374. * wtf/dtoa/strtod.cc: 2014-09-08 Jessie Berlin Speculative build fix after r173364. * wtf/dtoa/strtod.cc: 2014-09-07 Maciej Stachowiak Introduce COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE) and use it https://bugs.webkit.org/show_bug.cgi?id=136616 Reviewed by Darin Adler. * wtf/Compiler.h: Define the quirk for all compilers but clang. 2014-09-06 Sam Weinig XPCPtr should be converted into an all purpose smart pointer for os_objects https://bugs.webkit.org/show_bug.cgi?id=136602 Reviewed by Darin Adler. * WTF.xcodeproj/project.pbxproj: * wtf/OSObjectPtr.h: Copied from Source/WebKit2/Platform/IPC/mac/XPCPtr.h. (WTF::retainOSObject): (WTF::releaseOSObject): (WTF::OSObjectPtr::OSObjectPtr): (WTF::OSObjectPtr::~OSObjectPtr): (WTF::OSObjectPtr::operator=): (WTF::adoptOSObject): (IPC::XPCPtr::XPCPtr): Deleted. (IPC::XPCPtr::~XPCPtr): Deleted. (IPC::XPCPtr::operator=): Deleted. (IPC::adoptXPC): Deleted. Rename/move XPCPtr to OSObjectPtr and make it work with any os_object. 2014-09-06 Darin Adler Make updates suggested by new version of Xcode https://bugs.webkit.org/show_bug.cgi?id=136603 Reviewed by Mark Rowe. * Configurations/Base.xcconfig: Added CLANG_WARN_UNREACHABLE_CODE, COMBINE_HIDPI_IMAGES, and ENABLE_STRICT_OBJC_MSGSEND as suggested by Xcode upgrade check. * WTF.xcodeproj/project.pbxproj: Updated LastUpgradeCheck. 2014-09-05 Geoffrey Garen bmalloc should honor the FastMalloc statistics API https://bugs.webkit.org/show_bug.cgi?id=136592 Reviewed by Gavin Barraclough. * wtf/FastMalloc.cpp: (WTF::fastMallocStatistics): 2014-09-05 Geoffrey Garen bmalloc should honor the FastMalloc scavenging API https://bugs.webkit.org/show_bug.cgi?id=136588 Reviewed by Andreas Kling. * wtf/FastMalloc.cpp: (WTF::releaseFastMallocFreeMemory): 2014-09-05 Geoffrey Garen Rolled out . It seems to have broken the PLT bot. Do the bmalloc. https://bugs.webkit.org/show_bug.cgi?id=132629 * wtf/FastMalloc.cpp: 2014-06-06 Jer Noble Refactoring: make MediaTime the primary time type for audiovisual times. https://bugs.webkit.org/show_bug.cgi?id=133579 Reviewed by Eric Carlson. Add a unary minus operator, and add unimplemented private casting operators, to make unintentional double->MediaTime and MediaTime->double casts hard errors. * wtf/MediaTime.cpp: (WTF::MediaTime::operator-): * wtf/MediaTime.h: 2014-09-04 Geoffrey Garen Do the bmalloc. https://bugs.webkit.org/show_bug.cgi?id=132629 Reviewed by Michael Saboff. 64-bit only for now, just to try it out. * wtf/FastMalloc.cpp: 2014-09-05 Dániel Bátyai Enable GenGC on ARM Traditional https://bugs.webkit.org/show_bug.cgi?id=136567 Reviewed by Csaba Osztrogonác. * wtf/Platform.h: 2014-09-04 Filip Pizlo Beef up the DFG's CFG analyses to include iterated dominance frontiers and more user-friendly BlockSets https://bugs.webkit.org/show_bug.cgi?id=136520 Fix bug found in Geoff's review but not landed in previous commit. * wtf/BitVector.cpp: (WTF::BitVector::equalsSlowCaseFast): return true. 2014-09-03 Filip Pizlo Beef up the DFG's CFG analyses to include iterated dominance frontiers and more user-friendly BlockSets https://bugs.webkit.org/show_bug.cgi?id=136520 Reviewed by Geoffrey Garen. Give BitVector a way to quickly find the next set (or unset) bit. Make BitVector equality faster. Fix a minor closure goof in Spectrum. * wtf/BitVector.cpp: (WTF::BitVector::equalsSlowCase): (WTF::BitVector::equalsSlowCaseFast): (WTF::BitVector::equalsSlowCaseSimple): * wtf/BitVector.h: (WTF::BitVector::findBit): (WTF::BitVector::findBitFast): (WTF::BitVector::findBitSimple): (WTF::BitVector::findBitInWord): * wtf/Spectrum.h: (WTF::Spectrum::removeIf): 2014-09-04 Anders Carlsson Make hash table classes final https://bugs.webkit.org/show_bug.cgi?id=136540 Reviewed by Antti Koivisto. We don't want anybody inheriting from these classes, so make them final. * wtf/HashCountedSet.h: * wtf/HashMap.h: * wtf/HashSet.h: 2014-09-04 Eva Balazsfalvi Remove CSS_FILTERS flag https://bugs.webkit.org/show_bug.cgi?id=136529 Reviewed by Dirk Schulze. * wtf/FeatureDefines.h: 2014-09-04 Commit Queue Unreviewed, rolling out r173201. https://bugs.webkit.org/show_bug.cgi?id=136538 Improves the situation but also introduces additional crashes. (Requested by zdobersek on #webkit). Reverted changeset: "GMainLoopSource is exposed to race conditions" https://bugs.webkit.org/show_bug.cgi?id=135800 http://trac.webkit.org/changeset/173201 2014-09-04 Pratik Solanki Remove iOS specific disk image cache https://bugs.webkit.org/show_bug.cgi?id=136517 Reviewed by Antti Koivisto. Disk image cache code unnecessarily complicates SharedBuffer implementation. We can remove this now since we don't enable it in WebKit2 on iOS. * wtf/FeatureDefines.h: 2014-09-03 Dan Bernstein Get rid of HIGH_DPI_CANVAS leftovers https://bugs.webkit.org/show_bug.cgi?id=136491 Reviewed by Benjamin Poulain. * wtf/FeatureDefines.h: Removed definition of ENABLE_HIGH_DPI_CANVAS. 2014-09-03 Zan Dobersek GMainLoopSource is exposed to race conditions https://bugs.webkit.org/show_bug.cgi?id=135800 Reviewed by Carlos Garcia Campos. GMainLoopSource objects can be dispatching tasks on one thread while having a new task scheduled on a different thread. This can for instance occur in WebKitVideoSink, where the timeout callback can be called on main thread while at the same time it is being rescheduled on a different thread (created through GStreamer). The initial solution is to use GMutex to prevent parallel data access from different threads. In the future I plan to add better assertions, some meaningful comments and look at the possibility of creating thread-specific GMainLoopSource objects that wouldn't require the use of GMutex. GSource, GCancellable and std::function<> objects are now packed into an internal Context structure. Using the C++11 move semantics it's simple to, at the time of dispatch, move the current context out of the GMainLoopSource object in case the dispatch causes a rescheduling on that same object. All the schedule*() methods and the cancelInternal() method callers now lock the GMutex to ensure no one else is accessing the data at that moment. Similar goes for the dispatch methods, but those do the dispatch and possible destruction duties with the mutex unlocked. The dispatch can cause rescheduling on the same GMainLoopSource object, which must not be done with a locked mutex. * wtf/gobject/GMainLoopSource.cpp: (WTF::GMainLoopSource::GMainLoopSource): (WTF::GMainLoopSource::~GMainLoopSource): (WTF::GMainLoopSource::cancel): (WTF::GMainLoopSource::cancelInternal): (WTF::GMainLoopSource::scheduleIdleSource): (WTF::GMainLoopSource::schedule): (WTF::GMainLoopSource::scheduleTimeoutSource): (WTF::GMainLoopSource::scheduleAfterDelay): (WTF::GMainLoopSource::voidCallback): (WTF::GMainLoopSource::boolCallback): (WTF::GMainLoopSource::socketCallback): (WTF::GMainLoopSource::destroy): (WTF::GMainLoopSource::reset): Deleted. * wtf/gobject/GMainLoopSource.h: 2014-09-02 Daniel Bates [iOS] Support using Foundation networking code https://bugs.webkit.org/show_bug.cgi?id=136467 Reviewed by Pratik Solanki. Disable USE(CFNETWORK) and use the Foundation networking code by default when building iOS WebKit without the Apple Internal SDK. * wtf/Platform.h: 2014-08-26 Maciej Stachowiak Use RetainPtr::autorelease in some places where it seems appropriate https://bugs.webkit.org/show_bug.cgi?id=136280 Reviewed by Darin Adler. * wtf/text/mac/StringImplMac.mm: (WTF::StringImpl::operator NSString *): Use autorelease() instead of CFBridgingRelease(leakRef()) 2014-08-29 Joseph Pecoraro JavaScriptCore: Use ASCIILiteral where possible https://bugs.webkit.org/show_bug.cgi?id=136179 Reviewed by Michael Saboff. * wtf/text/WTFString.cpp: (asciiDebug): 2014-08-27 Filip Pizlo DFG should compute immediate dominators using the O(n log n) form of Lengauer and Tarjan's "A Fast Algorithm for Finding Dominators in a Flowgraph" https://bugs.webkit.org/show_bug.cgi?id=93361 Reviewed by Mark Hahnenberg. Make BitVector operations return the previous value of the bit you're changing. This is useful for the kinds of set operations that are commonplace in compiler graph searches. * wtf/BitVector.h: (WTF::BitVector::quickSet): (WTF::BitVector::quickClear): (WTF::BitVector::set): (WTF::BitVector::ensureSizeAndSet): (WTF::BitVector::clear): 2014-08-27 Filip Pizlo FTL should be able to do polymorphic call inlining https://bugs.webkit.org/show_bug.cgi?id=135145 Reviewed by Geoffrey Garen. Add some power that I need for call edge profiling. * wtf/OwnPtr.h: (WTF::OwnPtr::createTransactionally): * wtf/Spectrum.h: (WTF::Spectrum::add): (WTF::Spectrum::addAll): (WTF::Spectrum::get): (WTF::Spectrum::size): (WTF::Spectrum::KeyAndCount::KeyAndCount): (WTF::Spectrum::clear): (WTF::Spectrum::removeIf): 2014-08-27 Nico Weber Delete a MSVS2010 workaround. https://bugs.webkit.org/show_bug.cgi?id=136321 Reviewed by Benjamin Poulain. Ports https://codereview.chromium.org/512923004/ by the talented Nico Weber from Blink. No intended behavior change. * wtf/Vector.h: (WTF::=): 2014-08-27 Mark Rowe JavaScriptCore is missing debug info for WTF because libWTF.a is stripped. / Reviewed by Dan Bernstein. * Configurations/WTF.xcconfig: Set STRIP_INSTALLED_PRODUCT = NO for the target that produces libWTF.a so that the debug symbols will be linked into JavaScriptCore and end up in its dSYM file. 2014-08-26 Commit Queue Unreviewed, rolling out r172940. https://bugs.webkit.org/show_bug.cgi?id=136256 Caused assertions on fast/storage/serialized-script- value.html, and possibly flakiness on more tests (Requested by ap on #webkit). Reverted changeset: "FTL should be able to do polymorphic call inlining" https://bugs.webkit.org/show_bug.cgi?id=135145 http://trac.webkit.org/changeset/172940 2014-08-23 Filip Pizlo FTL should be able to do polymorphic call inlining https://bugs.webkit.org/show_bug.cgi?id=135145 Reviewed by Geoffrey Garen. Add some power that I need for call edge profiling. * wtf/OwnPtr.h: (WTF::OwnPtr::createTransactionally): * wtf/Spectrum.h: (WTF::Spectrum::add): (WTF::Spectrum::addAll): (WTF::Spectrum::get): (WTF::Spectrum::size): (WTF::Spectrum::KeyAndCount::KeyAndCount): (WTF::Spectrum::clear): (WTF::Spectrum::removeIf): 2014-08-25 Tomas Popela Add support for little-endian PowerPC64 https://bugs.webkit.org/show_bug.cgi?id=135647 Reviewed by Oliver Hunt. * wtf/Platform.h: * wtf/dtoa/utils.h: 2014-08-24 Zan Dobersek GenericHashTraits::peek() is producing copies of passed-in temporary values https://bugs.webkit.org/show_bug.cgi?id=131461 Reviewed by Darin Adler. * wtf/HashTraits.h: (WTF::GenericHashTraits::peek): Make this method a template that passes through the passed-in value without copying, achieved by using universal references and std::forward<>(). 2014-08-22 Daniel Bates [iOS] Disable ENABLE_IOS_{GESTURE, TOUCH}_EVENTS, and temporarily disable ENABLE_TOUCH_EVENTS and ENABLE_XSLT when building with the iOS public SDK https://bugs.webkit.org/show_bug.cgi?id=135945 Reviewed by Andy Estes. * wtf/FeatureDefines.h: 2014-08-22 Akos Kiss Enable fixed executable allocator for any ARM64 target. https://bugs.webkit.org/show_bug.cgi?id=136162 Reviewed by Michael Saboff. The ARM64 macro assembler relies on near calls being implemented by BL instructions, which have only 128MB offset range from PC. The on-demand executable allocator cannot ensure that any two locations in memory allocated for the JIT-compiled code are within this range. However, the fixed executable allocator has a fixed 16MB memory pool for ARM64. * wtf/Platform.h: Define ENABLE_EXECUTABLE_ALLOCATOR_FIXED if CPU(ARM64), and update attached comment. 2014-08-22 Commit Queue Unreviewed, rolling out r172844. https://bugs.webkit.org/show_bug.cgi?id=136164 re-applying WEBCORE_EXPORTS patch (Requested by alexchristensen on #webkit). Reverted changeset: "Revert r172831, it broke the Windows build." http://trac.webkit.org/changeset/172844 2014-08-22 Jon Lee Fix iOS build due to r172832 and move RUBBER_BANDING out of FeatureDefines.h https://bugs.webkit.org/show_bug.cgi?id=136157 Reviewed by Simon Fraser. * wtf/FeatureDefines.h: Remove ENABLE(RUBBER_BANDING) logic for Mac platform. 2014-08-21 Tim Horton Revert r172831, it broke the Windows build. * wtf/ExportMacros.h: 2014-08-21 Zalan Bujtas Enable SATURATED_LAYOUT_ARITHMETIC. https://bugs.webkit.org/show_bug.cgi?id=136106 Reviewed by Simon Fraser. SATURATED_LAYOUT_ARITHMETIC protects LayoutUnit against arithmetic overflow. (No measurable performance regression on Mac.) * wtf/FeatureDefines.h: 2014-08-21 Alex Christensen More WEBCORE_EXPORT macros. https://bugs.webkit.org/show_bug.cgi?id=136129 Reviewed by Tim Horton. * wtf/ExportMacros.h: Removed WTF_TESTING which isn't used. 2014-08-20 Akos Kiss Enable ARM64 disassembler on EFL https://bugs.webkit.org/show_bug.cgi?id=136089 Reviewed by Filip Pizlo. * wtf/Platform.h: Enable WTF_USE_ARM64_DISASSEMBLER for EFL as well. 2014-08-19 Pratik Solanki Remove PurgeableBuffer since it is not very useful any more https://bugs.webkit.org/show_bug.cgi?id=135939 Reviewed by Andreas Kling. * wtf/Platform.h: Remove ENABLE_PURGEABLE_MEMORY define. * wtf/VMTags.h: Remove VM tags used by WebCore for cached resource purgeable memory. 2014-08-19 Magnus Granberg TEXTREL in libjavascriptcoregtk-1.0.so.0.11.0 on x86 (or i586) https://bugs.webkit.org/show_bug.cgi?id=70610 Reviewed by Darin Adler. Add PLT if we're building with PIC. * wtf/InlineASM.h: 2014-08-19 Zalan Bujtas Remove ENABLE(SUBPIXEL_LAYOUT). https://bugs.webkit.org/show_bug.cgi?id=136077 Reviewed by Simon Fraser. Remove compile time flag SUBPIXEL_LAYOUT. All ports have it enabled for a while now. * wtf/FeatureDefines.h: 2014-08-18 Maciej Stachowiak Use NSURLFileTypeMappings directly instead of depending on WebKitSystemInterface wrappers for it https://bugs.webkit.org/show_bug.cgi?id=136035 Reviewed by Dan Bernstein. * wtf/Platform.h: Define USE(APPLE_INTERNAL_SDK) by default on platforms that have it. 2014-08-18 Commit Queue Unreviewed, rolling out r172736. https://bugs.webkit.org/show_bug.cgi?id=136060 Caused 14% PLT regressions (Requested by rniwa on #webkit). Reverted changeset: "Remove PurgeableBuffer since it is not very useful any more" https://bugs.webkit.org/show_bug.cgi?id=135939 http://trac.webkit.org/changeset/172736 2014-08-18 Pratik Solanki Remove PurgeableBuffer since it is not very useful any more https://bugs.webkit.org/show_bug.cgi?id=135939 Reviewed by Geoffrey Garen. * wtf/Platform.h: Remove ENABLE_PURGEABLE_MEMORY define. * wtf/VMTags.h: Remove VM tags used by WebCore for cached resource purgeable memory. 2014-08-14 Benjamin Poulain CSS JIT: compile the :empty pseudo class https://bugs.webkit.org/show_bug.cgi?id=135958 Reviewed by Andreas Kling. * wtf/text/StringImpl.h: (WTF::StringImpl::lengthMemoryOffset): 2014-08-12 Myles C. Maxfield Elements whose contents start with an astral Unicode symbol disappear when CSS `::first-letter` is applied to them https://bugs.webkit.org/show_bug.cgi?id=135756 Reviewed by Darin Adler. Add a method to StringView which passes through contains() to find(). * wtf/text/StringView.h: (WTF::StringView::contains): 2014-08-12 Pratik Solanki Enable didReceiveDataArray callback on Mac https://bugs.webkit.org/show_bug.cgi?id=135554 Reviewed by Andreas Kling. Enable WTF_USE_NETWORK_CFDATA_ARRAY_CALLBACK for all Cocoa platforms so that we use the same code path for Mac and iOS. * wtf/Platform.h: 2014-08-12 Alex Christensen Generate header detection headers for CMake on Windows. https://bugs.webkit.org/show_bug.cgi?id=135807 Reviewed by Brent Fulgham. * wtf/CMakeLists.txt: * wtf/PlatformWin.cmake: Generate and include a stub WTFHeaderDetection.h. 2014-08-11 Andy Estes [iOS] Get rid of iOS.xcconfig https://bugs.webkit.org/show_bug.cgi?id=135809 Reviewed by Joseph Pecoraro. All iOS.xcconfig did was include AspenFamily.xcconfig, so there's no need for the indirection. * Configurations/Base.xcconfig: * Configurations/iOS.xcconfig: Removed. * WTF.xcodeproj/project.pbxproj: 2014-08-12 Zan Dobersek Clean up GMutexLocker https://bugs.webkit.org/show_bug.cgi?id=135833 Reviewed by Carlos Garcia Campos. Place the GMutexLocker into the WTF namespace. There's no need for this class to use FastMalloc since it's always allocated on the stack. The constructor and class now operate on a GMutex reference. There's little need for an additional inline specifier for methods defined in the header. The mutex() method is removed as it was not used. m_val is renamed to a more descriptive m_locked and is made a boolean. * wtf/gobject/GMutexLocker.h: (WTF::GMutexLocker::GMutexLocker): (WTF::GMutexLocker::~GMutexLocker): (WTF::GMutexLocker::lock): (WTF::GMutexLocker::unlock): (WebCore::GMutexLocker::GMutexLocker): Deleted. (WebCore::GMutexLocker::~GMutexLocker): Deleted. (WebCore::GMutexLocker::lock): Deleted. (WebCore::GMutexLocker::unlock): Deleted. (WebCore::GMutexLocker::mutex): Deleted. 2014-08-12 Zan Dobersek Make GRefPtr move-able https://bugs.webkit.org/show_bug.cgi?id=135801 Reviewed by Carlos Garcia Campos. Add move constructor and move assignment operator for GRefPtr. * wtf/gobject/GRefPtr.h: (WTF::GRefPtr::GRefPtr): (WTF::=): 2014-08-10 Benjamin Poulain Update HashTable's operator= after r172167 per review comments * wtf/HashTable.h: Update the type as suggested by Darin. 2014-08-07 Benjamin Poulain Get rid of SCRIPTED_SPEECH https://bugs.webkit.org/show_bug.cgi?id=135729 Reviewed by Brent Fulgham. * wtf/FeatureDefines.h: 2014-08-07 Benjamin Poulain Get rid of INPUT_SPEECH https://bugs.webkit.org/show_bug.cgi?id=135672 Reviewed by Andreas Kling. * wtf/FeatureDefines.h: 2014-08-06 Dean Jackson ENABLE_CSS_TRANSFORMS_ANIMATIONS_UNPREFIXED is not used anywhere. Remove it. https://bugs.webkit.org/show_bug.cgi?id=135675 Reviewed by Sam Weinig. * wtf/FeatureDefines.h: 2014-08-06 Benjamin Poulain HashTable based classes leak a lot https://bugs.webkit.org/show_bug.cgi?id=135638 Reviewed by Darin Adler. * wtf/HashTable.h: The operator= taking a rvalue reference was never freeing the memory allocated for the table of the left hand side object. This patch fixes the leaks by doing an alloc+swap with a new object. The object temp gets the reference to m_table, and destroys it in the regular destructor when going out of scope. Kudos to Pratik Solanki for finding the leaks. 2014-08-06 Dániel Bátyai [JSC] Build fix for FTL on EFL after ftlopt merge https://bugs.webkit.org/show_bug.cgi?id=135565 Reviewed by Mark Lam. Added ENABLE(FTL_NATIVE_CALL_INLINING). * wtf/Platform.h: 2014-08-04 Alex Christensen Progress towards CMake on Mac. https://bugs.webkit.org/show_bug.cgi?id=135528 Reviewed by Gyuyoung Kim. * wtf/CMakeLists.txt: Include text directory. * wtf/PlatformMac.cmake: Added. 2014-07-31 Alex Christensen Progress towards cmake on Windows. https://bugs.webkit.org/show_bug.cgi?id=135484 Reviewed by Martin Robinson. * wtf/CMakeLists.txt: Added WTF_LIBRARY_TYPE because Windows needs WTF to be a shared library. 2014-07-30 Andreas Kling PropertyName's internal string is always atomic. Remove AtomicString::findStringWithHash() since nobody uses it anymore. Reviewed by Benjamin Poulain. * wtf/text/AtomicString.cpp: (WTF::findString): Deleted. (WTF::AtomicString::findStringWithHash): Deleted. * wtf/text/AtomicString.h: 2014-07-30 Andy Estes USE(CONTENT_FILTERING) should be ENABLE(CONTENT_FILTERING) https://bugs.webkit.org/show_bug.cgi?id=135439 Reviewed by Tim Horton. We now support two different platform content filters, and will soon support a mock content filter (as part of webkit.org/b/128858). This makes content filtering a feature of WebKit, not just an adoption of a third-party library. ENABLE() is the correct macro to use for such a feature. * wtf/Platform.h: 2014-07-29 Brent Fulgham [Win] Modify version numbering scheme to support 5-tuple versions https://bugs.webkit.org/show_bug.cgi?id=135400 Reviewed by David Kilzer. * WTF.vcxproj/WTFPostBuild.cmd: Use new version-stamp.pl script to version WTF.dll. * WTF.vcxproj/WTFPreBuild.cmd: Make sure we have created the appropriate version resource during builds. 2014-07-29 Daniel Bates Use WTF::move() instead of std::move() to help ensure move semantics https://bugs.webkit.org/show_bug.cgi?id=135351 Reviewed by Alexey Proskuryakov. * wtf/HashTable.h: (WTF::KeyTraits>::HashTable): 2014-07-28 Brian J. Burg Should not export symbols for base64Encode inline adapter methods https://bugs.webkit.org/show_bug.cgi?id=135355 Unreviewed build fix. Fixes the build break introduced by r171682, where a base64Encode inline adapter method was used in another header, thus creating multiple definitions of it (and problems with with weak symbols). * wtf/text/Base64.h: Remove WTF_EXPORT_PRIVATE for inlined methods. 2014-07-27 Filip Pizlo Merge r170090, r170092, r170129, r170141, r170161, r170215, r170275, r170375, r170376, r170382, r170383, r170399, r170436, r170489, r170490, r170556 from ftlopt. * wtf/text/WTFString.h: 2014-07-26 Filip Pizlo Unreviewed, roll out r171641-r171644. It broke some tests; will investigate and reland later. * wtf/text/WTFString.h: 2014-07-25 Filip Pizlo Attempt to fix Windows. * wtf/text/WTFString.h: 2014-07-25 Gavin Barraclough Yosemite version number is 101000 https://bugs.webkit.org/show_bug.cgi?id=135301 Reviewed by Sam Weinig. * wtf/FeatureDefines.h: * wtf/Platform.h: 2014-07-23 Brent Fulgham [Win] Use NO_RETURN_DUE_TO_CRASH on Windows. https://bugs.webkit.org/show_bug.cgi?id=13519 Reviewed by Mark Lam. * wtf/Assertions.h: Add MSVC to list of compilers supporting this macro. * wtf/FastMalloc.cpp: Correct function declaration for NO_RETURN_DUE_TO_CRASH. 2014-07-22 Filip Pizlo Merge r169148, r169185, r169188, r169578, r169582, r169584, r169588, r169753 from ftlopt. 2014-06-04 Filip Pizlo [ftlopt] AI should be able track structure sets larger than 1 https://bugs.webkit.org/show_bug.cgi?id=128073 Reviewed by Oliver Hunt. * wtf/Bag.h: (WTF::Bag::Node::Node): (WTF::Bag::add): 2014-07-22 Filip Pizlo Merge r168635, r168780, r169005, r169014, and r169143 from ftlopt. 2014-05-20 Filip Pizlo [ftlopt] DFG bytecode parser should turn GetById with nothing but a Getter stub as stuff+handleCall, and handleCall should be allowed to inline if it wants to https://bugs.webkit.org/show_bug.cgi?id=133105 Reviewed by Michael Saboff. * wtf/Bag.h: (WTF::Bag::iterator::operator!=): 2014-07-19 Zan Dobersek [WTF] Add the move constructor, move assignment operator for HashTable https://bugs.webkit.org/show_bug.cgi?id=130772 Reviewed by Darin Adler. HashTable has both copy constructor and copy assignment operator, meaning that the move constructor and move assignment operator are implicitly deleted. This patch defines both to avoid unnecessary copies when moves can be performed. * wtf/HashTable.h: (WTF::KeyTraits>::HashTable): 2014-07-15 Commit Queue Unreviewed, rolling out r171107. https://bugs.webkit.org/show_bug.cgi?id=134959 This was not the problem! (Requested by kling on #webkit). Reverted changeset: "Revert: Run the FastMalloc scavenger thread on iOS as well." https://bugs.webkit.org/show_bug.cgi?id=134927 http://trac.webkit.org/changeset/171107 2014-07-15 Andreas Kling Revert: Run the FastMalloc scavenger thread on iOS as well. This appears to be the cause of some elusive crashes, and since I don't have a way to reproduce them, let's just go back to not running the scavenger thread on iOS. Reviewed by Antti Koivisto. * wtf/FastMalloc.cpp: 2014-07-13 Filip Pizlo HashMap should have removeIf() https://bugs.webkit.org/show_bug.cgi?id=134870 Reviewed by Sam Weinig. Expose a new HashMap method, called removeIf(), which allows you to do an efficient pass over the map and remove a bunch of things at once. This is used by DFG GCSE as part of https://bugs.webkit.org/show_bug.cgi?id=134677. * wtf/HashMap.h: (WTF::X>::removeIf): * wtf/HashTable.h: (WTF::KeyTraits>::removeIf): 2014-07-11 peavo@outlook.com [Win] Enable DFG JIT. https://bugs.webkit.org/show_bug.cgi?id=123615 Reviewed by Mark Lam. * wtf/Platform.h: 2014-07-11 Commit Queue Unreviewed, rolling out r170995. https://bugs.webkit.org/show_bug.cgi?id=134831 Causing odd crashes in debug builds (Requested by zdobersek on #webkit). Reverted changeset: "[WTF] Add the move constructor, move assignment operator for HashTable" https://bugs.webkit.org/show_bug.cgi?id=130772 http://trac.webkit.org/changeset/170995 2014-07-09 Zan Dobersek [WTF] Add the move constructor, move assignment operator for HashTable https://bugs.webkit.org/show_bug.cgi?id=130772 Reviewed by Darin Adler. HashTable has both copy constructor and copy assignment operator, meaning that the move constructor and move assignment operator are implicitly deleted. This patch defines both to avoid unnecessary copies when moves can be performed. * wtf/HashTable.h: (WTF::KeyTraits>::HashTable): 2014-07-10 Alex Christensen Enable same features on all Windows ports. https://bugs.webkit.org/show_bug.cgi?id=134715 Reviewed by Brent Fulgham. * wtf/Platform.h: Use REQUEST_ANIMATION_FRAME_TIMER on WinCairo. 2014-07-09 Brent Fulgham [Win] Unreviewed build fix after r170930. * WTF.vcxproj/copy-files.cmd: Include cf files in post-build copy operation. 2014-07-09 Brent Fulgham [Win] Remove uses of 'bash' in build system https://bugs.webkit.org/show_bug.cgi?id=134782 Reviewed by Dean Jackson. Remove uses of 'bash' by replacing Windows-specific bash scripts with Perl equivalents. * WTF.vcxproj/WTFGenerated.make: * WTF.vcxproj/WTFGenerated.vcxproj: * WTF.vcxproj/WTFGenerated.vcxproj.filters: * WTF.vcxproj/WTFPreBuild.cmd: * WTF.vcxproj/build-generated-files.pl: Copied from Source/WTF/WTF.vcxproj/build-generated-files.sh. * WTF.vcxproj/build-generated-files.sh: Removed. 2014-07-09 Brent Fulgham [Win] Remove use of 'grep' in build steps https://bugs.webkit.org/show_bug.cgi?id=134770 Reviewed by Tim Horton. Replace uses of the grep command in Windows builds with the equivalent Perl program. * WTF.vcxproj/WTFPreBuild.cmd: 2014-07-07 Zan Dobersek Enable ARMv7 disassembler for the GTK port https://bugs.webkit.org/show_bug.cgi?id=134676 Reviewed by Benjamin Poulain. * wtf/Platform.h: Enable the ARMv7 disassembler for the GTK port when targeting the ARMv7 architecture. 2014-07-06 Yoav Weiss Turn on img@sizes compile flag https://bugs.webkit.org/show_bug.cgi?id=134634 Reviewed by Benjamin Poulain. * wtf/FeatureDefines.h: Added compile flag definition. 2014-07-03 Gyuyoung Kim Unreivewed, fix build break on EFL and GTK since r170767. * wtf/CMakeLists.txt: Exclude Decoder.h and Encoder.h because those files were removed. 2014-07-03 Daniel Bates Add WTF::move() https://bugs.webkit.org/show_bug.cgi?id=134500 Reviewed by Darin Adler. Substitution of WTF::move() for std::move() rubber-stamped by Anders Carlsson. Implement WTF::move(), a replacement for std::move(). WTF::move() is less error prone than std::move() as it compile asserts that its argument is a non-const lvalue reference before ultimately casting it to a rvalue reference (via std::move). * wtf/Deque.h: Substitute WTF::move() for std::move(). * wtf/HashMap.h: Ditto. * wtf/HashSet.h: Ditto. * wtf/HashTable.h: Ditto. * wtf/IteratorAdaptors.h: Ditto. * wtf/IteratorRange.h: Ditto. * wtf/ListHashSet.h: Ditto. * wtf/MainThread.cpp: Ditto. [...] * wtf/StdLibExtras.h: (WTF::move): Added. [...] 2014-07-03 Anders Carlsson Get rid of Encoder.h and Decoder.h from WTF https://bugs.webkit.org/show_bug.cgi?id=134600 Reviewed by Darin Adler. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/Decoder.h: Removed. * wtf/Encoder.h: Removed. 2014-07-03 Ryuan Choi Broken build with build-webkit --no-video https://bugs.webkit.org/show_bug.cgi?id=134587 Reviewed by Darin Adler. MEDIA_CONTROLS_SCRIPT requires VIDEO enabled. * wtf/FeatureDefines.h: Added error message for dependency failure. 2014-07-02 Enrica Casucci iOS build fix after http://trac.webkit.org/changeset/170697. Unreviewed. * wtf/Deque.h: 2014-07-02 Dan Bernstein Remove some code only needed for versions of Safari that are no longer supported https://bugs.webkit.org/show_bug.cgi?id=134537 Reviewed by Anders Carlsson. * wtf/Assertions.cpp: * wtf/Assertions.h: 2014-07-01 Alex Christensen Reduce dynamic memory allocation in css jit. https://bugs.webkit.org/show_bug.cgi?id=134416 Reviewed by Benjamin Poulain. * wtf/Deque.h: Added inlineCapacity optional template parameter. 2014-06-30 Commit Queue Unreviewed, rolling out r170605. https://bugs.webkit.org/show_bug.cgi?id=134484 The changes cause crashes on ARM64 (Requested by benjaminp on #webkit). Reverted changeset: "Reduce dynamic memory allocation in css jit." https://bugs.webkit.org/show_bug.cgi?id=134416 http://trac.webkit.org/changeset/170605 2014-06-30 Daniel Bates Make TransformIterator::TransformIterator() take rvalue references https://bugs.webkit.org/show_bug.cgi?id=134468 Reviewed by Darin Adler. It's unnecessary to support TransformIterator::TransformIterator() taking const lvalue references as we only call it with rvalues. As a side benefit, we can use move semantics to initialize the members of TransformIterator. * wtf/IteratorAdaptors.h: (WTF::TransformIterator::TransformIterator): Make constructor take arguments as rvalue references. (WTF::makeTransformIterator): Substitute std::move() for std::forward(). 2014-06-30 Alex Christensen Reduce dynamic memory allocation in css jit. https://bugs.webkit.org/show_bug.cgi?id=134416 Reviewed by Benjamin Poulain. * wtf/Deque.h: Added inlineCapacity optional template parameter. 2014-06-30 Anders Carlsson Add code for encoding legacy session history entries https://bugs.webkit.org/show_bug.cgi?id=134452 Reviewed by Andreas Kling. * wtf/MallocPtr.h: (WTF::MallocPtr::malloc): (WTF::MallocPtr::realloc): 2014-06-27 Andreas Kling [ARMv7] Skip one particularly expensive fastFree() alignment check. The size class alignment check in fastFree() was crazy expensive on ARMv7 due to its use of modulo. Disabling it shaves 470ms off of PLT main thread time in the web process. Note that this was very hard to identify in profiles due to TCO. Reviewed by Gavin Barraclough. * wtf/FastMalloc.cpp: (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): 2014-06-26 Andreas Kling Bump FastMalloc thread cache max size to 1MB on iOS. The previous limit (512kB) comes from the old days of very-low-memory devices, and we can now afford to spend another 512kB here. Note that we already have a mechanism to purge FastMalloc caches on system memory pressure. Looks like a ~400ms progression on PLT. Reviewed by Geoff Garen. * wtf/FastMalloc.cpp: 2014-06-26 Laszlo Gombos Define TARGET_OS_IPHONE to 0 for non-darwin ports https://bugs.webkit.org/show_bug.cgi?id=134347 Reviewed by Darin Adler. A follow-up to r169880 to make it easier to reason about the code. The purpose of this change to allow "#if TARGET_OS_IPHONE" in public header files. * wtf/Platform.h: 2014-06-26 Chris Fleizach Add an undo group for each dictated utterance in WebKit https://bugs.webkit.org/show_bug.cgi?id=134086 Applied review comments from Sam Weinig. Move the associated USE #define into Platform.h. * wtf/Platform.h: 2014-06-25 Geoffrey Garen Unreviewed, rolling out r166876. Caused some ECMA test262 failures Reverted changeset: "Date object needs to check for ES5 15.9.1.14 TimeClip limit." https://bugs.webkit.org/show_bug.cgi?id=131248 http://trac.webkit.org/changeset/166876 2014-06-25 peavo@outlook.com [Win64] ASM LLINT is not enabled. https://bugs.webkit.org/show_bug.cgi?id=130638 Reviewed by Mark Lam. * wtf/Platform.h: Enable LLINT and JIT for Win64. 2014-06-25 Laszlo Gombos Remove build guard for progress element https://bugs.webkit.org/show_bug.cgi?id=134292 Reviewed by Benjamin Poulain. The build flag is no longer needed as it is always on. * wtf/FeatureDefines.h: 2014-06-24 Andreas Kling Run the FastMalloc scavenger thread on iOS as well. Reviewed by Gavin Barraclough. * wtf/FastMalloc.cpp: 2014-06-24 Anders Carlsson Add PageState to HistoryItem conversion code https://bugs.webkit.org/show_bug.cgi?id=134259 Reviewed by Andreas Kling. * wtf/Optional.h: (WTF::Optional::valueOr): 2014-06-24 László Langó [JavaScriptCore] Enable concurrent JIT on EFL. https://bugs.webkit.org/show_bug.cgi?id=134242 Reviewed by Csaba Osztrogonác. * wtf/Platform.h: 2014-06-23 Ryuan Choi [EFL] Replace RefPtr with UniquePtrEfl https://bugs.webkit.org/show_bug.cgi?id=134236 Reviewed by Gyuyoung Kim. Although there are ref/unref for Evas_Object, it's bit odd so we should call evas_object_del to destroy it. So, this patch replaced RefPtr with UniquePtrEfl for the simplicity. * wtf/PlatformEfl.cmake: Removed RefPtrEfl.cpp from source list. * wtf/efl/RefPtrEfl.cpp: Removed. * wtf/efl/RefPtrEfl.h: Removed. 2014-06-21 Brady Eidson Gamepad API - Deprecate the existing implementation https://bugs.webkit.org/show_bug.cgi?id=134108 Reviewed by Timothy Hatcher. -Add new "GAMEPAD_DEPRECATED" build flag, moving the existing implementation to use it -Move some implementation files into a "deprecated" subdirectory. * wtf/FeatureDefines.h: 2014-06-21 Commit Queue Unreviewed, rolling out r170244. https://bugs.webkit.org/show_bug.cgi?id=134157 GTK/EFL bindings generator works differently, making this patch not work there. Will fix entire patch after a rollout. (Requested by bradee-oh on #webkit). Reverted changeset: "Gamepad API - Deprecate the existing implementation" https://bugs.webkit.org/show_bug.cgi?id=134108 http://trac.webkit.org/changeset/170244 2014-06-21 Brady Eidson Gamepad API - Deprecate the existing implementation https://bugs.webkit.org/show_bug.cgi?id=134108 Reviewed by Timothy Hatcher. -Add new "GAMEPAD_DEPRECATED" build flag, moving the existing implementation to use it -Add the "Deprecated" suffix to some implementation files * wtf/FeatureDefines.h: 2014-06-21 Eva Balazsfalvi Removing PAGE_VISIBILITY_API compile guard. https://bugs.webkit.org/show_bug.cgi?id=133844 Reviewed by Gavin Barraclough. * wtf/FeatureDefines.h: 2014-06-20 Anders Carlsson Add encoding and decoding support for WTF::Optional https://bugs.webkit.org/show_bug.cgi?id=134125 Reviewed by Andreas Kling. * wtf/Optional.h: (WTF::Optional::operator=): 2014-06-20 Anders Carlsson Add copy/move constructors and assignment operators to WTF::Optional https://bugs.webkit.org/show_bug.cgi?id=134119 Reviewed by Andreas Kling. * wtf/Optional.h: (WTF::Optional::Optional): (WTF::Optional::operator=): 2014-06-19 Anders Carlsson Add WTF::Optional class https://bugs.webkit.org/show_bug.cgi?id=134083 Reviewed by Andreas Kling. * WTF.xcodeproj/project.pbxproj: * wtf/Optional.h: Added. (WTF::Optional::Optional): (WTF::Optional::~Optional): (WTF::Optional::operator bool): (WTF::Optional::value): 2014-06-19 Dániel Bátyai Remove ENABLE(LLINT) and ENABLE(LLINT_C_LOOP) guards https://bugs.webkit.org/show_bug.cgi?id=130389 Reviewed by Mark Lam. Removed ENABLE(LLINT) since we always build with it, and changed ENABLE(LLINT_C_LOOP) into !ENABLE(JIT) since they are mutually exclusive. * wtf/OSAllocatorPosix.cpp: (WTF::OSAllocator::reserveAndCommit): * wtf/Platform.h: 2014-06-18 Anders Carlsson Add CF type cast function templates and use them in KeyedDecoder in WebKit2 https://bugs.webkit.org/show_bug.cgi?id=134033 Reviewed by Sam Weinig. * WTF.xcodeproj/project.pbxproj: * wtf/cf/TypeCasts.h: Added. (WTF::dynamic_cf_cast): Returns null if the given CFTypeRef object doesn't have the right type. (WTF::checked_cf_cast): ASSERTs (with security implication) if the given CFTypeRef object is null or doesn't have the right type. 2014-06-17 Tamas Gergely Misused PLATFORM(MIDDLE_ENDIAN) and PLATFORM(BIG_ENDIAN). https://bugs.webkit.org/show_bug.cgi?id=128301 Reviewed by Daniel Bates. Endianness is a CPU attribute, not a PLATFORM. PLATFORM() macro is replaced to CPU(). * wtf/text/ASCIIFastPath.h: (WTF::copyLCharsFromUCharSource): 2014-06-17 Andreas Kling Web process main thread priority is lower than some network process threads. Bring all of our threads to the appropriate priority level by opting in to the threading QoS APIs. By marking them "user initiated", they still yield to UI interaction, but take priority over background tasks. Reviewed by Maciej Stachowiak. * wtf/Platform.h: * wtf/Threading.cpp: (WTF::setCurrentThreadIsUserInitiated): * wtf/Threading.h: * wtf/ThreadingPthreads.cpp: (WTF::createThreadInternal): 2014-06-17 Alex Christensen Enable css jit for armv7 on iOS. https://bugs.webkit.org/show_bug.cgi?id=133961 Reviewed by Andreas Kling. * wtf/Platform.h: Enable css jit for ARM thumb on iOS. 2014-06-17 Dan Bernstein String::isolatedCopy doesn’t return an isolated copy when used on an rvalue reference https://bugs.webkit.org/show_bug.cgi?id=133968 Reviewed by Anders Carlsson. Made the rvalue reference overload of isolatedCopy() non-const, so that std::move(*this) is an rvalue reference that can be moved, rather than copied, into the returned String. * wtf/text/WTFString.cpp: (WTF::String::isolatedCopy): * wtf/text/WTFString.h: 2014-06-15 Dan Bernstein iOS build fix after r169995. * wtf/RetainPtr.h: 2014-06-15 Anders Carlsson Add an autorelease() member function to RetainPtr https://bugs.webkit.org/show_bug.cgi?id=133929 Reviewed by Dan Bernstein. * wtf/RetainPtr.h: 2014-06-13 Alex Christensen Unreviewed disabling css jit on armv7. It's not quite ready yet. * wtf/Platform.h: Disable css jit on armv7. 2014-06-13 Alex Christensen Enable css jit for armv7 on iOS. https://bugs.webkit.org/show_bug.cgi?id=133890 Reviewed by Andreas Kling. * wtf/Platform.h: Enable css jit for ARM thumb on iOS. 2014-06-13 Mark Hahnenberg OSR exit should barrier the Executables for all InlineCallFrames, not just those on the stack at the time of exit https://bugs.webkit.org/show_bug.cgi?id=133880 Reviewed by Filip Pizlo. * wtf/Bag.h: (WTF::Bag::iterator::operator!=): Add != to the Bag iterator so we can use it in range-based iteration. 2014-06-12 Gavin Barraclough Add support for thread/WorkQueue QoS https://bugs.webkit.org/show_bug.cgi?id=130688 Reviewed by Anders Carlson & Simon Fraser. Add the ability to mark threads as UserInteractive. * wtf/Threading.cpp: (WTF::setCurrentThreadIsUserInteractive): - added method to set QoS of current thread to UserInteractive. * wtf/Threading.h: - added declaration. 2014-06-12 Alexey Proskuryakov Fix Mac after r169880. This revision added a C++ comment to Platform.h, which breaks sandbox profile preprocessing. Also, I do not believe that this comment was entirely accurate - we've always used this technique with GCC, so there has to be more to it. So, I just removed the comment. * wtf/Platform.h: 2014-06-11 Csaba Osztrogonác [EFL][GTK] Ultimate fix not to have build failures in the future because of "#if TARGET_OS_IPHONE" guards. Unreviewed buildfix. * wtf/Platform.h: Define TARGET_OS_IPHONE to 0 on EFL and GTK. 2014-06-11 Ryosuke Niwa Turning on DUMP_PROPERTYMAP_STATS causes a build failure https://bugs.webkit.org/show_bug.cgi?id=133673 Reviewed by Andreas Kling. Added DEFINE_GLOBAL_FOR_LOGGING to allow running a destructor in logging code that needs to be enabled in release builds (e.g. for JavaScriptCore). * wtf/StdLibExtras.h: 2014-06-09 Benjamin Poulain Improve CSSPrimitiveValue::customCSSText for ARMv7 https://bugs.webkit.org/show_bug.cgi?id=133597 Reviewed by Andreas Kling. * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): * wtf/text/WTFString.h: (WTF::String::String): 2014-06-05 Yoav Weiss Align srcset parser with recent spec changes https://bugs.webkit.org/show_bug.cgi?id=133504 Reviewed by Darin Adler. I've added toInt and toFloat methods to StringView, and exposed charactersToInt so that they can be used by HTMLSrcsetParser.cpp. * wtf/text/WTFString.h: * wtf/text/StringView.h: (WTF::StringView::toInt): (WTF::StringView::toFloat): 2014-06-04 Alex Christensen Enable WebGL on Windows. https://bugs.webkit.org/show_bug.cgi?id=133503 Reviewed by Brent Fulgham. * wtf/FeatureDefines.h: Enable WebGL for AppleWin and WinCairo ports. 2014-06-01 Jer Noble [MSE] Appends of overlapping sample data do not clear existing samples properly. https://bugs.webkit.org/show_bug.cgi?id=133435 Reviewed by Darin Adler. Add a dump method to MediaTime, so that MediaTimes can be easily converted to strings (for logging purposes). * wtf/MediaTime.cpp: (WTF::MediaTime::dump): * wtf/MediaTime.h: 2014-05-31 Anders Carlsson Add a LazyNeverDestroyed class template and use it https://bugs.webkit.org/show_bug.cgi?id=133425 Reviewed by Darin Adler. LazyNeverDestroyed is similar to NeverDestroyed, except it's lazily constructed by calling construct(). This makes it useful for using inside std::call_once functions. * wtf/Forward.h: * wtf/NeverDestroyed.h: (WTF::LazyNeverDestroyed::construct): (WTF::LazyNeverDestroyed::operator T&): (WTF::LazyNeverDestroyed::get): (WTF::LazyNeverDestroyed::asPtr): (WTF::LazyNeverDestroyed::MaybeRelax::MaybeRelax): * wtf/mac/DeprecatedSymbolsUsedBySafari.mm: (WTF::atomicallyInitializedStaticMutex): * wtf/unicode/icu/CollatorICU.cpp: (WTF::cachedCollatorMutex): 2014-05-29 Alex Christensen Enable css jit by default on arm64. https://bugs.webkit.org/show_bug.cgi?id=133246 Reviewed by Benjamin Poulain. * wtf/Platform.h: Added arm64 to list of supported architectures. 2014-05-28 Filip Pizlo DFG::DCEPhase inserts into an insertion set in reverse, causing hilarious basic block corruption if you kill a lot of NewArrays https://bugs.webkit.org/show_bug.cgi?id=133368 Reviewed by Mark Lam. * wtf/Insertion.h: (WTF::executeInsertions): This algorithm is only correct if insertions are added in the right order. Assert that the order is right. 2014-05-27 Jon Lee Update ENABLE(MEDIA_SOURCE) on Mac https://bugs.webkit.org/show_bug.cgi?id=133141 Reviewed by Darin Adler. * wtf/FeatureDefines.h: #ifdef unneeded for Mac since it's covered in the .xcconfigs. 2014-05-27 Tibor Meszaros Remove BLOB guards https://bugs.webkit.org/show_bug.cgi?id=132863 Reviewed by Csaba Osztrogonác. * wtf/FeatureDefines.h: 2014-05-27 Gwang Yoon Hwang [GLIB] RunLoop::dispatch always executes the function on the main thread instead of the target thread. https://bugs.webkit.org/show_bug.cgi?id=133291 Reviewed by Carlos Garcia Campos. GMainLoopSource::schedule[AfterDelay] must be used with the appropriate GMainContext. Because current implementations in RunLoopGtk passes nullptr instead of its runLoopContext when using GMainLoopSource, all of dispatched functions are executed on the main thread regardless of which runloops is used. This patch fixes the issue by passing the m_runLoopContext instead the default parameter to the GMainLoopSource::schedule[AfterDelay]. * wtf/gtk/RunLoopGtk.cpp: (WTF::RunLoop::wakeUp): (WTF::RunLoop::TimerBase::start): 2014-05-26 Darin Adler Class name matching should use ASCII case-insensitive matching, not Unicode case folding https://bugs.webkit.org/show_bug.cgi?id=133292 Reviewed by Anders Carlsson. * wtf/text/AtomicString.cpp: (WTF::AtomicString::addSlowCase): Change to take references instead of pointers since these arguments can never be null. (WTF::AtomicString::lower): Rearranged slightly to use PassRef in a more efficient but slightly uglier way. (WTF::AtomicString::convertToASCIILowercase): Added. * wtf/text/AtomicString.h: Updated for above changes. * wtf/text/StringImpl.cpp: (WTF::StringImpl::convertToASCIILowercase): Added. * wtf/text/StringImpl.h: Updated for above. * wtf/text/WTFString.cpp: (WTF::String::convertToASCIILowercase): Added. * wtf/text/WTFString.h: Updated for above. 2014-05-22 Zan Dobersek Add the partial specialization for VectorTraits> https://bugs.webkit.org/show_bug.cgi?id=133083 Reviewed by Andreas Kling. * wtf/VectorTraits.h: Like for RefPtr

, OwnPtr

and Ref

, the partial specialization for VectorTraits> should exist and should inherit from SimpleClassVector. 2014-05-20 Geoffrey Garen Rolled out https://bugs.webkit.org/show_bug.cgi?id=133144 Reviewed by Gavin Barraclough. It caused a performance regression. * wtf/FastMalloc.cpp: (WTF::TCMalloc_PageHeap::runScavengerThread): * wtf/Threading.h: * wtf/ThreadingPthreads.cpp: (WTF::createThreadInternal): (WTF::setCurrentThreadQOSUtility): Deleted. * wtf/ThreadingWin.cpp: (WTF::setCurrentThreadQOSUtility): Deleted. 2014-05-20 Jer Noble [Mac] AVAssets are never destroyed; lack of an autorelease pool when calling callOnMainThread. https://bugs.webkit.org/show_bug.cgi?id=133130 Reviewed by Geoff Garen. Wrap the function to be called in an autorelease pool, so that autoreleased objects are cleaned up immediately after the end of the function. * wtf/mac/MainThreadMac.mm: (WTF::timerFired): 2014-05-18 Rik Cabanier support for navigator.hardwareConcurrency https://bugs.webkit.org/show_bug.cgi?id=132588 Reviewed by Filip Pizlo. * wtf/FeatureDefines.h: 2014-05-14 Tibor Meszaros Remove CSS_STICKY_POSITION guards https://bugs.webkit.org/show_bug.cgi?id=132676 Reviewed by Simon Fraser. * wtf/FeatureDefines.h: 2014-05-13 Simon Fraser [iOS WK2] background-attachment:fixed behaves very poorly https://bugs.webkit.org/show_bug.cgi?id=132881 Reviewed by Beth Dakin. Remove ENABLE_FAST_MOBILE_SCROLLING. Ports can use the fixedBackgroundsPaintRelativeToDocument setting now. * wtf/FeatureDefines.h: 2014-05-08 Alexey Proskuryakov Automatically zip document bundles used via File API https://bugs.webkit.org/show_bug.cgi?id=132713 Reviewed by Anders Carlsson. * wtf/FeatureDefines.h: Added ENABLE_FILE_REPLACEMENT for Mac. 2014-05-07 Filip Pizlo UNREACHABLE_FOR_PLATFORM() is meant to be a release crash. Rubber stamped by Mark Hahnenberg.. * wtf/Assertions.h: (UNREACHABLE_FOR_PLATFORM): 2014-05-06 Alberto Garcia There is no HW_AVAILCPU on FreeBSD, NetBSD, and OpenBSD https://bugs.webkit.org/show_bug.cgi?id=132542 Reviewed by Michael Saboff. Use sysconf() to get the number of processor cores. * wtf/NumberOfCores.cpp: (WTF::numberOfProcessorCores): 2014-05-04 Darin Adler RetainPtr: Use adoptCF function instead of AdoptCF constructor argument https://bugs.webkit.org/show_bug.cgi?id=80222 Reviewed by Alexey Proskuryakov. All the clients are gone, so we can now remove AdoptCF and AdoptNS. * wtf/RetainPtr.h: Removed the public constructors that let you specify AdoptCF and AdoptNS. Instead, made the adoptCF and adoptNS functions be friends and use a private constructor that takes an Adopt argument. (WTF::adoptCF): Moved the Objective-C class check in here. (WTF::adoptNS): Moved the code to deal with the CFRetain for garbage collection in here; it used to be spread across the constructor and adoptNSReference. 2014-05-04 Andreas Kling Optimize JSRopeString for resolving directly to AtomicString. Add AtomicString::find([LU]Char*, unsigned length) helpers for finding an existing AtomicString without a StringImpl on hand. Reviewed by Filip Pizlo. * wtf/text/AtomicString.h: * wtf/text/AtomicString.cpp: (WTF::AtomicString::find): 2014-05-01 Brent Fulgham Fix handling of attributes prior to compiling shader https://bugs.webkit.org/show_bug.cgi?id=132430 Reviewed by Dean Jackson. WebGL programs that called bindAttribLocations prior to compiling shader sources would perform the bind using the non-hashed symbol name, but would later create the attributes as hashed names. Consequently, the program would refer to attributes that were never actually part of any shader, resulting in some amazing display artifacts. This patch adds a dictionary of hashed symbol names so that we can tell the WebGL program the proper name that will be used when the shader is eventually compiled, allowing the WebGL program to link against the proper symbol after compiling and linking completes. * wtf/HexNumber.h: (WTF::appendUnsigned64AsHex): Add uint64_t-compatible hex->string converter. 2014-04-30 Geoffrey Garen Link against bmalloc in production builds https://bugs.webkit.org/show_bug.cgi?id=132413 Reviewed by Sam Weinig. Production builders have been configured to handle this, so let's build it. * Configurations/WTF.xcconfig: 2014-05-01 Ryuan Choi [EFL] There are many warnings with software backend https://bugs.webkit.org/show_bug.cgi?id=132422 Reviewed by Gyuyoung Kim. * wtf/efl/EflTypedefs.h: Added Ecore_X_Window typedef 2014-04-30 Simon Fraser Remove ENABLE_PLUGIN_PROXY_FOR_VIDEO https://bugs.webkit.org/show_bug.cgi?id=132396 Reviewed by Eric Carlson. Remove ENABLE_PLUGIN_PROXY_FOR_VIDEO and related code. * wtf/FeatureDefines.h: 2014-04-30 Víctor Manuel Jáquez Leal [GTK][GStreamer] Remove unnecessary GLIB_CHECK_VERSION #ifdefs https://bugs.webkit.org/show_bug.cgi?id=132390 Reviewed by Philippe Normand. Since EFL port use GLib 2.38 and GTK+, 2.33.2, I assume it is OK remove, in GTK+ and GST, the existing glib version guards. This code was rollback from r149879 because Qt MIPS used it. But since Qt is gone, it is safe to remove now. * wtf/gobject/GRefPtr.cpp: (WTF::refGPtr): Deleted. (WTF::derefGPtr): Deleted. 2014-04-29 Alex Christensen [WinCairo] Switch video from GStreamer to Media Foundation. https://bugs.webkit.org/show_bug.cgi?id=132358 Reviewed by Brent Fulgham. * WTF.vcxproj/WTF.vcxproj: Removed dependencies on GStreamer. * wtf/Platform.h: Use Media Foundation instead of GStreamer and GLib. 2014-04-29 Filip Pizlo Unreviewed, fix cloop build. * wtf/Platform.h: 2014-04-29 Michael Saboff For DARWIN platforms, use system temporary directory for DataLog output https://bugs.webkit.org/show_bug.cgi?id=132346 Reviewed by Geoffrey Garen. Added code to call confstr() to access the process's temporary directory to use that location instead of /tmp/. Put the code behind #ifdef DATA_LOG_TO_DARWIN_TEMP_DIR. * wtf/DataLog.cpp: (WTF::initializeLogFileOnce): 2014-04-25 Filip Pizlo Figure out how many cores are available for realsies. Rubber stamped by Andreas Kling. HW_AVAILCPU is more canonical than HW_NCPU. For example if you use hacks to tell Darwin to make it seem like there are fewer CPUs, HW_AVAILCPU will change but HW_NCPU won't. HW_NCPU doesn't reflect how much actual paralellism you'll get; it's merely reporting facts about the machine you're running on. HW_AVAILCPU is almost always what WebKit wants since it uses this information to decide how many threads to launch for various things. * wtf/NumberOfCores.cpp: (WTF::numberOfProcessorCores): 2014-04-22 Brent Fulgham [Win] Support Python 2.7 in Cygwin https://bugs.webkit.org/show_bug.cgi?id=132023 Reviewed by Michael Saboff. * WTF.vcxproj/WTFGenerated.make: Use proper path to Python. 2014-04-21 Eric Carlson [Mac] implement WebKitDataCue https://bugs.webkit.org/show_bug.cgi?id=131799 Reviewed by Dean Jackson. * wtf/FeatureDefines.h: Define ENABLE_DATACUE_VALUE. 2014-04-21 Darin Adler Add HashSet::takeAny https://bugs.webkit.org/show_bug.cgi?id=131928 Reviewed by Benjamin Poulain. * wtf/HashSet.h: Added an overload of take that takes an iterator, and used it to implement both the existing take and new takeAny functions. 2014-04-20 Andreas Kling Speed up jsStringWithCache() through WeakGCMap inlining. Add HashMap::fastAdd(), which is the same as add() except we'll tell the compiler to aggressively inline it. Reviewed by Darin Adler. * wtf/HashMap.h: * wtf/HashTable.h: 2014-04-19 Filip Pizlo Make it easier to check if an integer sum would overflow https://bugs.webkit.org/show_bug.cgi?id=131900 Reviewed by Darin Adler. * wtf/CheckedArithmetic.h: (WTF::checkedSum): (WTF::sumOverflows): 2014-04-18 Commit Queue Unreviewed, rolling out r167527. https://bugs.webkit.org/show_bug.cgi?id=131883 Broke 32-bit build (Requested by ap on #webkit). Reverted changeset: "[Mac] implement WebKitDataCue" https://bugs.webkit.org/show_bug.cgi?id=131799 http://trac.webkit.org/changeset/167527 2014-04-18 Eric Carlson [Mac] implement WebKitDataCue https://bugs.webkit.org/show_bug.cgi?id=131799 Reviewed by Dean Jackson. * wtf/FeatureDefines.h: Define ENABLE_DATACUE_VALUE. 2014-04-18 Martin Robinson Remove DynamicAnnotations.h? https://bugs.webkit.org/show_bug.cgi?id=131754 Reviewed by Simon Fraser. This file, which helped support tools like Valgrind was unused. * WTF.vcxproj/WTF.vcxproj: Remove references to the files. * WTF.vcxproj/WTF.vcxproj.filters: Remove references to the files. * WTF.xcodeproj/project.pbxproj: Remove references to the files. * wtf/CMakeLists.txt: Remove references to the files. * wtf/DynamicAnnotations.cpp: Removed. * wtf/DynamicAnnotations.h: Removed. * wtf/ThreadSafeRefCounted.h: Remove references to the files. * wtf/text/StringStatics.cpp: Remove references to the files. 2014-04-18 Philippe Normand Remove NETWORK_INFO support https://bugs.webkit.org/show_bug.cgi?id=131841 Reviewed by Gyuyoung Kim. * wtf/FeatureDefines.h: 2014-04-17 Filip Pizlo Don't include CompilationThread.h from StringImpl.h https://bugs.webkit.org/show_bug.cgi?id=131817 Reviewed by Simon Fraser. * wtf/CompilationThread.h: * wtf/StdLibExtras.h: * wtf/text/StringImpl.h: 2014-04-17 Darin Adler Use HashMap and Vector instead of deprecatedDeleteAllValues https://bugs.webkit.org/show_bug.cgi?id=73757 Reviewed by Brent Fulgham. * wtf/Vector.h: (WTF::deprecatedDeleteAllValues): Deleted. 2014-04-17 Darin Adler Add separate flag for IndexedDatabase in workers since the current implementation is not threadsafe https://bugs.webkit.org/show_bug.cgi?id=131785 rdar://problem/16003108 Reviewed by Brady Eidson. * wtf/FeatureDefines.h: Added INDEXED_DATABASE_IN_WORKERS. 2014-04-16 Simon Fraser Don't include CryptographicallyRandomNumber.h in StringImpl.h https://bugs.webkit.org/show_bug.cgi?id=131772 Reviewed by Sam Weinig. * wtf/text/StringImpl.h: 2014-04-16 Gavin Barraclough Update to pthread QoS SPI https://bugs.webkit.org/show_bug.cgi?id=131753 Rubber stamped by Benjamin Poulain * wtf/ThreadingPthreads.cpp: (WTF::setCurrentThreadQOSUtility): 2014-04-14 Geoffrey Garen WTF should have an optional mbmalloc target so we can benchmark FastMalloc https://bugs.webkit.org/show_bug.cgi?id=131662 Reviewed by Darin Adler. * WTF.xcodeproj/project.pbxproj: Added the target. * wtf/mbmalloc.cpp: Added. Implements the libmbmalloc.dylib API required by MallocBench. 2014-04-16 Darin Adler Make Vector::takeLast work with move-only types (and optimize for types where move is faster) https://bugs.webkit.org/show_bug.cgi?id=131735 Reviewed by Alexey Proskuryakov. * wtf/Vector.h: (WTF::Vector::takeLast): Added a missing std::move. All the other take functions have it. 2014-04-14 Mark Lam monotonicallyIncreasingTime() should only initialize its static timebaseInfo once. Reviewed by Filip Pizlo. The current initialization of the static field is not thread safe. * wtf/CurrentTime.cpp: (WTF::monotonicallyIncreasingTime): 2014-04-14 Benjamin Poulain [JSC] Improve the call site of string comparison in some hot path https://bugs.webkit.org/show_bug.cgi?id=131605 Reviewed by Darin Adler. * wtf/text/StringImpl.cpp: (WTF::stringImplContentEqual): Inline that function to reduce the call overhead for JSC. This is only inlined twice, it is not catastrophic for our binary. 2014-04-13 Andy Estes Relax adoption requirements of RefCounted objects that are NeverDestroyed https://bugs.webkit.org/show_bug.cgi?id=131593 Reviewed by Dan Bernstein. RefCounted objects that are created by NeverDestroyed<> won't have a RefPtr adopting them, so call relaxAdoptionRequirements(). * wtf/NeverDestroyed.h: (WTF::NeverDestroyed::NeverDestroyed): (WTF::NeverDestroyed::MaybeRelax::MaybeRelax): 2014-04-10 Brent Fulgham [Win] Clean up some 64-bit warnings from Visual Studio analyzer https://bugs.webkit.org/show_bug.cgi?id=131514 Reviewed by Tim Horton. * WTF.vcxproj/WTF.vcxproj: Use correct platform settings for 64-bit build. * config.h: Ditto. * wtf/CurrentTime.cpp: (WTF::highResUpTime): Resolve warning about deprecated API. * wtf/StackBounds.cpp: (WTF::StackBounds::initialize): Silence warning about an uninitialized variable. 2014-04-09 Geoffrey Garen Rolled back in r166972. This time, we conditionally exclude linking against bmalloc in Production builds. Production builds will not be able to link against bmalloc until the Production build system has been updated to build bmalloc. WTF should link against bmalloc https://bugs.webkit.org/show_bug.cgi?id=131403 Reviewed by Mark Rowe. * Configurations/WTF.xcconfig: * WTF.xcodeproj/project.pbxproj: 2014-04-09 Geoffrey Garen Put bmalloc headers in the right place https://bugs.webkit.org/show_bug.cgi?id=131464 Reviewed by Mark Rowe. * wtf/FastMalloc.cpp: Use "" syntax so we can find our headers in /usr/local/include/bmalloc/. 2014-04-09 Geoffrey Garen Rolled back out r166972. The production buildbots are still broken because the build-root script doesn't build bmalloc. * WTF.xcodeproj/project.pbxproj: 2014-04-09 Geoffrey Garen Rolled back in r166972. The iOS buildbot's scripts have been updated to build bmalloc, so the build should now succeed on the bot. Also renamed "Frameworks" to "Libraries" as suggested in a review comment. WTF should link against bmalloc https://bugs.webkit.org/show_bug.cgi?id=131403 Reviewed by Michael Saboff. This is required to build successfullly with bmalloc enabled. * WTF.xcodeproj/project.pbxproj: 2014-04-08 Geoffrey Garen Stop linking WTF against bmalloc. Reviewed by Enrica Casucci. This seems to have broken an iOS buildbot script. Disable it for now until we can fix the script. * WTF.xcodeproj/project.pbxproj: 2014-04-08 Geoffrey Garen WTF should link against bmalloc https://bugs.webkit.org/show_bug.cgi?id=131403 Reviewed by Michael Saboff. This is required to build successfullly with bmalloc enabled. * WTF.xcodeproj/project.pbxproj: 2014-04-08 Geoffrey Garen Added a bmalloc back-end for FastMalloc https://bugs.webkit.org/show_bug.cgi?id=131387 Reviewed by Andreas Kling. We'll need to rethink some things if we adopt this back-end. For example, fastMallocSize() and fastMallocGoodSize() are no longer real things. But, this is enough to test for now. * wtf/FastMalloc.cpp: (WTF::fastMalloc): (WTF::fastCalloc): (WTF::fastRealloc): (WTF::fastFree): (WTF::fastMallocSize): (WTF::fastMallocGoodSize): (WTF::tryFastMalloc): (WTF::tryFastRealloc): (WTF::tryFastCalloc): (WTF::releaseFastMallocFreeMemory): (WTF::fastMallocStatistics): 2014-04-08 Andres Gomez [GTK] [EFL] Build fails with GCC < 4.8.x https://bugs.webkit.org/show_bug.cgi?id=130585 Reviewed by Martin Robinson. The behavior in lower versions of GCC seem to be related to http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#2132. Provided explicit casts for the failing ambiguous overloads. * wtf/gtk/MainThreadGtk.cpp: (WTF::scheduleDispatchFunctionsOnMainThread): * wtf/gtk/RunLoopGtk.cpp: (WTF::RunLoop::wakeUp): Provided lambda with a RefPtr instead of ref and de-referring. 2014-04-04 Mark Lam Date object needs to check for ES5 15.9.1.14 TimeClip limit. Reviewed by Mark Hahnenberg. * wtf/DateMath.cpp: - Moved the definition of maxECMAScriptTime to the .h file so that we can use it in other files as well. (WTF::msToYear): - Removed a stale comment for parseDateFromNullTerminatedCharacters(). * wtf/DateMath.h: 2014-04-04 Mark Hahnenberg Enhanced GC logging https://bugs.webkit.org/show_bug.cgi?id=131246 Reviewed by Geoff Garen. Remove OBJECT_MARK_LOGGING * wtf/FeatureDefines.h: * wtf/Platform.h: 2014-04-03 Zsolt Borbely [EFL] Enable CSS JIT again, it works fine after r166666. Reviewed by Csaba Osztrogonác. * wtf/Platform.h: 2014-04-03 Javier Fernandez [GTK][Cmake] Enable CSS JIT https://bugs.webkit.org/show_bug.cgi?id=131022 Reviewed by Martin Robinson. * wtf/Platform.h: Enable CSS JIT for GTK port. 2014-04-02 Frédéric Wang Operator stretching: read the Open Type MATH table https://bugs.webkit.org/show_bug.cgi?id=130324 Reviewed by Chris Fleizach. * wtf/Platform.h: enable OPENTYPE_MATH on platforms that can read OpenType tables. 2014-04-02 Alex Christensen [WinCairo] Build fix with GMainLoopSource. https://bugs.webkit.org/show_bug.cgi?id=131089 Reviewed by Carlos Garcia Campos. * wtf/gobject/GMainLoopSource.cpp: Only compile if glib is used, which fixes compile errors with video disabled in WinCairo. * wtf/gobject/GMainLoopSource.h: Export the GMainLoopSource functions to WTF.dll to link with where they are called in the GStreamer code. Also removed spaces to appease style bot. 2014-04-01 Zsolt Borbely [EFL] REGRESSION(166569): It made DoYouEvenBench/Full.html, CSS/QuerySelector.html and Dromaeo performance tests crash https://bugs.webkit.org/show_bug.cgi?id=131039 Reviewed by Csaba Osztrogonác. * wtf/Platform.h: Disable CSS JIT on EFL until proper fix. 2014-04-01 Commit Queue Unreviewed, rolling out r166583. https://bugs.webkit.org/show_bug.cgi?id=131040 It's causing frequent crashes when running Layout Tests (Requested by svillar on #webkit). Reverted changeset: "[GTK][Cmake] Enable CSS JIT" https://bugs.webkit.org/show_bug.cgi?id=131022 http://trac.webkit.org/changeset/166583 2014-04-01 Javier Fernandez [GTK][Cmake] Enable CSS JIT https://bugs.webkit.org/show_bug.cgi?id=131022 Reviewed by Martin Robinson. * wtf/Platform.h: Enable CSS JIT for GTK port. 2014-04-01 Gyuyoung Kim [CMake][EFL] Enable CSS JIT https://bugs.webkit.org/show_bug.cgi?id=131010 Reviewed by Benjamin Poulain. * wtf/Platform.h: Enable CSS JIT for EFL port. 2014-03-31 Dean Jackson Remove WEB_ANIMATIONS https://bugs.webkit.org/show_bug.cgi?id=130989 Reviewed by Simon Fraser. Remove this feature flag until we plan to implement. * wtf/FeatureDefines.h: 2014-03-31 Alex Christensen Preparation for using Soup on Windows. https://bugs.webkit.org/show_bug.cgi?id=130615 Reviewed by Carlos Garcia Campos. * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: Add all gobject source files in WinCairo build. * wtf/gobject/GRefPtr.h: Export refGPtr and derefGPtr overloads in WTF.dll to fix linker errors with WebKit.dll when using soup. 2014-03-31 Zan Dobersek Use std::unique_ptr in WTF::CompressedVector, WTF::GenericCompressedData https://bugs.webkit.org/show_bug.cgi?id=130737 Switch to using std::unique_ptr instead of OwnPtr and PassOwnPtr for the CompressedVector and GenericCompressedData classes. * wtf/Compression.cpp: (WTF::GenericCompressedData::create): * wtf/Compression.h: (WTF::CompressedVector::create): (WTF::CompressibleVector::decompressIfNecessary): 2014-03-28 Alexey Proskuryakov [Mac] Enable async text input implementation https://bugs.webkit.org/show_bug.cgi?id=130856 Reviewed by Sam Weinig. * wtf/Platform.h: Added a USE macro definition. 2014-03-28 peavo@outlook.com Null pointer crash in String::append(UChar). https://bugs.webkit.org/show_bug.cgi?id=130900 Reviewed by Michael Saboff. * wtf/text/WTFString.cpp: (WTF::String::append): Check and initialize m_impl member first, to avoid null pointer crash. 2014-03-27 Commit Queue Unreviewed, rolling out r166360. https://bugs.webkit.org/show_bug.cgi?id=130869 Seems to have broken PLT (Requested by ap on #webkit). Reverted changeset: "Connection::dispatchOneMessage() can be re-entered while handling Cmd-key menu" https://bugs.webkit.org/show_bug.cgi?id=130767 http://trac.webkit.org/changeset/166360 2014-03-27 Alexey Proskuryakov Connection::dispatchOneMessage() can be re-entered while handling Cmd-key menu equivalents, ASSERT(!_data->_keyDownEventBeingResent) https://bugs.webkit.org/show_bug.cgi?id=130767 Reviewed by Darin Adler. Changed RunLoop to wake up and fire timers only in default run loop mode by default, and added an ability to add more modes (can't use AppKit symbols in WTF). In addition to this bug, the change also blocks modal alerts from appearing under menus during menu tracking. * wtf/RunLoop.h: * wtf/cf/RunLoopCF.cpp: (WTF::RunLoop::RunLoop): (WTF::RunLoop::addModeForWakeUpAndTimers): (WTF::RunLoop::TimerBase::start): 2014-03-26 Zan Dobersek Unreviewed. Removing the remaining Automake cruft. * GNUmakefile.list.am: Removed. 2014-03-25 Martin Robinson [GTK] Remove the autotools build https://bugs.webkit.org/show_bug.cgi?id=130717 Reviewed by Anders Carlsson. * GNUmakefile.am: Removed. * config.h: Removed references to the autotools configure file. 2014-03-25 Gabor Rapcsanyi [ARM64] GCC generates wrong code with -O2 flag in WTF::weakCompareAndSwap https://bugs.webkit.org/show_bug.cgi?id=130500 Reviewed by Filip Pizlo. Set the first operand to the exact register in the inline assembly with GCC. * wtf/Atomics.h: (WTF::weakCompareAndSwap): 2014-03-25 Gabor Rapcsanyi [EFL] Add ARM64 build support https://bugs.webkit.org/show_bug.cgi?id=130506 Rubber stamped by Gyuyoung Kim. * wtf/Platform.h: Set WTF_CPU_ARM64 when __aarch64__ is defined. 2014-03-24 Andy Estes Fix the iOS build. * wtf/ThreadingPthreads.cpp: (WTF::createThreadInternal): (WTF::setCurrentThreadQOSUtility): 2014-03-24 Gavin Barraclough Add support for thread QoS https://bugs.webkit.org/show_bug.cgi?id=130688 Speculative EFL build fix. * wtf/ThreadingPthreads.cpp: (WTF::setCurrentThreadQOSUtility): 2014-03-24 Gavin Barraclough Add support for thread QoS https://bugs.webkit.org/show_bug.cgi?id=130688 Reviewed by Andreas Kling. * wtf/FastMalloc.cpp: (WTF::TCMalloc_PageHeap::runScavengerThread): - block freeing is a utility activity. * wtf/Threading.h: - declaration. * wtf/ThreadingPthreads.cpp: (WTF::createThreadInternal): - default to interactive. (WTF::setCurrentThreadQOSUtility): - implementation. * wtf/ThreadingWin.cpp: (WTF::setCurrentThreadQOSUtility): - no-op implementation. 2014-03-23 Hyowon Kim Move all EFL typedefs into EflTypedefs.h. https://bugs.webkit.org/show_bug.cgi?id=130511 Reviewed by Gyuyoung Kim. * wtf/Platform.h: include EflTypedefs.h. * wtf/efl/EflTypedefs.h: Added. * wtf/efl/RefPtrEfl.h: Remove EFL typedefs. 2014-03-22 Darin Adler Remove String::deprecatedCharacters https://bugs.webkit.org/show_bug.cgi?id=126854 Reviewed by Sam Weinig. * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::reifyString): Removed code to update 16-bit shadow. * wtf/text/StringBuilder.h: Removed deprecatedCharacters. (WTF::StringBuilder::StringBuilder): Removed m_valid16BitShadowLength. (WTF::StringBuilder::clear): Removed code to clear m_valid16BitShadowLength. (WTF::StringBuilder::swap): Removed code to swap m_valid16BitShadowLength. * wtf/text/StringImpl.cpp: (WTF::StringImpl::~StringImpl): Removed code to free m_copyData16. (WTF::StringImpl::upper): Use StringView::upconvertedCharacters for slow case. (WTF::StringImpl::lower): Ditto. (WTF::StringImpl::find): Use characters8/16 rather than deprecatedCharacters. Added an 8-bit code path to one of the overloads. Might want to revisit later to decide whether to use templates instead of copy/paste, or even use StringView to cut down on duplicate code paths. (WTF::StringImpl::findIgnoringCase): Ditto. (WTF::StringImpl::sizeInBytes): Remove code to handle has16BitShadow case. (WTF::equalIgnoringNullity): Added. To be called by the Vector template in the header. * wtf/text/StringImpl.h: Removed deprecatedCharacters, has16BitShadow, upconvertCharacters, getData16SlowCase, s_hashFlagHas16BitShadow, and m_copyData16. (WTF::equalIgnoringNullity): Changed the template function into an inline that calls a non-inline helper function. The non-inline function handles both 8-bit and 16-bit strings. * wtf/text/StringView.h: (WTF::StringView::StringView): Added an overload so we can make one of these directly from a StringImpl without first wrapping it in a string. Added an adapter so we can use StringView as part of string concatenation. Added an append function so we can append to a Vector. * wtf/text/WTFString.cpp: (WTF::String::append): Use StringView::getCharactersWithUpconvert. Also changed single-character append so it won't always turn an 8-bit string into a 16-bit one. (WTF::String::insert): Removed one insert overload and changed the other to use StringView::getCharactersWithUpconvert. (WTF::String::truncate): Changed to use StringImpl::substring. (WTF::String::percentage): Added characters8/16 paths instead of using deprecatedCharacters. * wtf/text/WTFString.h: Removed deprecatedCharacters, getCharactersWithUpconvert, insert(UChar*, unsigned, unsigned), and the append overload for Vector. 2014-03-20 Darin Adler Fix a header guard mistake (harmless but clearly wrong) https://bugs.webkit.org/show_bug.cgi?id=130559 Reviewed by Andreas Kling. * wtf/text/StringConcatenate.h: Correct the macro name in the header guard. 2014-03-20 Hyowon Kim Move to using std::unique_ptr for EFL objects. https://bugs.webkit.org/show_bug.cgi?id=129853 Reviewed by Gyuyoung Kim. EflUniquePtr is a template alias of std::unique_ptr with a custom deleter for each Efl Objects, which is motivated by GUniquePtr. This patch replaces uses of OwnPtr and PassOwnPtr for Efl objects with EflUniquePtr. * wtf/OwnPtrCommon.h: * wtf/PlatformEfl.cmake: * wtf/RunLoop.h: * wtf/efl/MainThreadEfl.cpp: (WTF::pipeObject): (WTF::initializeMainThreadPlatform): * wtf/efl/OwnPtrEfl.cpp: Removed. * wtf/efl/RunLoopEfl.cpp: (WTF::RunLoop::RunLoop): * wtf/efl/UniquePtrEfl.h: Added. (WTF::EflPtrDeleter::operator()): 2014-03-20 Gavin Barraclough Remove IdentifierTable typedef, isIdentifier() https://bugs.webkit.org/show_bug.cgi?id=130533 Rubber stamped by Geoff Garen. Code should use AtomicStringTable, isAtomic() directly. * wtf/WTFThreadData.h: (WTF::WTFThreadData::setCurrentAtomicStringTable): (WTF::WTFThreadData::resetCurrentAtomicStringTable): - removed IdentifierTypedef. * wtf/text/StringImpl.h: (WTF::StringImpl::flagIsAtomic): - renamed flagIsIdentfier -> flagIsAtomic. 2014-03-20 Gavin Barraclough Merge AtomicString, Identifier https://bugs.webkit.org/show_bug.cgi?id=128624 Reviewed by Geoff Garen. WTF::StringImpl currently supports two uniquing mechanism - AtomicString and Identifer - that is one too many. Remove Identifier in favour of AtomicString. Identifier had two interesting mechanisms that we preserve. (1) JSC API VMs each get their own string table, switch the string table on API entry/exit. (2) JSC caches a pointer to the string table on the VM to avoid a thread specific access. Adds a new AtomicString::add method to support this. * wtf/WTFThreadData.cpp: (WTF::WTFThreadData::WTFThreadData): - remove allocation of IdentifierTable. (WTF::WTFThreadData::~WTFThreadData): - remove deletion of IdentifierTable. * wtf/WTFThreadData.h: (WTF::WTFThreadData::atomicStringTable): - table is now switched by JSC API, return the current table. (WTF::WTFThreadData::currentIdentifierTable): - now returns the current AtomicStringTable. (WTF::WTFThreadData::setCurrentIdentifierTable): - now sets the current AtomicStringTable. (WTF::WTFThreadData::resetCurrentIdentifierTable): - now resets the AtomicStringTable. * wtf/text/AtomicString.cpp: (WTF::AtomicString::addSlowCase): - add without thread-specific access to access string table. * wtf/text/AtomicString.h: (WTF::AtomicString::addWithStringTableProvider): - add without thread-specific access (used by JSC, string table provided by VM or ExecState). * wtf/text/AtomicStringTable.cpp: (WTF::AtomicStringTable::create): - renamed m_atomicStringTable -> m_defaultAtomicStringTable. (WTF::AtomicStringTable::~AtomicStringTable): (WTF::AtomicStringTable::destroy): - clearing of table moved from AtomicStringTable::destroy to destructor. * wtf/text/AtomicStringTable.h: - added destructor. * wtf/text/StringImpl.cpp: (WTF::StringImpl::~StringImpl): - Identifers no longer exist; no need to remove them from IdentifierTable. * wtf/text/StringImpl.h: (WTF::StringImpl::StringImpl): - removed s_hashFlagIsIdentifier. (WTF::StringImpl::flagIsIdentifier): - s_hashFlagIsIdentifier -> s_hashFlagIsAtomic. (WTF::StringImpl::isIdentifier): - now synonymous to isAtomic(). * wtf/text/StringStatics.cpp: (WTF::StringImpl::hashAndFlagsForEmptyUnique): - removed s_hashFlagIsIdentifier. 2014-03-20 Zan Dobersek Unreviewed Clang build fix for the GTK port after r165952. * wtf/gobject/GMainLoopSource.h: Include the header for the std::function<> objects. 2014-03-18 Carlos Garcia Campos [GLIB] Add GMainLoopSource class to wrap idle and timeout sources https://bugs.webkit.org/show_bug.cgi?id=130027 Reviewed by Martin Robinson. GLib main loop sources like idle and timeouts are sometimes unconvenient to use and it's very common to forget canceling the source when the object is destroyed or reset the source ID in the callback when called. GMainLoopSource is a wrapper class to make it easier to handle sources and also to avoid those typical mistakes. It forces to create sources with a name and the user doesn't have to deal with the source ID anymore. The source is cancelled when the object is deleted or when a new source is scheduled. It uses std::function for callbacks so that we no longer need to use the "proxy" static callbacks either. We can use std::bind to use a function pointer or a member or even lambda functions. It also handles repeating sources automatically depending on whether the given function returns a bool or not. * GNUmakefile.list.am: * wtf/PlatformEfl.cmake: * wtf/PlatformGTK.cmake: * wtf/RunLoop.h: * wtf/gobject/GMainLoopSource.cpp: Added. (WTF::GMainLoopSource::createAndDeleteOnDestroy): (WTF::GMainLoopSource::GMainLoopSource): (WTF::GMainLoopSource::~GMainLoopSource): (WTF::GMainLoopSource::cancel): (WTF::GMainLoopSource::reset): (WTF::GMainLoopSource::scheduleIdleSource): (WTF::GMainLoopSource::schedule): (WTF::GMainLoopSource::scheduleTimeoutSource): (WTF::GMainLoopSource::scheduleAfterDelay): (WTF::GMainLoopSource::voidCallback): (WTF::GMainLoopSource::boolCallback): (WTF::GMainLoopSource::socketCallback): (WTF::GMainLoopSource::destroy): (WTF::GMainLoopSource::voidSourceCallback): (WTF::GMainLoopSource::boolSourceCallback): (WTF::GMainLoopSource::socketSourceCallback): * wtf/gobject/GMainLoopSource.h: Added. (WTF::GMainLoopSource::isScheduled): * wtf/gtk/MainThreadGtk.cpp: (WTF::scheduleDispatchFunctionsOnMainThread): * wtf/gtk/RunLoopGtk.cpp: (WTF::RunLoop::wakeUp): (WTF::RunLoop::TimerBase::TimerBase): (WTF::RunLoop::TimerBase::start): (WTF::RunLoop::TimerBase::stop): (WTF::RunLoop::TimerBase::isActive): 2014-03-19 Gavin Barraclough https://bugs.webkit.org/show_bug.cgi?id=130494 EmptyUnique strings are Identifiers/Atomic Reviewed by Geoff Garen. EmptyUnique strings should set the Identifier/Atomic flag. * wtf/text/AtomicString.h: (WTF::AtomicString::add): - Previously we assumed the only StringImpl that was validly allowed to claim to be Atomic but not be in a table was the canonical empty string. Now that EmptyUniques are also marked Atomic, all empty strings may pass this condition. * wtf/text/StringImpl.cpp: (WTF::StringImpl::~StringImpl): - EmptyUnique strings are not in the Atomic/Identfiier tabels, so don't need removing. * wtf/text/StringImpl.h: (WTF::StringImpl::StringImpl): - Change EmptyUnique constructor to call hashAndFlagsForEmptyUnique. * wtf/text/StringStatics.cpp: (WTF::StringImpl::hashAndFlagsForEmptyUnique): - Allocate a sequential hash code (this should be just as good for distribution & better for debugging than the random value) and set flags, now including Atomic & Identifier. 2014-03-19 Gavin Barraclough Small cleanup of empty string https://bugs.webkit.org/show_bug.cgi?id=130438 Reviewed by Anders Carlson. The empty string is weird becuase it is used as the impl for an AtomicString, but isAtomic() returns false. Also, we set a valid pointer for the characters pointer due to an old PCRE bug; remove this. Also, we currently only create one 'static' string, the empty string. Adding more might break assumtions, inhibit the constructor from being used to create other static strings for now. * wtf/text/AtomicString.h: (WTF::AtomicString::add): - update assert. * wtf/text/StringImpl.h: (WTF::StringImpl::StringImpl): - Merge ConstructStaticString constructors, only allow the empty static string to be constructed. * wtf/text/StringStatics.cpp: (WTF::StringImpl::empty): - ConstructStaticString -> ConstructEmptyString, remove arguments, DEPRECATED_DEFINE_STATIC_LOCAL -> NeverDestroyed. 2014-03-18 Darin Adler Reduce use of deprecatedCharacters in WebCore https://bugs.webkit.org/show_bug.cgi?id=130318 Reviewed by Andreas Kling. * wtf/text/WTFString.h: Export another overload of charactersToFloat since it's used in WebCore now. * wtf/text/cf/StringViewCF.cpp: Change so this can build on Windows. * WTF.vcxproj/WTF.vcxproj: Added StringViewCF.cpp. * WTF.vcxproj/WTF.vcxproj.filters: Added StringViewCF.cpp. 2014-03-18 Filip Pizlo More FTL enabling. Rubber stamped by Dan Bernstein and Mark Hahnenberg. * wtf/Platform.h: 2014-03-17 Darin Adler Remove most uses of deprecatedCharacter in WTF https://bugs.webkit.org/show_bug.cgi?id=130317 Reviewed by Andreas Kling. Re-landing after fixing the "80 instead of 0x80" typo in equalLatin1WithUTF8. * wtf/text/AtomicString.cpp: (WTF::HashAndUTF8CharactersTranslator::equal): Add an 8-bit code path to the non-ASCII path. (WTF::SubstringTranslator8::hash): Added. (WTF::SubstringTranslator8::equal): Added. (WTF::SubstringTranslator16::hash): Renamed class. (WTF::SubstringTranslator16::equal): Ditto. (WTF::AtomicString::add): Added an 8-bit code path to the substring case. * wtf/text/Base64.cpp: (WTF::base64Decode): Added an 8 bit code path. (WTF::base64URLDecode): Ditto. * wtf/text/StringImpl.cpp: (WTF::StringImpl::find): Fixed a case that was incorrectly using characters16 without first using is8Bit. Need to return later to remove use of deprecatedCharacters. * wtf/unicode/UTF8.cpp: (WTF::Unicode::equalUTF16WithUTF8): Added a case for when the UTF-16 characters are ASCII. Also removed the aEnd argument, since the caller only calls this when the lengths are equal. (WTF::Unicode::equalLatin1WithUTF8): Added. * wtf/unicode/UTF8.h: Updated as described above. 2014-03-17 Commit Queue Unreviewed, rolling out r165721. https://bugs.webkit.org/show_bug.cgi?id=130367 It makes the debug bots flaky (Requested by benjaminp on #webkit). Reverted changeset: "Remove most uses of deprecatedCharacter in WTF" https://bugs.webkit.org/show_bug.cgi?id=130317 http://trac.webkit.org/changeset/165721 2014-03-17 Zan Dobersek Use RunLoop objects through references instead of pointers https://bugs.webkit.org/show_bug.cgi?id=130313 Reviewed by Andreas Kling. Make RunLoop::current() and RunLoop::main() return a RunLoop reference instead of a pointer. RunLoop::Holder now uses a Ref member. Timer and TimerBase constructors take in a RunLoop reference, with TimerBase now storing a RunLoop reference member instead of a pointer. Platform-specific bits of the RunLoop class are updated accordingly. * wtf/RunLoop.cpp: (WTF::RunLoop::Holder::Holder): (WTF::RunLoop::Holder::runLoop): (WTF::RunLoop::initializeMainRunLoop): (WTF::RunLoop::current): (WTF::RunLoop::main): (WTF::RunLoop::isMain): * wtf/RunLoop.h: (WTF::RunLoop::Timer::Timer): * wtf/cf/RunLoopCF.cpp: (WTF::RunLoop::run): (WTF::RunLoop::TimerBase::TimerBase): (WTF::RunLoop::TimerBase::start): * wtf/efl/RunLoopEfl.cpp: (WTF::RunLoop::TimerBase::TimerBase): * wtf/gtk/RunLoopGtk.cpp: (WTF::RunLoop::run): (WTF::RunLoop::TimerBase::TimerBase): (WTF::RunLoop::TimerBase::start): * wtf/win/RunLoopWin.cpp: (WTF::RunLoop::TimerBase::TimerBase): (WTF::RunLoop::TimerBase::start): (WTF::RunLoop::TimerBase::stop): (WTF::RunLoop::TimerBase::isActive): 2014-03-17 Tamas Gergely One more fix after r165725. Reviewed by Csaba Osztrogonác. * wtf/WTFThreadData.h: 2014-03-17 Tamas Gergely Buildfix after r165725 for non Mac platforms. Reviewed by Csaba Osztrogonác. * wtf/WTFThreadData.h: 2014-03-17 Andreas Kling [Mac] WTFThreadData should use _pthread_getspecific_direct(). Hack WTFThreadData to use a direct key for TLS access when available. This mechanism uses a dedicated segment register and is the same way we implement the fast path in FastMalloc. Reviewed by Darin Adler. * wtf/FastMalloc.cpp: * wtf/WTFThreadData.cpp: (WTF::WTFThreadData::createAndRegisterForGetspecificDirect): * wtf/WTFThreadData.h: (WTF::wtfThreadData): 2014-03-16 Darin Adler Remove most uses of deprecatedCharacter in WTF https://bugs.webkit.org/show_bug.cgi?id=130317 Reviewed by Andreas Kling. * wtf/text/AtomicString.cpp: (WTF::HashAndUTF8CharactersTranslator::equal): Add an 8-bit code path to the non-ASCII path. (WTF::SubstringTranslator8::hash): Added. (WTF::SubstringTranslator8::equal): Added. (WTF::SubstringTranslator16::hash): Renamed class. (WTF::SubstringTranslator16::equal): Ditto. (WTF::AtomicString::add): Added an 8-bit code path to the substring case. * wtf/text/Base64.cpp: (WTF::base64Decode): Added an 8 bit code path. (WTF::base64URLDecode): Ditto. * wtf/text/StringImpl.cpp: (WTF::StringImpl::find): Fixed a case that was incorrectly using characters16 without first using is8Bit. Need to return later to remove use of deprecatedCharacters. * wtf/unicode/UTF8.cpp: (WTF::Unicode::equalUTF16WithUTF8): Added a case for when the UTF-16 characters are ASCII. Also removed the aEnd argument, since the caller only calls this when the lengths are equal. (WTF::Unicode::equalLatin1WithUTF8): Added. * wtf/unicode/UTF8.h: Updated as described above. 2014-03-16 David Kilzer Follow-up: Fix undefined behavior in WTF::equal() in StringImpl.h for i386/x86_64 Reviewed by Darin Adler. * wtf/text/StringImpl.h: (WTF::loadUnaligned): Restore behavior prior to r165681 for compilers other than clang. 2014-03-16 Darin Adler Remove all uses of deprecatedCharacters from JavaScriptCore https://bugs.webkit.org/show_bug.cgi?id=130304 Reviewed by Anders Carlsson. * wtf/dtoa.h: (WTF::parseDouble): Added an overload that takes a StringView. 2014-03-15 Darin Adler Remove all uses of deprecatedCharacters from WebKit2 https://bugs.webkit.org/show_bug.cgi?id=130197 Reviewed by Andreas Kling. * wtf/text/StringView.h: Added new getCharactersWithUpconvert and upconvertedCharacters functions. These are useful for callers that need UTF-16. 2014-03-15 Darin Adler Try to fix EFL build. * wtf/ThreadingPthreads.cpp: (WTF::changeThreadPriority): Code in this function was setting the priority of the current thread instead of the passed-in thread. That was triggering an unused variable warning in the compiler used to build for EFL. Fixed by using the thread handle instead of pthread_self. 2014-03-15 Michael Saboff It should be possible to adjust DFG and FTL compiler thread priorities https://bugs.webkit.org/show_bug.cgi?id=130288 Reviewed by Filip Pizlo. Added ability to change thread priorities relative to its current priority. Created options to adjust the priority of the DFG and FTL compilation work thread pools. For two core systems, there might be three runnable threads, the main thread, the DFG compilation thread and the FTL compilation thread. With the same priority, the scheduler is free to schedule whatever thread it wants. By lowering the compilation threads, the main thread can run. Further tests may suggest better values for the new options, priorityDeltaOfDFGCompilerThreads and priorityDeltaOfFTLCompilerThreads. For a two-core device, this change has a net positive improvement of 1-3% across SunSpider, Octane, Kraken and AsmBench. * wtf/Threading.h: * wtf/ThreadingPthreads.cpp: (WTF::changeThreadPriority): * wtf/ThreadingWin.cpp: (WTF::changeThreadPriority): 2014-03-15 David Kilzer Fix undefined behavior in WTF::equal() in StringImpl.h for i386/x86_64 Reviewed by Geoff Garen. * wtf/text/StringImpl.h: (WTF::loadUnaligned): Add template method. (WTF::equal): Switch to using loadUnaligned<>(). 2014-03-14 Mark Rowe Fix the production build. Don't rely on USE_INTERNAL_SDK being set for the Production configuration since UseInternalSDK.xcconfig won't be at the expected relative path when working from installed source. * Configurations/Base.xcconfig: 2014-03-14 Maciej Stachowiak Replace "Apple Computer, Inc." with "Apple Inc." in copyright headers https://bugs.webkit.org/show_bug.cgi?id=130276 Reviewed by Simon Fraser. * wtf/ASCIICType.h: * wtf/AVLTree.h: * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Atomics.cpp: * wtf/Atomics.h: * wtf/AutodrainedPool.h: * wtf/AutodrainedPoolMac.mm: * wtf/BoundsCheckedPointer.h: * wtf/CryptographicUtilities.cpp: * wtf/CryptographicallyRandomNumber.h: * wtf/CurrentTime.h: * wtf/Deque.h: * wtf/DisallowCType.h: * wtf/ExportMacros.h: * wtf/FeatureDefines.h: * wtf/GetPtr.h: * wtf/HashIterators.h: * wtf/Locker.h: * wtf/MainThread.cpp: * wtf/MainThread.h: * wtf/MathExtras.h: * wtf/MediaTime.cpp: * wtf/MediaTime.h: * wtf/MessageQueue.h: * wtf/MetaAllocator.cpp: * wtf/MetaAllocator.h: * wtf/MetaAllocatorHandle.h: * wtf/OSRandomSource.cpp: * wtf/OSRandomSource.h: * wtf/Platform.h: * wtf/RandomNumber.cpp: * wtf/RandomNumber.h: * wtf/RandomNumberSeed.h: * wtf/RedBlackTree.h: * wtf/RunLoopTimer.h: * wtf/RunLoopTimerCF.cpp: * wtf/SchedulePair.h: * wtf/SchedulePairCF.cpp: * wtf/SchedulePairMac.mm: * wtf/SegmentedVector.h: * wtf/StackBounds.h: * wtf/StaticConstructors.h: * wtf/StringExtras.h: * wtf/ThreadFunctionInvocation.h: * wtf/ThreadSafeRefCounted.h: * wtf/ThreadSpecific.h: * wtf/Threading.h: * wtf/ThreadingPrimitives.h: * wtf/ThreadingPthreads.cpp: * wtf/ThreadingWin.cpp: * wtf/WTFThreadData.cpp: * wtf/WTFThreadData.h: * wtf/efl/OwnPtrEfl.cpp: * wtf/mac/MainThreadMac.mm: * wtf/text/AtomicStringHash.h: * wtf/text/AtomicStringImpl.h: * wtf/text/Base64.h: * wtf/text/CString.cpp: * wtf/text/CString.h: * wtf/text/LChar.h: * wtf/text/cf/StringCF.cpp: * wtf/text/mac/StringMac.mm: * wtf/unicode/CharacterNames.h: * wtf/unicode/Collator.h: * wtf/unicode/CollatorDefault.cpp: * wtf/unicode/UTF8.cpp: * wtf/unicode/UTF8.h: * wtf/unicode/icu/CollatorICU.cpp: * wtf/win/MainThreadWin.cpp: 2014-03-14 Byungseon Shin Incorrect Date returned between March 1, 2034 and February 28, 2100. https://bugs.webkit.org/show_bug.cgi?id=130123 Reviewed by Mark Lam. Fix logic by using predefined Date APIs. * wtf/DateMath.cpp: (WTF::ymdhmsToSeconds): 2014-03-12 Sergio Villar Senin Rename DEFINE_STATIC_LOCAL to DEPRECATED_DEFINE_STATIC_LOCAL https://bugs.webkit.org/show_bug.cgi?id=129612 Reviewed by Darin Adler. For new code use static NeverDestroyed instead. * wtf/RunLoop.cpp: (WTF::RunLoop::current): * wtf/StdLibExtras.h: * wtf/ThreadingPthreads.cpp: (WTF::threadMapMutex): (WTF::threadMap): * wtf/efl/MainThreadEfl.cpp: (WTF::pipeObject): * wtf/text/StringStatics.cpp: (WTF::StringImpl::empty): 2014-03-13 Radu Stavila Webkit not building on XCode 5.1 due to garbage collection no longer being supported https://bugs.webkit.org/show_bug.cgi?id=130087 Reviewed by Mark Rowe. Disable garbage collection on macosx when not using internal SDK. * Configurations/Base.xcconfig: 2014-03-12 Ryuan Choi [EFL] Enable Parallel GC https://bugs.webkit.org/show_bug.cgi?id=130177 Reviewed by Geoffrey Garen. * wtf/Platform.h: Turn on ENABLE_PARALLEL_GC for the EFL build. 2014-03-12 Joseph Pecoraro Web Inspector: Disable REMOTE_INSPECTOR in earlier OS X releases https://bugs.webkit.org/show_bug.cgi?id=130118 Reviewed by Timothy Hatcher. * wtf/FeatureDefines.h: 2014-03-11 Brent Fulgham [Win] Unreviewed gardening. * wtf/MathExtras.h: VS2013 provides an lrint implementation. No need to implement our own. 2014-03-10 Jer Noble Improve WeakPtr operators. https://bugs.webkit.org/show_bug.cgi?id=130053 Reviewed by Andreas Kling. Replace the "operator!()" with an explicit bool operator. Add an "operator->()". * wtf/WeakPtr.h: (WTF::WeakPtr::operator bool): (WTF::WeakPtr::operator->): 2014-03-10 Brent Fulgham [Win] Pass environment to Pre-Build, Pre-Link, and Post-Build Stages. https://bugs.webkit.org/show_bug.cgi?id=130023. Reviewed by Dean Jackson. * WTF.vcxproj/WTF.proj: Avoid putting trailing slashes in system paths to avoid escaping during later string substitution. * WTF.vcxproj/build-generated-files.sh: Accept environment values passed by VS. 2014-03-10 Mark Hahnenberg Turn on GenGC on other 64-bit platforms https://bugs.webkit.org/show_bug.cgi?id=129258 Reviewed by Oliver Hunt. * wtf/Platform.h: 2014-03-07 peavo@outlook.com [Win64] Compile error after r165128. https://bugs.webkit.org/show_bug.cgi?id=129807 Reviewed by Mark Lam. * wtf/Platform.h: MSVC does not support computed goto. Also enabled COMPUTED_GOTO_OPCODES when !ENABLE(LLINT_C_LOOP). This is needed because the ASM LLINT operates like COMPUTED_GOTO_OPCODES, and relies on the related data structures being defined to support this. On Win32, the platform does not HAVE_COMPUTED_GOTO support, but does want ENABLE_COMPUTED_GOTO_OPCODES because it uses the ASM LLINT. 2014-03-06 Michael Saboff JSC should disable the JIT when building for ARMv7k https://bugs.webkit.org/show_bug.cgi?id=129829 Reviewed by Oliver Hunt. Added WTF_CPU_APPLE_ARMV7K CPU define. Disabled the JITs when that feature define is set. * wtf/Platform.h: 2014-03-06 Filip Pizlo Use the LLVM disassembler on ARM64 if we are enabling the FTL https://bugs.webkit.org/show_bug.cgi?id=129785 Reviewed by Geoffrey Garen. * wtf/Platform.h: 2014-03-05 peavo@outlook.com [Win32][LLINT] Crash when running JSC stress tests. https://bugs.webkit.org/show_bug.cgi?id=129429 Reviewed by Geoffrey Garen. * wtf/Platform.h: Enable LLINT on Win32. 2014-03-04 Zan Dobersek [GTK] Build the Udis86 disassembler https://bugs.webkit.org/show_bug.cgi?id=129679 Reviewed by Michael Saboff. * wtf/Platform.h: Also enable the Udis86 disassembler for the GTK port on Linux. 2014-03-02 Jaehun Lim [EFL] Remove m_initEfl from RunLoop. https://bugs.webkit.org/show_bug.cgi?id=129568 Reviewed by Gyuyoung Kim. We don't use m_initEfl except RunLoop constructor. * wtf/RunLoop.h: * wtf/efl/RunLoopEfl.cpp: (WTF::RunLoop::RunLoop): 2014-03-02 Darin Adler Cut down use of OwnPtr within WTF itself https://bugs.webkit.org/show_bug.cgi?id=129567 Reviewed by Sam Weinig. * wtf/RefCounted.h: Removed OwnPtr includes. * wtf/StreamBuffer.h: Removed OwnPtr includes and switched to use std::make_unique and std::unique_ptr instead. * wtf/Threading.cpp: Removed OwnPtr includes. * wtf/ThreadingPthreads.cpp: Ditto. * wtf/Vector.h: Ditto. 2014-02-26 Gavin Barraclough FastMalloc should use vm_page_shift intead of PAGE_SHIFT. https://bugs.webkit.org/show_bug.cgi?id=129370 Reviewed by Mark Rowe. "Doesn't this lead to the page map using fewer bits than it was before? It seems like this will cause some page addresses to no longer be representable in the map when using 4K pages. Am I missing something?" * wtf/FastMalloc.cpp: - bdash raises a valid point. This should make the TCMalloc_PageMap larger than absolutely necessary, rather than potentially too small. 2014-02-25 Gavin Barraclough FastMalloc should use vm_page_shift intead of PAGE_SHIFT. https://bugs.webkit.org/show_bug.cgi?id=129370 Reviewed by Geoff Garen. Previously we used PAGE_SHIFT to initialize kPageShift. Since this was a constant, it could be used to calculate other contants used in the code. Some of these values are used in the definition of certain data structures (specifiying the length of some array members). Make kPageShift & dependent properties variables setup during initialization. Add upper bound values (K_PAGE_SHIFT_MAX, K_NUM_CLASSES_MAX) for use in cases where we need a constant. * wtf/FastMalloc.cpp: (WTF::InitSizeClasses): - initialize kPageShift, kNumClasses, kPageSize, kMaxValidPages. (WTF::pages): - added ASSERT. (WTF::AllocationSize): - added ASSERT. (WTF::TCMalloc_PageHeap::FreeBytes): - added ASSERT. (WTF::TCMalloc_PageHeap::init): - COMPILE_ASSERT -> ASSERT (WTF::TCMalloc_PageHeap::scavenge): - added ASSERT. (WTF::TCMalloc_PageHeap::Carve): - added ASSERT. (WTF::mergeDecommittedStates): - added ASSERT. (WTF::TCMalloc_PageHeap::IncrementalScavenge): - added ASSERT. (WTF::TCMalloc_PageHeap::ReturnedBytes): - added ASSERT. (WTF::PagesToMB): - added ASSERT. (WTF::TCMalloc_PageHeap::GrowHeap): - added ASSERT. (WTF::TCMalloc_PageHeap::ReleaseFreeList): - kNumClasses -> K_NUM_CLASSES_MAX (WTF::TCMalloc_ThreadCache::enumerateFreeObjects): - added ASSERT. (WTF::TCMalloc_Central_FreeList::Init): - added ASSERT. (WTF::TCMalloc_Central_FreeList::ReleaseToSpans): - added ASSERT. (WTF::TCMalloc_Central_FreeList::EvictRandomSizeClass): - added ASSERT. (WTF::TCMalloc_Central_FreeList::MakeCacheSpace): - added ASSERT. (WTF::TCMalloc_Central_FreeList::InsertRange): - added ASSERT. (WTF::TCMalloc_Central_FreeList::Populate): - added ASSERT. (WTF::TCMalloc_ThreadCache::Init): - added ASSERT. (WTF::TCMalloc_ThreadCache::Cleanup): - added ASSERT. (WTF::TCMalloc_ThreadCache::Scavenge): - added ASSERT. (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): - added ASSERT. 2014-02-24 Alex Christensen Disabled WebGL on WinCairo. Unreviewed. * wtf/FeatureDefines.h: Removed ENABLE_WEBGL definition for WinCairo port. WebGL has not worked on WinCairo since r163079 and it was not compiling with a recent ANGLE update. 2014-02-24 Mark Hahnenberg Turn GenGC on for 32-bit systems https://bugs.webkit.org/show_bug.cgi?id=128824 Reviewed by Geoffrey Garen. * wtf/Platform.h: 2014-02-21 Benjamin Poulain jsDocumentPrototypeFunctionGetElementById should not create an AtomicString for the function argument https://bugs.webkit.org/show_bug.cgi?id=128893 Reviewed by Darin Adler. AtomicString::find() is a special case optimized for the JavaScript bindings. The method can only be called under specific conditions. The method is renamed to findStringWithHash(). The new AtomicString::find is generic and does not require any propery on the input. * wtf/text/AtomicString.cpp: (WTF::AtomicString::findStringWithHash): (WTF::AtomicString::findSlowCase): * wtf/text/AtomicString.h: (WTF::AtomicString::find): 2014-02-20 Csaba Osztrogonác Add StackStats sources to cmake and autotools build files https://bugs.webkit.org/show_bug.cgi?id=129103 Reviewed by Anders Carlsson. * GNUmakefile.list.am: * wtf/CMakeLists.txt: 2014-02-20 Csaba Osztrogonác Get rid of redundant Platform.h includes https://bugs.webkit.org/show_bug.cgi?id=128817 Reviewed by Brent Fulgham. * wtf/Assertions.h: * wtf/Atomics.h: * wtf/ByteOrder.h: * wtf/DataLog.h: * wtf/DisallowCType.h: * wtf/DynamicAnnotations.h: * wtf/ExportMacros.h: * wtf/FastMalloc.h: * wtf/FlipBytes.h: * wtf/InlineASM.h: * wtf/PrintStream.h: * wtf/ProcessID.h: * wtf/Threading.h: * wtf/ThreadingPrimitives.h: 2014-02-19 Jon Honeycutt Crash in WTF::StringBuilder::append() https://bugs.webkit.org/show_bug.cgi?id=125817 Reviewed by Oliver Hunt. * wtf/text/StringBuilder.cpp: (WTF::expandedCapacity): Ensure that we return a new capacity of at least 'requiredLength' in the case where requiredLength is large. Also, use unsigned rather than size_t for the parameters and the return value, as callers pass unsigned arguments and treat the result as an unsigned int. 2014-02-19 Anders Carlsson Add WTF_MAKE_FAST_ALLOCATED to more classes https://bugs.webkit.org/show_bug.cgi?id=129064 Reviewed by Andreas Kling. * wtf/Bitmap.h: 2014-02-19 Zan Dobersek Make PrintStream::print() a variadic template https://bugs.webkit.org/show_bug.cgi?id=126388 Reviewed by Brent Fulgham. PrintStream::print() can be converted into a variadic template, printing the value of the first parameter and recursively calling itself until the single parameter version is used for printing the last value. * wtf/DataLog.h: (WTF::dataLog): Convert the function to a variadic template as well. * wtf/PrintStream.h: (WTF::PrintStream::print): * wtf/StringPrintStream.h: (WTF::toCString): Ditto. (WTF::toString): Ditto. 2014-02-19 Zan Dobersek Use std::swap() in HashTable::swap() https://bugs.webkit.org/show_bug.cgi?id=128995 Reviewed by Brent Fulgham. Use std::swap() to swap the member variable values of two HashTable objects in HashTable::swap(). * wtf/HashTable.h: (WTF::KeyTraits>::swap): 2014-02-19 Zan Dobersek SegmentedVector::append() should take in rvalue reference, forward it to Vector::uncheckedAppend() https://bugs.webkit.org/show_bug.cgi?id=128996 Reviewed by Brent Fulgham. * wtf/SegmentedVector.h: (WTF::SegmentedVector::append): Take in an rvalue reference of the object that's to be appended and then forward it to Vector::uncheckedAppend(). This avoids unnecessary copies in the current situation where a const lvalue is accepted and passed on. 2014-02-19 Dan Bernstein Simplify PLATFORM(MAC) && !PLATFORM(IOS) and similar expressions https://bugs.webkit.org/show_bug.cgi?id=129029 Reviewed by Mark Rowe. * wtf/FeatureDefines.h: * wtf/Platform.h: * wtf/Threading.cpp: * wtf/text/cf/StringImplCF.cpp: (garbageCollectionEnabled): 2014-02-18 Dan Bernstein PLATFORM(MAC) is true when building for iOS https://bugs.webkit.org/show_bug.cgi?id=129025 Reviewed by Mark Rowe. * wtf/Platform.h: Changed to define WTF_PLATFORM_MAC only on when building for OS X (but still not when WTF_PLATFORM_GTK or WTF_PLATFORM_EFL are defined). 2014-02-18 Joseph Pecoraro [iOS] Web Inspector: JSContext inspection crashes in isMainThread, uninitialized WebCoreWebThreadIsLockedOrDisabled https://bugs.webkit.org/show_bug.cgi?id=128959 Reviewed by David Kilzer. When JavaScriptCore is used without WebCore on iOS (e.g. JSContext) the WebCoreWebThread* functions will not be initialized. Avoid calling the function pointer if it is uninitialized. This was happening with remote inspection via StringImpl::createCFString for implicit NSString / WTFString conversion which uses isMainThread. * wtf/mac/MainThreadMac.mm: (WTF::webThreadIsUninitializedOrLockedOrDisabled): (WTF::isMainThread): (WTF::canAccessThreadLocalDataForThread): 2014-02-17 Filip Pizlo More ARM FTL glue https://bugs.webkit.org/show_bug.cgi?id=128948 Reviewed by Sam Weinig. * wtf/Platform.h: 2014-02-17 Anders Carlsson Remove ENABLE_GLOBAL_FASTMALLOC_NEW https://bugs.webkit.org/show_bug.cgi?id=127067 Reviewed by Geoffrey Garen. Remove the global operator new/operator delete overrides. Having ALWAYS_INLINE operators like we do is really undefined behavior according to the C++ standard and we've been lucky enough to get away with it so far, but any code that calls operator new/operator delete inside from the C++ standard library (not from headers that are included) will be mismatched and potentially crash. libc++ calls delete in it's std::thread implementation for example. The only supported way to override operator new and operator delete globally is to not use inline functions, but that would mean that any application using WebKit would not be able to provide custom operator new/operator delete functions so we'll just reuse the already existing infrastructure consisting of the WTF_MAKE_FAST_ALLOCATED macro. * wtf/FastMalloc.cpp: (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): * wtf/FastMalloc.h: * wtf/Platform.h: 2014-02-17 Ryan Lortie Enable DFG_JIT on FreeBSD https://bugs.webkit.org/show_bug.cgi?id=128898 Reviewed by Csaba Osztrogonác. * wtf/Platform.h: 2014-02-15 Filip Pizlo FTL should inline polymorphic heap accesses https://bugs.webkit.org/show_bug.cgi?id=128795 Reviewed by Oliver Hunt. * wtf/PrintStream.h: (WTF::PointerDumpInContext::PointerDumpInContext): (WTF::PointerDumpInContext::dump): (WTF::pointerDumpInContext): 2014-02-16 Zan Dobersek Reintroduce const qualifiers for return types of (Filter|Transform)Iterator::operator*() https://bugs.webkit.org/show_bug.cgi?id=126875 The const qualifiers for the return types of FilterIterator::operator*() and TransformIterator::operator*() were removed in r161797 and r161802 because of compilation failures when using GCC and having an Iterator type that already had the const qualifier. std::remove_const is now used to appease GCC and enforce the const qualifier on the return type, regardless of the Iterator type and its qualifiers. * wtf/IteratorAdaptors.h: (WTF::FilterIterator::operator*): (WTF::TransformIterator::operator*): 2014-02-15 Filip Pizlo Vector with inline capacity should work with non-PODs https://bugs.webkit.org/show_bug.cgi?id=128864 Reviewed by Michael Saboff. Previously, we would copy the inline storage of a vector as if it was a bag of bits. This presumed that the element type was relocatable. In general this is only true for PODs. This patch changes this by introducing a swap operation over inline storage. This swap operation requires being told about the size that is in use. Deques would have required some cleverness to make this work, because the swap operation needs to know which subset of elements are in-use and assumes that a size is sufficient for this. That's not true for deques. Instead of trying to do very clever things, I just removed the inline capacity option from Deque. I believe that this is fine since there are only two users of Deque with inline capacity, and both of them appear to be allocated rarely enough that inline capacity probably doesn't help much. * wtf/Deque.h: (WTF::DequeIterator::DequeIterator): (WTF::DequeConstIterator::DequeConstIterator): (WTF::Deque::checkValidity): (WTF::Deque::checkIndexValidity): (WTF::Deque::invalidateIterators): (WTF::Deque::Deque): (WTF::=): (WTF::Deque::destroyAll): (WTF::Deque::~Deque): (WTF::Deque::swap): (WTF::Deque::clear): (WTF::Deque::expandCapacityIfNeeded): (WTF::Deque::expandCapacity): (WTF::Deque::append): (WTF::Deque::prepend): (WTF::Deque::removeFirst): (WTF::Deque::removeLast): (WTF::Deque::remove): (WTF::DequeIteratorBase::checkValidity): (WTF::DequeIteratorBase::addToIteratorsList): (WTF::DequeIteratorBase::removeFromIteratorsList): (WTF::DequeIteratorBase::DequeIteratorBase): (WTF::DequeIteratorBase::~DequeIteratorBase): (WTF::DequeIteratorBase::isEqual): (WTF::DequeIteratorBase::increment): (WTF::DequeIteratorBase::decrement): (WTF::DequeIteratorBase::after): (WTF::DequeIteratorBase::before): * wtf/Vector.h: (WTF::VectorBuffer::swap): (WTF::VectorBuffer::swapInlineBuffer): (WTF::VectorBuffer::swapInlineBuffers): (WTF::Vector::swap): 2014-02-15 Mikhail Pozdnyakov Remove 'static' specifier from free inline functions in StringImpl.h https://bugs.webkit.org/show_bug.cgi?id=118554 Reviewed by Darin Adler. At first 'static' does not bring any use here, secondly static free inline functions in headers is a bad practice in general as each instance of function defined as inline is treated as a separate function and each instance has its own copy of static locals and string literals. * wtf/text/StringImpl.h: (WTF::codePointCompare): (WTF::codePointCompare8): (WTF::codePointCompare16): (WTF::codePointCompare8To16): (WTF::isSpaceOrNewline): 2014-02-14 Benjamin Poulain Improve the performance on mobile of FTPDirectoryDocument https://bugs.webkit.org/show_bug.cgi?id=128778 Reviewed by Antti Koivisto. * wtf/text/WTFString.h: (WTF::String::endsWith): add a missing overload. 2014-02-14 Wojciech Bielawski (try)append and insert operations don't need new operator for PODs https://bugs.webkit.org/show_bug.cgi?id=128185 Reviewed by Darin Adler. Vector's methods use VectorCopier to copy data. VectorCopier for PODs exteded to be used with different types. For different types placement new copy approach is applied. For the same types memcpy is applied. * wtf/Vector.h: (WTF::OverflowHandler>::append): use VectorCopier to copy data. (WTF::OverflowHandler>::tryAppend): use VectorCopier to copy data. (WTF::OverflowHandler>::insert): use VectorCopier to copy data. 2014-02-13 Daniel Bates Fix the iOS build after [iOS] Disable HAVE_ARM_NEON_INTRINSICS For now, disable HAVE_ARM_NEON_INTRINSICS when building for iOS. We want to audit the applicable code before we enable this define. * wtf/Platform.h: 2014-02-11 Filip Pizlo Hoist and combine array bounds checks https://bugs.webkit.org/show_bug.cgi?id=125433 Reviewed by Mark Hahnenberg. * GNUmakefile.list.am: * WTF.vcxproj/WTF.vcxproj: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/HashMethod.h: Added. (WTF::HashMethod::operator()): 2014-02-13 Tamas Gergely Code cleanup: remove gcc<4.7 guards. https://bugs.webkit.org/show_bug.cgi?id=128729 Reviewed by Anders Carlsson. Remove GCC_VERSION_AT_LEAST guards when it checks for pre-4.7 versions, as WK does not compile with earlier gcc versions. * wtf/Assertions.cpp: * wtf/Platform.h: 2014-02-12 Mark Lam No need to save reservedZoneSize when dropping the JSLock. Reviewed by Geoffrey Garen. * wtf/WTFThreadData.cpp: (WTF::WTFThreadData::WTFThreadData): * wtf/WTFThreadData.h: - removed unnneeded m_savedReservedZoneSize. 2014-02-11 Mark Hahnenberg 32-bit LLInt writeBarrierOnGlobalObject is wrong https://bugs.webkit.org/show_bug.cgi?id=128556 Reviewed by Geoffrey Garen. * wtf/Platform.h: Removed OBJECT_MARK_LOGGING from Platform.h since it already exists in FeatureDefines.h 2014-02-11 peavo@outlook.com [WinCairo] Compile error, deleted file in WTF. https://bugs.webkit.org/show_bug.cgi?id=128601 Reviewed by Csaba Osztrogonác. * WTF.vcxproj/WTF.vcxproj: Removed reference to deleted file. * WTF.vcxproj/WTF.vcxproj.filters: Ditto. 2014-02-10 Michael Saboff Re-enable ARM Thumb2 disassembler https://bugs.webkit.org/show_bug.cgi?id=128577 Reviewed by Filip Pizlo. Added definition of WTF_USE_ARMV7_DISASSEMBLER back to Platform.h * wtf/Platform.h: 2014-02-10 Benjamin Poulain Add the basic infrastructure to compile attributes matching in selectors https://bugs.webkit.org/show_bug.cgi?id=128484 Reviewed by Gavin Barraclough. * wtf/Vector.h: (WTF::VectorBufferBase::bufferMemoryOffset): (WTF::Vector::sizeMemoryOffset): (WTF::Vector::dataMemoryOffset): Expose the memory offsets of Vector::size() and the memory buffer pointer for the JIT. 2014-02-10 Enrica Casucci copyShortASCIIString crashes on iOS after r163793. https://bugs.webkit.org/show_bug.cgi?id=128548. Reviewed by Alexey Proskuryakov. Adding null check. * wtf/unicode/icu/CollatorICU.cpp: (WTF::copyShortASCIIString): 2014-02-10 Carlos Garcia Campos [GLIB] Add GUniqueOutPtr and use it instead of GOwnPtr https://bugs.webkit.org/show_bug.cgi?id=127554 Reviewed by Gustavo Noronha Silva. GUniqueOutPtr is a simplified version of GOwnPtr for the cases where we need the address of the contained pointer. GUniqueOutPtr uses GUniquePtr to free the contained object and to release the container pointer. The API is very simple to make sure this is only used when outPtr() is needed. It can't be constructed with a pointer, and there's not method to set a new pointer. Another difference with the old GOwnPtr is that outPtr() can be used multiple times, because it frees any pointer previously set. * GNUmakefile.list.am: * wtf/PlatformEfl.cmake: * wtf/PlatformGTK.cmake: * wtf/gobject/GOwnPtr.cpp: Removed. * wtf/gobject/GOwnPtr.h: Removed. * wtf/gobject/GUniquePtr.h: (WTF::GUniqueOutPtr::GUniqueOutPtr): (WTF::GUniqueOutPtr::~GUniqueOutPtr): (WTF::GUniqueOutPtr::outPtr): (WTF::GUniqueOutPtr::reset): (WTF::GUniqueOutPtr::release): (WTF::GUniqueOutPtr::operator*): (WTF::GUniqueOutPtr::operator->): (WTF::GUniqueOutPtr::get): (WTF::GUniqueOutPtr::operator!): (WTF::GUniqueOutPtr::operator UnspecifiedBoolType): 2014-02-10 Darin Adler Stop using String::deprecatedCharacters to call WTF::Collator https://bugs.webkit.org/show_bug.cgi?id=128517 WTF passes ICU’s deprecated ULOC_REQUESTED_LOCALE to ucol_getLocaleByType() rdar://problem/15183390 Reviewed by Alexey Proskuryakov. This patch fixes both bugs above by reworking WTF::Collator. * wtf/unicode/Collator.h: Fixed formatting. Got rid of the Collator::Result type, since the collator uses the same return value scheme as strcmp and as ICU; an int will do for the return type. Simplified the support for UCONFIG_NO_COLLATION by using a separate copy of the class definition. (We should check if anyone needs UCONFIG_NO_COLLATION support, and remove it if not.) Changed the lower-first flag from a separate function to a constructor argument. Changed the arguments to the collate function to StringView. Added a collate UTF8 function. Changed the m_collate data member to no longer be mutable since we no longer allocate it lazily. * wtf/unicode/CollatorDefault.cpp: (WTF::Collator::collate): Rewrote to be simpler. (WTF::Collator::collateUTF8): Added. Converts from UTF-8 to a String and then calls the collate function above. * wtf/unicode/icu/CollatorICU.cpp: Added a FIXME about the fact that this file has the wrong name and location. Since we always use ICU, there's no need to mention it in the file name. (WTF::copyASCIIString): Added. (WTF::copyDefaultLocale): Added. (WTF::resolveDefaultLocale): Added. Maps null locale to a default on Mac and iOS, since on those platforms ICU does not use the correct default locale when passed null. (WTF::localesMatch): Added. (WTF::Collator::Collator): Moved most of the code from createCollator here. Simplified it by storing the collator configuration along with the collator in globals. (WTF::Collator::~Collator): Moved most of the code from releaseCollator here. (WTF::getIndexLatin1): Added. (WTF::moveLatin1): Added. (WTF::hasNextLatin1): Added. (WTF::hasPreviousLatin1): Added. (WTF::currentLatin1): Added. (WTF::nextLatin1): Added. (WTF::previousLatin1): Added. (WTF::getStateLatin1): Added. (WTF::setStateLatin1): Added. (WTF::createLatin1Iterator): Added. Uses the functions above to make a UCharIterator that works for a WTF::StringView-style Latin-1 string. (WTF::createIterator): Added. Uses either createLatin1Iterator or uiter_setString to make a UCharIterator that works for a WTF::StringView. (WTF::Collator::collate): Changed to use ucol_strcollIter. (WTF::createIteratorUTF8): Added. Uses uiter_setUTF8. (WTF::Collator::collateUTF8): Added. Like collate, but for null-terminated UTF-8 strings. 2014-02-10 Tamas Gergely Code cleanup: Remove BUILDING_ON / TARGETING definitions. https://bugs.webkit.org/show_bug.cgi?id=128242 Reviewed by Brent Fulgham. The BUILDING_ON_* and TARGETING_* macros have not been used for a while. According to the FIXME: they are removed. * wtf/Platform.h: 2014-02-09 Anders Carlsson Add WTF_MAKE_FAST_ALLOCATED to more classes https://bugs.webkit.org/show_bug.cgi?id=128506 Reviewed by Andreas Kling. * wtf/Bag.h: * wtf/ListHashSet.h: 2014-02-08 Anders Carlsson Stop using getCharactersWithUpconvert in JavaScriptCore https://bugs.webkit.org/show_bug.cgi?id=128457 Reviewed by Andreas Kling. * wtf/text/StringBuilder.h: (WTF::StringBuilder::append): Add a new overload that takes a StringView. * wtf/text/StringView.h: (WTF::StringView::find): Add new find member function. 2014-02-08 Darin Adler Change TextIterator to use StringView, preparing to wean it from deprecatedCharacters https://bugs.webkit.org/show_bug.cgi?id=128233 Reviewed by Anders Carlsson. * WTF.xcodeproj/project.pbxproj: Added new source files. * wtf/text/StringView.h: Added operator[], createCFStringWithoutCopying, and createNSStringWithoutCopying. * wtf/text/cf/StringViewCF.cpp: (WTF::StringView::createCFStringWithoutCopying): Added. * wtf/text/mac/StringViewObjC.mm: (WTF::StringView::createNSString): Added. (WTF::StringView::createNSStringWithoutCopying): Added. 2014-02-06 Andreas Kling Remove unused ENABLE(REPAINT_THROTTLING) flag. Reviewed by Antti Koivisto. * wtf/FeatureDefines.h: 2014-02-06 Filip Pizlo More FTL build scaffolding https://bugs.webkit.org/show_bug.cgi?id=128330 Reviewed by Geoffrey Garen. * wtf/Platform.h: 2014-02-06 Anders Carlsson Use std::chrono functions in dispatchFunctionsFromMainThread() https://bugs.webkit.org/show_bug.cgi?id=128308 Reviewed by Antti Koivisto. * wtf/MainThread.cpp: (WTF::dispatchFunctionsFromMainThread): 2014-02-05 Zan Dobersek Remove the WTF_COMPILER_SUPPORTS_CXX_GENERALIZED_INITIALIZERS macro https://bugs.webkit.org/show_bug.cgi?id=128267 Reviewed by Andreas Kling. Remove the WTF_COMPILER_SUPPORTS_CXX_GENERALIZED_INITIALIZERS macro that was manually defined for compilers that support the C++11 initializer lists. The feature is well supported in Clang, MSVC and also GCC. It was actually already used unguarded in HashSet. * wtf/Compiler.h: * wtf/HashMap.h: (WTF::HashMap::HashMap): * wtf/Vector.h: (WTF::Vector::Vector): 2014-02-05 Andreas Kling Remove ENABLE(DIRECTORY_UPLOAD). Rubber-stamped by Ryosuke Niwa. * wtf/FeatureDefines.h: 2014-02-05 Carlos Garcia Campos HashMap can't be used with std::unique_ptr as value when it has a custom deleter https://bugs.webkit.org/show_bug.cgi?id=128250 Reviewed by Darin Adler. The problem is that the HashMap is using a unique_ptr with the default deleter, so that when trying to move the unique_ptr the deleters don't match. * wtf/HashTraits.h: Add the deleter also in the template definitation of the parent class for the HashTraits> 2014-02-05 Csaba Osztrogonác Remove ENABLE(SVG) guards https://bugs.webkit.org/show_bug.cgi?id=127991 Reviewed by Sam Weinig. * wtf/FeatureDefines.h: 2014-02-04 Mark Lam The stack limit computation does not work for Windows. Reviewed by Geoffrey Garen. The current stack limit computation assumes that the stack is allocated in high memory. On Windows, the stack seems to be allocated very near address 0, and is smaller in size than our Options::maxPerThreadStackUsage(). This combination triggers a bug where StackBounds::recursionLimit() underflows and computes a limit address that is ridiculously high in memory. The net effect is that the Windows port thinks its out of stack space all the time. We now check for potential underflows in StackBounds and return an appropriate limit address. * wtf/StackBounds.h: (WTF::StackBounds::recursionLimit): 2014-02-04 Andreas Kling Remove