1 2016-09-23 Filip Pizlo <fpizlo@apple.com>
3 Need a store-load fence between setting cell state and visiting the object in SlotVisitor
4 https://bugs.webkit.org/show_bug.cgi?id=162354
13 2016-09-23 Caitlin Potter <caitp@igalia.com>
15 [JSC] Implement parsing of Async Functions
16 https://bugs.webkit.org/show_bug.cgi?id=161409
18 Reviewed by Yusuke Suzuki.
20 * wtf/FeatureDefines.h:
22 2016-09-23 Commit Queue <commit-queue@webkit.org>
24 Unreviewed, rolling out r206314, r206316, and r206319.
25 https://bugs.webkit.org/show_bug.cgi?id=162506
27 These changes broke various builds (Requested by ryanhaddad on
32 "Need a store-load fence between setting cell state and
33 visiting the object in SlotVisitor"
34 https://bugs.webkit.org/show_bug.cgi?id=162354
35 http://trac.webkit.org/changeset/206314
37 "Unreviewed, fix cloop."
38 http://trac.webkit.org/changeset/206316
40 "Unreviewed, fix all other builds."
41 http://trac.webkit.org/changeset/206319
43 2016-09-23 Carlos Garcia Campos <cgarcia@igalia.com>
45 REGRESSION(r194387): Crash on github.com in IntlDateTimeFormat::resolvedOptions in C locale
46 https://bugs.webkit.org/show_bug.cgi?id=162139
48 Reviewed by Michael Catanzaro.
50 Handle the case of "C" or "POSIX" locale and use "en-US" as default. That matches what ICU and other ports do,
51 as well as what layout tests expect (some tests like js/intl-collator.html pass in the bots only because we use
52 en-US as system locale in those bots).
54 * wtf/PlatformUserPreferredLanguagesUnix.cpp:
55 (WTF::platformLanguage):
57 2016-09-22 Filip Pizlo <fpizlo@apple.com>
59 Need a store-load fence between setting cell state and visiting the object in SlotVisitor
60 https://bugs.webkit.org/show_bug.cgi?id=162354
69 2016-09-22 Filip Pizlo <fpizlo@apple.com>
71 Fences on x86 should be a lot cheaper
72 https://bugs.webkit.org/show_bug.cgi?id=162417
74 Reviewed by Mark Lam and Geoffrey Garen.
80 does everything that we wanted from:
84 And it's a lot faster. When I tried mfence for making object visiting concurrent-GC-TSO-
85 friendly, it was a 9% regression on Octane/splay. But when I tried ortop, it was neutral.
86 So, we should use ortop from now on.
88 This part of the change just affects our Atomics. I also changed this in the JITs.
92 (WTF::storeLoadFence):
93 (WTF::x86_mfence): Deleted.
95 2016-09-21 Alexey Proskuryakov <ap@apple.com>
97 Rolling out r206244, as it caused flaky crashes on tests.
98 Was: Correct uses of 'safeCast'
100 * wtf/StdLibExtras.h:
103 2016-09-21 Keith Miller <keith_miller@apple.com>
105 Fix build for future versions of Clang.
106 https://bugs.webkit.org/show_bug.cgi?id=162346
108 Reviewed by Filip Pizlo.
110 This fixes issues with the WebCore build where inline
111 template-class function definitions are marked as exported. This
112 genereates a weak external symobl that our build does not like.
114 * wtf/text/StringImpl.h:
116 2016-09-20 Brent Fulgham <bfulgham@apple.com>
118 Correct uses of 'safeCast'
119 https://bugs.webkit.org/show_bug.cgi?id=162301
120 <rdar://problem/28343658>
122 Reviewed by Antti Koivisto.
124 * wtf/StdLibExtras.h:
125 (WTF::safeCast): RELEASE_ASSERT on overflow.
127 2016-09-21 Commit Queue <commit-queue@webkit.org>
129 Unreviewed, rolling out r206222 and r206227.
130 https://bugs.webkit.org/show_bug.cgi?id=162361
132 "broke the windows build" (Requested by keith_mi_ on #webkit).
136 "Fix build for future versions of Clang."
137 https://bugs.webkit.org/show_bug.cgi?id=162346
138 http://trac.webkit.org/changeset/206222
140 "Attempt to fix windows build after r206222."
141 http://trac.webkit.org/changeset/206227
143 2016-09-21 Keith Miller <keith_miller@apple.com>
145 Fix build for future versions of Clang.
146 https://bugs.webkit.org/show_bug.cgi?id=162346
148 Reviewed by Filip Pizlo.
150 This fixes issues with the WebCore build where inline
151 template-class function definitions are marked as exported. This
152 genereates a weak external symobl that our build does not like.
154 * wtf/text/StringImpl.h:
156 2016-09-20 Alex Christensen <achristensen@webkit.org>
158 Require WTFMove for String::adopt
159 https://bugs.webkit.org/show_bug.cgi?id=162313
161 Reviewed by Yusuke Suzuki.
163 * wtf/text/StringImpl.cpp:
164 (WTF::StringImpl::removeCharacters):
165 (WTF::StringImpl::simplifyMatchedCharactersToSpace):
166 (WTF::StringImpl::adopt):
167 * wtf/text/StringImpl.h:
168 (WTF::StringImpl::adopt):
169 * wtf/text/WTFString.h:
170 (WTF::String::adopt):
172 2016-09-20 Filip Pizlo <fpizlo@apple.com>
174 Make MarkedBlock state tracking support overlapped allocation and marking state
175 https://bugs.webkit.org/show_bug.cgi?id=161581
177 Reviewed by Geoffrey Garen.
179 The main change here is to bring back FastBitVector.cpp, so that I could outline some
180 large slow path functions. This also adds some utilities, like atomicSetAndCheck() and
181 isEmpty(). The GC uses these.
183 * WTF.xcodeproj/project.pbxproj:
184 * wtf/CMakeLists.txt:
185 * wtf/FastBitVector.cpp: Added.
186 (WTF::FastBitVectorWordOwner::setEqualsSlow):
187 (WTF::FastBitVectorWordOwner::resizeSlow):
188 * wtf/FastBitVector.h:
189 (WTF::FastBitVectorWordOwner::operator=):
190 (WTF::FastBitVectorWordOwner::resize):
191 (WTF::FastBitVectorImpl::isEmpty):
192 (WTF::FastBitVector::atomicSetAndCheck):
193 (WTF::FastBitVector::operator[]): Deleted.
195 2016-09-20 Jonathan Bedard <jbedard@apple.com>
197 Undefined behavior: Left shift negative number
198 https://bugs.webkit.org/show_bug.cgi?id=161866
200 Reviewed by Keith Miller.
202 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.
204 * wtf/text/Base64.cpp:
205 (WTF::base64EncodeInternal): Changed signed character to unsigned when shifting.
206 (WTF::base64Encode): Ditto.
207 (WTF::base64URLEncode): Ditto.
208 (WTF::base64DecodeInternal): Ditto.
209 * wtf/text/Base64.h: Ditto.
210 (WTF::SignedOrUnsignedCharVectorAdapter): Rebuilt to stop using union as a bitwise_cast.
211 (WTF::ConstSignedOrUnsignedCharVectorAdapter): Ditto.
213 2016-09-19 Daniel Bates <dabates@apple.com>
215 Remove ENABLE(TEXT_AUTOSIZING) automatic text size adjustment code
216 https://bugs.webkit.org/show_bug.cgi?id=162167
218 Reviewed by Simon Fraser.
220 * wtf/FeatureDefines.h:
222 2016-09-14 Jer Noble <jer.noble@apple.com>
224 [media-source] fix imported/w3c/web-platform-tests/media-source/mediasource-duration.html
225 https://bugs.webkit.org/show_bug.cgi?id=161999
227 Reviewed by Eric Carlson.
229 The mediasource-duration.html test tries to set the duration of a MediaSource to a double value
230 (5.0), then some work happens and the duration is set to a media time (12533/2500, or 5.0132).
231 The test then tries to set that value as the duration, converted from a media time to a double,
232 and asserts that no duration change event is fired. But because the floating point value and the
233 media time value are ever so slightly different, this round-tripping fails.
235 Fix this bug in MediaTime by, when one side or the other of a comparison is a floating point
236 MediaTime, convert both sides to doubles and run the comparison against those values. This preserves
237 the transitive equality of doubles <-> MediaTimes.
240 (WTF::MediaTime::compare):
242 2016-09-16 Anders Carlsson <andersca@apple.com>
244 Fix isValidEnum to work with older versions of GCC
245 https://bugs.webkit.org/show_bug.cgi?id=162065
247 Reviewed by Michael Catanzaro.
249 Use the ternary operator instead of a more complex function body.
253 2016-09-15 JF Bastien <jfbastien@apple.com>
255 TextBreakIterator: unconvolute character break cache
256 https://bugs.webkit.org/show_bug.cgi?id=162001
258 Reviewed by Michael Saboff.
260 Simplify the one-element cache.
262 Added here (fixed a bit after): https://bugs.webkit.org/attachment.cgi?id=144118&action=prettypatch
263 Updated to never use a lock, and always use weak cmpxchg here: https://bugs.webkit.org/attachment.cgi?id=261719&action=prettypatch
265 It's just trying to reduce the number of times it calls into ICU
266 to initialize a UBRK_CHARACTER. The implementation keeps a
267 one-element cache of the latest used one, which threads can
268 optimistically grab. Failure is fine (just create a new one), same
269 for failure to cache (just destroy it), but the logic is odd and
270 you technically need release / acquire semantics because the
271 UBRK_CHARACTER creation's store need to be visible on acquisition
272 (but realistically it was created and then used and *then* cached,
273 so it's probably been long ago enough that read reorders never
276 Using exchange directly achieves this without the headache.
278 * wtf/text/TextBreakIterator.cpp:
279 (WTF::getNonSharedCharacterBreakIterator):
280 (WTF::cacheNonSharedCharacterBreakIterator):
281 (WTF::NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator):
282 (WTF::NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator):
283 (WTF::compareAndSwapNonSharedCharacterBreakIterator): Deleted.
285 2016-09-15 Keith Miller <keith_miller@apple.com>
287 Pragma out undefined-var-template warnings in JSC for JSObjects that are templatized
288 https://bugs.webkit.org/show_bug.cgi?id=161985
290 Reviewed by Alex Christensen.
292 Fix WTF_EXPORT_PRIVATE for an inline member function. This would
293 generate a weak export.
295 * wtf/MetaAllocator.h:
296 (WTF::MetaAllocator::getLock):
298 2016-09-14 Commit Queue <commit-queue@webkit.org>
300 Unreviewed, rolling out r205933 and r205936.
301 https://bugs.webkit.org/show_bug.cgi?id=162002
303 broke the build (Requested by keith_miller on #webkit).
307 "Pragma out undefined-var-template warnings in JSC for
308 JSObjects that are templatized"
309 https://bugs.webkit.org/show_bug.cgi?id=161985
310 http://trac.webkit.org/changeset/205933
312 "Unreviewed, fix the Windows build."
313 http://trac.webkit.org/changeset/205936
315 2016-09-14 Keith Miller <keith_miller@apple.com>
317 Pragma out undefined-var-template warnings in JSC for JSObjects that are templatized
318 https://bugs.webkit.org/show_bug.cgi?id=161985
320 Reviewed by Geoffrey Garen.
322 Fix WTF_EXPORT_PRIVATE for an inline member function. This would
323 generate a weak export.
325 * wtf/MetaAllocator.h:
326 (WTF::MetaAllocator::getLock):
328 2016-09-14 JF Bastien <jfbastien@apple.com>
330 Atomics on ARM don't require full-system fencing, and other minutiae
331 https://bugs.webkit.org/show_bug.cgi?id=161928
333 Reviewed by Geoffrey Garen.
335 Add cmpxchg versions with both success and failure memory
336 ordering. In some interesting cases we can craft code which needs
337 barriers which aren't as strong.
339 weakCompareAndSwap is super dubious, its 3 uses seem
340 questionable... but for now I'm just adding debug asserts.
342 Rename armv7_dmb* functions to arm_dmb* because they apply to v7
343 and v8 (or more precisely; to ARMv7's ARM and Thumb2, as well as
344 ARMv8's aarch32 A32/T32 and aarch64).
346 Use inner-shareability domain for ARM barriers instead of
347 full-system. This is what C++ uses.
349 The default case for barriers simply used a compiler barrier. This
350 is generally wrong, e.g. for MIPS.
353 (WTF::Atomic::compareExchangeWeak): offer two-order version
354 (WTF::Atomic::compareExchangeStrong): offer two-order version
355 (WTF::weakCompareAndSwap): a few assertions
356 (WTF::arm_dmb): rename since it applies to ARMv7 and v8; make it innser-shareable
357 (WTF::arm_dmb_st): rename since it applies to ARMv7 and v8; make it innser-shareable
358 (WTF::loadLoadFence): incorrect generally
359 (WTF::loadStoreFence): incorrect generally
360 (WTF::storeLoadFence): incorrect generally
361 (WTF::storeStoreFence): incorrect generally
362 (WTF::memoryBarrierAfterLock): incorrect generally
363 (WTF::memoryBarrierBeforeUnlock): incorrect generally
364 (WTF::armV7_dmb): Deleted.
365 (WTF::armV7_dmb_st): Deleted.
367 2016-09-14 JF Bastien <jfbastien@apple.com>
369 Alwasys inline atomic operations
370 https://bugs.webkit.org/show_bug.cgi?id=155371
372 Reviewed by Geoffrey Garen.
374 Fixes "build fails with memory model cannot be stronger than
375 success memory model for ‘__atomic_compare_exchange’".
377 Pre-5 revisions of GCC at Os only generated an error message
378 related to invalid failure memory ordering. The reason is that
379 libstdc++ tries to be clever about enforcing the C++ standard's
380 clause [atomics.types.operations.req] ¶21 which states:
382 Requires: The failure argument shall not be
383 `memory_order_release` nor `memory_order_acq_rel`. The failure
384 argument shall be no stronger than the success argument.
386 It fails at doing this because its inlining heuristics are
387 modified by Os, and they're not quite as dumb as O0 but not smart
388 enough to get to the good code at O1. Adding ALWAYS_INLINE fixes
389 the silliness at Os, leaves O1 great, and makes O0 slightly less
390 bad but still pretty bad.
392 The other good news is that I'm going to get this particular
393 problem fixed in the version of C++ which will come after C++17:
395 https://github.com/jfbastien/papers/blob/master/source/P0418r1.bs
397 While we're at it we should always inline all of these wrapped
398 functions because the generated code is horrendous if the memory
399 order isn't known at compile time.
403 (WTF::Atomic::store):
404 (WTF::Atomic::compareExchangeWeak):
405 (WTF::Atomic::compareExchangeStrong):
406 (WTF::Atomic::exchangeAndAdd):
407 (WTF::Atomic::exchange):
409 2016-09-13 Michael Saboff <msaboff@apple.com>
411 Promises aren't resolved properly when making a ObjC API callback
412 https://bugs.webkit.org/show_bug.cgi?id=161929
414 Reviewed by Geoffrey Garen.
416 Removed resetCurrentAtomicStringTable() which is no longer referenced.
418 * wtf/WTFThreadData.h:
419 (WTF::WTFThreadData::resetCurrentAtomicStringTable): Deleted.
421 2016-09-13 Alex Christensen <achristensen@webkit.org>
423 Implement URLSearchParams
424 https://bugs.webkit.org/show_bug.cgi?id=161920
426 Reviewed by Chris Dumez.
428 * wtf/text/StringView.h:
429 (WTF::StringView::split): Added.
431 2016-09-12 Filip Pizlo <fpizlo@apple.com>
433 ParkingLot is going to have a bad time with threads dying
434 https://bugs.webkit.org/show_bug.cgi?id=161893
436 Reviewed by Michael Saboff.
438 If a thread dies right as it falls out of parkConditionally, then unparkOne() and friends
439 might die because they will dereference a deallocated ThreadData.
441 The solution is to ref-count ThreadData's. When unparkOne() and friends want to hold onto a
442 ThreadData past the queue lock, they can use RefPtr<>.
444 * wtf/ParkingLot.cpp:
445 (WTF::ParkingLot::unparkOne):
446 (WTF::ParkingLot::unparkOneImpl):
447 (WTF::ParkingLot::unparkAll):
449 2016-09-12 Chris Dumez <cdumez@apple.com>
451 Fix post-landing review comments after r205787
452 https://bugs.webkit.org/show_bug.cgi?id=161885
454 Reviewed by Darin Adler.
456 Add new StringBuilder::append(CFStringRef) / append(NSString*)
457 overloads to avoid an extra string copy when possible.
459 * wtf/text/StringBuilder.cpp:
460 (WTF::StringBuilder::append):
461 * wtf/text/StringBuilder.h:
462 (WTF::StringBuilder::append):
464 2016-09-12 Yusuke Suzuki <utatane.tea@gmail.com>
466 [WTF] HashTable's rehash is not compatible to Ref<T> and ASan
467 https://bugs.webkit.org/show_bug.cgi?id=161763
469 Reviewed by Darin Adler.
471 Destructors of HashTable's empty values need to be called while ones of deleted values don't.
474 (WTF::KeyTraits>::deallocateTable):
477 2016-09-12 Myles C. Maxfield <mmaxfield@apple.com>
479 [Cocoa] Reduce uses of CGFonts in favor of CTFonts
480 https://bugs.webkit.org/show_bug.cgi?id=161809
482 Reviewed by Daniel Bates.
484 * wtf/unicode/CharacterNames.h:
486 2016-09-12 Saam Barati <sbarati@apple.com>
488 MapHash should do constant folding when it has a constant argument and its legal to hash that value
489 https://bugs.webkit.org/show_bug.cgi?id=161639
491 Reviewed by Filip Pizlo.
493 This patch adds a concurrentHash method to StringImpl. It's
494 probably safe to get the actual hash while being racy, however,
495 it's simpler and more future proof to not have to worry about
496 that and to just compute it on demand. Users of this API should
497 be aware that it's doing non-trivial work. Currently, the only
498 user is JSC's JIT compilers, and they only ask for hashes for small-ish
501 * wtf/text/StringImpl.h:
502 * wtf/text/StringStatics.cpp:
503 (WTF::StringImpl::concurrentHash):
505 2016-09-11 Filip Pizlo <fpizlo@apple.com>
507 DFG::forAllKilledOperands() could use a faster bitvector scan in the same-inline-stack fast path
508 https://bugs.webkit.org/show_bug.cgi?id=161849
510 Reviewed by Saam Barati.
512 It turns out that templates make private fields weird. FastBitVectorImpl can't necessarily
513 touch privates in instances of different template specializations of itself. So, I added a
514 public method called wordView() that exposes the necessary private field.
516 * wtf/FastBitVector.h:
517 (WTF::FastBitVectorImpl::operator&):
518 (WTF::FastBitVectorImpl::operator|):
519 (WTF::FastBitVectorImpl::operator~):
520 (WTF::FastBitVectorImpl::forEachSetBit):
521 (WTF::FastBitVectorImpl::wordView):
523 2016-09-11 Filip Pizlo <fpizlo@apple.com>
525 FastBitVector should have efficient and easy-to-use vector-vector operations
526 https://bugs.webkit.org/show_bug.cgi?id=161847
528 Reviewed by Saam Barati.
530 FastBitVector is a bitvector representation that supports manual dynamic resizing and is
531 optimized for speed, not space. (BitVector supports automatic dynamic resizing and is
532 optimized for space, while Bitmap is sized statically and is optimized for both speed and
533 space.) This change greatly increases the power of FastBitVector. We will use these new
534 powers for changing the JSC GC to use FastBitVectors to track sets of MarkedBlocks (bug
535 161581) instead of using a combination of Vectors and doubly-linked lists.
537 This change splits FastBitVector into two parts:
539 - A thing that manages the storage of a bitvector: a uint32_t array and a size_t numBits.
540 We call this the word view.
541 - A thing that takes some kind of abstract array of uint32_t's and does bitvector
542 operations to it. We call this the FastBitVectorImpl.
544 FastBitVectorImpl and word views are immutable. The FastBitVector class is a subclass of
545 FastBitVectorImpl specialized on a word view that owns its words and has additional
546 support for mutable operations.
548 Doing this allows us to efficiently support things like this without any unnecessary
549 memory allocation or copying:
551 FastBitVector a, b, c; // Assume that there is code to initialize these.
554 Previously, this kind of operation would not be efficient, because "~c" would have to
555 create a whole new FastBitVector. But now, it just returns a FastBitVectorImpl whose
556 underlying word view bitnots (~) its words on the fly. Using template magic, this can get
557 pretty complex. For example "b | ~c" returns a FastBitVectorImpl that wraps a word view
558 whose implementation of WordView::word(size_t index) is something like:
560 uint32_t word(size_t index) { return b.m_words.word(index) | ~c.m_words.word(index); }
562 FastBitVectorImpl supports all of the fast bulk bitvector operations, like
563 forEachSetBit(), bitCount(), etc. So, when you say "a &= b | ~c", the actual
564 implementation is going to run these bit operations on word granularity directly over the
565 storage inside a, b, c.
567 The use of operator overloading is worth explaining a bit. Previously, FastBitVector
568 avoided operator overloading. For example, the &= operation was called filter(). I think
569 that this was a pretty good approach at the time. I tried using non-operator methods in
570 this FastBitVector rewrite, but I found it very odd to say things like:
572 a.filter(b.bitOr(c.bitNot()));
574 I think that it's harder to see what is going on here, then using operators, because infix
575 notation is always better.
577 * WTF.xcodeproj/project.pbxproj:
579 (WTF::BitVector::findBitInWord): Deleted.
580 * wtf/CMakeLists.txt:
582 (WTF::Dominators::NaiveDominators::NaiveDominators):
583 (WTF::Dominators::NaiveDominators::dominates):
584 (WTF::Dominators::NaiveDominators::pruneDominators):
585 * wtf/FastBitVector.cpp: Removed.
586 * wtf/FastBitVector.h:
587 (WTF::fastBitVectorArrayLength):
588 (WTF::FastBitVectorWordView::FastBitVectorWordView):
589 (WTF::FastBitVectorWordView::numBits):
590 (WTF::FastBitVectorWordView::word):
591 (WTF::FastBitVectorWordOwner::FastBitVectorWordOwner):
592 (WTF::FastBitVectorWordOwner::~FastBitVectorWordOwner):
593 (WTF::FastBitVectorWordOwner::view):
594 (WTF::FastBitVectorWordOwner::operator=):
595 (WTF::FastBitVectorWordOwner::setAll):
596 (WTF::FastBitVectorWordOwner::clearAll):
597 (WTF::FastBitVectorWordOwner::set):
598 (WTF::FastBitVectorWordOwner::numBits):
599 (WTF::FastBitVectorWordOwner::arrayLength):
600 (WTF::FastBitVectorWordOwner::resize):
601 (WTF::FastBitVectorWordOwner::word):
602 (WTF::FastBitVectorWordOwner::words):
603 (WTF::FastBitVectorAndWords::FastBitVectorAndWords):
604 (WTF::FastBitVectorAndWords::view):
605 (WTF::FastBitVectorAndWords::numBits):
606 (WTF::FastBitVectorAndWords::word):
607 (WTF::FastBitVectorOrWords::FastBitVectorOrWords):
608 (WTF::FastBitVectorOrWords::view):
609 (WTF::FastBitVectorOrWords::numBits):
610 (WTF::FastBitVectorOrWords::word):
611 (WTF::FastBitVectorNotWords::FastBitVectorNotWords):
612 (WTF::FastBitVectorNotWords::view):
613 (WTF::FastBitVectorNotWords::numBits):
614 (WTF::FastBitVectorNotWords::word):
615 (WTF::FastBitVectorImpl::FastBitVectorImpl):
616 (WTF::FastBitVectorImpl::numBits):
617 (WTF::FastBitVectorImpl::size):
618 (WTF::FastBitVectorImpl::arrayLength):
619 (WTF::FastBitVectorImpl::operator==):
620 (WTF::FastBitVectorImpl::operator!=):
621 (WTF::FastBitVectorImpl::at):
622 (WTF::FastBitVectorImpl::operator[]):
623 (WTF::FastBitVectorImpl::bitCount):
624 (WTF::FastBitVectorImpl::operator&):
625 (WTF::FastBitVectorImpl::operator|):
626 (WTF::FastBitVectorImpl::operator~):
627 (WTF::FastBitVectorImpl::forEachSetBit):
628 (WTF::FastBitVectorImpl::forEachClearBit):
629 (WTF::FastBitVectorImpl::forEachBit):
630 (WTF::FastBitVectorImpl::findBit):
631 (WTF::FastBitVectorImpl::findSetBit):
632 (WTF::FastBitVectorImpl::findClearBit):
633 (WTF::FastBitVectorImpl::dump):
634 (WTF::FastBitVectorImpl::atImpl):
635 (WTF::FastBitVector::FastBitVector):
636 (WTF::FastBitVector::operator=):
637 (WTF::FastBitVector::resize):
638 (WTF::FastBitVector::setAll):
639 (WTF::FastBitVector::clearAll):
640 (WTF::FastBitVector::setAndCheck):
641 (WTF::FastBitVector::operator|=):
642 (WTF::FastBitVector::operator&=):
643 (WTF::FastBitVector::at):
644 (WTF::FastBitVector::operator[]):
645 (WTF::FastBitVector::BitReference::BitReference):
646 (WTF::FastBitVector::BitReference::operator bool):
647 (WTF::FastBitVector::BitReference::operator=):
648 (WTF::FastBitVector::~FastBitVector): Deleted.
649 (WTF::FastBitVector::numBits): Deleted.
650 (WTF::FastBitVector::set): Deleted.
651 (WTF::FastBitVector::equals): Deleted.
652 (WTF::FastBitVector::merge): Deleted.
653 (WTF::FastBitVector::filter): Deleted.
654 (WTF::FastBitVector::exclude): Deleted.
655 (WTF::FastBitVector::clear): Deleted.
656 (WTF::FastBitVector::get): Deleted.
657 (WTF::FastBitVector::bitCount): Deleted.
658 (WTF::FastBitVector::forEachSetBit): Deleted.
659 (WTF::FastBitVector::arrayLength): Deleted.
660 * wtf/StdLibExtras.h:
661 (WTF::findBitInWord):
663 2016-09-10 Chris Dumez <cdumez@apple.com>
665 parseHTMLInteger() should take a StringView in parameter
666 https://bugs.webkit.org/show_bug.cgi?id=161669
668 Reviewed by Ryosuke Niwa.
670 * wtf/text/StringBuilder.h:
671 (WTF::StringBuilder::append):
672 Add StringBuilder::append() overload taking an AtomicString in parameter.
673 It used to call StringBuilder::append(const String&) implicitly when
674 passing an AtomicString. However, it is now ambiguous because there
675 is an overload taking a StringView, and it is now possible to construct
676 a StringView from an AtomicString.
678 * wtf/text/StringView.h:
679 (WTF::StringView::StringView):
680 - Add StringView constructor taking an AtomicString in parameter for
681 convenience. This avoids having to call AtomicString::string()
682 explicitly at call sites.
683 - Add StringView constructor taking a 'const char*' in parameter for
684 performance. There are several call sites that were passing a const
685 char* and implicitly constructing an unnecessary String to construct
686 a StringView. This became more obvious because the constructor taking
687 an AtomicString in parameter made such calls ambiguous.
690 2016-09-09 Mark Lam <mark.lam@apple.com>
692 Gardening: fixing a few JSC test failures.
693 https://bugs.webkit.org/show_bug.cgi?id=161760
697 Without this fix, the following tests will crash on a null dereference of isGCThread.
698 stress/slow-path-generator-updating-current-node-dfg.js.misc-ftl-no-cjit
699 stress/unshift-array-storage.js.misc-ftl-no-cjit
701 * wtf/MainThread.cpp:
702 (WTF::mayBeGCThread):
704 2016-09-08 Yusuke Suzuki <utatane.tea@gmail.com>
706 [WTF] HashTable's rehash is not compatible to Ref<T> and ASan
707 https://bugs.webkit.org/show_bug.cgi?id=161763
709 Reviewed by Mark Lam.
711 If we move an object, the location which the moved object used should not be touched anymore.
712 HashTable::rehash performs WTFMove for the object that resides in the old table.
713 However, after moving it, we accidentally touch this location by using `!isEmptyOrDeletedBucket(table[i])`
714 in HashTable::deallocateTable. And it causes ASan crashing if we use Ref<> for HashTable's key or value.
716 In this patch, we call the destructor right after moving the object. And HashTable::rehash just calls
717 fastFree since all the objects in the old table are already moved and destructed.
718 And we also change HashTable::deallocate to destruct only live objects. Calling destructors for empty objects
719 is meaningless. And according to the Ref<>'s comment, empty object is not designed to be destructed.
722 (WTF::KeyTraits>::deallocateTable):
724 2016-09-08 Filip Pizlo <fpizlo@apple.com>
726 Heap::isMarked() shouldn't pay the price of concurrent lazy flipping
727 https://bugs.webkit.org/show_bug.cgi?id=161760
729 Reviewed by Mark Lam.
731 * wtf/MainThread.cpp:
732 (WTF::isMainThreadOrGCThread):
733 (WTF::mayBeGCThread):
736 2016-09-08 Myles C. Maxfield <mmaxfield@apple.com>
738 Support new emoji group candidates
739 https://bugs.webkit.org/show_bug.cgi?id=161664
740 <rdar://problem/24802695>
741 <rdar://problem/27666433>
743 Reviewed by Simon Fraser.
745 Update breaking rules.
747 * wtf/text/TextBreakIterator.cpp:
748 (WTF::cursorMovementIterator):
750 2016-09-07 JF Bastien <jfbastien@apple.com>
752 bitwise_cast: allow const destination type
753 https://bugs.webkit.org/show_bug.cgi?id=161719
755 Reviewed by Saam Barati.
757 * wtf/StdLibExtras.h:
758 (WTF::bitwise_cast): allow `const To to = bitwise_cast<const To>(from);`
760 2016-09-07 Mark Lam <mark.lam@apple.com>
762 Add CatchScope and force all exception checks to be via ThrowScope or CatchScope.
763 https://bugs.webkit.org/show_bug.cgi?id=161498
765 Reviewed by Geoffrey Garen.
769 2016-09-07 Youenn Fablet <youenn@apple.com>
771 [Streams API] Separate compile flag for ReadableStream and WritableStream
772 https://bugs.webkit.org/show_bug.cgi?id=161044
774 Reviewed by Alex Christensen.
776 * wtf/FeatureDefines.h:
778 2016-09-06 Saam Barati <sbarati@apple.com>
780 Make JSMap and JSSet faster
781 https://bugs.webkit.org/show_bug.cgi?id=160989
783 Reviewed by Filip Pizlo.
785 I made s_flagCount public in StringImpl since JSC's JITs now use this field.
787 * wtf/text/StringImpl.h:
789 2016-09-06 Commit Queue <commit-queue@webkit.org>
791 Unreviewed, rolling out r205504.
792 https://bugs.webkit.org/show_bug.cgi?id=161645
794 Broke the iOS device build (Requested by ryanhaddad on
799 "Make JSMap and JSSet faster"
800 https://bugs.webkit.org/show_bug.cgi?id=160989
801 http://trac.webkit.org/changeset/205504
803 2016-09-06 Saam Barati <sbarati@apple.com>
805 Make JSMap and JSSet faster
806 https://bugs.webkit.org/show_bug.cgi?id=160989
808 Reviewed by Filip Pizlo.
810 I made s_flagCount public since JSC's JITs now use this field.
812 * wtf/text/StringImpl.h:
814 2016-09-06 Per Arne Vollan <pvollan@apple.com>
816 [Win] Enable strict runtime stack buffer checks.
817 https://bugs.webkit.org/show_bug.cgi?id=161629
819 Reviewed by Brent Fulgham.
823 2016-09-06 Daniel Bates <dabates@apple.com>
825 Remove EXTERN_C from WTF
826 https://bugs.webkit.org/show_bug.cgi?id=161090
828 Reviewed by Brent Fulgham.
830 Guard external C declarations in WTF_EXTERN_C_BEGIN, WTF_EXTERN_C_END.
832 * wtf/Compiler.h: Remove macro definition EXTERN_C.
833 * wtf/spi/cf/CFBundleSPI.h:
834 * wtf/spi/cocoa/NSMapTableSPI.h:
835 * wtf/spi/cocoa/SecuritySPI.h:
836 * wtf/spi/darwin/CommonCryptoSPI.h:
837 * wtf/spi/darwin/SandboxSPI.h:
838 * wtf/spi/darwin/XPCSPI.h:
839 * wtf/spi/darwin/dyldSPI.h:
841 2016-08-31 Filip Pizlo <fpizlo@apple.com>
843 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
844 https://bugs.webkit.org/show_bug.cgi?id=160125
846 Reviewed by Geoffrey Garen and Keith Miller.
848 I needed tryFastAlignedMalloc() so I added it.
850 * wtf/FastMalloc.cpp:
851 (WTF::tryFastAlignedMalloc):
853 * wtf/ParkingLot.cpp:
854 (WTF::ParkingLot::forEachImpl):
855 (WTF::ParkingLot::forEach): Deleted.
857 (WTF::ParkingLot::parkConditionally):
858 (WTF::ParkingLot::unparkOne):
859 (WTF::ParkingLot::forEach):
860 * wtf/ScopedLambda.h:
861 (WTF::scopedLambdaRef):
862 * wtf/SentinelLinkedList.h:
863 (WTF::SentinelLinkedList::forEach):
864 (WTF::RawNode>::takeFrom):
866 (WTF::SimpleStats::operator bool):
867 (WTF::SimpleStats::operator!): Deleted.
869 2016-09-02 JF Bastien <jfbastien@apple.com>
871 bitwise_cast infinite loops if called from the default constructor in ToType
872 https://bugs.webkit.org/show_bug.cgi?id=161365
874 Reviewed by Saam Barati.
876 * wtf/StdLibExtras.h:
877 (WTF::bitwise_cast): use aggregate initialization to avoid ctor
879 2016-09-01 Anders Carlsson <andersca@apple.com>
881 Use BlockPtr::fromCallable in WorkQueue::dispatch and WorkQueue::dispatchAfter
882 https://bugs.webkit.org/show_bug.cgi?id=161512
884 Reviewed by Chris Dumez.
886 This lets us get rid of leakCallable and adoptCallable.
890 * wtf/cocoa/WorkQueueCocoa.cpp:
891 (WTF::WorkQueue::dispatch):
892 (WTF::WorkQueue::dispatchAfter):
894 2016-09-01 Anders Carlsson <andersca@apple.com>
896 add BlockPtr::fromCallable
897 https://bugs.webkit.org/show_bug.cgi?id=161504
899 Reviewed by Tim Horton.
901 BlockPtr::fromCallable lets you create an Objective-C block from any callable object - including lambdas that contain move-only types.
902 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).
906 2016-08-31 Keith Rollin <krollin@apple.com>
908 WebKit should set a subsystem for os_log so it's easier to filter for WebKit log messages
909 https://bugs.webkit.org/show_bug.cgi?id=160969
910 <rdar://problem/26068734>
912 Reviewed by Simon Fraser.
914 Add support for attaching a subsystem and category when logging via
915 the RELEASE_LOG macros. This support is provided by adding subsystem
916 and category information to WTFLogChannel. An os_log_t object is then
917 created to enacpsulate that information. When using RELEASE_LOG to log
918 through that channel, the associated log object is used when calling
921 To help support the inclusion of the subsystem and category
922 information in WTFLogChannel, the DECLARE_LOG_CHANNEL,
923 DEFINE_LOG_CHANNEL, and LOG_CHANNEL_ADDRESS macros that were defined
924 in various modules are consolidated and moved to Assertions.h.
925 DEFINE_LOG_CHANNEL is now defined to initialize the subsystem and
928 * wtf/Assertions.cpp:
930 * wtf/RefCountedLeakCounter.cpp:
932 2016-08-31 Alex Christensen <achristensen@webkit.org>
934 Implement IPv6 parsing in URLParser
935 https://bugs.webkit.org/show_bug.cgi?id=161390
937 Reviewed by Darin Adler.
940 (WTF::lowerNibbleToLowercaseASCIIHexDigit):
941 (WTF::upperNibbleToLowercaseASCIIHexDigit):
943 2016-08-30 Brady Eidson <beidson@apple.com>
945 GameController.framework backend for gamepad API.
946 https://bugs.webkit.org/show_bug.cgi?id=161086
948 Reviewed by Alex Christensen.
951 (WTF::RunLoop::TimerBase::startOneShot):
953 2016-08-30 Mark Lam <mark.lam@apple.com>
955 Introduce the ThrowScope and force every throw site to instantiate a ThrowScope.
956 https://bugs.webkit.org/show_bug.cgi?id=161171
958 Reviewed by Filip Pizlo and Geoffrey Garen.
961 - Introduced the ENABLE(THROW_SCOPE_VERIFICATION) flag.
963 2016-08-27 Alex Christensen <achristensen@webkit.org>
965 URLParser should parse relative URLs
966 https://bugs.webkit.org/show_bug.cgi?id=161282
968 Reviewed by Darin Adler.
970 * wtf/text/StringView.h:
971 Use a std::reference_wrapper for the StringView& to make it reassignable so we can add an operator=.
973 2016-08-26 JF Bastien <jfbastien@apple.com>
975 bitwise_cast uses inactive member of union
976 https://bugs.webkit.org/show_bug.cgi?id=161244
978 Reviewed by Benjamin Poulain.
981 Add COMPILER_HAS_CLANG_FEATURE
982 * wtf/StdLibExtras.h:
984 Fix C++ UB, add trivially-copyable check.
986 bitwise_cast stores into a union with one type and reads with
987 another, which is technically C++ undefined behavior because it's
988 accessing the wrong active member of the union. The better way to
989 do this is through memcpy, which compilers optimize as well
990 because it's known-size in known-not-to-escape storage (for small
991 types they'll inline and then convert stack memory access to SSA
992 values which may be in-register if that makes sense, which would
993 be a move between int/FP registers at worst).
995 The C++ Standard's section [basic.types] explicitly blesses memcpy:
997 For any trivially copyable type T, if two pointers to T point to
998 distinct T objects obj1 and obj2, where neither obj1 nor obj2 is a
999 base-class subobject, if the underlying bytes (1.7) making up obj1
1000 are copied into obj2, 42 obj2 shall subsequently hold the same
1006 // provided that t2p points to an initialized object ...
1007 std::memcpy(t1p, t2p, sizeof(T));
1008 // at this point, every subobject of trivially copyable type in *t1p contains
1009 // the same value as the corresponding subobject in *t2p
1012 Whereas section [class.union] says:
1014 In a union, at most one of the non-static data members can be
1015 active at any time, that is, the value of at most one of the
1016 non-static data members can be stored in a union at any time.
1018 While we're at it, checking that sizeof(To) == sizeof(From) is
1019 good, but we should also check that both types are trivially
1020 copyable (can have a ctor, no dtor, and copy is defaulted as if by
1021 memcpy for type and all subtypes). Unfortunately that trait isn't
1022 implemented consistently in all recent compiler+stdlib
1023 implementations, but recent clang has an equivalent builtin
1024 (other compilers simply won't do the check, and will break on bots
1025 with the right compilers which is better than the current silent
1026 breakage). This builtin hack also avoids #include <type_traits>
1027 which really doesn't save much.
1029 2016-08-26 Johan K. Jensen <johan_jensen@apple.com>
1031 Web Inspector: Frontend should have access to Resource Timing information
1032 https://bugs.webkit.org/show_bug.cgi?id=160095
1034 Reviewed by Alex Christensen.
1036 Add method to get elapsed time for any monotonic time.
1037 Used by InspectorNetworkAgent.
1040 (WTF::Stopwatch::elapsedTimeSinceMonotonicTime):
1042 2016-08-26 Csaba Osztrogonác <ossy@webkit.org>
1044 Fix the ENABLE(WEBASSEMBLY) build on Linux
1045 https://bugs.webkit.org/show_bug.cgi?id=161197
1047 Reviewed by Mark Lam.
1051 2016-08-25 Yusuke Suzuki <utatane.tea@gmail.com>
1053 [DFG][FTL] Implement ES6 Generators in DFG / FTL
1054 https://bugs.webkit.org/show_bug.cgi?id=152723
1056 Reviewed by Filip Pizlo.
1058 * wtf/FastBitVector.h:
1059 (WTF::FastBitVector::FastBitVector):
1061 2016-08-25 JF Bastien <jfbastien@apple.com>
1063 TryGetById should have a ValueProfile so that it can predict its output type
1064 https://bugs.webkit.org/show_bug.cgi?id=160921
1066 Reviewed by Saam Barati.
1068 Add WTF_CONCAT to StdLibExtras.h
1070 * wtf/StdLibExtras.h:
1072 2016-08-25 Johan K. Jensen <johan_jensen@apple.com>
1074 Don't store networkLoadTiming in the disk cache
1075 https://bugs.webkit.org/show_bug.cgi?id=161161
1077 Reviewed by Antti Koivisto.
1080 Remove Encode and Decode forward declarations.
1082 2016-08-24 Yusuke Suzuki <utatane.tea@gmail.com>
1084 [JSC] Move generic data structures out of B3
1085 https://bugs.webkit.org/show_bug.cgi?id=161155
1087 Reviewed by Saam Barati.
1089 Add IndexSet, IndexMap, and IndexedContainerIterator.
1091 * WTF.xcodeproj/project.pbxproj:
1092 * wtf/CMakeLists.txt:
1093 * wtf/IndexMap.h: Copied from Source/JavaScriptCore/b3/B3IndexMap.h.
1094 (WTF::IndexMap::IndexMap):
1095 (WTF::IndexMap::resize):
1096 (WTF::IndexMap::clear):
1097 (WTF::IndexMap::size):
1098 (WTF::IndexMap::operator[]):
1099 * wtf/IndexSet.h: Renamed from Source/JavaScriptCore/b3/B3IndexSet.h.
1100 (WTF::IndexSet::IndexSet):
1101 (WTF::IndexSet::add):
1102 (WTF::IndexSet::addAll):
1103 (WTF::IndexSet::remove):
1104 (WTF::IndexSet::contains):
1105 (WTF::IndexSet::size):
1106 (WTF::IndexSet::isEmpty):
1107 (WTF::IndexSet::Iterable::Iterable):
1108 (WTF::IndexSet::Iterable::iterator::iterator):
1109 (WTF::IndexSet::Iterable::iterator::operator*):
1110 (WTF::IndexSet::Iterable::iterator::operator++):
1111 (WTF::IndexSet::Iterable::iterator::operator==):
1112 (WTF::IndexSet::Iterable::iterator::operator!=):
1113 (WTF::IndexSet::Iterable::begin):
1114 (WTF::IndexSet::Iterable::end):
1115 (WTF::IndexSet::values):
1116 (WTF::IndexSet::indices):
1117 (WTF::IndexSet::dump):
1118 * wtf/IndexedContainerIterator.h: Renamed from Source/JavaScriptCore/b3/B3IndexMap.h.
1119 (WTF::IndexedContainerIterator::IndexedContainerIterator):
1120 (WTF::IndexedContainerIterator::operator++):
1121 (WTF::IndexedContainerIterator::operator==):
1122 (WTF::IndexedContainerIterator::operator!=):
1123 (WTF::IndexedContainerIterator::findNext):
1125 2016-08-24 Andreas Kling <akling@apple.com>
1127 Add WTF::isFastMallocEnabled().
1128 <https://webkit.org/b/160534>
1130 Reviewed by Joseph Pecoraro.
1132 * wtf/FastMalloc.cpp:
1133 (WTF::isFastMallocEnabled):
1136 2016-08-23 Anders Carlsson <andersca@apple.com>
1138 Add enum traits and use them in the IPC::Decoder
1139 https://bugs.webkit.org/show_bug.cgi?id=161103
1141 Reviewed by Sam Weinig.
1143 Add EnumTraits.h which provides a forward declaration for WTF::EnumTraits as well as
1144 the WTF::isValidEnum function.
1146 * WTF.xcodeproj/project.pbxproj:
1147 * wtf/EnumTraits.h: Added.
1149 2016-08-24 Filip Pizlo <fpizlo@apple.com>
1151 Unreviewed, roll out r204901, r204897, r204866, r204856, r204854.
1153 * wtf/FastMalloc.cpp:
1154 (WTF::tryFastAlignedMalloc): Deleted.
1156 * wtf/ParkingLot.cpp:
1157 (WTF::ParkingLot::forEach):
1158 (WTF::ParkingLot::forEachImpl): Deleted.
1160 (WTF::ParkingLot::parkConditionally):
1161 (WTF::ParkingLot::unparkOne):
1162 (WTF::ParkingLot::forEach): Deleted.
1163 * wtf/ScopedLambda.h:
1164 (WTF::scopedLambdaRef): Deleted.
1166 2016-08-22 Filip Pizlo <fpizlo@apple.com>
1168 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
1169 https://bugs.webkit.org/show_bug.cgi?id=160125
1171 Reviewed by Geoffrey Garen.
1173 I needed tryFastAlignedMalloc() so I added it.
1175 * wtf/FastMalloc.cpp:
1176 (WTF::fastAlignedMalloc):
1177 (WTF::tryFastAlignedMalloc):
1178 (WTF::fastAlignedFree):
1181 2016-08-22 Keith Miller <keith_miller@apple.com>
1183 Actually enable the WASM build.
1184 https://bugs.webkit.org/show_bug.cgi?id=160933
1186 Reviewed by Geoffrey Garen.
1188 * wtf/FeatureDefines.h:
1190 2016-08-17 Don Olmstead <don.olmstead@am.sony.com>
1192 Use find_library within Windows build
1193 https://bugs.webkit.org/show_bug.cgi?id=160904
1195 Reviewed by Brent Fulgham.
1197 * wtf/CMakeLists.txt:
1199 2016-08-17 Anders Carlsson <andersca@apple.com>
1201 Move WKSignedPublicKeyAndChallengeString into WebCore and make it proper C++
1202 https://bugs.webkit.org/show_bug.cgi?id=160945
1204 Reviewed by Dan Bernstein.
1207 (WTF::RetainPtr::operator&):
1208 Cast this to the right type.
1210 * wtf/spi/cocoa/SecuritySPI.h:
1213 2016-08-17 Antti Koivisto <antti@apple.com>
1215 Remove CSS_IMAGE_SET feature define
1216 https://bugs.webkit.org/show_bug.cgi?id=160944
1218 Reviewed by Dean Jackson.
1220 * wtf/FeatureDefines.h:
1222 2016-08-16 Keith Miller <keith_miller@apple.com>
1224 Enable WebAssembly in the build.
1225 https://bugs.webkit.org/show_bug.cgi?id=160916
1227 Reviewed by Benjamin Poulain.
1229 This patch turns on WebAssembly on all the platforms that support B3.
1230 Turning on WebAssembly by default lets us check the build on every
1233 * wtf/FeatureDefines.h:
1235 2016-08-16 Anders Carlsson <andersca@apple.com>
1241 2016-08-16 Anders Carlsson <andersca@apple.com>
1244 https://bugs.webkit.org/show_bug.cgi?id=160908
1246 Reviewed by Geoffrey Garen.
1248 WTF::ScopeExit and WTF::makeScopeExit let you define an object that will invoke a function when the
1249 object goes out of scope. This is going to be used to avoid spagetti-code and gotos in a future patch.
1251 The class is modeled after the LWG paper "P0052 - Generic Scope Guard and RAII Wrapper for the Standard Library".
1253 * WTF.xcodeproj/project.pbxproj:
1254 * wtf/Scope.h: Added.
1255 (WTF::makeScopeExit):
1257 2016-08-15 Anders Carlsson <andersca@apple.com>
1259 Add an address-of operator to RetainPtr
1260 https://bugs.webkit.org/show_bug.cgi?id=160879
1262 Reviewed by Tim Horton.
1264 This will make some security-related code from WebKitSystemInterface easier to port.
1266 * wtf/HashIterators.h:
1267 (WTF::HashTableValuesIterator::get):
1269 (WTF::HashTableBucketInitializer<true>::initialize):
1270 Use std::addressof instead of &, in case & is overloaded.
1273 (WTF::RetainPtr::operator&):
1276 2016-08-15 Sam Weinig <sam@webkit.org>
1278 Speed up compile times by not including wtf/Variant.h so much
1279 https://bugs.webkit.org/show_bug.cgi?id=160847
1281 Reviewed by Alex Christensen and Saam Barati.
1284 Add forward declaration of std::variant.
1286 * wtf/StdLibExtras.h:
1287 Remove references to std::variant. Move them to wtf/Variant.h
1289 2016-08-15 Keith Miller <keith_miller@apple.com>
1291 Implement WASM Parser and B3 IR generator
1292 https://bugs.webkit.org/show_bug.cgi?id=160681
1294 Reviewed by Benjamin Poulain.
1297 (WTF::dataLogLn): Add a new dataLog function, dataLogLn that
1298 automagically includes a new line at the end of the print.
1301 (decodeInt32): Change the LEBDecoder to take a pointer and length
1302 rather than a Vector.
1304 2016-08-15 Keith Rollin <krollin@apple.com>
1307 https://bugs.webkit.org/show_bug.cgi?id=160768
1309 Rename LOG_ALWAYS and friends, given that the first parameter to it is
1310 a boolean expression that determines whether or not logging should be
1313 Reviewed by Chris Dumez.
1317 2016-08-15 Joseph Pecoraro <pecoraro@apple.com>
1319 Remove unused includes of wtf headers
1320 https://bugs.webkit.org/show_bug.cgi?id=160839
1322 Reviewed by Alex Christensen.
1324 * wtf/BackwardsGraph.h:
1326 * wtf/WorkQueue.cpp:
1327 * wtf/text/StringImpl.cpp:
1328 * wtf/unicode/icu/CollatorICU.cpp:
1330 2016-08-14 Daniel Bates <dabates@apple.com>
1332 Fix compiler errors when building iOS WebKit using the iOS 10 beta SDK
1333 https://bugs.webkit.org/show_bug.cgi?id=160725
1335 Reviewed by Sam Weinig.
1337 For now, disable OS_LOG when building with the iOS 10 beta SDK until
1338 we have the fix for <rdar://problem/27758343>.
1342 2016-08-13 Dan Bernstein <mitz@apple.com>
1344 Build fix follow-up to r204433.
1346 * wtf/StdLibExtras.h:
1347 (WTF::makeVisitor): Don’t use an auto return type.
1349 2016-08-12 Sam Weinig <sam@webkit.org>
1351 Make variant only available when compiling for C++14 or greater
1352 https://bugs.webkit.org/show_bug.cgi?id=160813
1354 Reviewed by Anders Carlsson.
1357 * wtf/StdLibExtras.h:
1360 2016-08-11 Maureen Daum <mdaum@apple.com>
1362 Add NSButtonType to AppKitCompatibilityDeclarations.h.
1363 https://bugs.webkit.org/show_bug.cgi?id=160767.
1365 Reviewed by Dan Bernstein.
1367 Add NSButtonType to AppKitCompatibilityDeclarations.h so that we can use the new
1368 names but still build successfully on older OS versions.
1370 * wtf/mac/AppKitCompatibilityDeclarations.h:
1372 2016-08-10 Benjamin Poulain <bpoulain@apple.com>
1374 [JSC] TinyPtrSet::deleteListIfNecessary() no longer needs to test for reservedValue
1375 https://bugs.webkit.org/show_bug.cgi?id=160721
1377 Reviewed by Sam Weinig.
1379 Previously, TinyPtrSet was using a ThinFlag if there was no OutOfLineList.
1380 A side effect is that isThin() was false for reservedValue. When deleting
1381 the list, we had to consider both cases: isThin() and reservedValue.
1383 In r204065, I changed the flag to a FatFlag to ensure TinyPtrSet can be initialized
1385 This changes the value of isThin() of reservedValue to true since reservedValue
1386 does not have the FatFlag bit set.
1387 This patch removes the useless condition from deleteListIfNecessary().
1390 (WTF::TinyPtrSet::deleteListIfNecessary):
1392 2016-08-09 Sam Weinig <sam@webkit.org>
1397 (std::experimental::__visit_helper2::__visit):
1398 MSVC does not support extended constexpr. Use a ternary operator instead of an if statement.
1400 2016-08-06 Sam Weinig <sam@webkit.org>
1402 Replace NodeOrString with std::variant<RefPtr<Node>, String>
1403 https://bugs.webkit.org/show_bug.cgi?id=160638
1405 Reviewed by Anders Carlsson.
1407 * wtf/StdLibExtras.h:
1408 (WTF::Visitor::Visitor):
1410 Add WTF::makeVisitor() which takes a list of lambdas to use
1411 an an overload set for a visitor object.
1413 Also, re-export std::experimental::variant (and helpers) in the std
1414 namespace using type aliasing.
1417 Make std::experimental::variant work in WebCore.
1419 2016-08-06 Sam Weinig <sam@webkit.org>
1421 WTF needs a variant implementation
1422 https://bugs.webkit.org/show_bug.cgi?id=160618
1424 Reviewed by Darin Adler.
1426 Add an implementation of std::experimental::variant matching the C++17 draft http://wg21.link/n4606
1427 taken from https://bitbucket.org/anthonyw/variant/src (5bce47fa788648f79e5ea1d77b0eef2e8f0b2999) and
1428 modified to support compiling without exceptions (where it used to throw, we lovingly CRASH()).
1430 * WTF.xcodeproj/project.pbxproj:
1434 Add COMPILER_SUPPORTS define for C++ exceptions.
1436 * wtf/Variant.h: Added.
1438 2016-08-05 Keith Miller <keith_miller@apple.com>
1440 Add LEBDecoder and tests
1441 https://bugs.webkit.org/show_bug.cgi?id=160625
1443 Reviewed by Benjamin Poulain.
1445 Adds some LEB decoder functions to WTF. These are used in the
1446 WASM spec to encode numbers in a semi-compressed format.
1448 * WTF.xcodeproj/project.pbxproj:
1449 * wtf/LEBDecoder.h: Added.
1453 2016-08-05 Keith Miller <keith_miller@apple.com>
1455 Delete out of date WASM code.
1456 https://bugs.webkit.org/show_bug.cgi?id=160603
1458 Reviewed by Saam Barati.
1460 Add Feature define for WebAssembly on mac.
1462 * wtf/FeatureDefines.h:
1464 2016-08-03 Csaba Osztrogonác <ossy@webkit.org>
1466 Lacking support on a arm-traditional disassembler.
1467 https://bugs.webkit.org/show_bug.cgi?id=123717
1469 Reviewed by Mark Lam.
1473 2016-08-02 Myles C. Maxfield <mmaxfield@apple.com>
1475 Update breaking rules to match ICU 57
1476 https://bugs.webkit.org/show_bug.cgi?id=160488
1477 <rdar://problem/25856238>
1479 Reviewed by Darin Adler.
1481 This patch fixes a typo in the uax14AssignmentsAfter rules which
1482 was causing flag emoji to have line breaking opportunities in their
1483 middles. It also fixes significant language issues for languages
1484 such as Hebrew, and adds correct breaking opportunities around
1487 * wtf/text/TextBreakIterator.cpp:
1488 (WTF::cursorMovementIterator):
1489 (WTF::uax14AssignmentsAfter):
1490 (WTF::uax14Forward):
1491 (WTF::uax14Reverse):
1493 2016-08-02 Benjamin Poulain <benjamin@webkit.org>
1495 [JSC] Simplify the initialization of AbstractValue in the AbstractInterpreter
1496 https://bugs.webkit.org/show_bug.cgi?id=160370
1498 Reviewed by Saam Barati.
1501 (WTF::TinyPtrSet::isThin):
1502 (WTF::TinyPtrSet::set):
1504 2016-08-02 Benjamin Poulain <bpoulain@apple.com>
1506 Clean up some useless AtomicString atoms
1507 https://bugs.webkit.org/show_bug.cgi?id=160471
1509 Reviewed by Geoffrey Garen.
1511 * wtf/text/AtomicString.h:
1512 * wtf/text/StringStatics.cpp:
1513 (WTF::AtomicString::init): Deleted.
1515 2016-08-01 Benjamin Poulain <bpoulain@apple.com>
1517 [JSC][ARM64] Fix branchTest32/64 taking an immediate as mask
1518 https://bugs.webkit.org/show_bug.cgi?id=160439
1520 Reviewed by Filip Pizlo.
1524 This was not working at all for MacroAssembler.
1525 Since TrustedImm32/64 are signed integers, the arithmetic shift would
1526 never get rid of the top bit and we get an infinite loop.
1528 2016-07-29 Mark Lam <mark.lam@apple.com>
1530 Make StringView capable of being passed or returned in only 2 registers.
1531 https://bugs.webkit.org/show_bug.cgi?id=160344
1533 Reviewed by Geoffrey Garen.
1535 We just need to #if out copy and move constructors and assignment operators.
1537 After this change, the following test code:
1539 JS_EXPORT_PRIVATE StringView returnStringView(StringView sv)
1544 ... compiles to the following for x86_64:
1546 __ZN3JSC16returnStringViewEN3WTF10StringViewE:
1547 000000000093fb20 pushq %rbp
1548 000000000093fb21 movq %rsp, %rbp
1549 000000000093fb24 movq %rdi, %rax // Copy from arg word 0 to ret word 0.
1550 000000000093fb27 movq %rsi, %rdx // Copy from arg word 1 to ret word 1.
1551 000000000093fb2a popq %rbp
1552 000000000093fb2b retq
1554 ... and this for arm64:
1556 __ZN3JSC16returnStringViewEN3WTF10StringViewE:
1557 0000000000818504 ret // arg word 0 and 1 are in the same regs as ret word 0 and 1.
1559 * wtf/text/StringView.h:
1560 (WTF::StringView::StringView):
1561 (WTF::StringView::~StringView):
1562 (WTF::StringView::operator=):
1564 2016-07-29 Csaba Osztrogonác <ossy@webkit.org>
1566 Remove PassRef.h after r177259
1567 https://bugs.webkit.org/show_bug.cgi?id=160348
1569 Reviewed by Andreas Kling.
1571 * wtf/PassRef.h: Removed.
1573 2016-07-28 Mark Lam <mark.lam@apple.com>
1575 StringView should have an explicit m_is8Bit field.
1576 https://bugs.webkit.org/show_bug.cgi?id=160282
1577 <rdar://problem/27327943>
1579 Reviewed by Benjamin Poulain.
1581 The current implementation reserves 1 bit in the 32-bit m_length field as an
1582 is16Bit flag. As a result, a StringView is incapable of handling strings that
1583 have a length of 32-bit in size. This results in a mismatch with the
1584 expectations of String, StringImpl, and JavaScriptCore's JSString which all
1585 support a 32-bit unsigned length.
1587 This patch fixes this issue by introducing an explicit m_is8Bit field, thereby
1588 allowing m_length to be a full 32-bit again.
1590 We also introduced a clear() convenience method to set the fields of StringView
1591 to empty values. Previously, we were duplicating the code for clearing those
1592 fields. We now call clear() in all those places instead.
1594 Note: in clear(), we set m_is8Bit to true because we want an empty StringView
1595 to be 8-bit rather than 16-bit. This is consistent with what the empty() method
1598 * wtf/text/StringView.h:
1599 (WTF::StringView::setUnderlyingString):
1600 (WTF::StringView::StringView):
1601 (WTF::StringView::operator=):
1602 (WTF::StringView::initialize):
1603 (WTF::StringView::clear):
1604 (WTF::StringView::empty):
1605 (WTF::StringView::length):
1606 (WTF::StringView::operator bool):
1607 (WTF::StringView::is8Bit):
1608 (WTF::StringView::substring):
1609 (WTF::StringView::getCharactersWithUpconvert):
1610 (WTF::StringView::toString):
1611 (WTF::StringView::toAtomicString):
1612 (WTF::StringView::toFloat):
1613 (WTF::StringView::toInt):
1614 (WTF::StringView::toIntStrict):
1615 (WTF::StringView::toStringWithoutCopying):
1616 (WTF::StringView::find):
1618 2016-07-24 Filip Pizlo <fpizlo@apple.com>
1620 B3 should support multiple entrypoints
1621 https://bugs.webkit.org/show_bug.cgi?id=159391
1623 Reviewed by Saam Barati.
1625 * wtf/GraphNodeWorklist.h: Expose some handy functionality.
1626 (WTF::GraphNodeWorklist::pop):
1627 (WTF::GraphNodeWorklist::saw):
1628 (WTF::GraphNodeWorklist::seen):
1629 * wtf/VectorTraits.h: Fix a bug! Otherwise filling a vector of byte-sized enum classes doesn't work.
1631 2016-07-21 Myles C. Maxfield <mmaxfield@apple.com>
1633 [macOS] Caret placement occurs in the middle of new emoji group candidates
1634 https://bugs.webkit.org/show_bug.cgi?id=160008
1635 <rdar://problem/27430111>
1637 Reviewed by Simon Fraser.
1639 r203330 added support for new emoji group candidates. This patch updates the rules
1640 governing caret placement around these new emoji groups.
1642 * wtf/text/TextBreakIterator.cpp:
1643 (WTF::cursorMovementIterator):
1645 2016-07-20 Rajeev Misra <rajeevmisraforapple@gmail.com>
1647 Remove unnecessary if check from ParkingLot.cpp
1648 https://bugs.webkit.org/show_bug.cgi?id=159961
1650 Reviewed by Alex Christensen.
1652 A good practice is to have as less conditional statement
1653 or special cases as possible in code. This change
1654 simply removes a unnecessary "if" statement for
1655 condition which was already evaluated by switch/case
1656 and thus there was no need to evaluate again.
1658 * wtf/ParkingLot.cpp:
1660 2016-07-18 Anders Carlsson <andersca@apple.com>
1662 WebKit nightly fails to build on macOS Sierra
1663 https://bugs.webkit.org/show_bug.cgi?id=159902
1664 rdar://problem/27365672
1666 Reviewed by Tim Horton.
1668 * icu/unicode/ucurr.h: Added.
1669 Add ucurr.h from ICU.
1671 2016-07-18 Michael Saboff <msaboff@apple.com>
1673 ASSERTION FAILED: : (year >= 1970 && yearday >= 0) || (year < 1970 && yearday < 0) -- WTF/wtf/DateMath.cpp
1674 https://bugs.webkit.org/show_bug.cgi?id=159883
1676 Reviewed by Filip Pizlo.
1678 The function daysFrom1970ToYear() takes an integer year and returns a double result.
1679 The calculation uses 1970 as a baseline year and subtracts 1970 from the argument year.
1680 It does that subtraction using integer arithmetic, which given negative years close to
1681 INT_MIN can underflow as a result of subtracting 1970. Since we want a double result,
1682 the fix is to cast year as a double before the subtraction, which eliminates the underflow.
1685 (WTF::daysFrom1970ToYear):
1687 2016-07-17 Filip Pizlo <fpizlo@apple.com>
1689 RegisterSet should use a Bitmap instead of a BitVector so that it never allocates memory and is trivial to copy
1690 https://bugs.webkit.org/show_bug.cgi?id=159863
1692 Reviewed by Saam Barati.
1694 Give Bitmap all of the power of BitVector (except for automatic resizing). This means a
1695 variant of set() that takes a bool, and a bunch of helper methods (merge, filter, exclude,
1696 forEachSetBit, ==, !=, and hash).
1699 (WTF::WordType>::set):
1700 (WTF::WordType>::testAndSet):
1701 (WTF::WordType>::isFull):
1702 (WTF::WordType>::merge):
1703 (WTF::WordType>::filter):
1704 (WTF::WordType>::exclude):
1705 (WTF::WordType>::forEachSetBit):
1707 (WTF::WordType>::hash):
1709 2016-07-02 Filip Pizlo <fpizlo@apple.com>
1711 WTF::Lock should be fair eventually
1712 https://bugs.webkit.org/show_bug.cgi?id=159384
1714 Reviewed by Geoffrey Garen.
1716 In https://webkit.org/blog/6161/locking-in-webkit/ we showed how relaxing the fairness of
1717 locks makes them fast. That post presented lock fairness as a trade-off between two
1720 - Barging. A barging lock, like WTF::Lock, releases the lock in unlock() even if there was a
1721 thread on the queue. If there was a thread on the queue, the lock is released and that
1722 thread is made runnable. That thread may then grab the lock, or some other thread may grab
1723 the lock first (it may barge). Usually, the barging thread is the thread that released the
1724 lock in the first place. This maximizes throughput but hurts fairness. There is no good
1725 theoretical bound on how unfair the lock may become, but empirical data suggests that it's
1726 fair enough for the cases we previously measured.
1728 - FIFO. A FIFO lock, like HandoffLock in ToyLocks.h, does not release the lock in unlock()
1729 if there is a thread waiting. If there is a thread waiting, unlock() will make that thread
1730 runnable and inform it that it now holds the lock. This ensures perfect round-robin
1731 fairness and allows us to reason theoretically about how long it may take for a thread to
1732 grab the lock. For example, if we know that only N threads are running and each one may
1733 contend on a critical section, and each one may hold the lock for at most S seconds, then
1734 the time it takes to grab the lock is N * S. Unfortunately, FIFO locks perform very badly
1735 in most cases. This is because for the common case of short critical sections, they force
1736 a context switch after each critical section if the lock is contended.
1738 This change makes WTF::Lock almost as fair as FIFO while still being as fast as barging.
1739 Thanks to this new algorithm, you can now have both of these things at the same time.
1741 This change makes WTF::Lock eventually fair. We can almost (more on the caveats below)
1742 guarantee that the time it takes to grab a lock is N * max(1ms, S). In other words, critical
1743 sections that are longer than 1ms are always fair. For shorter critical sections, the amount
1744 of time that any thread waits is 1ms times the number of threads. There are some caveats
1745 that arise from our use of randomness, but even then, in the limit as the critical section
1746 length goes to infinity, the lock becomes fair. The corner cases are unlikely to happen; our
1747 experiments show that the lock becomes exactly as fair as a FIFO lock for any critical
1748 section that is 1ms or longer.
1750 The fairness mechanism is broken into two parts. WTF::Lock can now choose to unlock a lock
1751 fairly or unfairly thanks to the new ParkingLot token mechanism. WTF::Lock knows when to use
1752 fair unlocking based on a timeout mechanism in ParkingLot called timeToBeFair.
1754 ParkingLot::unparkOne() and ParkingLot::parkConditionally() can now communicate with each
1755 other via a token. unparkOne() can pass a token, which parkConditionally() will return. This
1756 change also makes parkConditionally() a lot more precise about when it was unparked due to a
1757 call to unparkOne(). If unparkOne() is told that a thread was unparked then this thread is
1758 guaranteed to report that it was unparked rather than timing out, and that thread is
1759 guaranteed to get the token that unparkOne() passed. The token is an intptr_t. We use it as
1760 a boolean variable in WTF::Lock, but you could use it to pass arbitrary data structures. By
1761 default, the token is zero. WTF::Lock's unlock() will pass 1 as the token if it is doing
1762 fair unlocking. In that case, unlock() will not release the lock, and lock() will know that
1763 it holds the lock as soon as parkConditionally() returns. Note that this algorithm relies
1764 on unparkOne() invoking WTF::Lock's callback while the queue lock is held, so that WTF::Lock
1765 can make a decision about unlock strategy and inject a token while it has complete knowledge
1766 over the state of the queue. As such, it's not immediately obvious how to implement this
1767 algorithm on top of futexes. You really need ParkingLot!
1769 WTF::Lock does not use fair unlocking every time. We expose a new API, Lock::unlockFairly(),
1770 which forces the fair unlocking behavior. Additionally, ParkingLot now maintains a
1771 per-bucket stochastic fairness timeout. When the timeout fires, the unparkOne() callback
1772 sees UnparkResult::timeToBeFair = true. This timeout is set to be anywhere from 0ms to 1ms
1773 at random. When a dequeue happens and there are threads that actually get dequeued, we check
1774 if the time since the last unfair unlock (the last time timeToBeFair was set to true) is
1775 more than the timeout amount. If so, then we set timeToBeFair to true and reset the timeout.
1776 This means that in the absence of ParkingLot collisions, unfair unlocking is guaranteed to
1777 happen at least once per millisecond. It will happen at 2 KHz on average. If there are
1778 collisions, then each collision adds one millisecond to the worst case (and 0.5 ms to the
1779 average case). The reason why we don't just use a fixed 1ms timeout is that we want to avoid
1780 resonance. Imagine a program in which some thread acquires a lock at 1 KHz in-phase with the
1781 timeToBeFair timeout. Then this thread would be the benefactor of fairness to the detriment
1782 of everyone else. Randomness ensures that we aren't too fair to any one thread.
1784 Empirically, this is neutral on our major benchmarks like JetStream but it's an enormous
1785 improvement in LockFairnessTest. It's common for an unfair lock (either our BargingLock, the
1786 old WTF::Lock, any of the other futex-based locks that barge, or new os_unfair_lock) to
1787 allow only one thread to hold the lock during a whole second in which each thread is holding
1788 the lock for 1ms at a time. This is because in a barging lock, releasing a lock after
1789 holding it for 1ms and then reacquiring it immediately virtually ensures that none of the
1790 other threads can wake up in time to grab it before it's relocked. But the new WTF::Lock
1791 handles this case like a champ: each thread gets equal turns.
1793 Here's some data. If we launch 10 threads and have each of them run for 1 second while
1794 repeatedly holding a critical section for 1ms, then here's how many times each thread gets
1795 to hold the lock using the old WTF::Lock algorithm:
1797 799, 6, 1, 1, 1, 1, 1, 1, 1, 1
1799 One thread hogged the lock for almost the whole time! With the new WTF::Lock, the lock
1800 becomes totally fair:
1802 80, 79, 79, 79, 79, 79, 79, 80, 80, 79
1804 I don't know of anyone creating such an automatically-fair adaptive lock before, so I think
1805 that this is a pretty awesome advancement to the state of the art!
1807 This change is good for three reasons:
1809 - We do have long critical sections in WebKit and we don't want to have to worry about
1810 starvation. This reduces the likelihood that we will see starvation due to our lock
1813 - I was talking to ggaren about bmalloc's locking needs, and he wanted unlockFairly() or
1814 lockFairly() or some moral equivalent for the scavenger thread.
1816 - If we use a WTF::Lock to manage heap access in a multithreaded GC, we'll need the ability
1817 to unlock and relock without barging.
1819 * benchmarks/LockFairnessTest.cpp:
1821 * benchmarks/ToyLocks.h:
1823 (WTF::ConditionBase::waitUntil):
1824 (WTF::ConditionBase::notifyOne):
1826 (WTF::LockBase::lockSlow):
1827 (WTF::LockBase::unlockSlow):
1828 (WTF::LockBase::unlockFairlySlow):
1829 (WTF::LockBase::unlockSlowImpl):
1831 (WTF::LockBase::try_lock):
1832 (WTF::LockBase::unlock):
1833 (WTF::LockBase::unlockFairly):
1834 (WTF::LockBase::isHeld):
1835 (WTF::LockBase::isFullyReset):
1836 * wtf/ParkingLot.cpp:
1837 (WTF::ParkingLot::parkConditionallyImpl):
1838 (WTF::ParkingLot::unparkOne):
1839 (WTF::ParkingLot::unparkOneImpl):
1840 (WTF::ParkingLot::unparkAll):
1842 (WTF::ParkingLot::parkConditionally):
1843 (WTF::ParkingLot::compareAndPark):
1844 (WTF::ParkingLot::unparkOne):
1846 2016-07-17 Myles C. Maxfield <mmaxfield@apple.com>
1848 Support new emoji group candidates
1849 https://bugs.webkit.org/show_bug.cgi?id=159755
1850 <rdar://problem/27325521>
1852 Reviewed by Dean Jackson.
1854 This patch doesn't update the rules for our cursor movement iterator, because
1855 I don't know the language used for implementing these rules. These rules will
1856 be updated in the near future. When they do,
1857 editing/deleting/delete-emoji-expected.txt will need to be updated.
1859 * wtf/text/TextBreakIterator.cpp:
1860 (WTF::cursorMovementIterator):
1862 2016-07-16 Chris Dumez <cdumez@apple.com>
1864 Add move constructor / assignment operator to ListHashSet
1865 https://bugs.webkit.org/show_bug.cgi?id=159837
1867 Reviewed by Darin Adler.
1869 Add move constructor / assignment operator to ListHashSet.
1871 * wtf/ListHashSet.h:
1872 (WTF::ListHashSetConstIterator::operator++):
1873 (WTF::U>::ListHashSet):
1876 (WTF::U>::appendNode):
1877 (WTF::U>::prependNode):
1878 (WTF::U>::deleteAllNodes):
1879 (WTF::ListHashSetNode::ListHashSetNode): Deleted.
1881 2016-07-15 Chris Dumez <cdumez@apple.com>
1883 Use emptyString() / nullAtom when possible
1884 https://bugs.webkit.org/show_bug.cgi?id=159850
1886 Reviewed by Ryosuke Niwa.
1888 Use emptyString() / nullAtom when possible, for performance.
1890 * wtf/text/AtomicString.cpp:
1891 (WTF::AtomicString::convertASCIICase):
1893 2016-07-15 Chris Dumez <cdumez@apple.com>
1895 Unreviewed, rolling out r203304.
1897 This is wrong because of Node* entries in the internal HashMap
1901 "Add move constructor / assignment operator to ListHashSet"
1902 https://bugs.webkit.org/show_bug.cgi?id=159837
1903 http://trac.webkit.org/changeset/203304
1905 2016-07-15 Chris Dumez <cdumez@apple.com>
1907 Add move constructor / assignment operator to ListHashSet
1908 https://bugs.webkit.org/show_bug.cgi?id=159837
1910 Reviewed by Alex Christensen.
1912 Add move constructor / assignment operator to ListHashSet.
1914 * wtf/ListHashSet.h:
1916 2016-07-15 Geoffrey Garen <ggaren@apple.com>
1918 Added a makeRef<T> helper
1919 https://bugs.webkit.org/show_bug.cgi?id=159835
1921 Reviewed by Andreas Kling.
1926 (WTF::makeRef): Helper function to do type inference for you.
1928 2016-07-15 Ryan Haddad <ryanhaddad@apple.com>
1930 Unreviewed, rolling out r203266.
1932 This change caused editing/deleting/delete-emoji.html to time
1933 out on El Capitan, crash under GuardMalloc
1937 "Support new emoji group candidates"
1938 https://bugs.webkit.org/show_bug.cgi?id=159755
1939 http://trac.webkit.org/changeset/203266
1941 2016-07-15 Csaba Osztrogonác <ossy@webkit.org>
1943 Revert r202560 to fix the ARMv7 build with ARM instruction set
1944 https://bugs.webkit.org/show_bug.cgi?id=159707
1946 Reviewed by Carlos Garcia Campos.
1948 * wtf/Platform.h: Revert r202560.
1950 2016-07-14 Myles C. Maxfield <mmaxfield@apple.com>
1952 Support new emoji group candidates
1953 https://bugs.webkit.org/show_bug.cgi?id=159755
1954 <rdar://problem/27325521>
1956 Reviewed by Dean Jackson.
1958 This patch doesn't update the rules for our cursor movement iterator, because
1959 I don't know the language used for implementing these rules. These rules will
1960 be updated in the near future. When they do,
1961 editing/deleting/delete-emoji-expected.txt will need to be updated.
1963 * wtf/text/TextBreakIterator.cpp:
1964 (WTF::cursorMovementIterator):
1966 2016-07-14 Alex Christensen <achristensen@webkit.org>
1968 Allow RefPtrs of const RefCounted types
1969 https://bugs.webkit.org/show_bug.cgi?id=158269
1971 Reviewed by Anders Carlsson.
1974 (WTF::RefCountedBase::ref):
1975 (WTF::RefCountedBase::~RefCountedBase):
1976 (WTF::RefCountedBase::derefBase):
1977 (WTF::RefCounted::deref):
1978 Creating references to a const object does not really modify the object,
1979 so everything in RefCounted is now mutable, and ref and deref are const.
1981 2016-07-14 Chris Dumez <cdumez@apple.com>
1983 Avoid an extra heap allocation when dispatching Functions to WorkQueue
1984 https://bugs.webkit.org/show_bug.cgi?id=158367
1986 Reviewed by Anders Carlsson.
1988 Avoid an extra heap allocation when dispatching Functions to WorkQueue
1989 by adding leakCallable() / adoptCallable() functions to Function.
1992 * wtf/cocoa/WorkQueueCocoa.cpp:
1993 (WTF::WorkQueue::dispatch):
1994 (WTF::WorkQueue::dispatchAfter):
1996 2016-07-13 Myles C. Maxfield <mmaxfield@apple.com>
1998 Addressing post-review comments after r203119
1999 https://bugs.webkit.org/show_bug.cgi?id=159749
2003 * wtf/text/StringView.h:
2004 (WTF::StringView::CodePoints::Iterator::Iterator):
2005 (WTF::StringView::CodePoints::Iterator::operator*):
2006 (WTF::StringView::CodePoints::Iterator::operator==):
2008 2016-07-13 Enrica Casucci <enrica@apple.com>
2010 Update supported platforms in xcconfig files to match the sdk names.
2011 https://bugs.webkit.org/show_bug.cgi?id=159728
2013 Reviewed by Tim Horton.
2015 * Configurations/Base.xcconfig:
2017 2016-07-13 Carlos Garcia Campos <cgarcia@igalia.com>
2019 [GTK] WebKitGtk+ uses too many file descriptors
2020 https://bugs.webkit.org/show_bug.cgi?id=152316
2022 Reviewed by Michael Catanzaro.
2024 Add helper functions to duplicate a file descriptor setting close on exec flag, and also to set close on exec
2025 flag to an existing file descriptor.
2027 * wtf/UniStdExtras.h:
2028 * wtf/UniStdExtras.cpp
2029 (WTF::setCloseOnExec):
2030 (WTF::dupCloseOnExec):
2032 2016-07-12 Benjamin Poulain <bpoulain@apple.com>
2034 [JSC] Array.prototype.join() fails some conformance tests
2035 https://bugs.webkit.org/show_bug.cgi?id=159657
2037 Reviewed by Saam Barati.
2039 * wtf/text/AtomicString.cpp:
2040 (WTF::AtomicString::number):
2041 * wtf/text/AtomicString.h:
2043 2016-07-12 Commit Queue <commit-queue@webkit.org>
2045 Unreviewed, rolling out r203131.
2046 https://bugs.webkit.org/show_bug.cgi?id=159698
2048 This change caused an existing LayoutTest to time out on debug
2049 testers (Requested by ryanhaddad on #webkit).
2053 "[JSC] Array.prototype.join() fails some conformance tests"
2054 https://bugs.webkit.org/show_bug.cgi?id=159657
2055 http://trac.webkit.org/changeset/203131
2057 2016-07-12 Filip Pizlo <fpizlo@apple.com>
2059 platformUserPreferredLanguages on Mac should not try to put the region into the language
2060 https://bugs.webkit.org/show_bug.cgi?id=159693
2062 Rubber stamped by Alexey Proskuryakov.
2064 Currently, navigator.language is the thing that we use as the BCP-47 tag in our Intl code
2065 when certain APIs are called without a locale argument. That mostly makes sense, and is
2066 deeply wired into our engine.
2068 In r200105, we made Intl aware of the region as a separate thing from the language by having
2069 platformUserPreferredLanguages() return something like a BCP-47 tag that was
2070 <language>-<region>. For example, if I told System Preferences that I want to speak English
2071 but live in Poland then we'd get "en-pl". This had the effect of making Intl APIs format
2072 dates using Polish formatting, for example.
2074 But this is an odd change, since that same function also feeds into navigator.language.
2075 "en-pl" isn't what we want there, since my System Preferences settings aren't supposed to
2076 mean that I want to speak Polish-style English. There's no such thing.
2078 It may be worthwhile to wire the region settings more elegantly into Intl, but if we do that,
2079 it should be via a mechanism that is separate from navigator.language. So, this change simply
2082 * wtf/PlatformUserPreferredLanguagesMac.mm:
2083 (WTF::httpStyleLanguageCode):
2084 (WTF::platformUserPreferredLanguages):
2085 (WTF::isValidICUCountryCode): Deleted.
2087 2016-07-12 Per Arne Vollan <pvollan@apple.com>
2089 [Win] Fix for build error when trying to version stamp dll.
2090 https://bugs.webkit.org/show_bug.cgi?id=159692
2092 Reviewed by Brent Fulgham.
2094 Use correct path to version stamp script.
2096 * wtf/CMakeLists.txt:
2098 2016-07-12 Benjamin Poulain <bpoulain@apple.com>
2100 [JSC] Array.prototype.join() fails some conformance tests
2101 https://bugs.webkit.org/show_bug.cgi?id=159657
2103 Reviewed by Saam Barati.
2105 * wtf/text/AtomicString.cpp:
2106 (WTF::AtomicString::number):
2107 * wtf/text/AtomicString.h:
2109 2016-07-12 Myles C. Maxfield <mmaxfield@apple.com>
2111 Relax ordering requirements on StringView::CodePoints iterator
2112 https://bugs.webkit.org/show_bug.cgi?id=159609
2114 Reviewed by Darin Adler.
2116 Previously, there was a requirement where if you use a CodePoints
2117 iterator, you couldn't dereference twice in a row or increment
2118 twice in a row. This restriction is unnecessary.
2120 * wtf/text/StringView.h:
2121 (WTF::StringView::CodePoints::Iterator::Iterator):
2122 (WTF::StringView::CodePoints::Iterator::advanceCurrentCodePoint):
2123 (WTF::StringView::CodePoints::Iterator::operator*):
2124 (WTF::StringView::CodePoints::Iterator::operator==):
2126 2016-07-12 Csaba Osztrogonác <ossy@webkit.org>
2128 JSCOnly bulidfix after r203078
2129 https://bugs.webkit.org/show_bug.cgi?id=159669
2131 Reviewed by Yusuke Suzuki.
2133 * wtf/PlatformJSCOnly.cmake:
2134 * wtf/text/jsconly/TextBreakIteratorInternalICUJSCOnly.cpp: Added.
2135 (WTF::currentSearchLocaleID):
2136 (WTF::currentTextBreakLocaleID):
2138 2016-07-12 Per Arne Vollan <pvollan@apple.com>
2140 [Win] DLLs are missing version information.
2141 https://bugs.webkit.org/show_bug.cgi?id=159349
2143 Reviewed by Brent Fulgham.
2145 Generate autoversion.h and run perl version stamp utility.
2147 * wtf/CMakeLists.txt:
2149 2016-07-11 Myles C. Maxfield <mmaxfield@apple.com>
2151 Implement grapheme cluster iterator on StringView
2152 https://bugs.webkit.org/show_bug.cgi?id=159598
2154 Reviewed by Anders Carlsson.
2156 This is in preparation for honoring the second argument to FontFaceSet.load().
2158 * wtf/text/StringView.cpp:
2159 (WTF::StringView::GraphemeClusters::Iterator::Impl::Impl):
2160 (WTF::StringView::GraphemeClusters::Iterator::Impl::operator++):
2161 (WTF::StringView::GraphemeClusters::Iterator::Impl::operator*):
2162 (WTF::StringView::GraphemeClusters::Iterator::Impl::operator==):
2163 (WTF::StringView::GraphemeClusters::Iterator::Impl::computeIndexEnd):
2164 (WTF::StringView::GraphemeClusters::Iterator::Iterator):
2165 (WTF::StringView::GraphemeClusters::Iterator::~Iterator):
2166 (WTF::StringView::GraphemeClusters::Iterator::operator*):
2167 (WTF::StringView::GraphemeClusters::Iterator::operator==):
2168 (WTF::StringView::GraphemeClusters::Iterator::operator!=):
2169 * wtf/text/StringView.h:
2170 (WTF::StringView::GraphemeClusters::GraphemeClusters):
2171 * text/TextBreakIterator.cpp:
2172 (WebCore::NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator):
2173 * text/TextBreakIterator.h:
2175 2016-07-10 Myles C. Maxfield <mmaxfield@apple.com>
2177 Move breaking iterator code to WTF
2178 https://bugs.webkit.org/show_bug.cgi?id=159594
2180 Reviewed by Alex Christensen.
2182 This is in preparation for giving StringView a GraphemeClusters iterator.
2183 Such an interator needs to be implemented on top of our breaking iterator
2186 * WTF.xcodeproj/project.pbxproj:
2187 * icu/unicode/ubrk.h: Added.
2188 * icu/unicode/utext.h: Renamed from Source/WebCore/icu/unicode/utext.h.
2189 * wtf/CMakeLists.txt:
2190 * wtf/PlatformEfl.cmake:
2191 * wtf/PlatformGTK.cmake:
2192 * wtf/PlatformMac.cmake:
2193 * wtf/PlatformWin.cmake:
2194 * wtf/TinyLRUCache.h:
2195 * wtf/text/LineBreakIteratorPoolICU.h: Renamed from Source/WebCore/platform/text/LineBreakIteratorPoolICU.h.
2196 (WTF::LineBreakIteratorPool::LineBreakIteratorPool):
2197 (WTF::LineBreakIteratorPool::sharedPool):
2198 (WTF::LineBreakIteratorPool::makeLocaleWithBreakKeyword):
2199 (WTF::LineBreakIteratorPool::take):
2200 (WTF::LineBreakIteratorPool::put):
2201 * wtf/text/TextBreakIterator.cpp: Renamed from Source/WebCore/platform/text/TextBreakIterator.cpp.
2202 (WTF::initializeIterator):
2203 (WTF::initializeIteratorWithRules):
2204 (WTF::setTextForIterator):
2205 (WTF::setContextAwareTextForIterator):
2206 (WTF::wordBreakIterator):
2207 (WTF::sentenceBreakIterator):
2208 (WTF::cursorMovementIterator):
2209 (WTF::acquireLineBreakIterator):
2210 (WTF::releaseLineBreakIterator):
2211 (WTF::mapLineIteratorModeToRules):
2213 (WTF::openLineBreakIterator):
2214 (WTF::closeLineBreakIterator):
2215 (WTF::compareAndSwapNonSharedCharacterBreakIterator):
2216 (WTF::NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator):
2217 (WTF::NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator):
2218 (WTF::textBreakFirst):
2219 (WTF::textBreakLast):
2220 (WTF::textBreakNext):
2221 (WTF::textBreakPrevious):
2222 (WTF::textBreakPreceding):
2223 (WTF::textBreakFollowing):
2224 (WTF::textBreakCurrent):
2226 (WTF::isWordTextBreak):
2227 (WTF::numGraphemeClusters):
2228 (WTF::numCharactersInGraphemeClusters):
2229 * wtf/text/TextBreakIterator.h: Renamed from Source/WebCore/platform/text/TextBreakIterator.h.
2230 (WTF::LazyLineBreakIterator::LazyLineBreakIterator):
2231 (WTF::LazyLineBreakIterator::~LazyLineBreakIterator):
2232 (WTF::LazyLineBreakIterator::string):
2233 (WTF::LazyLineBreakIterator::isLooseCJKMode):
2234 (WTF::LazyLineBreakIterator::lastCharacter):
2235 (WTF::LazyLineBreakIterator::secondToLastCharacter):
2236 (WTF::LazyLineBreakIterator::setPriorContext):
2237 (WTF::LazyLineBreakIterator::updatePriorContext):
2238 (WTF::LazyLineBreakIterator::resetPriorContext):
2239 (WTF::LazyLineBreakIterator::priorContextLength):
2240 (WTF::LazyLineBreakIterator::get):
2241 (WTF::LazyLineBreakIterator::resetStringAndReleaseIterator):
2242 (WTF::NonSharedCharacterBreakIterator::operator TextBreakIterator*):
2243 * wtf/text/TextBreakIteratorInternalICU.h: Renamed from Source/WebCore/platform/text/TextBreakIteratorInternalICU.h.
2244 * wtf/text/efl/TextBreakIteratorInternalICUEfl.cpp: Renamed from Source/WebCore/platform/text/efl/TextBreakIteratorInternalICUEfl.cpp.
2245 (WebCore::currentSearchLocaleID):
2246 (WebCore::currentTextBreakLocaleID):
2247 * wtf/text/gtk/TextBreakIteratorInternalICUGtk.cpp: Renamed from Source/WebCore/platform/text/gtk/TextBreakIteratorInternalICUGtk.cpp.
2248 (WebCore::currentSearchLocaleID):
2249 (WebCore::currentTextBreakLocaleID):
2250 * wtf/text/icu/UTextProvider.cpp: Renamed from Source/WebCore/platform/text/icu/UTextProvider.cpp.
2252 (WTF::uTextCloneImpl):
2253 * wtf/text/icu/UTextProvider.h: Renamed from Source/WebCore/platform/text/icu/UTextProvider.h.
2254 (WTF::uTextProviderContext):
2255 (WTF::initializeContextAwareUTextProvider):
2256 (WTF::uTextAccessPinIndex):
2257 (WTF::uTextAccessInChunkOrOutOfRange):
2258 * wtf/text/icu/UTextProviderLatin1.cpp: Renamed from Source/WebCore/platform/text/icu/UTextProviderLatin1.cpp.
2259 (WTF::uTextLatin1Clone):
2260 (WTF::uTextLatin1NativeLength):
2261 (WTF::uTextLatin1Access):
2262 (WTF::uTextLatin1Extract):
2263 (WTF::uTextLatin1MapOffsetToNative):
2264 (WTF::uTextLatin1MapNativeIndexToUTF16):
2265 (WTF::uTextLatin1Close):
2266 (WTF::openLatin1UTextProvider):
2267 (WTF::textLatin1ContextAwareGetCurrentContext):
2268 (WTF::textLatin1ContextAwareMoveInPrimaryContext):
2269 (WTF::textLatin1ContextAwareSwitchToPrimaryContext):
2270 (WTF::textLatin1ContextAwareMoveInPriorContext):
2271 (WTF::textLatin1ContextAwareSwitchToPriorContext):
2272 (WTF::uTextLatin1ContextAwareClone):
2273 (WTF::uTextLatin1ContextAwareNativeLength):
2274 (WTF::uTextLatin1ContextAwareAccess):
2275 (WTF::uTextLatin1ContextAwareExtract):
2276 (WTF::uTextLatin1ContextAwareClose):
2277 (WTF::openLatin1ContextAwareUTextProvider):
2278 * wtf/text/icu/UTextProviderLatin1.h: Renamed from Source/WebCore/platform/text/icu/UTextProviderLatin1.h.
2279 * wtf/text/icu/UTextProviderUTF16.cpp: Renamed from Source/WebCore/platform/text/icu/UTextProviderUTF16.cpp.
2280 (WTF::textUTF16ContextAwareGetCurrentContext):
2281 (WTF::textUTF16ContextAwareMoveInPrimaryContext):
2282 (WTF::textUTF16ContextAwareSwitchToPrimaryContext):
2283 (WTF::textUTF16ContextAwareMoveInPriorContext):
2284 (WTF::textUTF16ContextAwareSwitchToPriorContext):
2285 (WTF::uTextUTF16ContextAwareClone):
2286 (WTF::uTextUTF16ContextAwareNativeLength):
2287 (WTF::uTextUTF16ContextAwareAccess):
2288 (WTF::uTextUTF16ContextAwareExtract):
2289 (WTF::uTextUTF16ContextAwareClose):
2290 (WTF::openUTF16ContextAwareUTextProvider):
2291 * wtf/text/icu/UTextProviderUTF16.h: Renamed from Source/WebCore/platform/text/icu/UTextProviderUTF16.h.
2292 * wtf/text/mac/TextBreakIteratorInternalICUMac.mm: Renamed from Source/WebCore/platform/text/mac/TextBreakIteratorInternalICUMac.mm.
2293 (WTF::textBreakLocalePreference):
2294 (WTF::topLanguagePreference):
2296 (WTF::getSearchLocale):
2297 (WTF::currentSearchLocaleID):
2298 (WTF::getTextBreakLocale):
2299 (WTF::currentTextBreakLocaleID):
2300 * wtf/text/win/TextBreakIteratorInternalICUWin.cpp: Renamed from Source/WebCore/platform/text/win/TextBreakIteratorInternalICUWin.cpp.
2301 (WebCore::currentSearchLocaleID):
2302 (WebCore::currentTextBreakLocaleID):
2304 2016-07-08 Commit Queue <commit-queue@webkit.org>
2306 Unreviewed, rolling out r202799.
2307 https://bugs.webkit.org/show_bug.cgi?id=159568
2309 Caused build failure (Requested by perarne on #webkit).
2313 "[Win] DLLs are missing version information."
2314 https://bugs.webkit.org/show_bug.cgi?id=159349
2315 http://trac.webkit.org/changeset/202799
2317 2016-07-08 Jiewen Tan <jiewen_tan@apple.com>
2319 Define DYLD_MACOSX_VERSION_10_12
2320 https://bugs.webkit.org/show_bug.cgi?id=159525
2321 <rdar://problem/26250296>
2323 Reviewed by Brent Fulgham.
2325 * wtf/spi/darwin/dyldSPI.h:
2327 2016-07-01 Jer Noble <jer.noble@apple.com>
2329 REGRESSION (r202641): Netflix playback stalls after a few seconds
2330 https://bugs.webkit.org/show_bug.cgi?id=159365
2332 Reviewed by Eric Carlson.
2334 Add a isBetween() convenience method.
2336 * wtf/MediaTime.cpp:
2337 (WTF::MediaTime::isBetween):
2340 2016-07-03 Per Arne Vollan <pvollan@apple.com>
2342 [Win] DLLs are missing version information.
2343 https://bugs.webkit.org/show_bug.cgi?id=159349
2345 Reviewed by Brent Fulgham.
2347 Generate autoversion.h in the prebuild step.
2348 Run the perl version stamp utility.
2350 * wtf/CMakeLists.txt:
2352 2016-07-03 Saam Barati <sbarati@apple.com>
2354 BytecodeGenerator::getVariablesUnderTDZ is too conservative
2355 https://bugs.webkit.org/show_bug.cgi?id=159387
2357 Reviewed by Filip Pizlo.
2359 I've templatized SmallPtrSet on its SmallArraySize instead
2360 of it always being 8.
2362 * wtf/SmallPtrSet.h:
2363 (WTF::SmallPtrSet::SmallPtrSet):
2364 (WTF::SmallPtrSet::add):
2365 (WTF::SmallPtrSet::iterator::operator!=):
2366 (WTF::SmallPtrSet::bucket):
2368 2016-07-03 Filip Pizlo <fpizlo@apple.com>
2370 Ugh. Once again, unreviewed, roll out unintentional commit in r202790.
2372 * benchmarks/LockFairnessTest.cpp:
2375 2016-07-02 Dan Bernstein <mitz@apple.com>
2379 * wtf/Assertions.cpp:
2381 2016-07-02 Filip Pizlo <fpizlo@apple.com>
2383 Unreviewed, roll back unintentional commit in r202778.
2385 * benchmarks/LockFairnessTest.cpp:
2388 2016-07-01 Jer Noble <jer.noble@apple.com>
2390 Deadlock inside -[WebCoreNSURLSession dealloc]
2391 https://bugs.webkit.org/show_bug.cgi?id=159331
2392 <rdar://problem/27122716>
2394 Reviewed by Alex Christensen.
2396 A Function<> object can wrap any callable type, including a C++ lambda.
2398 dispatchFunctionsFromMainThread() holds a lock while iterating over the functions in
2399 functionQueue(), and during ths iteration, the previous callable object is destroyed by
2400 assigning the result of functionQueue().takeFirst(). Because lambdas (and other callables,
2401 like functors) can own objects, destroying this callable can have side effects, and if one
2402 of those side effects is to call callOnMainThread(), this can deadlock.
2404 Move this side-effect-having call outside the locked block by clearing the function object
2405 immediately after calling it.
2407 * wtf/MainThread.cpp:
2408 (WTF::dispatchFunctionsFromMainThread):
2410 2016-06-29 Jer Noble <jer.noble@apple.com>
2413 https://bugs.webkit.org/show_bug.cgi?id=159250
2415 Reviewed by Eric Carlson.
2417 Add USE_MEDIAREMOTE.
2421 2016-06-28 Commit Queue <commit-queue@webkit.org>
2423 Unreviewed, rolling out r202580.
2424 https://bugs.webkit.org/show_bug.cgi?id=159245
2426 Caused all WKTR tests to fail on GuardMalloc and Production
2427 only for unknown reasons, investigating offline. (Requested by
2432 "RunLoop::Timer should use constructor templates instead of
2434 https://bugs.webkit.org/show_bug.cgi?id=159153
2435 http://trac.webkit.org/changeset/202580
2437 2016-06-28 Brian Burg <bburg@apple.com>
2439 RunLoop::Timer should use constructor templates instead of class templates
2440 https://bugs.webkit.org/show_bug.cgi?id=159153
2442 Reviewed by Alex Christensen.
2444 Refactor RunLoop::Timer to align with WebCore::Timer. Use a constructor
2445 template instead of a class template. Store a bound std::function rather than
2446 a templated member and function. Add a constructor that takes a std::function.
2449 (WTF::RunLoop::Timer::Timer):
2450 (WTF::RunLoop::Timer::fired):
2452 2016-06-28 Tomas Popela <tpopela@redhat.com>
2454 THUMB2 support not correctly detected on Fedora with GCC 6.1.
2455 https://bugs.webkit.org/show_bug.cgi?id=159083
2457 Reviewed by Carlos Garcia Campos.
2459 On Fedora 24 with GCC 6.1. the __thumb2__ and __thumb__ are not
2460 defined so the detection of THUMB2 support will fail. Look also
2461 whether the __ARM_ARCH_ISA_THUMB is defined to fix the THUMB2
2466 2016-06-27 Joseph Pecoraro <pecoraro@apple.com>
2468 Remove now unused WTF::findNextLineStart
2469 https://bugs.webkit.org/show_bug.cgi?id=159157
2471 Reviewed by Mark Lam.
2473 Unused after r202498.
2475 * wtf/text/StringImpl.cpp:
2476 (WTF::StringImpl::findNextLineStart): Deleted.
2477 * wtf/text/StringImpl.h:
2478 (WTF::findNextLineStart): Deleted.
2479 * wtf/text/WTFString.h:
2480 (WTF::String::findNextLineStart): Deleted.
2482 2016-06-21 Anders Carlsson <andersca@apple.com>
2484 Rename NoncopyableFunction to Function
2485 https://bugs.webkit.org/show_bug.cgi?id=158354
2487 Reviewed by Chris Dumez.
2489 * WTF.xcodeproj/project.pbxproj:
2490 * wtf/CrossThreadTask.h:
2491 (WTF::CrossThreadTask::CrossThreadTask):
2492 * wtf/Function.h: Renamed from Source/WTF/wtf/NoncopyableFunction.h.
2493 * wtf/FunctionDispatcher.h:
2494 * wtf/MainThread.cpp:
2495 (WTF::functionQueue):
2496 (WTF::dispatchFunctionsFromMainThread):
2497 (WTF::callOnMainThread):
2500 (WTF::RunLoop::performWork):
2501 (WTF::RunLoop::dispatch):
2504 * wtf/cocoa/WorkQueueCocoa.cpp:
2505 (WTF::WorkQueue::dispatch):
2506 (WTF::WorkQueue::dispatchAfter):
2507 * wtf/efl/DispatchQueueWorkItemEfl.h:
2508 (WorkItem::WorkItem):
2509 (TimerWorkItem::create):
2510 (TimerWorkItem::TimerWorkItem):
2511 * wtf/efl/WorkQueueEfl.cpp:
2512 (WTF::WorkQueue::dispatch):
2513 (WTF::WorkQueue::dispatchAfter):
2514 * wtf/generic/RunLoopGeneric.cpp:
2515 (WTF::RunLoop::TimerBase::ScheduledTask::create):
2516 (WTF::RunLoop::TimerBase::ScheduledTask::ScheduledTask):
2517 (WTF::RunLoop::dispatchAfter):
2518 * wtf/generic/WorkQueueGeneric.cpp:
2519 (WorkQueue::dispatch):
2520 (WorkQueue::dispatchAfter):
2521 * wtf/glib/RunLoopGLib.cpp:
2522 (WTF::DispatchAfterContext::DispatchAfterContext):
2523 (WTF::RunLoop::dispatchAfter):
2524 * wtf/win/WorkItemWin.cpp:
2525 (WTF::WorkItemWin::WorkItemWin):
2526 (WTF::WorkItemWin::create):
2527 (WTF::HandleWorkItem::HandleWorkItem):
2528 (WTF::HandleWorkItem::createByAdoptingHandle):
2529 * wtf/win/WorkItemWin.h:
2530 (WTF::WorkItemWin::function):
2531 * wtf/win/WorkQueueWin.cpp:
2532 (WTF::WorkQueue::dispatch):
2533 (WTF::WorkQueue::dispatchAfter):
2535 2016-06-23 David Kilzer <ddkilzer@apple.com>
2537 REGRESSION (r202380): iOS 9.x internal builds are broken
2539 Follow-up fix for: Enable window.open() for existing versions of Secret Society
2540 <https://webkit.org/b/159049>
2541 <rdar://problem/26528349>
2543 * wtf/spi/darwin/dyldSPI.h: Define DYLD_IOS_VERSION_10_0 when
2544 building on internal SDKs older than iOS 10.
2546 2016-06-23 John Wilander <wilander@apple.com>
2548 Enable window.open() for existing versions of Secret Society
2549 https://bugs.webkit.org/show_bug.cgi?id=159049
2550 <rdar://problem/26528349>
2552 Reviewed by Andy Estes.
2554 The Secret Society Hidden Mystery app has a broken version check treating iOS 10
2555 as iOS 1 on iPads. Therefore it believes it can use window.open() in a tap
2556 handler. We should allow the existing versions of the app to do this to not break
2559 * wtf/spi/darwin/dyldSPI.h:
2560 Added DYLD_IOS_VERSION_10_0.
2562 2016-06-21 Said Abou-Hallawa <sabouhallawa@apple,com>
2564 Add system tracing points for requestAnimationFrame() workflow
2565 https://bugs.webkit.org/show_bug.cgi?id=158723
2567 Reviewed by Simon Fraser.
2569 Define new trace score codes for requestAnimationFrame().
2571 * wtf/SystemTracing.h:
2573 (WTF::TraceScope::TraceScope):
2574 (WTF::TraceScope::~TraceScope):
2576 2016-06-20 Commit Queue <commit-queue@webkit.org>
2578 Unreviewed, rolling out r202136.
2579 https://bugs.webkit.org/show_bug.cgi?id=158932
2581 JSBench wasn't regressed by r202002 and r202111 on iOS after
2582 all (Requested by rniwa_ on #webkit).
2586 "Unreviewed, rolling out r202002 and r202111."
2587 https://bugs.webkit.org/show_bug.cgi?id=158638
2588 http://trac.webkit.org/changeset/202136
2590 2016-06-17 Chris Dumez <cdumez@apple.com>
2592 Optimize parseCacheHeader() by using StringView
2593 https://bugs.webkit.org/show_bug.cgi?id=158891
2595 Reviewed by Darin Adler.
2597 Add a StringView::find() overload which takes a CharacterMatchFunction
2598 to match the one on String.
2600 * wtf/text/StringView.h:
2601 (WTF::StringView::find):
2603 2016-06-17 Mark Lam <mark.lam@apple.com>
2605 OOM Assertion failure in JSON.stringify.
2606 https://bugs.webkit.org/show_bug.cgi?id=158794
2607 <rdar://problem/26826254>
2609 Reviewed by Saam Barati.
2611 The bug was actually in StringBuilder::appendQuotedJSONString() where it failed
2612 to detect an imminent unsigned int overflow. The fix is to use Checked<unsigned>
2613 for the needed math, and RELEASE_ASSERT afterwards that we did not overflow.
2615 I also added more assertions to detect sooner if any there are any problems with
2616 StringBuilder's m_buffer or m_length being incorrectly sized. These assertions
2617 have been run on the JSC and layout tests without any issue.
2619 * wtf/text/StringBuilder.cpp:
2620 (WTF::StringBuilder::resize):
2621 (WTF::StringBuilder::allocateBuffer):
2622 (WTF::StringBuilder::allocateBufferUpConvert):
2623 (WTF::StringBuilder::reallocateBuffer<LChar>):
2624 (WTF::StringBuilder::reallocateBuffer<UChar>):
2625 (WTF::StringBuilder::reserveCapacity):
2626 (WTF::StringBuilder::appendUninitializedSlow):
2627 (WTF::StringBuilder::append):
2628 (WTF::StringBuilder::appendQuotedJSONString):
2629 * wtf/text/StringBuilder.h:
2630 (WTF::StringBuilder::swap):
2632 2016-06-14 Filip Pizlo <fpizlo@apple.com>
2634 Baseline JIT should be concurrent
2635 https://bugs.webkit.org/show_bug.cgi?id=158755
2637 Reviewed by Geoffrey Garen.
2639 The concurrent baseline JIT needs to be able to clone bytecode to get a consistent snapshot.
2640 So, this adds such a method.
2642 * wtf/RefCountedArray.h:
2643 (WTF::RefCountedArray::RefCountedArray):
2644 (WTF::RefCountedArray::clone):
2646 2016-06-16 Chris Dumez <cdumez@apple.com>
2648 No need to ref connection in lambda inside NetworkResourceLoader::tryStoreAsCacheEntry()
2649 https://bugs.webkit.org/show_bug.cgi?id=158862
2651 Reviewed by Darin Adler.
2653 Add NoncopyableFunction constructor that takes a nullptr_t in, in order
2654 to match the std::function API and make porting from one to the other
2657 * wtf/NoncopyableFunction.h:
2659 2016-06-16 Chris Dumez <cdumez@apple.com>
2661 Unreviewed, rolling out r202002 and r202111.
2663 Ryosuke says this was a JSBench regression on iOS
2665 Reverted changesets:
2667 "Make HashMap and HashSet work with Refs"
2668 https://bugs.webkit.org/show_bug.cgi?id=158638
2669 http://trac.webkit.org/changeset/202002
2671 "Improve HashMap and HashSet support for Ref"
2672 https://bugs.webkit.org/show_bug.cgi?id=158789
2673 http://trac.webkit.org/changeset/202111
2675 2016-06-15 Chris Dumez <cdumez@apple.com>
2677 [Cocoa] Clean up / optimize ResourceResponse::platformLazyInit(InitLevel)
2678 https://bugs.webkit.org/show_bug.cgi?id=158809
2680 Reviewed by Darin Adler.
2682 Add toAtomicString() method to StringView to avoid having to call toString()
2683 and then atomizing the String at call sites.
2685 * wtf/text/StringView.h:
2686 (WTF::StringView::toAtomicString):
2688 2016-06-15 Sam Weinig <sam@webkit.org>
2690 Improve HashMap and HashSet support for Ref
2691 https://bugs.webkit.org/show_bug.cgi?id=158789
2693 Reviewed by Chris Dumez.
2695 Tests: Add more cases to WTF_HashMap.Ref_Key, WTF_HashMap.Ref_Value and WTF_HashSet.Ref
2699 Add a MappedTakeType typedef and rework the take functions to use it and HashTraits::take(...).
2702 (WTF::GenericHashTraits::assignToEmpty):
2703 Move to GenericHashTraits rather than GenericHashTraitsBase, since it is not different
2704 between integral and non-integral HashTraits.
2706 (WTF::GenericHashTraits::take):
2707 Add a trait function for take that defaults as a forward. This allows us to override take
2708 just like we do with get/peek.
2710 (WTF::HashTraits<Ref<P>>::emptyValue):
2711 Remove unnecessary explicit construction.
2713 (WTF::HashTraits<Ref<P>>::peek):
2714 Fix assertion that could happen if you did a HashMap.get() on an empty Ref value.
2716 (WTF::HashTraits<Ref<P>>::take):
2717 Make the TakeType of a Ref<P> be Optional<Ref<P>>, to avoid having empty
2718 Refs returned from HashMap and HashSet. Implement an explicit take() function to
2721 (WTF::HashTraits<Ref<P>>::customDeleteBucket): Deleted.
2722 Remove unnecessary customDeleteBucket implementation. Ref does not assign nullptr to
2723 it's m_ptr in destruction, so there is no dead store to avoid here.
2726 (WTF::Ref::ptrAllowingHashTableEmptyValue):
2727 Add HashTrait helper to allow getting the value of m_ptr even when it is null. This
2728 allows us to avoid a branch in HashTraits<Ref<P>>::peek().
2730 2016-06-15 Konstantin Tokarev <annulen@yandex.ru>
2732 Only Mac port needs ObjC API for JSC
2733 https://bugs.webkit.org/show_bug.cgi?id=158780
2735 Reviewed by Philippe Normand.
2737 * wtf/FeatureDefines.h:
2739 2016-06-15 Yusuke Suzuki <utatane.tea@gmail.com>
2741 Unreviewed, follow up patch for r202092
2742 https://bugs.webkit.org/show_bug.cgi?id=158661
2744 During checking Windows port on EWS, accidentally introduce the regression.
2748 2016-06-15 Yusuke Suzuki <utatane.tea@gmail.com>
2750 [JSC] Move calling convention flags to WTF
2751 https://bugs.webkit.org/show_bug.cgi?id=158661
2753 Reviewed by Keith Miller.
2757 2016-06-14 Myles C. Maxfield <mmaxfield@apple.com>
2759 Honor bidi unicode codepoints
2760 https://bugs.webkit.org/show_bug.cgi?id=149170
2761 <rdar://problem/26527378>
2763 Reviewed by Simon Fraser.
2765 * wtf/unicode/CharacterNames.h:
2767 2016-06-14 Commit Queue <commit-queue@webkit.org>
2769 Unreviewed, rolling out r202057.
2770 https://bugs.webkit.org/show_bug.cgi?id=158749
2772 This change broke the Windows build. (Requested by ryanhaddad
2777 "Honor bidi unicode codepoints"
2778 https://bugs.webkit.org/show_bug.cgi?id=149170
2779 http://trac.webkit.org/changeset/202057
2781 2016-06-14 Myles C. Maxfield <mmaxfield@apple.com>
2783 Honor bidi unicode codepoints
2784 https://bugs.webkit.org/show_bug.cgi?id=149170
2785 <rdar://problem/26527378>
2787 Reviewed by Simon Fraser.
2789 * wtf/unicode/CharacterNames.h:
2791 2016-06-13 Alex Christensen <achristensen@webkit.org>
2793 Add WebSocketProvider stub
2794 https://bugs.webkit.org/show_bug.cgi?id=158702
2796 Reviewed by Brady Eidson.
2799 (WTF::UniqueRef::operator->):
2800 (WTF::UniqueRef::operator T&):
2801 (WTF::UniqueRef::operator const T&):
2802 Added operator T& to avoid unneeded .get() calls.
2804 2016-06-13 Sam Weinig <sam@webkit.org>
2806 Make HashMap and HashSet work with Refs
2807 https://bugs.webkit.org/show_bug.cgi?id=158638
2809 Reviewed by Darin Adler.
2812 Move HashTableDeletedValueType and HashTableEmptyValueType here, as they are now shared
2813 by more than one smart pointer. This file should probably be renamed to something else
2814 at some point to indicate that it contains helpers for pointer and ref related functionality.
2816 * wtf/HashFunctions.h:
2817 Add a DefaultHash for Refs. Customize the PtrHash to indicate that it is not safe to compare
2818 to empty or deleted Refs.
2821 (WTF::HashMapTranslator::equal):
2822 (WTF::HashMapTranslator::translate):
2823 (WTF::HashMapEnsureTranslator::equal):
2824 (WTF::HashMapEnsureTranslator::translate):
2826 (WTF::IdentityExtractor::extract):
2827 (WTF::HashSetTranslator::hash):
2828 (WTF::HashSetTranslator::equal):
2829 (WTF::HashSetTranslator::translate):
2831 (WTF::IdentityHashTranslator::hash):
2832 (WTF::IdentityHashTranslator::equal):
2833 (WTF::IdentityHashTranslator::translate):
2834 Use the new assignToEmpty trait function to allow uninitialized Ref's to be safely assigned to.
2837 (WTF::HashTraits<Ref<P>>::emptyValue):
2838 (WTF::HashTraits<Ref<P>>::isEmptyValue):
2839 (WTF::HashTraits<Ref<P>>::assignToEmpty):
2840 (WTF::HashTraits<Ref<P>>::peek):
2841 (WTF::HashTraits<Ref<P>>::customDeleteBucket):
2842 Add custom HashTraits for Ref. Also, introduce a new trait function, assignToEmpty, for use
2843 in translation assignments. This is necessary since the default assignment operator for Ref
2844 will not allow assignment to the empty Ref, which we need to do here.
2847 (WTF::Ref::operator=):
2849 (WTF::Ref::isHashTableDeletedValue):
2850 (WTF::Ref::hashTableDeletedValue):
2851 (WTF::Ref::isHashTableEmptyValue):
2852 (WTF::Ref::hashTableEmptyValue):
2853 Add explicit constructors/predicates for making deleted/empty Refs.
2855 (WTF::Ref::assignToHashTableEmptyValue):
2856 Add a special function that allows assignment to an empty Ref, which the
2857 assignment operator does not.
2860 Add an IsSmartPtr override to indicate that Ref is a smart pointer.
2863 Move HashTableDeletedValueType to GetPtr.h.
2865 2016-06-13 Fujii Hironori <Hironori.Fujii@sony.com>
2867 Stack overflow at RefPtr::release on Windows port since r201782
2868 https://bugs.webkit.org/show_bug.cgi?id=158687
2870 Reviewed by Chris Dumez.
2872 RefPtr::release calls RefPtr::RefPtr, and RefPtr::RefPtr calls
2875 RefPtr::RefPtr does not need to call RefPtr::release.
2878 (WTF::RefPtr::RefPtr): Do not call RefPtr::release.
2880 2016-06-11 Myles C. Maxfield <mmaxfield@apple.com>
2882 Addressing post-review comments after r201978.
2883 https://bugs.webkit.org/show_bug.cgi?id=158649
2884 <rdar://problem/13258122>
2888 * wtf/text/StringCommon.h:
2890 (WTF::naiveEqualWithoutPerformingUnicodeNormalization): Deleted.
2892 2016-06-11 Myles C. Maxfield <mmaxfield@apple.com>
2894 [Cocoa] Map commonly used Chinese Windows font names to names present on Cocoa operating systems
2895 https://bugs.webkit.org/show_bug.cgi?id=158649
2896 <rdar://problem/13258122>
2898 Reviewed by Darin Adler.
2900 * wtf/text/StringCommon.h:
2901 (WTF::naiveEqualWithoutPerformingUnicodeNormalization): Added.
2903 2016-06-11 Chris Dumez <cdumez@apple.com>
2905 WorkerNavigator is missing some attributes
2906 https://bugs.webkit.org/show_bug.cgi?id=158593
2907 <rdar://problem/26731334>
2909 Reviewed by Darin Adler.
2911 * wtf/PlatformUserPreferredLanguages.h:
2912 * wtf/PlatformUserPreferredLanguagesWin.cpp:
2913 (WTF::platformLanguage):
2914 (WTF::platformUserPreferredLanguages):
2916 Make platformUserPreferredLanguages() thread safe on Windows. The
2917 Mac and Unix implementations are already thread-safe.
2919 HAS_FASTCALL_CALLING_CONVENTION is changed to COMPILER_SUPPORTS(FASTCALL_CALLING_CONVENTION).
2921 2016-06-10 Alex Christensen <achristensen@webkit.org>
2923 Introduce WTF::UniqueRef
2924 https://bugs.webkit.org/show_bug.cgi?id=158596
2926 Reviewed by Brady Eidson.
2928 WTF::UniqueRef is like a std::unique_ptr that is guaranteed to be non-null.
2929 std::make_unique returns a non-null value that is put into a std::unique_ptr, a type
2930 that could contain null values. To be able to pass such values around and store them
2931 without wondering if they are null, we now have WTF::UniqueRef which cannot be null.
2933 * WTF.xcodeproj/project.pbxproj:
2934 * wtf/CMakeLists.txt:
2935 * wtf/UniqueRef.h: Added.
2936 (WTF::makeUniqueRef):
2937 (WTF::UniqueRef::UniqueRef):
2938 (WTF::UniqueRef::get):
2939 (WTF::UniqueRef::operator&):
2940 (WTF::UniqueRef::operator->):
2942 2016-06-09 Brady Eidson <beidson@apple.com>
2944 Unaddressed review feedback from r201872
2946 * wtf/CrossThreadTask.h:
2947 (WTF::callFunctionForCrossThreadTask): Fix typo.
2949 2016-06-09 Brady Eidson <beidson@apple.com>
2951 Greatly simplify CrossThreadTask.h.
2952 https://bugs.webkit.org/show_bug.cgi?id=158542
2954 Reviewed by Darin Adler.
2956 * wtf/CrossThreadTask.h:
2957 (WTF::crossThreadCopy):
2958 (WTF::callFunctionForCrossThreadTaskImpl):
2959 (WTF::callFunctionForCrossThreadTask):
2960 (WTF::createCrossThreadTask):
2961 (WTF::callMemberFunctionForCrossThreadTaskImpl):
2962 (WTF::callMemberFunctionForCrossThreadTask):
2964 2016-06-08 Brady Eidson <beidson@apple.com>
2966 Make CrossThreadCopier more efficient (fewer copies!).
2967 https://bugs.webkit.org/show_bug.cgi?id=158456
2969 Reviewed by Alex Christensen.
2971 Previously, we'd run all arguments through CrossThreadCopier, then immediately make
2972 an unnecessary copy of the result during lambda capture.
2974 Instead, we should just put the CrossThreadCopier generated objects directly in lambdas,
2975 which are then captured by NoncopyableFunctions.
2977 This reduces the number of constructor calls per argument from 2 copies to 1 move.
2979 * wtf/CrossThreadTask.h:
2980 (WTF::CrossThreadTask::CrossThreadTask):
2981 (WTF::createCrossThreadTask):
2983 2016-06-07 Filip Pizlo <fpizlo@apple.com>
2985 Implement Air::allocateStack() in ES6 to see how much of a bad idea that is
2986 https://bugs.webkit.org/show_bug.cgi?id=158318
2988 Reviewed by Saam Barati.
2991 (WTF::executeInsertions): I found a bug while rewriting this code in JS.
2992 * wtf/PrintStream.h:
2993 (WTF::PrintStream::print):
2994 (WTF::PrintStream::println): This is useful to have.
2996 2016-06-07 Keith Rollin <krollin@apple.com>
2998 Remove all uses of PassRefPtr in WTF
2999 https://bugs.webkit.org/show_bug.cgi?id=157596
3000 <rdar://problem/26234391>
3002 Reviewed by Chris Dumez.
3004 Remove/update most interfaces that take or return PassRefPtrs.
3005 Remaining references include those in non-Cocoa implementations and
3006 those required for continued compatibility with modules that still use
3007 PassRefPtrs (specifically: Forward.h, RefPtr interoperability,
3008 SizeLimits.h, WorkQueue (Windows) DispatchQueueEfl,
3009 DispatchWorkItemEfl, and PassRefPtr itself).
3011 Update calls to interfaces that no longer take or return PassRefPtrs.
3013 Update adoptRef(T*) to return a RefPtr instead of a PassRefPtr and
3014 move it to RefPtr.h from PassRefPtr.h.
3016 * wtf/MetaAllocator.cpp:
3017 (WTF::MetaAllocator::allocate):
3018 * wtf/MetaAllocator.h:
3019 * wtf/ParallelJobsGeneric.h:
3020 (WTF::ParallelEnvironment::ThreadPrivate::create):
3021 * wtf/text/AtomicStringImpl.cpp:
3022 (WTF::HashAndUTF8CharactersTranslator::translate):
3023 (WTF::SubstringTranslator::translate):
3024 * wtf/text/CString.cpp:
3025 (WTF::CStringBuffer::createUninitialized):
3026 * wtf/text/CString.h:
3027 * wtf/text/StringBuilder.cpp:
3028 (WTF::StringBuilder::reifyString):
3029 (WTF::StringBuilder::resize):
3030 (WTF::StringBuilder::reallocateBuffer<LChar>):
3031 (WTF::StringBuilder::reallocateBuffer<UChar>):
3032 * wtf/text/StringImpl.cpp:
3033 (WTF::StringImpl::reallocateInternal):
3034 (WTF::StringImpl::reallocate):
3035 (WTF::StringImpl::create8BitIfPossible):
3036 (WTF::StringImpl::createSymbol):
3037 (WTF::StringImpl::createNullSymbol):
3038 (WTF::StringImpl::convertToLowercaseWithoutLocale):
3039 (WTF::StringImpl::convertToUppercaseWithoutLocale):
3040 (WTF::StringImpl::convertToLowercaseWithLocale):
3041 (WTF::StringImpl::convertToUppercaseWithLocale):
3042 (WTF::StringImpl::convertASCIICase):
3043 * wtf/text/StringImpl.h:
3044 (WTF::StringImpl::StringImpl):
3045 (WTF::StringImpl::createSubstringSharingImpl):
3046 (WTF::StringImpl::tryCreateUninitialized):
3047 (WTF::StringImpl::extractFoldedStringInSymbol):
3048 * wtf/text/SymbolRegistry.cpp:
3049 (WTF::SymbolRegistry::symbolForKey):
3050 * wtf/text/WTFString.cpp:
3051 (WTF::String::substringSharingImpl):
3052 * wtf/text/WTFString.h:
3053 (WTF::String::String): Deleted.
3054 * wtf/text/cf/StringImplCF.cpp:
3056 2016-06-07 Yusuke Suzuki <utatane.tea@gmail.com>
3058 [JSC] Do not allocate unnecessary UTF-8 string for encodeXXX functions
3059 https://bugs.webkit.org/show_bug.cgi?id=158416
3061 Reviewed by Darin Adler and Geoffrey Garen.
3064 (WTF::Bitmap::size):
3065 (WTF::WordType>::Bitmap):
3066 (WTF::WordType>::get):
3067 (WTF::WordType>::set):
3068 (WTF::WordType>::testAndSet):
3069 (WTF::WordType>::testAndClear):
3070 (WTF::WordType>::concurrentTestAndSet):
3071 (WTF::WordType>::concurrentTestAndClear):
3072 (WTF::WordType>::clear):
3073 (WTF::WordType>::clearAll):
3074 (WTF::WordType>::nextPossiblyUnset):
3075 (WTF::WordType>::findRunOfZeros):
3076 (WTF::WordType>::count):
3077 (WTF::WordType>::isEmpty):
3078 (WTF::WordType>::isFull):
3080 2016-06-06 Saam Barati <sbarati@apple.com>
3082 equal(StringView, StringView) for strings should have a fast path for pointer equality
3083 https://bugs.webkit.org/show_bug.cgi?id=158452
3085 Reviewed by Andreas Kling.
3087 JSBench does a lot of StringView::operator== on StringViews that have
3088 the same underlying characters pointer. This becomes hot inside JSBench
3089 because JSBench heavily stresses JSC's UnlinkedCodeCache with a high
3090 hit rate. This means that when we get a hit in the cache, we used to
3091 do the long form of string compare. However, we were often comparing
3092 two StringViews that had the same underlying buffer and length.
3093 This patch speeds this case up to run in constant time instead of
3096 * wtf/text/StringCommon.h:
3098 * wtf/text/StringImpl.h:
3099 (WTF::StringImpl::StringImpl):
3100 (WTF::StringImpl::data):
3101 * wtf/text/StringView.h:
3102 (WTF::StringView::data):
3104 2016-06-04 Anders Carlsson <andersca@apple.com>
3106 Get rid of WorkItemWin
3107 https://bugs.webkit.org/show_bug.cgi?id=158381
3109 Reviewed by Sam Weinig.
3111 * wtf/PlatformWin.cmake:
3113 * wtf/win/WorkItemWin.cpp: Removed.
3114 (WTF::WorkItemWin::WorkItemWin): Deleted.
3115 (WTF::WorkItemWin::create): Deleted.
3116 (WTF::WorkItemWin::~WorkItemWin): Deleted.
3117 * wtf/win/WorkItemWin.h: Removed.
3118 (WTF::WorkItemWin::function): Deleted.
3119 (WTF::WorkItemWin::queue): Deleted.
3120 * wtf/win/WorkQueueWin.cpp:
3121 (WTF::WorkQueue::performWorkOnRegisteredWorkThread):
3122 (WTF::WorkQueue::dispatch):
3124 2016-06-03 Anders Carlsson <andersca@apple.com>
3126 Get rid of HANDLE registration code in WorkQueueWin
3127 https://bugs.webkit.org/show_bug.cgi?id=158375
3129 Reviewed by Darin Adler.
3132 * wtf/win/WorkItemWin.cpp:
3133 (WTF::HandleWorkItem::HandleWorkItem): Deleted.
3134 (WTF::HandleWorkItem::createByAdoptingHandle): Deleted.
3135 (WTF::HandleWorkItem::~HandleWorkItem): Deleted.
3136 * wtf/win/WorkItemWin.h:
3137 (WTF::HandleWorkItem::setWaitHandle): Deleted.
3138 (WTF::HandleWorkItem::waitHandle): Deleted.
3139 * wtf/win/WorkQueueWin.cpp:
3140 (WTF::WorkQueue::handleCallback): Deleted.
3141 (WTF::WorkQueue::platformInvalidate): Deleted.
3142 (WTF::WorkQueue::unregisterWaitAndDestroyItemSoon): Deleted.
3143 (WTF::WorkQueue::unregisterWaitAndDestroyItemCallback): Deleted.
3145 2016-06-03 Commit Queue <commit-queue@webkit.org>
3147 Unreviewed, rolling out r201663.
3148 https://bugs.webkit.org/show_bug.cgi?id=158374
3150 Broke the Windows build (Requested by andersca on #webkit).
3154 "Rename NoncopyableFunction to Function"
3155 https://bugs.webkit.org/show_bug.cgi?id=158354
3156 http://trac.webkit.org/changeset/201663
3158 2016-06-03 Anders Carlsson <andersca@apple.com>
3160 Rename NoncopyableFunction to Function
3161 https://bugs.webkit.org/show_bug.cgi?id=158354
3163 Reviewed by Chris Dumez.
3165 * WTF.xcodeproj/project.pbxproj:
3166 * wtf/CrossThreadTask.h:
3167 (WTF::CrossThreadTask::CrossThreadTask):
3168 * wtf/Function.h: Renamed from Source/WTF/wtf/NoncopyableFunction.h.
3169 * wtf/FunctionDispatcher.h:
3170 * wtf/MainThread.cpp:
3171 (WTF::functionQueue):
3172 (WTF::dispatchFunctionsFromMainThread):
3173 (WTF::callOnMainThread):
3176 (WTF::RunLoop::performWork):
3177 (WTF::RunLoop::dispatch):
3180 * wtf/cocoa/WorkQueueCocoa.cpp:
3181 (WTF::WorkQueue::dispatch):
3182 (WTF::WorkQueue::dispatchAfter):
3183 * wtf/efl/DispatchQueueWorkItemEfl.h:
3184 (WorkItem::WorkItem):
3185 (TimerWorkItem::create):
3186 (TimerWorkItem::TimerWorkItem):
3187 * wtf/efl/WorkQueueEfl.cpp:
3188 (WTF::WorkQueue::dispatch):
3189 (WTF::WorkQueue::dispatchAfter):
3190 * wtf/generic/RunLoopGeneric.cpp:
3191 (WTF::RunLoop::TimerBase::ScheduledTask::create):
3192 (WTF::RunLoop::TimerBase::ScheduledTask::ScheduledTask):
3193 (WTF::RunLoop::dispatchAfter):
3194 * wtf/generic/WorkQueueGeneric.cpp:
3195 (WorkQueue::dispatch):
3196 (WorkQueue::dispatchAfter):
3197 * wtf/glib/RunLoopGLib.cpp:
3198 (WTF::DispatchAfterContext::DispatchAfterContext):
3199 (WTF::RunLoop::dispatchAfter):
3200 * wtf/win/WorkItemWin.cpp:
3201 (WTF::WorkItemWin::WorkItemWin):
3202 (WTF::WorkItemWin::create):
3203 (WTF::HandleWorkItem::HandleWorkItem):
3204 (WTF::HandleWorkItem::createByAdoptingHandle):
3205 * wtf/win/WorkItemWin.h:
3206 (WTF::WorkItemWin::function):
3207 * wtf/win/WorkQueueWin.cpp:
3208 (WTF::WorkQueue::dispatch):
3209 (WTF::WorkQueue::dispatchAfter):
3211 2016-06-03 Mark Lam <mark.lam@apple.com>
3213 Clean up how StackVisitor dumps its frames.
3214 https://bugs.webkit.org/show_bug.cgi?id=158316
3216 Reviewed by Keith Miller.
3218 Added an Indenter class what works with dataLog.
3220 * WTF.xcodeproj/project.pbxproj:
3221 * wtf/Indenter.h: Added.
3222 (WTF::Indenter::Indenter):
3223 (WTF::Indenter::dump):
3224 (WTF::Indenter::operator++):
3225 (WTF::Indenter::operator--):
3227 2016-06-02 Said Abou-Hallawa <sabouhallawa@apple,com>
3229 [iOS] PDFDocumentImage should not create a cached image larger than 4M pixels
3230 https://bugs.webkit.org/show_bug.cgi?id=157857
3232 Reviewed by Darin Adler.
3234 * wtf/StdLibExtras.h: Add a constant value for GB (2^30).
3236 2016-06-02 Oliver Hunt <oliver@apple.com>
3238 JS parser incorrectly handles invalid utf8 in error messages.
3239 https://bugs.webkit.org/show_bug.cgi?id=158128
3241 Reviewed by Saam Barati.
3243 Add a new toStringWithLatin1Fallback that simply uses
3244 String::fromUTF8WithLatin1Fallback, so we can avoid the
3245 standard String::fromUTF8 null return.
3247 * wtf/StringPrintStream.cpp:
3248 (WTF::StringPrintStream::toStringWithLatin1Fallback):
3249 * wtf/StringPrintStream.h:
3251 2016-06-02 Keith Miller <keith_miller@apple.com>
3253 Unreviewed, reland r201532. The associated regressions have been fixed
3256 2016-06-02 Filip Pizlo <fpizlo@apple.com>
3258 Use "= delete" for Locker(int)
3260 Rubber stamped by Saam Barati.
3262 See discussion: https://bugs.webkit.org/show_bug.cgi?id=158306#c8
3265 (WTF::Locker::Locker):
3266 (WTF::Locker::~Locker):
3268 2016-06-02 Filip Pizlo <fpizlo@apple.com>
3270 Make it harder to accidentally pass an integer to a locker.
3272 Rubber stamped by Keith Miller.
3274 See here for the discussion: https://bugs.webkit.org/show_bug.cgi?id=158306#c3
3277 (WTF::Locker::Locker):
3278 (WTF::Locker::~Locker):
3280 2016-06-02 Filip Pizlo <fpizlo@apple.com>
3282 Make it easier to use NoLockingNecessary
3283 https://bugs.webkit.org/show_bug.cgi?id=158306
3285 Reviewed by Keith Miller.
3287 An idiom that we borrowed from LLVM is that if a function requires a lock to be held, we
3288 have it take a const Locker& as its first argument. This may not communicate which lock is
3289 to be held, but it does help us to remember that some lock must be held. So far, it's been
3290 relatively easy to then figure out which lock. We've had bugs where we forgot to hold a
3291 lock but I don't remember the last time we had a bug where we grabbed the wrong lock.
3293 But sometimes, we know at the point where we call such a method that we actually don't
3294 need to hold any lock. This usually happens during object construction. If we're
3295 constructing some object then we usually know that we have not escaped it yet, so we don't
3296 need to waste time acquiring its lock. We could solve this by having a separate set of
3297 methods that don't do or require locking. This would be cumbersome, since usually for
3298 every variant that takes const Locker&, there is already one that doesn't, and that one
3299 will grab the lock for you. So this means having a third variant, that also doesn't take a
3300 const Locker&, but does no locking. That's pretty weird.
3302 So, we introduced NoLockingNecessary for situations like this. The idiom went like so:
3304 Locker<Whatever> locker(Locker<Whatever>::NoLockingNecessary)
3307 Usually though, there would be some distance between where the locker is defined and where
3308 it's used, so when you just look at stuff->foo(locker) in isolation you don't know if this
3309 is a real locker or a NoLockingNecessary cast. Also, requiring two lines for this just
3312 This change makes this easier. Now you can just do:
3314 stuff->foo(NoLockingNecessary).
3316 This is because NoLockingNecessary has been pulled out into the WTF namespace (and is
3317 usinged from the global namespace) and the Locker<> constructor that takes
3318 NoLockingNecessaryTag is now implicit.
3320 The only possible downside of this change is that people might use this idiom more
3321 frequently now that it's easier to use. I don't think that's a bad thing. I'm now
3322 convinced that this is not a bad idiom. When I was fixing an unrelated bug, I almost went
3323 the way of adding more locking to some core JSC data structures, and in the process, I
3324 needed to use NoLockingNecessary. It's clear that this is a general-purpose idiom and we
3325 should not impose artificial constraints on its use.
3328 (WTF::Locker::Locker):
3329 (WTF::Locker::~Locker):
3331 2016-06-01 Brady Eidson <beidson@apple.com>
3333 Get rid of StringCapture.
3334 https://bugs.webkit.org/show_bug.cgi?id=158285
3336 Reviewed by Chris Dumez.
3338 * wtf/text/WTFString.h:
3339 (WTF::StringCapture::StringCapture): Deleted.
3340 (WTF::StringCapture::string): Deleted.
3341 (WTF::StringCapture::releaseString): Deleted.
3342 (WTF::StringCapture::operator=): Deleted.
3344 2016-06-01 Benjamin Poulain <bpoulain@apple.com>
3346 [JSC] Some setters for components of Date do not timeClip() their result
3347 https://bugs.webkit.org/show_bug.cgi?id=158278
3352 (WTF::equivalentYearForDST): Deleted.
3353 The assertion is bogus.
3354 As the comments above explains, the function is completely wrong for years
3355 outside [1900-2100].
3356 The tests passing large values for years are failing (year <= maxYear).
3357 The weird NaN test is a mystery. The old changelog does not explain it.
3359 2016-05-31 Commit Queue <commit-queue@webkit.org>
3361 Unreviewed, rolling out r201363 and r201456.
3362 https://bugs.webkit.org/show_bug.cgi?id=158240
3364 "40% regression on date-format-xparb" (Requested by
3365 keith_miller on #webkit).
3367 Reverted changesets:
3369 "LLInt should be able to cache prototype loads for values in
3371 https://bugs.webkit.org/show_bug.cgi?id=158032
3372 http://trac.webkit.org/changeset/201363
3374 "get_by_id should support caching unset properties in the
3376 https://bugs.webkit.org/show_bug.cgi?id=158136
3377 http://trac.webkit.org/changeset/201456
3379 2016-05-31 Brady Eidson <beidson@apple.com>
3381 Make createCrossThreadTask() functions return on the stack instead of the heap.
3382 https://bugs.webkit.org/show_bug.cgi?id=158215
3384 Reviewed by Darin Adler.
3386 * WTF.xcodeproj/project.pbxproj:
3388 * wtf/CrossThreadCopier.cpp:
3390 * wtf/CrossThreadQueue.h: Added. A lightweight of MessageQueue that deals directly
3391 in objects instead of in std::unique_ptrs.
3392 (WTF::CrossThreadQueue::isKilled):
3393 (WTF::CrossThreadQueue<DataType>::append):
3394 (WTF::CrossThreadQueue<DataType>::waitForMessage):
3395 (WTF::CrossThreadQueue<DataType>::tryGetMessage):
3397 * wtf/CrossThreadTask.h:
3398 (WTF::createCrossThreadTask):
3399 (WTF::CrossThreadTask::CrossThreadTask): Deleted.
3401 2016-05-30 Brady Eidson <beidson@apple.com>
3403 Move CrossThreadCopier/CrossThreadTask to WTF.
3404 https://bugs.webkit.org/show_bug.cgi?id=158207
3406 Reviewed by Alex Christensen.
3408 * WTF.xcodeproj/project.pbxproj:
3409 * wtf/CMakeLists.txt:
3411 * wtf/CrossThreadCopier.cpp: Renamed from Source/WebCore/platform/CrossThreadCopier.cpp.
3412 * wtf/CrossThreadCopier.h: Renamed from Source/WebCore/platform/CrossThreadCopier.h.
3413 (WTF::CrossThreadCopierPassThrough::copy):
3415 * wtf/CrossThreadTask.h: Renamed from Source/WebCore/platform/CrossThreadTask.h.
3416 (WTF::CrossThreadTask::CrossThreadTask):
3417 (WTF::CrossThreadTask::performTask):
3418 (WTF::createCrossThreadTask):
3420 2016-05-28 Chris Dumez <cdumez@apple.com>
3422 Templatize NoncopyableFunction class similarly to std::function
3423 https://bugs.webkit.org/show_bug.cgi?id=158185
3425 Reviewed by Darin Adler.
3427 Templatize NoncopyableFunction class similarly to std::function, so
3428 that it can be used as a std::function replacement in more places.
3430 Previously, NoncopyableFunction could only support "void()" lambdas.
3432 * wtf/FunctionDispatcher.h:
3433 * wtf/MainThread.cpp:
3434 (WTF::functionQueue):
3435 (WTF::dispatchFunctionsFromMainThread):
3436 (WTF::callOnMainThread):
3438 * wtf/NoncopyableFunction.h:
3440 (WTF::RunLoop::performWork):
3441 (WTF::RunLoop::dispatch):
3444 * wtf/cocoa/WorkQueueCocoa.cpp:
3445 (WTF::WorkQueue::dispatch):
3446 (WTF::WorkQueue::dispatchAfter):
3447 * wtf/efl/DispatchQueueWorkItemEfl.h:
3448 (WorkItem::WorkItem):
3449 (TimerWorkItem::create):
3450 (TimerWorkItem::TimerWorkItem):
3451 * wtf/efl/WorkQueueEfl.cpp:
3452 (WTF::WorkQueue::dispatch):
3453 (WTF::WorkQueue::dispatchAfter):
3454 * wtf/generic/RunLoopGeneric.cpp:
3455 (WTF::RunLoop::TimerBase::ScheduledTask::create):
3456 (WTF::RunLoop::TimerBase::ScheduledTask::ScheduledTask):
3457 (WTF::RunLoop::dispatchAfter):
3458 * wtf/generic/WorkQueueGeneric.cpp:
3459 (WorkQueue::dispatch):
3460 (WorkQueue::dispatchAfter):
3461 * wtf/glib/RunLoopGLib.cpp:
3462 (WTF::DispatchAfterContext::DispatchAfterContext):
3463 (WTF::RunLoop::dispatchAfter):
3464 * wtf/win/WorkItemWin.cpp:
3465 (WTF::WorkItemWin::WorkItemWin):
3466 (WTF::WorkItemWin::create):
3467 (WTF::HandleWorkItem::HandleWorkItem):
3468 (WTF::HandleWorkItem::createByAdoptingHandle):
3469 * wtf/win/WorkItemWin.h:
3470 (WTF::WorkItemWin::function):
3471 * wtf/win/WorkQueueWin.cpp:
3472 (WTF::WorkQueue::dispatch):
3473 (WTF::WorkQueue::dispatchAfter):
3475 2016-05-28 Dan Bernstein <mitz@apple.com>
3477 Build fix for projects that include MainThread.h without including FastMalloc.h.
3479 * wtf/NoncopyableFunction.h: Include FastMalloc.h from here.
3481 2016-05-27 Chris Dumez <cdumez@apple.com>
3483 callOnMainThread() should not copy captured lambda variables
3484 https://bugs.webkit.org/show_bug.cgi?id=158166
3486 Reviewed by Brady Eidson.
3488 callOnMainThread() should not copy captured lambda variables. This
3489 function is usually called cross-thread with a lambda and copying
3490 the lambda (and its captured variables) can lead to thread-safety
3493 This patch updates callOnMainThread() to take a NoncopyableFunction&&
3494 in parameter instead of a std::function. The call sites of
3495 callOnMainThread() have also been updated to use C++14's lambda
3496 capture with initializer.
3498 * WTF.xcodeproj/project.pbxproj:
3500 * wtf/FunctionDispatcher.h:
3501 * wtf/NoncopyableFunction.h:
3502 - Moved NoncopyableFunction from FunctionDispatcher.h to
3503 NoncopyableFunction.h.
3504 - Add a new operator=(nullptr_t) operator to NoncopyableFunction to
3505 match std::function, as one of the call sites needed it.
3507 * wtf/MainThread.cpp:
3508 (WTF::functionQueue):
3509 (WTF::dispatchFunctionsFromMainThread):
3510 (WTF::callOnMainThread):
3513 2016-05-27 Yusuke Suzuki <utatane.tea@gmail.com>
3515 Unreviewed, build fix for JSCOnly port.
3516 https://bugs.webkit.org/show_bug.cgi?id=158111
3518 Use NoncopyableFunction instead of std::function<>.
3520 * wtf/generic/RunLoopGeneric.cpp:
3521 (WTF::RunLoop::TimerBase::ScheduledTask::create):
3522 (WTF::RunLoop::TimerBase::ScheduledTask::ScheduledTask):
3524 2016-05-27 Chris Dumez <cdumez@apple.com>
3526 WorkQueue::dispatch() / RunLoop::dispatch() should not copy captured lambda variables
3527 https://bugs.webkit.org/show_bug.cgi?id=158111
3529 Reviewed by Darin Adler.
3531 WorkQueue::dispatch() / RunLoop::dispatch() should not copy captured lambda variables.
3532 These are often used cross-thread and copying the captured lambda variables can be
3533 dangerous (e.g. we do not want to copy a String after calling isolatedCopy() upon
3536 This patch introduces a new NoncopyableFunction type that behaves similarly to
3537 std::function but guarantees that the passed-in lambda (and its captured variables)
3538 cannot be copied. This new NoncopyableFunction type is now used for
3539 WorkQueue / RunLoop's dispatch() / dispatchAfter() which are commonly used
3540 cross-thread. This should now allow us to call WorkQueue::dispatch() with a lambda
3541 that captures a String like so:
3542 [str = str.isolatedCopy()]() { }
3544 Also note that even though this is not leveraged in this patch, NoncopyableFunction
3545 would allow us to capture move-only types such as std::unique_ptr as so:
3546 [p = WTFMove(p)]() { }
3547 This does not work if we convert the lambda into an std::function because
3548 std::function requires the lambda to be copyable, NoncopyableFunction does not.
3550 * wtf/FunctionDispatcher.h:
3551 (WTF::CallableWrapperBase::~CallableWrapperBase):
3552 (WTF::NoncopyableFunction::NoncopyableFunction):
3553 (WTF::NoncopyableFunction::operator()):
3554 (WTF::NoncopyableFunction::operator bool):
3555 (WTF::NoncopyableFunction::operator=):
3557 (WTF::RunLoop::performWork):
3558 (WTF::RunLoop::dispatch):
3561 * wtf/cocoa/WorkQueueCocoa.cpp:
3562 (WTF::WorkQueue::dispatch):
3563 (WTF::WorkQueue::dispatchAfter):
3564 * wtf/efl/DispatchQueueWorkItemEfl.h:
3565 (WorkItem::WorkItem):
3566 (TimerWorkItem::create):
3567 (TimerWorkItem::TimerWorkItem):
3568 * wtf/efl/WorkQueueEfl.cpp:
3569 (WTF::WorkQueue::dispatch):
3570 (WTF::WorkQueue::dispatchAfter):
3571 * wtf/generic/RunLoopGeneric.cpp:
3572 (WTF::RunLoop::dispatchAfter):
3573 * wtf/generic/WorkQueueGeneric.cpp:
3574 (WorkQueue::dispatch):
3575 (WorkQueue::dispatchAfter):
3576 * wtf/glib/RunLoopGLib.cpp:
3577 (WTF::DispatchAfterContext::DispatchAfterContext):
3578 (WTF::RunLoop::dispatchAfter):
3579 * wtf/win/WorkItemWin.cpp:
3580 (WTF::WorkItemWin::WorkItemWin):
3581 (WTF::WorkItemWin::create):
3582 (WTF::HandleWorkItem::HandleWorkItem):
3583 (WTF::HandleWorkItem::createByAdoptingHandle):
3584 * wtf/win/WorkItemWin.h:
3585 (WTF::WorkItemWin::function):
3586 * wtf/win/WorkQueueWin.cpp:
3587 (WTF::WorkQueue::dispatch):
3588 (WTF::WorkQueue::timerCallback):
3589 (WTF::WorkQueue::dispatchAfter):
3591 2016-05-26 Filip Pizlo <fpizlo@apple.com>
3593 ScopedLambda should have a lifetime story that makes sense to the compiler
3594 https://bugs.webkit.org/show_bug.cgi?id=158118
3596 Reviewed by Mark Lam.
3598 Prior to this change, there were two lifetime bugs in ScopedLambda:
3600 - scopedLambda(Functor&&) would bind Functor to const lambda&, so the resulting ScopedLambdaFunctor
3601 would hold a reference to the original lambda. This would have surprising behavior; for example
3602 it meant that this code was wrong:
3604 auto l = scopedLambda<things>([&] ...);
3606 The solution is to have explicit copy/move versions of scopedLambda() rather than rely on perfect
3609 - ScopedLambdaFunctor did not override its copy or move operations, so if the compiler did not RVO
3610 scopedLambda(), it would return a ScopedLambdaFunctor whose m_arg points to a dead temporary
3611 ScopedLambdaFunctor instance. The solution is to have explicit copy/move constructors and
3612 operators, which preserve the invariant that ScopedLambda::m_arg points to this.
3614 One nice side-effect of all of these constructors and operators being explicit is that we can rely
3615 on WTFMove's excellent assertions, which helped catch the first issue.
3617 This reverts ParkingLot to use ScopedLambda again.
3619 * wtf/ParkingLot.cpp:
3620 (WTF::ParkingLot::parkConditionallyImpl):
3621 (WTF::ParkingLot::unparkOne):
3622 (WTF::ParkingLot::unparkOneImpl):
3624 (WTF::ParkingLot::parkConditionally):
3625 (WTF::ParkingLot::unparkOne):
3626 * wtf/ScopedLambda.h:
3627 (WTF::scopedLambda):
3629 2016-05-25 Anders Carlsson <andersca@apple.com>
3631 Get rid of WTF/Functional.h
3632 https://bugs.webkit.org/show_bug.cgi?id=158081
3634 Reviewed by Chris Dumez.
3636 This is no longer used, and removing it will free up the name for a new Functional.h implementation.
3638 * WTF.xcodeproj/project.pbxproj:
3639 * wtf/Functional.h: Removed.
3640 (WTF::RefAndDeref::ref): Deleted.
3641 (WTF::RefAndDeref::deref): Deleted.
3642 (WTF::ParamStorageTraits::wrap): Deleted.
3643 (WTF::ParamStorageTraits::unwrap): Deleted.
3644 (WTF::ParamStorageTraits<PassRefPtr<T>>::wrap): Deleted.
3645 (WTF::ParamStorageTraits<PassRefPtr<T>>::unwrap): Deleted.
3646 (WTF::ParamStorageTraits<RefPtr<T>>::wrap): Deleted.
3647 (WTF::ParamStorageTraits<RefPtr<T>>::unwrap): Deleted.
3648 (WTF::ParamStorageTraits<RetainPtr<T>>::wrap): Deleted.
3649 (WTF::ParamStorageTraits<RetainPtr<T>>::unwrap): Deleted.
3650 (WTF::FunctionImplBase::~FunctionImplBase): Deleted.
3651 (WTF::FunctionBase::isNull): Deleted.
3652 (WTF::FunctionBase::FunctionBase): Deleted.
3653 (WTF::FunctionBase::impl): Deleted.
3654 (WTF::bind): Deleted.
3655 * wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
3657 2016-05-24 Keith Miller <keith_miller@apple.com>
3659 LLInt should be able to cache prototype loads for values in GetById
3660 https://bugs.webkit.org/show_bug.cgi?id=158032
3662 Reviewed by Filip Pizlo.
3664 Add move constructors/initializers to Bags.
3668 (WTF::Bag::operator=):
3670 2016-05-24 Chris Dumez <cdumez@apple.com>
3672 Use auto for some of our lambda function parameters
3673 https://bugs.webkit.org/show_bug.cgi?id=158001
3675 Reviewed by Darin Adler.
3677 Use auto for some of our lambda function parameters now that we build with c++14.
3682 2016-05-23 Chris Dumez <cdumez@apple.com>
3684 Speed up move of vectors of POD types that have an inline buffer
3685 https://bugs.webkit.org/show_bug.cgi?id=158003
3687 Reviewed by Benjamin Poulain.
3689 When moving a vector of POD types that have an inline buffer, we would
3690 call std::swap() on the inline buffers. This unnecessarily slow because:
3691 1. It does not consider the vector size, and therefore may end up doing
3692 more work than necessary when the inline buffer is not full.
3693 2. In the "move" case, the destination buffer is completely empty so
3694 we don't really want a swap. We merely want the move the content of
3695 the source's inline buffer into the destination's one.
3697 Instead of calling std::swap(), we now call swapInlineBuffers() which
3698 was already used for non-POD types. swapInlineBuffers() will do just
3699 what we want in the "move" case because swapBound is going to be 0.
3700 As a result, we will only move the content of the source buffer into
3701 the destination one. Also swapInlineBuffers() is aware of the source
3702 vector's size so it will only move what's strictly needed.
3704 This seems to be a 2% progression on Dromaeo DOM attributes test.
3707 (WTF::VectorBuffer::swapInlineBuffer):
3709 2016-05-22 Dan Bernstein <mitz@apple.com>
3711 Added NSEventMaskMouseMoved to AppKitCompatibilityDeclarations.h.
3713 Rubber-stamped by Anders Carlsson.
3715 * wtf/mac/AppKitCompatibilityDeclarations.h:
3717 2016-05-22 Dan Bernstein <mitz@apple.com>
3719 Another attempt to fix the GTK build after my previous changes.
3721 * wtf/StdLibExtras.h:
3723 2016-05-22 Dan Bernstein <mitz@apple.com>
3725 Tried to fix the GTK build after r201257.
3727 * wtf/StdLibExtras.h:
3729 2016-05-22 Dan Bernstein <mitz@apple.com>
3731 Additional fixes for non-C++14 Apple projects that use WTF.
3733 * wtf/StdLibExtras.h:
3736 2016-05-22 Dan Bernstein <mitz@apple.com>
3738 Additional fixes for non-C++14 Apple projects that use WTF.
3740 * wtf/StdLibExtras.h:
3744 2016-05-22 Dan Bernstein <mitz@apple.com>
3746 Correct the previous build fix attempt.
3748 * wtf/StdLibExtras.h:
3750 2016-05-22 Dan Bernstein <mitz@apple.com>
3752 Build fix for non-C++14 Apple projects that use WTF.
3754 Rubber-stamped by Anders.
3756 * wtf/StdLibExtras.h:
3758 2016-05-22 Brady Eidson <beidson@apple.com>
3761 https://bugs.webkit.org/show_bug.cgi?id=157948
3763 Reviewed by Michael Catanzaro.
3765 * Configurations/Base.xcconfig:
3767 Delete a lot of "stl additions until we can adopt C++14" code:
3768 * wtf/StdLibExtras.h:
3769 (std::make_unique): Deleted.
3770 (std::index_sequence::size): Deleted.
3771 (std::exchange): Deleted.
3772 (std::literals::chrono_literals::operator _s): Deleted.
3773 (std::literals::chrono_literals::operator _ms): Deleted.
3775 2016-05-20 Rawinder Singh <rawinder.singh-webkit@cisra.canon.com.au>
3777 Implement operator== for WeakPtr
3778 https://bugs.webkit.org/show_bug.cgi?id=157883
3780 Reviewed by Chris Dumez.
3782 Implement operator== and operator!= for WeakPtr and update code to use the operators.
3788 2016-05-19 Chris Dumez <cdumez@apple.com>
3790 Improve compile-time assertions in is<>() / downcast<>()
3791 https://bugs.webkit.org/show_bug.cgi?id=157817
3793 Reviewed by Darin Adler.
3797 Add is<>() overloads taking a Ref<>() so that is<>() keeps working when
3798 passing a Ref<>(), despite the new static assertions on the input type.
3799 Some call sites were already leveraging this as it was working by
3800 implicitly converting the Ref<T> into a T&.
3805 Make static assertions stricter in is<>() / downcast<>() to catch more
3806 cases where those are either unnecessary or incorrect.
3808 2016-05-19 Filip Pizlo <fpizlo@apple.com>
3810 Unreviewed, fix all of the builds. I failed a second time.
3812 * wtf/BackwardsGraph.h:
3813 (WTF::BackwardsGraph::rootName):
3815 2016-05-19 Filip Pizlo <fpizlo@apple.com>
3817 Unreviewed, fix all of the builds. I had made an additional change that I did not mean to
3818 commit. This fixes it.
3820 * wtf/BackwardsGraph.h:
3821 (WTF::BackwardsGraph::rootName):
3822 (WTF::BackwardsGraph::Set::dump):
3823 (WTF::BackwardsGraph::dump):
3825 2016-05-18 Filip Pizlo <fpizlo@apple.com>
3827 DFG::LICMPhase shouldn't hoist type checks unless it knows that the check will succeed at the loop pre-header
3828 https://bugs.webkit.org/show_bug.cgi?id=144527
3830 Reviewed by Saam Barati.
3832 This adds an adaptor for graphs called BackwardsGraph. The WTF graph framework is based on
3833 passing around a Graph template argument that follows the protocol shared by DFG::CFG,
3834 B3::CFG, and Air::CFG. These graphs always have a single root node but may have many leaf
3835 nodes. This new BackwardsGraph adaptor reverses the graph by creating a synthetic return
3836 node that it uses as the root in the inverted graph. This currently may resort to some
3837 heuristics in programs that have an infinite loop, but other than that, it'll work well in
3840 This allows us to say Dominators<BackwardsGraph<some graph type>> as a way of computing
3841 backwards dominators, which then allows us to easily answer control flow equivalence
3845 * WTF.xcodeproj/project.pbxproj:
3846 * wtf/BackwardsGraph.h: Added.
3847 (WTF::BackwardsGraph::Node::Node):
3848 (WTF::BackwardsGraph::Node::root):
3849 (WTF::BackwardsGraph::Node::operator==):
3850 (WTF::BackwardsGraph::Node::operator!=):
3851 (WTF::BackwardsGraph::Node::operator bool):
3852 (WTF::BackwardsGraph::Node::isRoot):
3853 (WTF::BackwardsGraph::Node::node):
3854 (WTF::BackwardsGraph::Set::Set):
3855 (WTF::BackwardsGraph::Set::add):
3856 (WTF::BackwardsGraph::Set::remove):
3857 (WTF::BackwardsGraph::Set::contains):
3858 (WTF::BackwardsGraph::Set::dump):
3859 (WTF::BackwardsGraph::Map::Map):
3860 (WTF::BackwardsGraph::Map::clear):
3861 (WTF::BackwardsGraph::Map::size):
3862 (WTF::BackwardsGraph::Map::operator[]):
3863 (WTF::BackwardsGraph::BackwardsGraph):
3864 (WTF::BackwardsGraph::root):
3865 (WTF::BackwardsGraph::newMap):
3866 (WTF::BackwardsGraph::successors):
3867 (WTF::BackwardsGraph::predecessors):
3868 (WTF::BackwardsGraph::index):
3869 (WTF::BackwardsGraph::node):
3870 (WTF::BackwardsGraph::numNodes):
3871 (WTF::BackwardsGraph::dump):
3873 (WTF::Dominators::Dominators):
3874 (WTF::Dominators::dump):
3875 (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering):
3876 * wtf/GraphNodeWorklist.h:
3877 (WTF::GraphNodeWith::GraphNodeWith):
3878 (WTF::GraphNodeWith::operator bool):
3879 * wtf/StdLibExtras.h:
3880 (WTF::callStatelessLambda):
3883 2016-05-18 Saam barati <sbarati@apple.com>
3885 StringBuilder::appendQuotedJSONString doesn't properly protect against the math it's doing. Make the math fit the assertion.
3886 https://bugs.webkit.org/show_bug.cgi?id=157868
3888 Reviewed by Benjamin Poulain.
3890 appendQuotedJSONString was rounding up to the next power of two when resizing
3891 its buffer. Lets call the allocation size X. If X > 2^31, then
3892 roundUpToPowerOfTwo(X) == 0. This patch fixes this by making the
3893 assertion reflect what the code is doing. We now allocate to a size
3894 of X = std::max(maximumCapacityRequired , roundUpToPowerOfTwo(maximumCapacityRequired))
3896 * wtf/text/StringBuilder.cpp:
3897 (WTF::StringBuilder::appendQuotedJSONString):
3899 2016-05-17 Joseph Pecoraro <pecoraro@apple.com>
3901 REGRESSION(r192855): Math.random() always produces the same first 7 decimal points the first two invocations
3902 https://bugs.webkit.org/show_bug.cgi?id=157805
3903 <rdar://problem/26327851>
3905 Reviewed by Geoffrey Garen.
3908 (WTF::WeakRandom::setSeed):
3909 Advance once to randomize the 32bit seed across the 128bit state
3910 and avoid re-using 64bits of state in the second advance.
3912 2016-05-17 Dean Jackson <dino@apple.com>
3914 Remove ES6_GENERATORS flag
3915 https://bugs.webkit.org/show_bug.cgi?id=157815
3916 <rdar://problem/26332894>
3918 Reviewed by Geoffrey Garen.
3920 This flag isn't needed. Generators are enabled everywhere and
3921 part of a stable specification.
3923 * wtf/FeatureDefines.h:
3925 2016-05-17 Filip Pizlo <fpizlo@apple.com>
3927 WTF should know about Language
3928 https://bugs.webkit.org/show_bug.cgi?id=157756
3930 Reviewed by Geoffrey Garen.
3932 This contains two changes:
3934 - Move everything that WebCore's logic for getting the platform user preferred language
3935 depended on into WTF. This means CFBundleSPI.h and BlockObjCExceptions.h|cpp.
3937 - Move WebCore::platformUserPreferredLanguages() to WTF::platformUserPreferredLanguages().
3938 This is needed by https://bugs.webkit.org/show_bug.cgi?id=157755, which will make JSC
3939 use this to detect the platform user preferred language when running standalone.
3941 Moving the dependencies accounts for a huge chunk of this change, since we have to rewire
3942 all of the references to those headers in all of WebKit.
3944 Moving platformUserPreferredLanguages() is mostly easy except for the weird callback.
3945 That function would call languageDidChange(), which needs to stay in WebCore. So, this
3946 gives WebCore the ability to register a languageDidChange callback. Other than this new
3947 logic, the code being added to WTF is just being lifted out of WebCore.
3949 * WTF.xcodeproj/project.pbxproj:
3950 * wtf/BlockObjCExceptions.h: Added.
3951 * wtf/BlockObjCExceptions.mm: Added.
3952 (ReportBlockedObjCException):
3953 * wtf/PlatformEfl.cmake:
3954 * wtf/PlatformGTK.cmake:
3955 * wtf/PlatformJSCOnly.cmake:
3956 * wtf/PlatformMac.cmake:
3957 * wtf/PlatformUserPreferredLanguages.h: Added.
3958 * wtf/PlatformUserPreferredLanguagesMac.mm: Added.
3959 (WTF::setPlatformUserPreferredLanguagesChangedCallback):
3960 (WTF::preferredLanguages):
3961 (+[WTFLanguageChangeObserver languagePreferencesDidChange:]):
3962 (WTF::httpStyleLanguageCode):
3963 (WTF::isValidICUCountryCode):
3964 (WTF::platformUserPreferredLanguages):
3965 * wtf/PlatformUserPreferredLanguagesUnix.cpp: Added.
3966 (WTF::setPlatformUserPreferredLanguagesChangedCallback):
3967 (WTF::platformLanguage):
3968 (WTF::platformUserPreferredLanguages):
3969 * wtf/PlatformUserPreferredLanguagesWin.cpp: Added.
3970 (WTF::setPlatformUserPreferredLanguagesChangedCallback):
3972 (WTF::platformLanguage):
3973 (WTF::platformUserPreferredLanguages):
3974 * wtf/PlatformWin.cmake:
3975 * wtf/spi/cf: Added.
3976 * wtf/spi/cf/CFBundleSPI.h: Added.
3978 2016-05-17 Youenn Fablet <youenn.fablet@crf.canon.fr>
3980 DOMPromise should only restrict the resolution type
3981 https://bugs.webkit.org/show_bug.cgi?id=157307
3983 Reviewed by Darin Adler.
3985 * wtf/Ref.h: Adding static constexpr to ease detection of Ref for templates.
3986 * wtf/RefPtr.h: Ditto.
3988 2016-05-16 Michael Saboff <msaboff@apple.com>
3990 ARMV7K: Crash at JavaScriptCore: WTF::ScopedLambdaFunctor<bool
3991 https://bugs.webkit.org/show_bug.cgi?id=157781
3993 Reviewed by Filip Pizlo.
3995 Replaced use of ScopedLambda in locking code with std::function much as it was
3996 before change set 199760 to work around what appears to be a clang compiler issue.
3998 * wtf/ParkingLot.cpp:
3999 (WTF::ParkingLot::parkConditionallyImpl):
4000 (WTF::ParkingLot::unparkOne):
4001 (WTF::ParkingLot::unparkAll):
4002 (WTF::ParkingLot::forEach):
4003 (WTF::ParkingLot::unparkOneImpl): Deleted.
4004 (WTF::ParkingLot::forEachImpl): Deleted.
4006 (WTF::ParkingLot::parkConditionally):
4007 (WTF::ParkingLot::unparkOne): Deleted.
4008 (WTF::ParkingLot::forEach): Deleted.
4010 2016-05-15 Chris Dumez <cdumez@apple.com>
4012 Use more references in JS wrappers related code
4013 https://bugs.webkit.org/show_bug.cgi?id=157721
4015 Reviewed by Darin Adler.
4017 Add new static_reference_cast() overload that takes a Ref<U>&& in
4018 in order to downcast Ref<> types without causing ref-counting
4022 (WTF::static_reference_cast):