61c2feb361edfd303e8180a4d498b00f48770866
[WebKit-https.git] / Source / WTF / ChangeLog
1 2015-08-19  Alex Christensen  <achristensen@webkit.org>
2
3         CMake Windows build should not include files directly from other Source directories
4         https://bugs.webkit.org/show_bug.cgi?id=148198
5
6         Reviewed by Brent Fulgham.
7
8         * wtf/CMakeLists.txt:
9         * wtf/PlatformWin.cmake:
10
11 2015-08-18  Filip Pizlo  <fpizlo@apple.com>
12
13         Replace all uses of std::mutex/std::condition_variable with WTF::Lock/WTF::Condition
14         https://bugs.webkit.org/show_bug.cgi?id=148140
15
16         Reviewed by Geoffrey Garen.
17
18         Also beef up Condition by giving it a StaticCondition variant.
19
20         * wtf/Condition.h:
21         (WTF::ConditionBase::notifyAll):
22         (WTF::ConditionBase::waitForSecondsImpl):
23         (WTF::ConditionBase::absoluteFromRelative):
24         (WTF::Condition::Condition):
25         (WTF::Condition::notifyAll): Deleted.
26         (WTF::Condition::waitForSecondsImpl): Deleted.
27         (WTF::Condition::absoluteFromRelative): Deleted.
28         * wtf/CryptographicallyRandomNumber.cpp:
29         * wtf/HashTable.cpp:
30         (WTF::HashTableStats::recordCollisionAtCount):
31         (WTF::HashTableStats::dumpStats):
32         (WTF::hashTableStatsMutex): Deleted.
33         * wtf/HashTable.h:
34         (WTF::KeyTraits>::HashTable):
35         (WTF::KeyTraits>::invalidateIterators):
36         (WTF::addIterator):
37         (WTF::removeIterator):
38         * wtf/Lock.h:
39         * wtf/MainThread.cpp:
40         (WTF::functionQueue):
41         (WTF::dispatchFunctionsFromMainThread):
42         (WTF::callOnMainThread):
43         (WTF::cancelCallOnMainThread):
44         (WTF::mainThreadFunctionQueueMutex): Deleted.
45         * wtf/StackStats.cpp:
46         (WTF::StackStats::PerThreadStats::PerThreadStats):
47         (WTF::StackStats::CheckPoint::CheckPoint):
48         (WTF::StackStats::CheckPoint::~CheckPoint):
49         (WTF::StackStats::probe):
50         (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
51         (WTF::StackStats::LayoutCheckPoint::~LayoutCheckPoint):
52         (WTF::StackStats::initialize): Deleted.
53         * wtf/StackStats.h:
54         (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
55         (WTF::StackStats::probe):
56         (WTF::StackStats::initialize): Deleted.
57         * wtf/ThreadingPthreads.cpp:
58         (WTF::initializeThreading):
59         * wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
60         (WTF::callOnMainThread):
61         (WTF::lockAtomicallyInitializedStaticMutex):
62         (WTF::unlockAtomicallyInitializedStaticMutex):
63         (WTF::atomicallyInitializedStaticMutex): Deleted.
64         * wtf/text/StringView.cpp:
65         (WTF::StringView::UnderlyingString::UnderlyingString):
66         (WTF::underlyingStrings):
67         (WTF::StringView::invalidate):
68         (WTF::StringView::adoptUnderlyingString):
69         (WTF::StringView::setUnderlyingString):
70         (WTF::underlyingStringsMutex): Deleted.
71         * wtf/unicode/icu/CollatorICU.cpp:
72         (WTF::Collator::Collator):
73         (WTF::Collator::~Collator):
74         (WTF::cachedCollatorMutex): Deleted.
75
76 2015-08-18  Zan Dobersek  <zdobersek@igalia.com>
77
78         [GLib] GMainLoopSource should receive the std::function<> objects through rvalue references
79         https://bugs.webkit.org/show_bug.cgi?id=147981
80
81         Reviewed by Carlos Garcia Campos.
82
83         Scheduling methods on GMainLoopSource and GThreadSafeMainLoopSource should
84         have the std::function<> objects passed through rvalue references, and should
85         move the passed-in objects forward when required.
86
87         * wtf/glib/GMainLoopSource.cpp:
88         (WTF::GMainLoopSource::schedule):
89         (WTF::GMainLoopSource::scheduleAfterDelay):
90         (WTF::GMainLoopSource::scheduleAndDeleteOnDestroy):
91         (WTF::GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy):
92         * wtf/glib/GMainLoopSource.h:
93         * wtf/glib/GThreadSafeMainLoopSource.cpp:
94         (WTF::GThreadSafeMainLoopSource::schedule):
95         (WTF::GThreadSafeMainLoopSource::scheduleAfterDelay):
96         * wtf/glib/GThreadSafeMainLoopSource.h:
97
98 2015-08-18  Eric Carlson  <eric.carlson@apple.com>
99
100         Remove "platform text track menu"
101         https://bugs.webkit.org/show_bug.cgi?id=148139
102
103         Reviewed by Jer Noble.
104
105         * wtf/Platform.h: Remove PLATFORM_TEXT_TRACK_MENU.
106
107 2015-08-18  Filip Pizlo  <fpizlo@apple.com>
108
109         WTF::Condition should have a fast path for notifyOne/notifyAll that avoids calling unparkOne/unparkAll
110         https://bugs.webkit.org/show_bug.cgi?id=148090
111
112         Reviewed by Geoffrey Garen.
113
114         This change makes notifyOne()/notifyAll() blazing fast when nobody is waiting, by using the
115         various hooks that ParkingLot gives us to maintain a m_hasWaiters variable. When it's false, it
116         means that any unpark operation would simply return immediately.
117
118         This is a 45% speed-up for the 1-producer/1-consumer scenario with a 100-element queue when you
119         use the notifyOne()-per-enqueue style. What's cool about this change is that you can now safely
120         call notifyOne() (or notifyAll()) out of paranoia, just in case someone might be waiting. It's
121         free to do so if nobody is waiting!
122
123         * wtf/Condition.h:
124         (WTF::Condition::Condition):
125         (WTF::Condition::waitUntil):
126         (WTF::Condition::notifyOne):
127         (WTF::Condition::notifyAll):
128
129 2015-08-17  Filip Pizlo  <fpizlo@apple.com>
130
131         Replace all remaining uses of WTF::Mutex with WTF::Lock
132         https://bugs.webkit.org/show_bug.cgi?id=148089
133
134         Reviewed by Geoffrey Garen.
135
136         This also beefs up and rationalizes the Condition API, so that it can deal with units of time
137         other than just steady_clock. This makes it easier to port ThreadCondition and
138         std::condition_variable code over to Condition. This patch does not take a position on what
139         kind of time is best; from reading a lot of the uses in WebCore, it seems like our use of
140         double to measure seconds is often nicer than the many different classes in std::chrono.
141
142         Also added a Condition speed test, to make sure that all of this is a good idea. And indeed it
143         is. The 1-producer/1-consumer scenario with a 100-element queue runs 36x faster using
144         Lock/Condition than Mutex/ThreadCondition when you use the notifyOne()-per-enqueue style. It
145         runs 58x faster with Lock/Condition when you use the notifyAll()-at-boundary style. Note that
146         I have a bug open for making the notifyOne()-per-enqueue style even faster:
147         https://bugs.webkit.org/show_bug.cgi?id=148090. Also, the 10-consumer/10-producer scenario with
148         a 100-element queue runs 20x faster with Lock/Condition for notifyOne()-per-enqueue and 30x
149         faster with notifyAll()-at-boundary. The only way to tweak the test to get
150         Mutex/ThreadCondition to win is to have one producer, one consumer, a 1-element queue, and use
151         the notifyOne()-per-enqueue style. In that case, one of the two threads is going to be waiting
152         most of the time and the test basically measures wake-up latency and nothing else. Because
153         Condition::wait() does a little bit more work than ThreadCondition::wait(),
154         Mutex/ThreadCondition end up running 3% faster in this test case. But if you vary any of the
155         parameters of the test, Mutex/ThreadCondition ends up losing - all it takes is more threads or
156         a queue size of 5 or more. To my knowledge, we never do producer/consumer with a queue bounded
157         to one element precisely because that approach is the least efficient regardless of locking
158         algorithm. For example, neither WTF::MessageQueue nor DFG::Worklist have any bounds on their
159         queue size. So, it seems that replacing all uses of system mutexes and condition variables with
160         our own thing is a great idea.
161
162         * benchmarks/LockSpeedTest.cpp:
163         * benchmarks/ConditionSpeedTest.cpp: Added.
164         * wtf/Condition.h:
165         (WTF::Condition::Condition):
166         (WTF::Condition::waitUntil):
167         (WTF::Condition::waitFor):
168         (WTF::Condition::wait):
169         (WTF::Condition::waitUntilWallClockSeconds):
170         (WTF::Condition::waitUntilMonotonicClockSeconds):
171         (WTF::Condition::notifyOne):
172         (WTF::Condition::notifyAll):
173         (WTF::Condition::waitForSecondsImpl):
174         (WTF::Condition::waitForImpl):
175         (WTF::Condition::absoluteFromRelative):
176         * wtf/MessageQueue.h:
177         (WTF::MessageQueue::infiniteTime):
178         (WTF::MessageQueue<DataType>::append):
179         (WTF::MessageQueue<DataType>::appendAndKill):
180         (WTF::MessageQueue<DataType>::appendAndCheckEmpty):
181         (WTF::MessageQueue<DataType>::prepend):
182         (WTF::MessageQueue<DataType>::removeIf):
183         (WTF::MessageQueue<DataType>::isEmpty):
184         (WTF::MessageQueue<DataType>::kill):
185         (WTF::MessageQueue<DataType>::killed):
186         * wtf/ParallelJobsGeneric.cpp:
187         (WTF::ParallelEnvironment::ThreadPrivate::execute):
188         (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish):
189         (WTF::ParallelEnvironment::ThreadPrivate::workerThread):
190         * wtf/ParallelJobsGeneric.h:
191         * wtf/ParkingLot.cpp:
192         (WTF::ParkingLot::parkConditionally):
193         * wtf/ParkingLot.h:
194         (WTF::ParkingLot::compareAndPark):
195         * wtf/ThreadingPthreads.cpp:
196         (WTF::initializeThreading):
197         * wtf/ThreadingWin.cpp:
198         (WTF::initializeThreading):
199         * wtf/dtoa.cpp:
200         (WTF::pow5mult):
201         * wtf/dtoa.h:
202
203 2015-08-17  Alex Christensen  <achristensen@webkit.org>
204
205         Build Debug Suffix on Windows with CMake
206         https://bugs.webkit.org/show_bug.cgi?id=148083
207
208         Reviewed by Brent Fulgham.
209
210         * wtf/PlatformWin.cmake:
211         Add DEBUG_SUFFIX
212
213 2015-08-17  Myles C. Maxfield  <mmaxfield@apple.com>
214
215         Implement IntegerHasher
216         https://bugs.webkit.org/show_bug.cgi?id=147866
217
218         Reviewed by Darin Adler and Anders Carlsson.
219
220         Rename StringHasher.h to Hasher.h, and include an IntegerHasher class.
221
222         * WTF.vcxproj/WTF.vcxproj: Update to target new file.
223         * WTF.vcxproj/WTF.vcxproj.filters: Ditto.
224         * WTF.xcodeproj/project.pbxproj: Ditto.
225         * wtf/CMakeLists.txt: Ditto.
226         * wtf/Hasher.h: Renamed from Source/WTF/wtf/StringHasher.h.
227         * wtf/text/CString.cpp: Use new #include
228         * wtf/text/StringHash.h: Ditto.
229         * wtf/text/StringImpl.h: Ditto.
230         * wtf/unicode/UTF8.cpp: Ditto.
231
232 2015-08-17  Alex Christensen  <achristensen@webkit.org>
233
234         Move some commands from ./CMakeLists.txt to Source/cmake
235         https://bugs.webkit.org/show_bug.cgi?id=148003
236
237         Reviewed by Brent Fulgham.
238
239         * CMakeLists.txt:
240         Added commands needed to build WTF by itself.
241
242 2015-08-14  Filip Pizlo  <fpizlo@apple.com>
243
244         Use WTF::Lock and WTF::Condition instead of WTF::Mutex, WTF::ThreadCondition, std::mutex, and std::condition_variable
245         https://bugs.webkit.org/show_bug.cgi?id=147999
246
247         Reviewed by Geoffrey Garen.
248
249         Relanding after fixing a deadlock on Linux.
250
251         * wtf/Condition.h: "using WTF::Condition".
252         * wtf/Lock.h:
253         (WTF::LockBase::lock):
254         (WTF::LockBase::tryLock): Add tryLock() because it turns out that we use it sometimes.
255         (WTF::LockBase::try_lock): unique_lock needs this.
256         (WTF::LockBase::unlock):
257         * wtf/ParkingLot.cpp:
258         (WTF::ParkingLot::parkConditionally): Work around a Linux C++ bug where wait_until with time_point::max() immediately returns and doesn't flash the lock.
259
260 2015-08-14  Keith Miller  <keith_miller@apple.com>
261
262         cryptographicallyRandomValuesFromOS should use arc4random_buf on Darwin.
263         https://bugs.webkit.org/show_bug.cgi?id=148038
264
265         Reviewed by Geoffrey Garen.
266
267         Currently, we open a file descriptor to /dev/urandom, which can sometimes
268         fail to open. Using arc4random_buf instead should get around this issue.
269
270         * wtf/OSRandomSource.cpp:
271         (WTF::cryptographicallyRandomValuesFromOS):
272
273 2015-08-14  Commit Queue  <commit-queue@webkit.org>
274
275         Unreviewed, rolling out r188444.
276         https://bugs.webkit.org/show_bug.cgi?id=148029
277
278         Broke GTK and EFL (see bug #148027) (Requested by philn on
279         #webkit).
280
281         Reverted changeset:
282
283         "Use WTF::Lock and WTF::Condition instead of WTF::Mutex,
284         WTF::ThreadCondition, std::mutex, and std::condition_variable"
285         https://bugs.webkit.org/show_bug.cgi?id=147999
286         http://trac.webkit.org/changeset/188444
287
288 2015-08-13  Filip Pizlo  <fpizlo@apple.com>
289
290         Use WTF::Lock and WTF::Condition instead of WTF::Mutex, WTF::ThreadCondition, std::mutex, and std::condition_variable
291         https://bugs.webkit.org/show_bug.cgi?id=147999
292
293         Reviewed by Geoffrey Garen.
294
295         * wtf/Condition.h: "using WTF::Condition".
296         * wtf/Lock.h:
297         (WTF::LockBase::lock):
298         (WTF::LockBase::tryLock): Add tryLock() because it turns out that we use it sometimes.
299         (WTF::LockBase::try_lock): unique_lock needs this.
300         (WTF::LockBase::unlock):
301
302 2015-08-13  Commit Queue  <commit-queue@webkit.org>
303
304         Unreviewed, rolling out r188428.
305         https://bugs.webkit.org/show_bug.cgi?id=148015
306
307         broke cmake build (Requested by alexchristensen on #webkit).
308
309         Reverted changeset:
310
311         "Move some commands from ./CMakeLists.txt to Source/cmake"
312         https://bugs.webkit.org/show_bug.cgi?id=148003
313         http://trac.webkit.org/changeset/188428
314
315 2015-08-13  Alex Christensen  <achristensen@webkit.org>
316
317         Move some commands from ./CMakeLists.txt to Source/cmake
318         https://bugs.webkit.org/show_bug.cgi?id=148003
319
320         Reviewed by Brent Fulgham.
321
322         * CMakeLists.txt:
323         Added commands needed to build WTF by itself.
324
325 2015-08-13  Mark Lam  <mark.lam@apple.com>
326
327         WorkQueue::dispatchAfter() on Windows fires early.
328         https://bugs.webkit.org/show_bug.cgi?id=147992
329
330         Reviewed by Brent Fulgham.
331
332         The Windows implementation of WorkQueue::dispatchAfter() uses CreateTimerQueueTimer().
333         Unfortunately, CreateTimerQueueTimer() is sloppy and can fire early.  We need to compensate
334         for this slop to ensure that the specified duration does expire before the callback function
335         is called.  Otherwise, the JSC watchdog (which depends on this) can fail randomly.
336
337         * wtf/win/WorkQueueWin.cpp:
338         (WTF::WorkQueue::dispatchAfter):
339
340 2015-08-13  Filip Pizlo  <fpizlo@apple.com>
341
342         WTF should have a compact Condition object to use with Lock
343         https://bugs.webkit.org/show_bug.cgi?id=147986
344
345         Reviewed by Geoffrey Garen.
346
347         Adds a condition variable implementation based on ParkingLot, called simply WTF::Condition.
348         It can be used with WTF::Lock or actually any lock implementation. It should even work with
349         WTF::SpinLock, WTF::Mutex, or std::mutex. Best of all, Condition only requires one byte.
350
351         ParkingLot almost contained all of the functionality needed to implemenet wait/notify. We
352         could have implemented Condition using a 32-bit (or even 64-bit) version that protects
353         against a notify that happens just before we park. But, this changes the ParkingLot API to
354         give us the ability to run some code between when ParkingLot enqueues the current thread
355         and when it actually sleeps. This callback is called with no locks held, so it can call
356         unlock() on any kind of lock, so long as that lock's unlock() method doesn't recurse into
357         ParkingLot::parkConditionally(). That seems unlikely; unlock() is more likely to call
358         ParkingLot::unparkOne() or unparkAll(). WTF::Lock will never call parkConditionally()
359         inside unlock(), so WTF::Lock is definitely appropriate for use with Condition.
360
361         Condition supports most of the API that std::condition_variable supports. It does some
362         things to try to reduce footgun potential. The preferred timeout form is waitUntil() which
363         takes an absolute time from the steady_clock. The only relative timeout form also takes a
364         predicate callback, so it's impossible to write the subtly incorrect
365         "while (...) wait_for(...)" idiom.
366
367         This patch doesn't actually introduce any uses of WTF::Condition other than the unit tests.
368         I'll start switching code over to using WTF::Condition in another patch.
369
370         * WTF.vcxproj/WTF.vcxproj:
371         * WTF.xcodeproj/project.pbxproj:
372         * wtf/CMakeLists.txt:
373         * wtf/Condition.h: Added.
374         (WTF::Condition::Condition):
375         (WTF::Condition::waitUntil):
376         (WTF::Condition::waitFor):
377         (WTF::Condition::wait):
378         (WTF::Condition::notifyOne):
379         (WTF::Condition::notifyAll):
380         * wtf/Lock.cpp:
381         (WTF::LockBase::unlockSlow): Make this useful assertion be a release assertion. It catches cases where you unlock the lock even though you don't hold it.
382         * wtf/ParkingLot.cpp:
383         (WTF::ParkingLot::parkConditionally): Add the beforeSleep() callback.
384         (WTF::ParkingLot::unparkOne):
385         * wtf/ParkingLot.h:
386         (WTF::ParkingLot::compareAndPark):
387
388 2015-08-12  Anders Carlsson  <andersca@apple.com>
389
390         Use WTF::Optional in WindowFeatures
391         https://bugs.webkit.org/show_bug.cgi?id=147956
392
393         Reviewed by Sam Weinig.
394
395         Add new operators to WTF::Optional to make it more like std::optional.
396
397         * wtf/Optional.h:
398         (WTF::Optional::operator->):
399         (WTF::Optional::operator*):
400
401 2015-08-12  Filip Pizlo  <fpizlo@apple.com>
402
403         WTF::Lock should not suffer from the thundering herd
404         https://bugs.webkit.org/show_bug.cgi?id=147947
405
406         Reviewed by Geoffrey Garen.
407
408         This changes Lock::unlockSlow() to use unparkOne() instead of unparkAll(). The problem with
409         doing this is that it's not obvious after calling unparkOne() if there are any other threads
410         that are still parked on the lock's queue. If we assume that there are and leave the
411         hasParkedBit set, then future calls to unlock() will take the slow path. We don't want that
412         if there aren't actually any threads parked. On the other hand, if we assume that there
413         aren't any threads parked and clear the hasParkedBit, then if there actually were some
414         threads parked, then they may never be awoken since future calls to unlock() won't take slow
415         path and so won't call unparkOne(). In other words, we need a way to be very precise about
416         when we clear the hasParkedBit and we need to do it in a race-free way: it can't be the case
417         that we clear the bit just as some thread gets parked on the queue.
418
419         A similar problem arises in futexes, and one of the solutions is to have a thread that
420         acquires a lock after parking sets the hasParkedBit. This is what Rusty Russel's usersem
421         does. It's a subtle algorithm. Also, it means that if a thread barges in before the unparked
422         thread runs, then that barging thread will not know that there are threads parked. This
423         could increase the severity of barging.
424
425         Since ParkingLot is a user-level API, we don't have to worry about the kernel-user security
426         issues and so we can expose callbacks while ParkingLot is holding its internal locks. This
427         change does exactly that for unparkOne(). The new variant of unparkOne() will call a user
428         function while the queue from which we are unparking is locked. The callback is told basic
429         stats about the queue: did we unpark a thread this time, and could there be more threads to
430         unpark in the future. The callback runs while it's impossible for the queue state to change,
431         since the ParkingLot's internal locks for the queue is held. This means that
432         Lock::unlockSlow() can either clear, or leave, the hasParkedBit while releasing the lock
433         inside the callback from unparkOne(). This takes care of the thundering herd problem while
434         also reducing the greed that arises from barging threads.
435
436         This required some careful reworking of the ParkingLot algorithm. The first thing I noticed
437         was that the ThreadData::shouldPark flag was useless, since it's set exactly when
438         ThreadData::address is non-null. Then I had to make sure that dequeue() could lazily create
439         both hashtables and buckets, since the "callback is called while queue is locked" invariant
440         requires that we didn't exit early due to the hashtable or bucket not being present. Note
441         that all of this is done in such a way that the old unparkOne() and unparkAll() don't have
442         to create any buckets, though they now may create the hashtable. We don't care as much about
443         the hashtable being created by unpark since it's just such an unlikely scenario and it would
444         only happen once.
445
446         This change reduces the kernel CPU usage of WTF::Lock for the long critical section test by
447         about 8x and makes it always perform as well as WTF::WordLock and WTF::Mutex for that
448         benchmark.
449
450         * benchmarks/LockSpeedTest.cpp:
451         * wtf/Lock.cpp:
452         (WTF::LockBase::unlockSlow):
453         * wtf/Lock.h:
454         (WTF::LockBase::isLocked):
455         (WTF::LockBase::isFullyReset):
456         * wtf/ParkingLot.cpp:
457         (WTF::ParkingLot::parkConditionally):
458         (WTF::ParkingLot::unparkOne):
459         (WTF::ParkingLot::unparkAll):
460         * wtf/ParkingLot.h:
461         * wtf/WordLock.h:
462         (WTF::WordLock::isLocked):
463         (WTF::WordLock::isFullyReset):
464
465 2015-08-11  Filip Pizlo  <fpizlo@apple.com>
466
467         Always use a byte-sized lock implementation
468         https://bugs.webkit.org/show_bug.cgi?id=147908
469
470         Reviewed by Geoffrey Garen.
471
472         At the start of my locking algorithm crusade, I implemented Lock, which is a sizeof(void*)
473         lock implementation with some nice theoretical properties and good performance. Then I added
474         the ParkingLot abstraction and ByteLock. ParkingLot uses Lock in its implementation.
475         ByteLock uses ParkingLot to create a sizeof(char) lock implementation that performs like
476         Lock.
477
478         It turns out that ByteLock is always at least as good as Lock, and sometimes a lot better:
479         it requires 8x less memory on 64-bit systems. It's hard to construct a benchmark where
480         ByteLock is significantly slower than Lock, and when you do construct such a benchmark,
481         tweaking it a bit can also create a scenario where ByteLock is significantly faster than
482         Lock.
483
484         So, the thing that we call "Lock" should really use ByteLock's algorithm, since it is more
485         compact and just as fast. That's what this patch does.
486
487         But we still need to keep the old Lock algorithm, because it's used to implement ParkingLot,
488         which in turn is used to implement ByteLock. So this patch does this transformation:
489
490         - Move the algorithm in Lock into files called WordLock.h|cpp. Make ParkingLot use
491           WordLock.
492
493         - Move the algorithm in ByteLock into Lock.h|cpp. Make everyone who used ByteLock use Lock
494           instead. All other users of Lock now get the byte-sized lock implementation.
495
496         - Remove the old ByteLock files.
497
498         * WTF.vcxproj/WTF.vcxproj:
499         * WTF.xcodeproj/project.pbxproj:
500         * benchmarks/LockSpeedTest.cpp:
501         (main):
502         * wtf/WordLock.cpp: Added.
503         (WTF::WordLock::lockSlow):
504         (WTF::WordLock::unlockSlow):
505         * wtf/WordLock.h: Added.
506         (WTF::WordLock::WordLock):
507         (WTF::WordLock::lock):
508         (WTF::WordLock::unlock):
509         (WTF::WordLock::isHeld):
510         (WTF::WordLock::isLocked):
511         * wtf/ByteLock.cpp: Removed.
512         * wtf/ByteLock.h: Removed.
513         * wtf/CMakeLists.txt:
514         * wtf/Lock.cpp:
515         (WTF::LockBase::lockSlow):
516         (WTF::LockBase::unlockSlow):
517         * wtf/Lock.h:
518         (WTF::LockBase::lock):
519         (WTF::LockBase::unlock):
520         (WTF::LockBase::isHeld):
521         (WTF::LockBase::isLocked):
522         (WTF::Lock::Lock):
523         * wtf/ParkingLot.cpp:
524
525 2015-08-11  Filip Pizlo  <fpizlo@apple.com>
526
527         Remove ByteSpinLock
528         https://bugs.webkit.org/show_bug.cgi?id=147900
529
530         Rubber stamped by Mark Lam.
531
532         * WTF.xcodeproj/project.pbxproj:
533         * wtf/ByteSpinLock.h: Removed.
534
535 2015-08-11  Brent Fulgham  <bfulgham@apple.com>
536
537         [Win] Switch Windows build to Visual Studio 2015
538         https://bugs.webkit.org/show_bug.cgi?id=147887
539         <rdar://problem/22235098>
540
541         Reviewed by Alex Christensen.
542
543         Update Visual Studio project file settings to use the current Visual
544         Studio and compiler. Continue targeting binaries to run on our minimum
545         supported configuration of Windows 7.
546
547         * WTF.vcxproj/WTF.vcxproj:
548         * WTF.vcxproj/WTFGenerated.vcxproj:
549
550 2015-08-10  Filip Pizlo  <fpizlo@apple.com>
551
552         WTF should have a ParkingLot for parking sleeping threads, so that locks can fit in 1.6 bits
553         https://bugs.webkit.org/show_bug.cgi?id=147665
554
555         Reviewed by Mark Lam.
556
557         This change adds a major new abstraction for concurrency algorithms in WebKit. It's called a
558         ParkingLot, and it makes available a thread parking queue for each virtual address in memory.
559         The queues are maintained by a data-access-parallel concurrent hashtable implementation. The
560         memory usage is bounded at around half a KB per thread.
561
562         The ParkingLot makes it easy to turn any spinlock-based concurrency protocol into one that
563         parks threads after a while. Because queue state management is up to the ParkingLot and not
564         the user's data structure, this patch uses it to implement a full adaptive mutex in one byte.
565         In fact, only three states of that byte are used (0 = available, 1 = locked, 2 = locked and
566         there are parked threads). Hence the joke that ParkingLot allows locks that fit in 1.6 bits.
567
568         ByteLock is used as a replacement for ByteSpinLock in JavaScriptCore.
569
570         The API tests for this also demo how to create a completely fair (FIFO) binary semamphore. The
571         comment in Lock.h shows how we could accelerate Lock performance using ParkingLot. After we
572         are sure that this code works, we can expand the use of ParkingLot. That's covered by
573         https://bugs.webkit.org/show_bug.cgi?id=147841.
574
575         * WTF.vcxproj/WTF.vcxproj:
576         * WTF.xcodeproj/project.pbxproj:
577         * benchmarks/LockSpeedTest.cpp:
578         (main):
579         * wtf/Atomics.h:
580         (WTF::Atomic::compareExchangeWeak):
581         (WTF::Atomic::compareExchangeStrong):
582         * wtf/ByteLock.cpp: Added.
583         (WTF::ByteLock::lockSlow):
584         (WTF::ByteLock::unlockSlow):
585         * wtf/ByteLock.h: Added.
586         (WTF::ByteLock::ByteLock):
587         (WTF::ByteLock::lock):
588         (WTF::ByteLock::unlock):
589         (WTF::ByteLock::isHeld):
590         (WTF::ByteLock::isLocked):
591         * wtf/CMakeLists.txt:
592         * wtf/Lock.h:
593         * wtf/ParkingLot.cpp: Added.
594         (WTF::ParkingLot::parkConditionally):
595         (WTF::ParkingLot::unparkOne):
596         (WTF::ParkingLot::unparkAll):
597         (WTF::ParkingLot::forEach):
598         * wtf/ParkingLot.h: Added.
599         (WTF::ParkingLot::compareAndPark):
600
601 2015-08-11  Brent Fulgham  <bfulgham@apple.com>
602
603         [Win] Unreviewed gardening.
604
605         * WTF.vcxproj/WTF.vcxproj.filters: Place file references so that files appear in correct
606         folders in IDE.
607
608 2015-08-10  Youenn Fablet  <youenn.fablet@crf.canon.fr>
609
610         Compile warning (-Wsign-compare) on 32-bits at WebCore/platform/FileSystem.cpp
611         https://bugs.webkit.org/show_bug.cgi?id=146414
612
613         Reviewed by Darin Adler.
614
615         Added convertSafely routine based on isInBounds routine.
616         Updated BoundChecker by adding a third boolean parameter to this template giving whether Target has greater or equal precision than Source.
617         Removed BoundCheckElider, which is no longer necessary and had some issues.
618
619         * wtf/CheckedArithmetic.h:
620         (WTF::isInBounds):
621         (WTF::convertSafely):
622
623 2015-08-07  Filip Pizlo  <fpizlo@apple.com>
624
625         Lightweight locks should be adaptive
626         https://bugs.webkit.org/show_bug.cgi?id=147545
627
628         Reviewed by Geoffrey Garen.
629
630         A common idiom in WebKit is to use spinlocks. We use them because the lock acquisition
631         overhead is lower than system locks and because they take dramatically less space than system
632         locks. The speed and space advantages of spinlocks can be astonishing: an uncontended spinlock
633         acquire is up to 10x faster and under microcontention - short critical section with two or
634         more threads taking turns - spinlocks are up to 100x faster. Spinlocks take only 1 byte or 4
635         bytes depending on the flavor, while system locks take 64 bytes or more. Clearly, WebKit
636         should continue to avoid system locks - they are just far too slow and far too big.
637
638         But there is a problem with this idiom. System lock implementations will sleep a thread when
639         it attempts to acquire a lock that is held, while spinlocks will cause the thread to burn CPU.
640         In WebKit spinlocks, the thread will repeatedly call sched_yield(). This is awesome for
641         microcontention, but awful when the lock will not be released for a while. In fact, when
642         critical sections take tens of microseconds or more, the CPU time cost of our spinlocks is
643         almost 100x more than the CPU time cost of a system lock. This case doesn't arise too
644         frequently in our current uses of spinlocks, but that's probably because right now there are
645         places where we make a conscious decision to use system locks - even though they use more
646         memory and are slower - because we don't want to waste CPU cycles when a thread has to wait a
647         while to acquire the lock.
648
649         The solution is to just implement a modern adaptive mutex in WTF. Luckily, this isn't a new
650         concept. This patch implements a mutex that is reminiscent of the kinds of low-overhead locks
651         that JVMs use. The actual implementation here is inspired by some of the ideas from [1]. The
652         idea is simple: the fast path is an inlined CAS to immediately acquire a lock that isn't held,
653         the slow path tries some number of spins to acquire the lock, and if that fails, the thread is
654         put on a queue and put to sleep. The queue is made up of statically allocated thread nodes and
655         the lock itself is a tagged pointer: either it is just bits telling us the complete lock state
656         (not held or held) or it is a pointer to the head of a queue of threads waiting to acquire the
657         lock. This approach gives WTF::Lock three different levels of adaptation: an inlined fast path
658         if the lock is not contended, a short burst of spinning for microcontention, and a full-blown
659         queue for critical sections that are held for a long time.
660
661         On a locking microbenchmark, this new Lock exhibits the following performance
662         characteristics:
663
664         - Lock+unlock on an uncontended no-op critical section: 2x slower than SpinLock and 3x faster
665           than a system mutex.
666
667         - Lock+unlock on a contended no-op critical section: 2x slower than SpinLock and 100x faster
668           than a system mutex.
669
670         - CPU time spent in lock() on a lock held for a while: same as system mutex, 90x less than a
671           SpinLock.
672
673         - Memory usage: sizeof(void*), so on 64-bit it's 8x less than a system mutex but 2x worse than
674           a SpinLock.
675
676         This patch replaces all uses of SpinLock with Lock, since our critical sections are not
677         no-ops so if you do basically anything in your critical section, the Lock overhead will be
678         invisible. Also, in all places where we used SpinLock, we could tolerate 8 bytes of overhead
679         instead of 4. Performance benchmarking using JSC macrobenchmarks shows no difference, which is
680         as it should be: the purpose of this change is to reduce CPU time wasted, not wallclock time.
681         This patch doesn't replace any uses of ByteSpinLock, since we expect that the space benefits
682         of having a lock that just uses a byte are still better than the CPU wastage benefits of
683         Lock. But, this work will enable some future work to create locks that will fit in just 1.6
684         bits: https://bugs.webkit.org/show_bug.cgi?id=147665.
685         
686         Rolling this back in after fixing Lock::unlockSlow() for architectures that have a truly weak
687         CAS. Since the Lock::unlock() fast path can go to slow path spuriously, it may go there even if
688         there aren't any threads on the Lock's queue. So, unlockSlow() must be able to deal with the
689         possibility of a null queue head.
690
691         [1] http://www.filpizlo.com/papers/pizlo-pppj2011-fable.pdf
692
693         * WTF.vcxproj/WTF.vcxproj:
694         * WTF.xcodeproj/project.pbxproj:
695         * benchmarks: Added.
696         * benchmarks/LockSpeedTest.cpp: Added.
697         (main):
698         * wtf/Atomics.h:
699         (WTF::Atomic::compareExchangeWeak):
700         (WTF::Atomic::compareExchangeStrong):
701         * wtf/CMakeLists.txt:
702         * wtf/Lock.cpp: Added.
703         (WTF::LockBase::lockSlow):
704         (WTF::LockBase::unlockSlow):
705         * wtf/Lock.h: Added.
706         (WTF::LockBase::lock):
707         (WTF::LockBase::unlock):
708         (WTF::LockBase::isHeld):
709         (WTF::LockBase::isLocked):
710         (WTF::Lock::Lock):
711         * wtf/MetaAllocator.cpp:
712         (WTF::MetaAllocator::release):
713         (WTF::MetaAllocatorHandle::shrink):
714         (WTF::MetaAllocator::allocate):
715         (WTF::MetaAllocator::currentStatistics):
716         (WTF::MetaAllocator::addFreshFreeSpace):
717         (WTF::MetaAllocator::debugFreeSpaceSize):
718         * wtf/MetaAllocator.h:
719         * wtf/SpinLock.h:
720         * wtf/ThreadingPthreads.cpp:
721         * wtf/ThreadingWin.cpp:
722         * wtf/text/AtomicString.cpp:
723         * wtf/text/AtomicStringImpl.cpp:
724         (WTF::AtomicStringTableLocker::AtomicStringTableLocker):
725
726 2015-08-05  Filip Pizlo  <fpizlo@apple.com>
727
728         Unreviewed, roll out http://trac.webkit.org/changeset/187972.
729
730         * wtf/Atomics.cpp:
731         (WTF::getSwapLock):
732         (WTF::atomicStep):
733         * wtf/MessageQueue.h:
734         (WTF::MessageQueue::infiniteTime):
735         (WTF::MessageQueue<DataType>::append):
736         (WTF::MessageQueue<DataType>::appendAndKill):
737         (WTF::MessageQueue<DataType>::appendAndCheckEmpty):
738         (WTF::MessageQueue<DataType>::prepend):
739         (WTF::MessageQueue<DataType>::removeIf):
740         (WTF::MessageQueue<DataType>::isEmpty):
741         (WTF::MessageQueue<DataType>::kill):
742         (WTF::MessageQueue<DataType>::killed):
743         * wtf/ParallelJobsGeneric.cpp:
744         (WTF::ParallelEnvironment::ThreadPrivate::execute):
745         (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish):
746         (WTF::ParallelEnvironment::ThreadPrivate::workerThread):
747         * wtf/ParallelJobsGeneric.h:
748         * wtf/RunLoop.cpp:
749         (WTF::RunLoop::performWork):
750         (WTF::RunLoop::dispatch):
751         * wtf/RunLoop.h:
752         * wtf/ThreadSpecificWin.cpp:
753         (WTF::destructorsList):
754         (WTF::destructorsMutex):
755         (WTF::threadSpecificKeyCreate):
756         (WTF::threadSpecificKeyDelete):
757         (WTF::ThreadSpecificThreadExit):
758         * wtf/Threading.cpp:
759         (WTF::threadEntryPoint):
760         (WTF::createThread):
761         * wtf/ThreadingPrimitives.h:
762         * wtf/ThreadingPthreads.cpp:
763         (WTF::threadMapMutex):
764         (WTF::initializeThreading):
765         (WTF::identifierByPthreadHandle):
766         (WTF::establishIdentifierForPthreadHandle):
767         (WTF::changeThreadPriority):
768         (WTF::waitForThreadCompletion):
769         (WTF::detachThread):
770         (WTF::threadDidExit):
771         (WTF::currentThread):
772         (WTF::Mutex::Mutex):
773         (WTF::Mutex::~Mutex):
774         (WTF::Mutex::lock):
775         (WTF::Mutex::tryLock):
776         (WTF::Mutex::unlock):
777         (WTF::ThreadCondition::~ThreadCondition):
778         (WTF::ThreadCondition::wait):
779         (WTF::ThreadCondition::timedWait):
780         (WTF::DeprecatedMutex::DeprecatedMutex): Deleted.
781         (WTF::DeprecatedMutex::~DeprecatedMutex): Deleted.
782         (WTF::DeprecatedMutex::lock): Deleted.
783         (WTF::DeprecatedMutex::tryLock): Deleted.
784         (WTF::DeprecatedMutex::unlock): Deleted.
785         * wtf/ThreadingWin.cpp:
786         (WTF::initializeCurrentThreadInternal):
787         (WTF::threadMapMutex):
788         (WTF::initializeThreading):
789         (WTF::storeThreadHandleByIdentifier):
790         (WTF::threadHandleForIdentifier):
791         (WTF::clearThreadHandleForIdentifier):
792         (WTF::currentThread):
793         (WTF::Mutex::Mutex):
794         (WTF::Mutex::~Mutex):
795         (WTF::Mutex::lock):
796         (WTF::Mutex::tryLock):
797         (WTF::Mutex::unlock):
798         (WTF::ThreadCondition::~ThreadCondition):
799         (WTF::ThreadCondition::wait):
800         (WTF::ThreadCondition::timedWait):
801         (WTF::DeprecatedMutex::DeprecatedMutex): Deleted.
802         (WTF::DeprecatedMutex::~DeprecatedMutex): Deleted.
803         (WTF::DeprecatedMutex::lock): Deleted.
804         (WTF::DeprecatedMutex::tryLock): Deleted.
805         (WTF::DeprecatedMutex::unlock): Deleted.
806         * wtf/WorkQueue.h:
807         * wtf/dtoa.cpp:
808         * wtf/dtoa.h:
809         * wtf/efl/DispatchQueueEfl.cpp:
810         (DispatchQueue::dispatch):
811         (DispatchQueue::performWork):
812         (DispatchQueue::performTimerWork):
813         (DispatchQueue::insertTimerWorkItem):
814         (DispatchQueue::wakeUpThread):
815         (DispatchQueue::getNextTimeOut):
816         * wtf/efl/DispatchQueueEfl.h:
817         * wtf/efl/RunLoopEfl.cpp:
818         (WTF::RunLoop::wakeUpEvent):
819         (WTF::RunLoop::wakeUp):
820         * wtf/threads/BinarySemaphore.cpp:
821         (WTF::BinarySemaphore::signal):
822         (WTF::BinarySemaphore::wait):
823         * wtf/threads/BinarySemaphore.h:
824         * wtf/win/WorkQueueWin.cpp:
825         (WTF::WorkQueue::handleCallback):
826         (WTF::WorkQueue::platformInvalidate):
827         (WTF::WorkQueue::dispatch):
828         (WTF::WorkQueue::timerCallback):
829         (WTF::WorkQueue::dispatchAfter):
830
831 2015-08-05  Filip Pizlo  <fpizlo@apple.com>
832
833         Unreviewed, fix Windows.
834
835         * wtf/ThreadSpecificWin.cpp:
836         (WTF::destructorsList):
837         (WTF::destructorsMutex):
838         (WTF::threadSpecificKeyCreate):
839         (WTF::threadSpecificKeyDelete):
840         (WTF::ThreadSpecificThreadExit):
841
842 2015-08-04  Filip Pizlo  <fpizlo@apple.com>
843
844         Rename Mutex to DeprecatedMutex
845         https://bugs.webkit.org/show_bug.cgi?id=147675
846
847         Reviewed by Geoffrey Garen.
848
849         * wtf/Atomics.cpp:
850         (WTF::getSwapLock):
851         (WTF::atomicStep):
852         * wtf/MessageQueue.h:
853         (WTF::MessageQueue::infiniteTime):
854         (WTF::MessageQueue<DataType>::append):
855         (WTF::MessageQueue<DataType>::appendAndKill):
856         (WTF::MessageQueue<DataType>::appendAndCheckEmpty):
857         (WTF::MessageQueue<DataType>::prepend):
858         (WTF::MessageQueue<DataType>::removeIf):
859         (WTF::MessageQueue<DataType>::isEmpty):
860         (WTF::MessageQueue<DataType>::kill):
861         (WTF::MessageQueue<DataType>::killed):
862         * wtf/ParallelJobsGeneric.cpp:
863         (WTF::ParallelEnvironment::ThreadPrivate::execute):
864         (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish):
865         (WTF::ParallelEnvironment::ThreadPrivate::workerThread):
866         * wtf/ParallelJobsGeneric.h:
867         * wtf/RunLoop.cpp:
868         (WTF::RunLoop::performWork):
869         (WTF::RunLoop::dispatch):
870         * wtf/RunLoop.h:
871         * wtf/Threading.cpp:
872         (WTF::threadEntryPoint):
873         (WTF::createThread):
874         * wtf/ThreadingPrimitives.h:
875         * wtf/ThreadingPthreads.cpp:
876         (WTF::threadMapMutex):
877         (WTF::initializeThreading):
878         (WTF::identifierByPthreadHandle):
879         (WTF::establishIdentifierForPthreadHandle):
880         (WTF::changeThreadPriority):
881         (WTF::waitForThreadCompletion):
882         (WTF::detachThread):
883         (WTF::threadDidExit):
884         (WTF::currentThread):
885         (WTF::DeprecatedMutex::DeprecatedMutex):
886         (WTF::DeprecatedMutex::~DeprecatedMutex):
887         (WTF::DeprecatedMutex::lock):
888         (WTF::DeprecatedMutex::tryLock):
889         (WTF::DeprecatedMutex::unlock):
890         (WTF::ThreadCondition::~ThreadCondition):
891         (WTF::ThreadCondition::wait):
892         (WTF::ThreadCondition::timedWait):
893         (WTF::Mutex::Mutex): Deleted.
894         (WTF::Mutex::~Mutex): Deleted.
895         (WTF::Mutex::lock): Deleted.
896         (WTF::Mutex::tryLock): Deleted.
897         (WTF::Mutex::unlock): Deleted.
898         * wtf/ThreadingWin.cpp:
899         (WTF::initializeCurrentThreadInternal):
900         (WTF::threadMapMutex):
901         (WTF::initializeThreading):
902         (WTF::storeThreadHandleByIdentifier):
903         (WTF::threadHandleForIdentifier):
904         (WTF::clearThreadHandleForIdentifier):
905         (WTF::currentThread):
906         (WTF::DeprecatedMutex::DeprecatedMutex):
907         (WTF::DeprecatedMutex::~DeprecatedMutex):
908         (WTF::DeprecatedMutex::lock):
909         (WTF::DeprecatedMutex::tryLock):
910         (WTF::DeprecatedMutex::unlock):
911         (WTF::ThreadCondition::~ThreadCondition):
912         (WTF::ThreadCondition::wait):
913         (WTF::ThreadCondition::timedWait):
914         (WTF::Mutex::Mutex): Deleted.
915         (WTF::Mutex::~Mutex): Deleted.
916         (WTF::Mutex::lock): Deleted.
917         (WTF::Mutex::tryLock): Deleted.
918         (WTF::Mutex::unlock): Deleted.
919         * wtf/WorkQueue.h:
920         * wtf/dtoa.cpp:
921         * wtf/dtoa.h:
922         * wtf/efl/DispatchQueueEfl.cpp:
923         (DispatchQueue::dispatch):
924         (DispatchQueue::performWork):
925         (DispatchQueue::performTimerWork):
926         (DispatchQueue::insertTimerWorkItem):
927         (DispatchQueue::wakeUpThread):
928         (DispatchQueue::getNextTimeOut):
929         * wtf/efl/DispatchQueueEfl.h:
930         * wtf/efl/RunLoopEfl.cpp:
931         (WTF::RunLoop::wakeUpEvent):
932         (WTF::RunLoop::wakeUp):
933         * wtf/threads/BinarySemaphore.cpp:
934         (WTF::BinarySemaphore::signal):
935         (WTF::BinarySemaphore::wait):
936         * wtf/threads/BinarySemaphore.h:
937         * wtf/win/WorkQueueWin.cpp:
938         (WTF::WorkQueue::handleCallback):
939         (WTF::WorkQueue::platformInvalidate):
940         (WTF::WorkQueue::dispatch):
941         (WTF::WorkQueue::timerCallback):
942         (WTF::WorkQueue::dispatchAfter):
943
944 2015-08-04  Alex Christensen  <achristensen@webkit.org>
945
946         Fix quirks with CMake and VS2015
947         https://bugs.webkit.org/show_bug.cgi?id=147663
948
949         Reviewed by Brent Fulgham.
950
951         * wtf/Platform.h:
952         Build fix after r187908
953
954 2015-08-04  Brent Fulgham  <bfulgham@apple.com>
955
956         [Win] Update Apple Windows build for VS2015
957         https://bugs.webkit.org/show_bug.cgi?id=147653
958
959         Reviewed by Dean Jackson.
960
961         * WTF.vcxproj/WTF.vcxproj.filters: Drive-by-fix to place files in
962         proper project locations in the IDE.
963         * wtf/Platform.h: Don't define the _HAS_EXCEPTIONS macro when building with
964         Visual Studio 2015.
965
966 2015-08-04  Commit Queue  <commit-queue@webkit.org>
967
968         Unreviewed, rolling out r187815 and r187817.
969         https://bugs.webkit.org/show_bug.cgi?id=147644
970
971         Caused lots of Windows crashes (Requested by smfr on #webkit).
972
973         Reverted changesets:
974
975         "[WTF] Turn tryMakeString(), makeString() into variadic
976         templates"
977         https://bugs.webkit.org/show_bug.cgi?id=147142
978         http://trac.webkit.org/changeset/187815
979
980         "Unreviewed build fix."
981         http://trac.webkit.org/changeset/187817
982
983 2015-08-04  Alex Christensen  <achristensen@webkit.org>
984
985         Enable WebGL on Windows CMake build.
986         https://bugs.webkit.org/show_bug.cgi?id=143311
987
988         Reviewed by Csaba Osztrogonác.
989
990         * wtf/FeatureDefines.h:
991         Made the CMake feature defines the same as the non-CMake feature defines.
992
993 2015-08-03  Csaba Osztrogonác  <ossy@webkit.org>
994
995         Introduce COMPILER(GCC_OR_CLANG) guard and make COMPILER(GCC) true only for GCC
996         https://bugs.webkit.org/show_bug.cgi?id=146833
997
998         Reviewed by Alexey Proskuryakov.
999
1000         * wtf/Assertions.cpp:
1001         * wtf/Assertions.h: Removed redundant COMPILER(CLANG) guard.
1002         * wtf/Atomics.cpp:
1003         * wtf/Atomics.h:
1004         (WTF::weakCompareAndSwap):
1005         (WTF::compilerFence):
1006         * wtf/Compiler.h:
1007          - Renamed COMPILER(GCC) to COMPILER(GCC_OR_CLANG), because it is true for both compiler.
1008          - Added COMPILER(GCC) which is true only for GCC.
1009          - Moved all GCC related stuff to one block and removed redundant guards accordingly.
1010          - Removed the unused default false definition of GCC_VERSION_AT_LEAST for non GCC compilers.
1011         * wtf/ExportMacros.h:
1012         * wtf/FastMalloc.h:
1013         * wtf/Platform.h:
1014         * wtf/StdLibExtras.h:
1015         * wtf/Vector.h:
1016         * wtf/text/ASCIIFastPath.h:
1017         (WTF::copyLCharsFromUCharSource):
1018
1019 2015-08-03  Zan Dobersek  <zdobersek@igalia.com>
1020
1021         Unreviewed build fix.
1022
1023         * wtf/text/StringConcatenate.h: Include <tuple> to avoid missing
1024         std::tuple<> class definitions.
1025
1026 2015-08-03  Zan Dobersek  <zdobersek@igalia.com>
1027
1028         [WTF] Turn tryMakeString(), makeString() into variadic templates
1029         https://bugs.webkit.org/show_bug.cgi?id=147142
1030
1031         Reviewed by Sam Weinig.
1032
1033         Built upon the original work by Anders Carlsson, Mark Rowe and Sam Weinig.
1034
1035         Implement tryMakeString() and makeString() as variadic templates, replacing
1036         the argument count-based overloads.
1037
1038         tryMakeString() now constructs a stack-based tuple of necessary StringTypeAdapter
1039         objects and utilizes the StringAdapterTuple struct template to operate on that
1040         tuple, recursively calling the necessary operations on each element in the tuple.
1041         This effectively mimics the process of previous tryMakeString() implementation,
1042         but makes it scalable to a tuple of elements that are to be concatenated.
1043
1044         StringAppend class template now stores two StringTypeAdapter objects for the
1045         two passed-in string objects, packed in a tuple, calling
1046         StringAdapterTuple<>::createString() directly when concatenating the two objects
1047         into one String.
1048
1049         * wtf/text/StringConcatenate.h:
1050         (WTF::StringTypeAdapter<char>::length):
1051         (WTF::StringTypeAdapter<char>::is8Bit):
1052         (WTF::StringAdapterTuple::sumWithOverflow):
1053         (WTF::StringAdapterTuple::is8Bit):
1054         (WTF::StringAdapterTuple::writeTo):
1055         (WTF::StringAdapterTuple::createString):
1056         (WTF::tryMakeString):
1057         (WTF::makeString):
1058         (WTF::sumWithOverflow): Deleted.
1059         * wtf/text/StringOperators.h:
1060         (WTF::StringAppend::StringAppend):
1061         (WTF::StringAppend::operator String):
1062         (WTF::StringAppend::is8Bit):
1063         (WTF::StringAppend::writeTo):
1064         (WTF::StringAppend::length):
1065         (WTF::StringAppend::string1):
1066         (WTF::StringAppend::string2):
1067
1068 2015-08-03  Anders Carlsson  <andersca@apple.com>
1069
1070         Make it possible to use String::utf8() in the debugger
1071         https://bugs.webkit.org/show_bug.cgi?id=147566
1072
1073         Reviewed by Tim Horton.
1074
1075         Add a new utf8() overload that doesn't take any parameters and just calls utf8(LenientConversion), since lldb doesn't support evaluating
1076         function calls with default parameters at the moment.
1077
1078         * wtf/text/WTFString.cpp:
1079         (WTF::String::utf8):
1080         * wtf/text/WTFString.h:
1081
1082 2015-08-02  Benjamin Poulain  <bpoulain@apple.com>
1083
1084         Investigate HashTable::HashTable(const HashTable&) and HashTable::operator=(const HashTable&) performance for hash-based static analyses
1085         https://bugs.webkit.org/show_bug.cgi?id=118455
1086
1087         Reviewed by Filip Pizlo.
1088
1089         Previously, when copying a HashTable, we would start from scratch
1090         with an empty table and insert elements one by one, growing-rehashing
1091         the table as needed.
1092
1093         With this patch, we have 2 improvements to remove most of the cost.
1094
1095         First, we compute a good size from the start. This removes all the
1096         reallocations and rehashs.
1097         This is where the biggest gain comes from.
1098
1099         The second part is a simpler version of add() when we know that
1100         we cannot find a bucket with the same key and there cannot
1101         be any deleted bucket.
1102         This removes most branches from the hot loop, cutting another 25%
1103         of the time.
1104
1105         * wtf/HashTable.h:
1106         (WTF::KeyTraits>::addUniqueForInitialization):
1107         (WTF::KeyTraits>::HashTable):
1108
1109 2015-08-01  Myles C. Maxfield  <mmaxfield@apple.com>
1110
1111         HashTraits<AtomicString> can use SimpleClassHashTraits
1112         https://bugs.webkit.org/show_bug.cgi?id=147528
1113
1114         Reviewed by Andreas Kling.
1115
1116         No point in duplicating the code inside SimpleClassHashTraits.
1117
1118         * wtf/text/AtomicStringHash.h:
1119         (WTF::HashTraits<WTF::AtomicString>::constructDeletedValue): Deleted.
1120         (WTF::HashTraits<WTF::AtomicString>::isDeletedValue): Deleted.
1121
1122 2015-08-01  Alex Christensen  <achristensen@webkit.org>
1123
1124         Fix compile errors with VS2015
1125         https://bugs.webkit.org/show_bug.cgi?id=147526
1126
1127         Reviewed by Myles Maxfield.
1128
1129         * wtf/StringExtras.h:
1130         (snprintf):
1131         (wtf_vsnprintf):
1132         VS2015 has an implementation of snprintf.
1133
1134 2015-07-31  Alex Christensen  <achristensen@webkit.org>
1135
1136         Prepare for VS2015
1137         https://bugs.webkit.org/show_bug.cgi?id=146579
1138
1139         Reviewed by Jon Honeycutt.
1140
1141         * wtf/StdLibExtras.h:
1142         (std::exchange):
1143         Added preprocessor macros around functions implemented in VS2015's standard library.
1144
1145 2015-07-30  Chris Dumez  <cdumez@apple.com>
1146
1147         Mark more classes as fast allocated
1148         https://bugs.webkit.org/show_bug.cgi?id=147440
1149
1150         Reviewed by Sam Weinig.
1151
1152         Mark more classes as fast allocated for performance. We heap-allocate
1153         objects of those types throughout the code base.
1154
1155         * wtf/Bag.h:
1156         * wtf/SegmentedVector.h:
1157         * wtf/SentinelLinkedList.h:
1158
1159 2015-07-29  Basile Clement  <basile_clement@apple.com>
1160
1161         Remove native call inlining
1162         https://bugs.webkit.org/show_bug.cgi?id=147417
1163
1164         Rubber-stamped by Filip Pizlo.
1165
1166         * wtf/Platform.h:
1167
1168 2015-07-28  Yusuke Suzuki  <utatane.tea@gmail.com>
1169
1170         [ES6] Add ENABLE_ES6_MODULES compile time flag with the default value "false"
1171         https://bugs.webkit.org/show_bug.cgi?id=147350
1172
1173         Reviewed by Sam Weinig.
1174
1175         * wtf/FeatureDefines.h:
1176
1177 2015-07-28  Filip Pizlo  <fpizlo@apple.com>
1178
1179         Unreviewed, fix Windows build.
1180
1181         * wtf/MetaAllocatorHandle.h:
1182         (WTF::MetaAllocatorHandle::key):
1183
1184 2015-07-27  Filip Pizlo  <fpizlo@apple.com>
1185
1186         Add logging when executable code gets deallocated
1187         https://bugs.webkit.org/show_bug.cgi?id=147355
1188
1189         Reviewed by Mark Lam.
1190
1191         * wtf/MetaAllocator.cpp:
1192         (WTF::MetaAllocatorHandle::dump): It's useful to be able to dump these.
1193         * wtf/MetaAllocatorHandle.h:
1194
1195 2015-07-28  Benjamin Poulain  <bpoulain@apple.com>
1196
1197         Speed up StringBuilder::appendQuotedJSONString()
1198         https://bugs.webkit.org/show_bug.cgi?id=147352
1199
1200         Reviewed by Andreas Kling.
1201
1202         * wtf/text/StringBuilder.cpp:
1203         (WTF::appendQuotedJSONStringInternal):
1204         The cases '"' and '\\' are not that uncommon, and they can easily
1205         be handled in the original branch testing for them.
1206
1207         This is about 2.5% better on the JSON.stringify test.
1208
1209 2015-07-27  Alex Christensen  <achristensen@webkit.org>
1210
1211         Progress towards building AppleWin with CMake
1212         https://bugs.webkit.org/show_bug.cgi?id=147325
1213
1214         Reviewed by Martin Robinson.
1215
1216         * wtf/PlatformWin.cmake:
1217         Link with CoreFoundation.lib.
1218
1219 2015-07-25  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1220
1221         REGRESSION (bmalloc): WebKit performance tests don't report memory stats.
1222         https://bugs.webkit.org/show_bug.cgi?id=141247
1223
1224         Reviewed by Geoffrey Garen.
1225
1226         Meanwhile a better way of getting memory stats with bmalloc is not found
1227         (see bug 136592), we can report as memory stats the resident set size
1228         information that the operating system provides to us.
1229
1230         This at least should be good enough to get back the memory stats on the
1231         performance tests and being able to track down memory usage regressions
1232         at https://perf.webkit.org
1233
1234         * wtf/FastMalloc.cpp:
1235         (WTF::fastMallocStatistics): Report maxrss data as committedVMBytes.
1236
1237 2015-07-24  Csaba Osztrogonác  <ossy@webkit.org>
1238
1239         Remove the unused GCC workaround - std::is_trivially_destructible
1240         https://bugs.webkit.org/show_bug.cgi?id=147226
1241
1242         Reviewed by Darin Adler.
1243
1244         * wtf/StdLibExtras.h:
1245
1246 2015-07-23  Alex Christensen  <achristensen@webkit.org>
1247
1248         Remove compile and runtime flags for promises.
1249         https://bugs.webkit.org/show_bug.cgi?id=147244
1250
1251         Reviewed by Yusuke Suzuki.
1252
1253         * wtf/FeatureDefines.h:
1254
1255 2015-07-22  Sukolsak Sakshuwong  <sukolsak@gmail.com>
1256
1257         Add ENABLE_WEBASSEMBLY feature flag for WebAssembly
1258         https://bugs.webkit.org/show_bug.cgi?id=147212
1259
1260         Reviewed by Filip Pizlo.
1261
1262         * wtf/FeatureDefines.h:
1263
1264 2015-07-22  Filip Pizlo  <fpizlo@apple.com>
1265
1266         Introduce release assert for using threads before threading is initialized
1267         https://bugs.webkit.org/show_bug.cgi?id=147200
1268
1269         Reviewed by Michael Saboff.
1270         
1271         This will help bugs where you use createThread() before calling initializeThreading().
1272
1273         * wtf/ThreadIdentifierDataPthreads.cpp:
1274         (WTF::ThreadIdentifierData::initialize):
1275
1276 2015-07-21  Daniel Bates  <dabates@apple.com>
1277
1278         WTFCrash() in WebKit::WebProcess::networkConnection()
1279         https://bugs.webkit.org/show_bug.cgi?id=147112
1280         <rdar://problem/18477459>
1281
1282         Reviewed by Gavin Barraclough.
1283
1284         Add explicit boolean conversion function and remove overload of operator! to support
1285         checking whether an activity token is valid more directly than using the overloaded operator!.
1286
1287         * wtf/RefCounter.h:
1288         (WTF::RefCounter::Token::operator bool): Added.
1289         (WTF::RefCounter::Token::operator!): Deleted.
1290
1291 2015-07-20  Mark Lam  <mark.lam@apple.com>
1292
1293         Rollout r187020 and r187021: breaks JSC API tests on debug builds.
1294         https://bugs.webkit.org/show_bug.cgi?id=147110
1295
1296         * wtf/WTFThreadData.cpp:
1297         (WTF::WTFThreadData::WTFThreadData):
1298         * wtf/WTFThreadData.h:
1299         (WTF::WTFThreadData::stack):
1300
1301 2015-07-20  Alex Christensen  <achristensen@webkit.org>
1302
1303         Resurrect CMake build on Windows.
1304         https://bugs.webkit.org/show_bug.cgi?id=147083
1305
1306         Reviewed by Gyuyoung Kim.
1307
1308         * wtf/PlatformWin.cmake:
1309
1310 2015-07-20  Per Arne Vollan  <peavo@outlook.com>
1311
1312         JavaScriptCore performance is very bad on Windows
1313         https://bugs.webkit.org/show_bug.cgi?id=146448
1314
1315         Reviewed by Mark Lam.
1316
1317         Updating the stack bounds is time consuming.
1318         Only update the stack bounds when a new fiber is running.
1319
1320         * wtf/WTFThreadData.cpp:
1321         (WTF::WTFThreadData::WTFThreadData):
1322         * wtf/WTFThreadData.h:
1323         (WTF::WTFThreadData::stack):
1324
1325 2015-07-20  Julien Brianceau  <julien.brianceau@gmail.com>
1326
1327         Use isnan from std namespace in Stopwatch.h.
1328         https://bugs.webkit.org/show_bug.cgi?id=146911
1329
1330         Reviewed by Žan Doberšek.
1331
1332         * wtf/Stopwatch.h:
1333         (WTF::Stopwatch::isActive):
1334         (WTF::Stopwatch::start):
1335         (WTF::Stopwatch::stop):
1336         (WTF::Stopwatch::elapsedTime):
1337
1338 2015-07-16  Benjamin Poulain  <bpoulain@apple.com>
1339
1340         [Content extensions] Combine suffixes when generating NFAs
1341         https://bugs.webkit.org/show_bug.cgi?id=146961
1342
1343         Reviewed by Alex Christensen.
1344
1345         * wtf/Vector.h:
1346         (WTF::minCapacity>::Vector):
1347         (WTF::=):
1348         Copying a vector with a different inline capacity was broken due to
1349         the addition of MinimumCapacity.
1350
1351         This feature was needed by this patch so I fixed WTF.
1352
1353 2015-07-15  Anders Carlsson  <andersca@apple.com>
1354
1355         Make JavaScriptCore SPI headers used by WebCore SPI headers self-contained
1356         https://bugs.webkit.org/show_bug.cgi?id=146978
1357
1358         Reviewed by Dan Bernstein.
1359
1360         * wtf/ExportMacros.h:
1361
1362 2015-07-14  Anders Carlsson  <andersca@apple.com>
1363
1364         Assertions.h should include ExportMacros.h
1365         https://bugs.webkit.org/show_bug.cgi?id=146948
1366
1367         Reviewed by Tim Horton.
1368
1369         * wtf/Assertions.h:
1370
1371 2015-07-11  Joseph Pecoraro  <pecoraro@apple.com>
1372
1373         Unreviewed build fix, restrict APP_LINKS to just iOS.
1374
1375         * wtf/Platform.h:
1376
1377 2015-07-09  Tim Horton  <timothy_horton@apple.com>
1378
1379         Use CoreAnimation fences instead of synchronous IPC to synchronize resize
1380         https://bugs.webkit.org/show_bug.cgi?id=146294
1381         <rdar://problem/21090193>
1382
1383         Reviewed by Anders Carlsson.
1384
1385         * wtf/Platform.h:
1386         Add HAVE(COREANIMATION_FENCES)
1387
1388 2015-07-04  Chris Dumez  <cdumez@apple.com>
1389
1390         Drop RefPtr::clear() method
1391         https://bugs.webkit.org/show_bug.cgi?id=146556
1392
1393         Reviewed by Brady Eidson.
1394
1395         Drop RefPtr::clear() method in favor of "= nullptr;" pattern.
1396         Also made the "= nullptr;" pattern as efficient as clear()
1397         by providing a operator=(nullptr_t) overload. Local micro-
1398         benchmarking showed that "= nullptr;" used to be ~1.7% slower
1399         than clear().
1400
1401 2015-07-03  Dan Bernstein  <mitz@apple.com>
1402
1403         [Xcode] Update some build settings as recommended by Xcode 7
1404         https://bugs.webkit.org/show_bug.cgi?id=146597
1405
1406         Reviewed by Sam Weinig.
1407
1408         * Configurations/Base.xcconfig: Enabled CLANG_WARN_UNREACHABLE_CODE and
1409         GCC_NO_COMMON_BLOCKS. Removed GCC_MODEL_TUNING.
1410
1411         * WTF.xcodeproj/project.pbxproj: Updated LastUpgradeCheck.
1412
1413 2015-07-01  Alex Christensen  <achristensen@webkit.org>
1414
1415         Re-enable WebGL on WinCairo
1416         https://bugs.webkit.org/show_bug.cgi?id=146537
1417
1418         Reviewed by Csaba Osztrogonác.
1419
1420         * wtf/FeatureDefines.h:
1421         Enable WebGL on WinCairo again.
1422
1423 2015-07-01  Alex Christensen  <achristensen@webkit.org>
1424
1425         Ignore Visual Studio warning in SegmentedVector
1426         https://bugs.webkit.org/show_bug.cgi?id=146514
1427
1428         Reviewed by Andreas Kling.
1429
1430         * wtf/SegmentedVector.h:
1431         (WTF::SegmentedVector::deleteAllSegments):
1432         Use pragmas to ignore the 0 element array warning.
1433
1434 2015-07-01  Dean Jackson  <dino@apple.com>
1435
1436         Disable the experimental WebGL2 implementation
1437         https://bugs.webkit.org/show_bug.cgi?id=146526
1438         <rdar://problem/21641235>
1439
1440         Reviewed by Myles Maxfield.
1441
1442         Add (and disable) an ENABLE_WEBGL2 flag.
1443
1444         * wtf/FeatureDefines.h:
1445
1446 2015-06-30  Alex Christensen  <achristensen@webkit.org>
1447
1448         [Win] Unreviewed build fix after r186169.
1449
1450         * wtf/FeatureDefines.h:
1451         Temporarily disable WebGL on WinCairo. It was already temporarily disabled on AppleWin.
1452
1453 2015-06-30  Andy VanWagoner  <thetalecrafter@gmail.com>
1454
1455         Implement ECMAScript Internationalization API
1456         https://bugs.webkit.org/show_bug.cgi?id=90906
1457
1458         Reviewed by Benjamin Poulain.
1459
1460         * wtf/FeatureDefines.h: add ENABLE_INTL flag
1461
1462 2015-06-30  Keith Miller  <keith_miller@apple.com>
1463
1464         Errors in read() are not handled in WTF::cryptographicallyRandomValuesFromOS.
1465         https://bugs.webkit.org/show_bug.cgi?id=146473
1466
1467         Reviewed by Filip Pizlo.
1468
1469         We were not checking if errors occurred in WTF::cryptographicallyRandomValuesFromOS.
1470         We now buffer the data until enough bits of entropy exist to fill the buffer
1471         rather than crash. Additionally, added two crash functions so we can distinguish
1472         between the two reasons why we crashed in traces.
1473
1474         * wtf/OSRandomSource.cpp:
1475         (WTF::crashUnableToOpenFD):
1476         (WTF::crashUnableToReadFromFD):
1477         (WTF::cryptographicallyRandomValuesFromOS):
1478
1479 2015-06-29  Dean Jackson  <dino@apple.com>
1480
1481         Temporarily disable PICTURE_SIZES
1482         https://bugs.webkit.org/show_bug.cgi?id=146435
1483         <rdar://problem/21087013>
1484
1485         Reviewed by Tim Horton.
1486
1487         Temporarily disable PICTURE_SIZES because it causes problems with out
1488         of date <picture> polyfills.
1489
1490         * wtf/FeatureDefines.h:
1491
1492 2015-06-26  Antti Koivisto  <antti@apple.com>
1493
1494         Network process hangs fetching disk cache entries
1495         https://bugs.webkit.org/show_bug.cgi?id=146348
1496         <rdar://problem/21528072>
1497
1498         Reviewed by Anders Carlsson.
1499
1500         RunLoop::dispatch may deadlock if invoked with std::function that captures an object that calls RunLoop::dispatch in destructor.
1501
1502         * wtf/RunLoop.cpp:
1503         (WTF::RunLoop::performWork):
1504
1505             Don't reuse std::function variable in loop. We may end up destroying previously held std::function in assignment
1506             while holding the runloop mutex. With this change std::function is always destroyed with mutex unlocked.
1507
1508 2015-06-24  Commit Queue  <commit-queue@webkit.org>
1509
1510         Unreviewed, rolling out r185906.
1511         https://bugs.webkit.org/show_bug.cgi?id=146276
1512
1513         MSVC doesn't yet provide a const-qualified std::array<T,
1514         N>::size(), failing to compile the static_assert (Requested by
1515         zdobersek on #webkit).
1516
1517         Reverted changeset:
1518
1519         "Improve the source code generated by make_names.pl"
1520         https://bugs.webkit.org/show_bug.cgi?id=146208
1521         http://trac.webkit.org/changeset/185906
1522
1523 2015-06-24  Zan Dobersek  <zdobersek@igalia.com>
1524
1525         Improve the source code generated by make_names.pl
1526         https://bugs.webkit.org/show_bug.cgi?id=146208
1527
1528         Reviewed by Darin Adler.
1529
1530         * wtf/text/StringImpl.h:
1531         (WTF::StringImpl::assertHashIsCorrect): Make this method const-qualified.
1532
1533 2015-06-22  Darin Adler  <darin@apple.com>
1534
1535         Make Array.join work directly on substrings without reifying them
1536         https://bugs.webkit.org/show_bug.cgi?id=146191
1537
1538         Reviewed by Andreas Kling.
1539
1540         * wtf/Vector.h: Added an overload of uncheckedAppend like the one we added
1541         a while back, a non-template function that forwards through to the function
1542         template. This lets us call uncheckedAppend on an argument list and have it
1543         properly convert it to the Vector's element type.
1544
1545         * wtf/text/StringView.h:
1546         (WTF::StringView::getCharactersWithUpconvert): Changed to not use memcpy;
1547         saw some indication the hand-written loop was faster when profiling. Also
1548         use m_length directly when we know we are dealing with an 8-bit string,
1549         since the masking that the index function does is not needed in that case.
1550         (WTF::StringView::UpconvertedCharacters::UpconvertedCharacters): Ditto.
1551         (WTF::StringView::toString): Ditto.
1552         (WTF::StringView::toFloat): Ditto.
1553         (WTF::StringView::toInt): Ditto.
1554         (WTF::StringView::toStringWithoutCopying): Ditto.
1555         (WTF::StringView::find): Ditto.
1556
1557 2015-06-22  YunQiang Su  <wzssyqa@gmail.com>
1558
1559         [WTF] Platform.h: use _ABI64 instead of _MIPS_SIM_ABI64 to determine MIPS N64
1560         https://bugs.webkit.org/show_bug.cgi?id=145113
1561
1562         Reviewed by Csaba Osztrogonác.
1563
1564         * wtf/Platform.h:
1565
1566 2015-06-22  Anders Carlsson  <andersca@apple.com>
1567
1568         Fix build.
1569
1570         * wtf/threads/BinarySemaphore.cpp:
1571
1572 2015-06-22  Anders Carlsson  <andersca@apple.com>
1573
1574         Get rid of the Windows specific BinarySemaphore implementation
1575         https://bugs.webkit.org/show_bug.cgi?id=146216
1576
1577         Reviewed by Andreas Kling.
1578
1579         The fact that the Windows implementation uses a HEVENT internally was only useful
1580         to the Windows port of WebKit2; we can get rid of it now.
1581
1582         * WTF.vcxproj/WTF.vcxproj:
1583         * WTF.vcxproj/WTF.vcxproj.filters:
1584         * wtf/threads/BinarySemaphore.h:
1585         (WTF::BinarySemaphore::event): Deleted.
1586         * wtf/threads/win/BinarySemaphoreWin.cpp: Removed.
1587         (WTF::BinarySemaphore::BinarySemaphore): Deleted.
1588         (WTF::BinarySemaphore::~BinarySemaphore): Deleted.
1589         (WTF::BinarySemaphore::signal): Deleted.
1590         (WTF::BinarySemaphore::wait): Deleted.
1591
1592 2015-06-21  Gavin Barraclough  <barraclough@apple.com>
1593
1594         Page load performance regression due to bugs.webkit.org/show_bug.cgi?id=145542
1595         https://bugs.webkit.org/show_bug.cgi?id=146198
1596
1597         Unreviewed rollout.
1598
1599         * wtf/glib/GUniquePtr.h:
1600
1601 2015-06-20  Michael Catanzaro  <mcatanzaro@igalia.com>
1602
1603         [EFL][GTK] Define GLIB_VERSION_MIN_REQUIRED and require glib 2.36 for GTK
1604         https://bugs.webkit.org/show_bug.cgi?id=146181
1605
1606         Reviewed by Martin Robinson.
1607
1608         Define GLIB_VERSION_MIN_REQUIRED to avoid deprecation warnings.
1609
1610         * wtf/Platform.h:
1611
1612 2015-06-19  Michael Catanzaro  <mcatanzaro@igalia.com>
1613
1614         [SOUP] Define SOUP_VERSION_MIN_REQUIRED
1615         https://bugs.webkit.org/show_bug.cgi?id=146165
1616
1617         Reviewed by Martin Robinson.
1618
1619         Define SOUP_VERSION_MIN_REQUIRED to avoid deprecation warnings.
1620
1621         * wtf/Platform.h:
1622
1623 2015-06-19  Mark Lam  <mark.lam@apple.com>
1624
1625         Gardening: build fixes for GTK and EFL for CheckedArithmetic change.
1626
1627         Not reviewed.
1628
1629         * wtf/CheckedArithmetic.h:
1630         (WTF::Checked::operator<):
1631         (WTF::Checked::operator<=):
1632         (WTF::Checked::operator>):
1633         (WTF::Checked::operator>=):
1634
1635 2015-06-19  Mark Lam  <mark.lam@apple.com>
1636
1637         CheckedArithmetic's operator bool() and operator==() is broken.
1638         https://bugs.webkit.org/show_bug.cgi?id=146129
1639
1640         Reviewed by Geoffrey Garen and Oliver Hunt.
1641
1642         The existing operator UnspecifiedBoolType*() in CheckedArithmetic is erroneously
1643         allowing the Checked value to be implicitly casted into pointer types.  This is
1644         because it is doing a reinterpret_cast<UnspecifiedBoolType*>(1) whereas the idiom
1645         relies on the address of a member e.g. &Checked::m_value.  As a result,
1646         ImageBufferData::putData() was getting an implicit cast of a Checked value to
1647         (void*)1 and doing incorrect pointer comparisons on it.
1648
1649         Also, 2 of CheckedArithmetic's operator==() will crash if used on an overflowed
1650         value, while a 3rd one does not.  The 3rd one should be consistent and also crash
1651         if used on an overflowed Checked value.
1652
1653         In this fix, we replace operator UnspecifiedBoolType*() with an explicit operator
1654         bool().  We also add the missing operators <, <=, >, and >=.  That takes care of
1655         the comparisons in ImageBufferData::putData().
1656
1657         * wtf/CheckedArithmetic.h:
1658         (WTF::CrashOnOverflow::overflowed):
1659         (WTF::CrashOnOverflow::crash):
1660         (WTF::RecordOverflow::crash):
1661
1662         (WTF::Checked::operator!):
1663         (WTF::Checked::operator bool):
1664         (WTF::Checked::unsafeGet):
1665         - Don't call CRASH() directly.  Delegate to the handler.
1666
1667         (WTF::Checked::operator==):
1668         - Should call the handler's crash() to be consistent with the other 2 versions of
1669           operator== which will crash in unsafeGet() if used on an overflowed Checked
1670           value.
1671
1672         (WTF::Checked::operator<):
1673         (WTF::Checked::operator<=):
1674         (WTF::Checked::operator>):
1675         (WTF::Checked::operator>=):
1676         - Add missing operators.
1677
1678         (WTF::Checked::operator UnspecifiedBoolType*): Deleted.
1679
1680 2015-06-19  Csaba Osztrogonác  <ossy@webkit.org>
1681
1682         [WK2] Fix unused-private-field warning in WebProcess/Plugins/PluginView.<h|cpp>
1683         https://bugs.webkit.org/show_bug.cgi?id=145252
1684
1685         Reviewed by Tim Horton.
1686
1687         * wtf/FeatureDefines.h: Moved the definition of ENABLE_PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC
1688         here from Source/WebKit2/WebProcess/WebPage/WebPage.h
1689
1690 2015-06-17  Andreas Kling  <akling@apple.com>
1691
1692         SegmentedVector should waste less memory.
1693         <https://webkit.org/b/146069>
1694
1695         Reviewed by Anders Carlsson.
1696
1697         We were wasting sizeof(Vector) on every segment in SegmentVector.
1698         The segments were using inline capacity, and would never go beyond it,
1699         so all the size/capacity/out-of-line-buffer metadata was useless.
1700
1701         Change the internal representation to Vector<T[SegmentSize]> instead.
1702         This saves 16 bytes per segment, so lower SegmentSize -> bigger savings!
1703
1704         * wtf/SegmentedVector.h:
1705         (WTF::SegmentedVectorIterator::operator*):
1706         (WTF::SegmentedVectorIterator::operator->):
1707         (WTF::SegmentedVectorIterator::operator++):
1708         (WTF::SegmentedVectorIterator::operator==):
1709         (WTF::SegmentedVectorIterator::operator!=):
1710         (WTF::SegmentedVectorIterator::SegmentedVectorIterator):
1711         (WTF::SegmentedVector::at):
1712         (WTF::SegmentedVector::append):
1713         (WTF::SegmentedVector::removeLast):
1714         (WTF::SegmentedVector::grow):
1715         (WTF::SegmentedVector::begin):
1716         (WTF::SegmentedVector::end):
1717         (WTF::SegmentedVector::deleteAllSegments):
1718         (WTF::SegmentedVector::ensureSegmentsFor):
1719         (WTF::SegmentedVector::ensureSegment):
1720         (WTF::SegmentedVector::allocateSegment):
1721         (WTF::SegmentedVectorIterator::operator=): Deleted.
1722         (WTF::SegmentedVector::SegmentedVector): Deleted.
1723
1724 2015-06-16  Andreas Kling  <akling@apple.com>
1725
1726         Remove unused template parameter InlineCapacity from SegmentedVector.
1727         <https://webkit.org/b/146044>
1728
1729         Reviewed by Anders Carlsson.
1730
1731         * wtf/SegmentedVector.h:
1732         (WTF::SegmentedVectorIterator::operator=):
1733         (WTF::SegmentedVectorIterator::SegmentedVectorIterator):
1734         (WTF::SegmentedVector::at):
1735
1736 2015-06-16  Mark Lam  <mark.lam@apple.com>
1737
1738         Use NakedPtr<Exception>& to return exception results.
1739         https://bugs.webkit.org/show_bug.cgi?id=145870
1740
1741         Reviewed by Anders Carlsson and Filip Pizlo.
1742
1743         Introducing the NakedPtr class.
1744
1745         * WTF.xcodeproj/project.pbxproj:
1746         * wtf/NakedPtr.h: Added.
1747         (WTF::NakedPtr::NakedPtr):
1748         (WTF::NakedPtr::get):
1749         (WTF::NakedPtr::clear):
1750         (WTF::NakedPtr::operator*):
1751         (WTF::NakedPtr::operator->):
1752         (WTF::NakedPtr::operator T*):
1753         (WTF::NakedPtr::operator!):
1754         (WTF::NakedPtr::operator bool):
1755         (WTF::=):
1756         (WTF::NakedPtr<T>::swap):
1757         (WTF::swap):
1758
1759 2015-06-12  Zan Dobersek  <zdobersek@igalia.com>
1760
1761         [GLib] Move files under Source/WTF/wtf/gobject to Source/WTF/wtf/glib
1762         https://bugs.webkit.org/show_bug.cgi?id=145799
1763
1764         Reviewed by Carlos Garcia Campos.
1765
1766         Move the GLib-specific files to the Source/WTF/wtf/glib/ directory.
1767         'gobject' wasn't the most appropriate name for the directory since
1768         GObject is a submodule of GLib, but a lot of the code there didn't
1769         have much to do with GObject specifically.
1770
1771         Build rules for the moved files are also updated.
1772
1773         * WTF.vcxproj/WTF.vcxproj:
1774         * WTF.vcxproj/WTF.vcxproj.filters:
1775         * wtf/Platform.h:
1776         * wtf/PlatformEfl.cmake:
1777         * wtf/PlatformGTK.cmake:
1778         * wtf/RunLoop.h:
1779         * wtf/WorkQueue.h:
1780         * wtf/glib/GLibUtilities.cpp: Renamed from Source/WTF/wtf/gobject/GlibUtilities.cpp.
1781         (getCurrentExecutablePath):
1782         * wtf/glib/GLibUtilities.h: Renamed from Source/WTF/wtf/gobject/GlibUtilities.h.
1783         * wtf/glib/GMainLoopSource.cpp: Renamed from Source/WTF/wtf/gobject/GMainLoopSource.cpp.
1784         (WTF::GMainLoopSource::create):
1785         (WTF::GMainLoopSource::GMainLoopSource):
1786         (WTF::GMainLoopSource::~GMainLoopSource):
1787         (WTF::GMainLoopSource::isScheduled):
1788         (WTF::GMainLoopSource::isActive):
1789         (WTF::GMainLoopSource::cancel):
1790         (WTF::GMainLoopSource::scheduleIdleSource):
1791         (WTF::GMainLoopSource::schedule):
1792         (WTF::GMainLoopSource::scheduleTimeoutSource):
1793         (WTF::GMainLoopSource::scheduleAfterDelay):
1794         (WTF::createMicrosecondsTimeoutSource):
1795         (WTF::GMainLoopSource::scheduleAndDeleteOnDestroy):
1796         (WTF::GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy):
1797         (WTF::GMainLoopSource::prepareVoidCallback):
1798         (WTF::GMainLoopSource::finishVoidCallback):
1799         (WTF::GMainLoopSource::voidCallback):
1800         (WTF::GMainLoopSource::prepareBoolCallback):
1801         (WTF::GMainLoopSource::finishBoolCallback):
1802         (WTF::GMainLoopSource::boolCallback):
1803         (WTF::GMainLoopSource::socketCallback):
1804         (WTF::GMainLoopSource::voidSourceCallback):
1805         (WTF::GMainLoopSource::boolSourceCallback):
1806         (WTF::GMainLoopSource::socketSourceCallback):
1807         (WTF::GMainLoopSource::Context::destroySource):
1808         * wtf/glib/GMainLoopSource.h: Renamed from Source/WTF/wtf/gobject/GMainLoopSource.h.
1809         (WTF::GMainLoopSource::Context::operator=):
1810         * wtf/glib/GMutexLocker.h: Renamed from Source/WTF/wtf/gobject/GMutexLocker.h.
1811         (WTF::MutexWrapper<GMutex>::lock):
1812         (WTF::MutexWrapper<GMutex>::unlock):
1813         (WTF::MutexWrapper<GRecMutex>::lock):
1814         (WTF::MutexWrapper<GRecMutex>::unlock):
1815         (WTF::GMutexLocker::GMutexLocker):
1816         (WTF::GMutexLocker::~GMutexLocker):
1817         (WTF::GMutexLocker::lock):
1818         (WTF::GMutexLocker::unlock):
1819         * wtf/glib/GRefPtr.cpp: Renamed from Source/WTF/wtf/gobject/GRefPtr.cpp.
1820         (WTF::refGPtr):
1821         (WTF::derefGPtr):
1822         * wtf/glib/GRefPtr.h: Renamed from Source/WTF/wtf/gobject/GRefPtr.h.
1823         (WTF::GRefPtr::GRefPtr):
1824         (WTF::GRefPtr::~GRefPtr):
1825         (WTF::GRefPtr::clear):
1826         (WTF::GRefPtr::outPtr):
1827         (WTF::GRefPtr::isHashTableDeletedValue):
1828         (WTF::GRefPtr::get):
1829         (WTF::GRefPtr::operator*):
1830         (WTF::GRefPtr::operator->):
1831         (WTF::GRefPtr::operator!):
1832         (WTF::GRefPtr::operator UnspecifiedBoolType):
1833         (WTF::GRefPtr::hashTableDeletedValue):
1834         (WTF::=):
1835         (WTF::GRefPtr<T>::swap):
1836         (WTF::swap):
1837         (WTF::operator==):
1838         (WTF::operator!=):
1839         (WTF::static_pointer_cast):
1840         (WTF::const_pointer_cast):
1841         (WTF::adoptGRef):
1842         (WTF::refGPtr):
1843         (WTF::derefGPtr):
1844         * wtf/glib/GThreadSafeMainLoopSource.cpp: Renamed from Source/WTF/wtf/gobject/GThreadSafeMainLoopSource.cpp.
1845         (WTF::GThreadSafeMainLoopSource::GThreadSafeMainLoopSource):
1846         (WTF::GThreadSafeMainLoopSource::~GThreadSafeMainLoopSource):
1847         (WTF::GThreadSafeMainLoopSource::cancel):
1848         (WTF::GThreadSafeMainLoopSource::schedule):
1849         (WTF::GThreadSafeMainLoopSource::scheduleAfterDelay):
1850         (WTF::GThreadSafeMainLoopSource::prepareVoidCallback):
1851         (WTF::GThreadSafeMainLoopSource::finishVoidCallback):
1852         (WTF::GThreadSafeMainLoopSource::voidCallback):
1853         (WTF::GThreadSafeMainLoopSource::prepareBoolCallback):
1854         (WTF::GThreadSafeMainLoopSource::finishBoolCallback):
1855         (WTF::GThreadSafeMainLoopSource::boolCallback):
1856         * wtf/glib/GThreadSafeMainLoopSource.h: Renamed from Source/WTF/wtf/gobject/GThreadSafeMainLoopSource.h.
1857         * wtf/glib/GTypedefs.h: Renamed from Source/WTF/wtf/gobject/GTypedefs.h.
1858         * wtf/glib/GUniquePtr.h: Renamed from Source/WTF/wtf/gobject/GUniquePtr.h.
1859         (WTF::GPtrDeleter::operator()):
1860         (WTF::GUniqueOutPtr::GUniqueOutPtr):
1861         (WTF::GUniqueOutPtr::~GUniqueOutPtr):
1862         (WTF::GUniqueOutPtr::outPtr):
1863         (WTF::GUniqueOutPtr::release):
1864         (WTF::GUniqueOutPtr::operator*):
1865         (WTF::GUniqueOutPtr::operator->):
1866         (WTF::GUniqueOutPtr::get):
1867         (WTF::GUniqueOutPtr::operator!):
1868         (WTF::GUniqueOutPtr::operator UnspecifiedBoolType):
1869         (WTF::GUniqueOutPtr::reset):
1870         * wtf/glib/MainThreadGLib.cpp:
1871         * wtf/gobject/GMainLoopSource.cpp:
1872         (WTF::GMainLoopSource::create): Deleted.
1873         (WTF::GMainLoopSource::GMainLoopSource): Deleted.
1874         (WTF::GMainLoopSource::~GMainLoopSource): Deleted.
1875         (WTF::GMainLoopSource::isScheduled): Deleted.
1876         (WTF::GMainLoopSource::isActive): Deleted.
1877         (WTF::GMainLoopSource::cancel): Deleted.
1878         (WTF::GMainLoopSource::scheduleIdleSource): Deleted.
1879         (WTF::GMainLoopSource::schedule): Deleted.
1880         (WTF::GMainLoopSource::scheduleTimeoutSource): Deleted.
1881         (WTF::GMainLoopSource::scheduleAfterDelay): Deleted.
1882         (WTF::createMicrosecondsTimeoutSource): Deleted.
1883         (WTF::GMainLoopSource::scheduleAndDeleteOnDestroy): Deleted.
1884         (WTF::GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy): Deleted.
1885         (WTF::GMainLoopSource::prepareVoidCallback): Deleted.
1886         (WTF::GMainLoopSource::finishVoidCallback): Deleted.
1887         (WTF::GMainLoopSource::voidCallback): Deleted.
1888         (WTF::GMainLoopSource::prepareBoolCallback): Deleted.
1889         (WTF::GMainLoopSource::finishBoolCallback): Deleted.
1890         (WTF::GMainLoopSource::boolCallback): Deleted.
1891         (WTF::GMainLoopSource::socketCallback): Deleted.
1892         (WTF::GMainLoopSource::voidSourceCallback): Deleted.
1893         (WTF::GMainLoopSource::boolSourceCallback): Deleted.
1894         (WTF::GMainLoopSource::socketSourceCallback): Deleted.
1895         (WTF::GMainLoopSource::Context::destroySource): Deleted.
1896         * wtf/gobject/GMainLoopSource.h:
1897         (WTF::GMainLoopSource::Context::operator=): Deleted.
1898         * wtf/gobject/GMutexLocker.h:
1899         (WTF::MutexWrapper<GMutex>::lock): Deleted.
1900         (WTF::MutexWrapper<GMutex>::unlock): Deleted.
1901         (WTF::MutexWrapper<GRecMutex>::lock): Deleted.
1902         (WTF::MutexWrapper<GRecMutex>::unlock): Deleted.
1903         (WTF::GMutexLocker::GMutexLocker): Deleted.
1904         (WTF::GMutexLocker::~GMutexLocker): Deleted.
1905         (WTF::GMutexLocker::lock): Deleted.
1906         (WTF::GMutexLocker::unlock): Deleted.
1907         * wtf/gobject/GRefPtr.cpp:
1908         (WTF::refGPtr): Deleted.
1909         (WTF::derefGPtr): Deleted.
1910         * wtf/gobject/GRefPtr.h:
1911         (WTF::GRefPtr::GRefPtr): Deleted.
1912         (WTF::GRefPtr::~GRefPtr): Deleted.
1913         (WTF::GRefPtr::clear): Deleted.
1914         (WTF::GRefPtr::outPtr): Deleted.
1915         (WTF::GRefPtr::isHashTableDeletedValue): Deleted.
1916         (WTF::GRefPtr::get): Deleted.
1917         (WTF::GRefPtr::operator*): Deleted.
1918         (WTF::GRefPtr::operator->): Deleted.
1919         (WTF::GRefPtr::operator!): Deleted.
1920         (WTF::GRefPtr::operator UnspecifiedBoolType): Deleted.
1921         (WTF::GRefPtr::hashTableDeletedValue): Deleted.
1922         (WTF::=): Deleted.
1923         (WTF::GRefPtr<T>::swap): Deleted.
1924         (WTF::swap): Deleted.
1925         (WTF::operator==): Deleted.
1926         (WTF::operator!=): Deleted.
1927         (WTF::static_pointer_cast): Deleted.
1928         (WTF::const_pointer_cast): Deleted.
1929         (WTF::adoptGRef): Deleted.
1930         (WTF::refGPtr): Deleted.
1931         (WTF::derefGPtr): Deleted.
1932         * wtf/gobject/GThreadSafeMainLoopSource.cpp:
1933         (WTF::GThreadSafeMainLoopSource::GThreadSafeMainLoopSource): Deleted.
1934         (WTF::GThreadSafeMainLoopSource::~GThreadSafeMainLoopSource): Deleted.
1935         (WTF::GThreadSafeMainLoopSource::cancel): Deleted.
1936         (WTF::GThreadSafeMainLoopSource::schedule): Deleted.
1937         (WTF::GThreadSafeMainLoopSource::scheduleAfterDelay): Deleted.
1938         (WTF::GThreadSafeMainLoopSource::prepareVoidCallback): Deleted.
1939         (WTF::GThreadSafeMainLoopSource::finishVoidCallback): Deleted.
1940         (WTF::GThreadSafeMainLoopSource::voidCallback): Deleted.
1941         (WTF::GThreadSafeMainLoopSource::prepareBoolCallback): Deleted.
1942         (WTF::GThreadSafeMainLoopSource::finishBoolCallback): Deleted.
1943         (WTF::GThreadSafeMainLoopSource::boolCallback): Deleted.
1944         * wtf/gobject/GUniquePtr.h:
1945         (WTF::GPtrDeleter::operator()): Deleted.
1946         (WTF::GUniqueOutPtr::GUniqueOutPtr): Deleted.
1947         (WTF::GUniqueOutPtr::~GUniqueOutPtr): Deleted.
1948         (WTF::GUniqueOutPtr::outPtr): Deleted.
1949         (WTF::GUniqueOutPtr::release): Deleted.
1950         (WTF::GUniqueOutPtr::operator*): Deleted.
1951         (WTF::GUniqueOutPtr::operator->): Deleted.
1952         (WTF::GUniqueOutPtr::get): Deleted.
1953         (WTF::GUniqueOutPtr::operator!): Deleted.
1954         (WTF::GUniqueOutPtr::operator UnspecifiedBoolType): Deleted.
1955         (WTF::GUniqueOutPtr::reset): Deleted.
1956         * wtf/gobject/GlibUtilities.cpp:
1957         (getCurrentExecutablePath): Deleted.
1958
1959 2015-06-10  Basile Clement  <basile_clement@apple.com>
1960
1961         Unreviewed, fix an typo in unused template code.
1962
1963         * wtf/TinyPtrSet.h:
1964         (WTF::TinyPtrSet::iterator::operator*): s/at(index)/at(m_index)/
1965
1966 2015-06-09  Csaba Osztrogonác  <ossy@webkit.org>
1967
1968         [cmake] Fix the style issues in cmake project files
1969         https://bugs.webkit.org/show_bug.cgi?id=145755
1970
1971         Reviewed by Darin Adler.
1972
1973         * wtf/CMakeLists.txt:
1974
1975 2015-06-08  Alexey Proskuryakov  <ap@apple.com>
1976
1977         Build fix.
1978
1979         * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::isEmpty): s/poointer/pointer/
1980
1981 2015-06-07  Filip Pizlo  <fpizlo@apple.com>
1982
1983         The tiny set magic in StructureSet should be available in WTF
1984         https://bugs.webkit.org/show_bug.cgi?id=145722
1985
1986         Reviewed by Geoffrey Garen.
1987         
1988         As the management of structure sets evolved in JSC, the StructureSet data structure grew
1989         increasingly smart. It's got some smart stuff for managing small sets of pointers. I
1990         wanted to take the generic logic out of JSC and put it into a reusable templatized class
1991         in WTF.
1992         
1993         * WTF.vcxproj/WTF.vcxproj:
1994         * WTF.xcodeproj/project.pbxproj:
1995         * wtf/CMakeLists.txt:
1996         * wtf/TinyPtrSet.h: Added.
1997         (WTF::TinyPtrSet::TinyPtrSet):
1998         (WTF::TinyPtrSet::operator=):
1999         (WTF::TinyPtrSet::~TinyPtrSet):
2000         (WTF::TinyPtrSet::clear):
2001         (WTF::TinyPtrSet::onlyEntry):
2002         (WTF::TinyPtrSet::isEmpty):
2003         (WTF::TinyPtrSet::add):
2004         (WTF::TinyPtrSet::remove):
2005         (WTF::TinyPtrSet::contains):
2006         (WTF::TinyPtrSet::merge):
2007         (WTF::TinyPtrSet::forEach):
2008         (WTF::TinyPtrSet::genericFilter):
2009         (WTF::TinyPtrSet::filter):
2010         (WTF::TinyPtrSet::exclude):
2011         (WTF::TinyPtrSet::isSubsetOf):
2012         (WTF::TinyPtrSet::isSupersetOf):
2013         (WTF::TinyPtrSet::overlaps):
2014         (WTF::TinyPtrSet::size):
2015         (WTF::TinyPtrSet::at):
2016         (WTF::TinyPtrSet::operator[]):
2017         (WTF::TinyPtrSet::last):
2018         (WTF::TinyPtrSet::iterator::iterator):
2019         (WTF::TinyPtrSet::iterator::operator*):
2020         (WTF::TinyPtrSet::iterator::operator++):
2021         (WTF::TinyPtrSet::iterator::operator==):
2022         (WTF::TinyPtrSet::iterator::operator!=):
2023         (WTF::TinyPtrSet::begin):
2024         (WTF::TinyPtrSet::end):
2025         (WTF::TinyPtrSet::operator==):
2026         (WTF::TinyPtrSet::addOutOfLine):
2027         (WTF::TinyPtrSet::containsOutOfLine):
2028         (WTF::TinyPtrSet::copyFrom):
2029         (WTF::TinyPtrSet::copyFromOutOfLine):
2030         (WTF::TinyPtrSet::OutOfLineList::create):
2031         (WTF::TinyPtrSet::OutOfLineList::destroy):
2032         (WTF::TinyPtrSet::OutOfLineList::list):
2033         (WTF::TinyPtrSet::OutOfLineList::OutOfLineList):
2034         (WTF::TinyPtrSet::deleteListIfNecessary):
2035         (WTF::TinyPtrSet::isThin):
2036         (WTF::TinyPtrSet::pointer):
2037         (WTF::TinyPtrSet::singleEntry):
2038         (WTF::TinyPtrSet::list):
2039         (WTF::TinyPtrSet::set):
2040         (WTF::TinyPtrSet::setEmpty):
2041         (WTF::TinyPtrSet::getReservedFlag):
2042         (WTF::TinyPtrSet::setReservedFlag):
2043
2044 2015-06-05  Chris Dumez  <cdumez@apple.com>
2045
2046         [WK2][iOS] Limit the number of vnodes used by the WebContent processes
2047         https://bugs.webkit.org/show_bug.cgi?id=145672
2048         <rdar://problem/21126637>
2049
2050         Reviewed by Antti Koivisto.
2051
2052         * wtf/RefCounter.h:
2053         (WTF::RefCounter::value):
2054
2055         Expose the actual refcount instead of a boolean value.
2056
2057 2015-06-05  Alex Christensen  <achristensen@webkit.org>
2058
2059         [Web Timing] Use new SPI to enable data collection.
2060         https://bugs.webkit.org/show_bug.cgi?id=145650
2061         rdar://problem/21203358
2062
2063         Reviewed by Chris Dumez.
2064
2065         * wtf/Platform.h:
2066         Added HAVE_TIMINGDATAOPTIONS for platform and version dependent feature.
2067
2068 2015-06-05  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Youenn Fablet <youenn.fablet@crf.canon.fr>
2069
2070         [Streams API] ReadableStream should store callbacks as a Deque
2071         https://bugs.webkit.org/show_bug.cgi?id=145641
2072
2073         Reviewed by Darin Adler.
2074
2075         * wtf/Deque.h:
2076         (WTF::Deque::append): Adding not templated append method, forwarding to templated append method.
2077
2078 2015-06-02  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Youenn Fablet <youenn.fablet@crf.canon.fr>
2079
2080         [Streams API] Delegate ReadableStreamReader reference counting to ReadableStream
2081         https://bugs.webkit.org/show_bug.cgi?id=144907
2082
2083         Reviewed by Darin Adler.
2084
2085         * wtf/Vector.h:
2086         (WTF::Vector::append): Adding not templated append method, forwarding to ValueType templated append method.
2087
2088 2015-06-02  Yusuke Suzuki  <utatane.tea@gmail.com>
2089
2090         Heap-use-after-free read of size 4 in JavaScriptCore: WTF::StringImpl::isSymbol() (StringImpl.h:496)
2091         https://bugs.webkit.org/show_bug.cgi?id=145532
2092
2093         Reviewed by Geoffrey Garen.
2094
2095         Return `RefPtr<AtomicStringImpl>` instead of `AtomicStringImpl*`.
2096
2097         * wtf/text/AtomicStringImpl.cpp:
2098         (WTF::AtomicStringImpl::lookUpSlowCase):
2099         (WTF::AtomicStringImpl::lookUpInternal):
2100         * wtf/text/AtomicStringImpl.h:
2101         (WTF::AtomicStringImpl::lookUp):
2102
2103 2015-06-01  Anders Carlsson  <andersca@apple.com>
2104
2105         Use xpc_connection_set_oneshot_instance where possible
2106         https://bugs.webkit.org/show_bug.cgi?id=145535
2107         rdar://problem/21109994
2108
2109         Reviewed by Sam Weinig.
2110
2111         Add SPI declaration.
2112
2113         * wtf/spi/darwin/XPCSPI.h:
2114
2115 2015-05-29  Anders Carlsson  <andersca@apple.com>
2116
2117         Missing #import of Platform.h in several WTF headers
2118         https://bugs.webkit.org/show_bug.cgi?id=145475
2119         rdar://problem/21161818
2120
2121         Reviewed by Darin Adler.
2122
2123         Add Platform.h #includes.
2124
2125         * wtf/Assertions.h:
2126         * wtf/RetainPtr.h:
2127
2128 2015-05-29  Commit Queue  <commit-queue@webkit.org>
2129
2130         Unreviewed, rolling out r184949.
2131         https://bugs.webkit.org/show_bug.cgi?id=145458
2132
2133         Ends up generating worse code for HashTable move constructors
2134         (Requested by zdobersek on #webkit).
2135
2136         Reverted changeset:
2137
2138         "Clean up HashTable constructors"
2139         https://bugs.webkit.org/show_bug.cgi?id=145369
2140         http://trac.webkit.org/changeset/184949
2141
2142 2015-05-28  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
2143
2144         Purge PassRefPtr in StringConcatenate.h
2145         https://bugs.webkit.org/show_bug.cgi?id=145376
2146
2147         Reviewed by Darin Adler.
2148
2149         Replace PassRefPtr with RefPtr. Additionally use nullptr instead of 0.
2150
2151         * wtf/text/StringConcatenate.h:
2152         (WTF::tryMakeString):
2153         (WTF::makeString):
2154
2155 2015-05-28  Zan Dobersek  <zdobersek@igalia.com>
2156
2157         Clean up HashTable constructors
2158         https://bugs.webkit.org/show_bug.cgi?id=145369
2159
2160         Reviewed by Andreas Kling.
2161
2162         Use nullptr to initialize pointer member variables in the HashTable
2163         default constructor. Copy and move constructors can use constructor
2164         delegation instead of replicating all member initializations. Move
2165         constructor should simply call HashTable::swap() instead of replicating
2166         all the swap operations.
2167
2168         * wtf/HashTable.h:
2169         (WTF::KeyTraits>::HashTable):
2170
2171 2015-05-27  Alexey Proskuryakov  <ap@apple.com>
2172
2173         [Mac] Fix clang static analyzer build
2174         https://bugs.webkit.org/show_bug.cgi?id=145426
2175         rdar://problem/20947408
2176
2177         Reviewed by Dan Bernstein.
2178
2179         * wtf/spi/darwin/XPCSPI.h: Correct declarations of xpc_retain and xpc_release.
2180
2181 2015-05-27  Dean Jackson  <dino@apple.com>
2182
2183         img.currentSrc problem in strict mode with old picturefill
2184         https://bugs.webkit.org/show_bug.cgi?id=144095
2185         <rdar://problem/21087013>
2186
2187         Reviewed by Simon Fraser.
2188
2189         Add a PICTURE_SIZES flag.
2190
2191         * wtf/FeatureDefines.h:
2192
2193 2015-05-26  Andreas Kling  <akling@apple.com>
2194
2195         StringView should have find(StringView, start).
2196         <https://webkit.org/b/145351>
2197
2198         Reviewed by Darin Adler.
2199
2200         Move the class agnostic guts of StringImpl's find() implementation from StringImpl
2201         to StringCommon.h and templatize the code into a findCommon() helper.
2202
2203         StringImpl::find() and StringView::find() now both call findCommon().
2204
2205         * wtf/text/StringCommon.h:
2206         (WTF::findInner):
2207         (WTF::find):
2208         (WTF::findCommon):
2209         * wtf/text/StringImpl.cpp:
2210         (WTF::StringImpl::find):
2211         (WTF::findInner): Deleted.
2212         * wtf/text/StringImpl.h:
2213         (WTF::find): Deleted.
2214         * wtf/text/StringView.cpp:
2215         (WTF::StringView::find):
2216         * wtf/text/StringView.h:
2217
2218
2219 2015-05-26  Dan Bernstein  <mitz@apple.com>
2220
2221         <rdar://problem/21104551> Update build settings
2222
2223         Reviewed by Anders Carlsson.
2224
2225         * Configurations/DebugRelease.xcconfig:
2226
2227 2015-05-23  Dan Bernstein  <mitz@apple.com>
2228
2229         Remove unused definitions of WEBKIT_VERSION_MIN_REQUIRED
2230         https://bugs.webkit.org/show_bug.cgi?id=145345
2231
2232         Reviewed by Sam Weinig.
2233
2234         * Configurations/Base.xcconfig: Also changed to use $(inherited).
2235
2236 2015-05-23  Yusuke Suzuki  <utatane.tea@gmail.com>
2237
2238         Introduce UniquedStringImpl and SymbolImpl to separate symbolic strings from AtomicStringImpl
2239         https://bugs.webkit.org/show_bug.cgi?id=144848
2240
2241         Reviewed by Darin Adler.
2242
2243         he current AtomicStringImpl accidentally means the symbol OR atomic StringImpl.
2244         t's not correct to its name and it's error prone.
2245
2246         In this patch, we'll introduce/changes classes into WTF.
2247
2248         1. UniquedStringImpl
2249         It's derived class from StringImpl. And it represents symbol || atomic StringImpl.
2250
2251         2. SymbolImpl
2252         It's derived class from UniquedStringImpl. Only symbol strings can become this.
2253         It ensures the given StringImpl is symbol in compile time.
2254
2255         3. AtomicStringImpl
2256         It's derived class from UniquedStringImpl. Only atomic (non-normal && non-symbol) strings can become this.
2257         It ensures the given StringImpl is atomic in compile time.
2258
2259         And, in this time, I just accept UniqueStringImpl in AtomicString. As the result,
2260         1. Now AtomicStringImpl issue is fixed. Its SymbolImpl is separated and UniquedStringImpl is introduced.
2261         2. But AtomicString still have both symbol and atomic strings.
2262         This should be solved in the separated patch.
2263
2264         * WTF.vcxproj/WTF.vcxproj:
2265         * WTF.vcxproj/WTF.vcxproj.filters:
2266         * WTF.xcodeproj/project.pbxproj:
2267         * wtf/CMakeLists.txt:
2268         * wtf/PrintStream.cpp:
2269         * wtf/PrintStream.h:
2270         (WTF::printInternal):
2271         * wtf/text/AtomicString.h:
2272         (WTF::AtomicString::AtomicString):
2273         * wtf/text/AtomicStringImpl.h:
2274         * wtf/text/StringImpl.cpp:
2275         (WTF::StringImpl::~StringImpl):
2276         (WTF::StringImpl::createSymbol):
2277         (WTF::StringImpl::createSymbolEmpty):
2278         * wtf/text/StringImpl.h:
2279         * wtf/text/SymbolImpl.h: Copied from Source/JavaScriptCore/runtime/PrivateName.h.
2280         * wtf/text/SymbolRegistry.cpp:
2281         (WTF::SymbolRegistry::symbolForKey):
2282         (WTF::SymbolRegistry::keyForSymbol):
2283         (WTF::SymbolRegistry::remove):
2284         * wtf/text/SymbolRegistry.h:
2285         * wtf/text/UniquedStringImpl.h: Copied from Source/JavaScriptCore/runtime/PrivateName.h.
2286
2287 2015-05-20  Zan Dobersek  <zdobersek@igalia.com>
2288
2289         [GTK] Move MainThreadGtk, RunLoopGtk, WorkQueueGtk under Source/WTF/wtf/glib/
2290         https://bugs.webkit.org/show_bug.cgi?id=145117
2291
2292         Reviewed by Csaba Osztrogonác.
2293
2294         Move the MainThreadGtk, RunLoopGtk and WorkQueueGtk implementation files from
2295         Source/WTF/wtf/gtk/ to Source/WTF/wtf/glib/. These implementations are not
2296         GTK-specific and only depend on GLib, so they are renamed as well.
2297
2298         There are other such implementations under Source/WTF/wtf/gobject/ (GObject
2299         is just a subset of GLib) that will be moved under the new directory in
2300         future patches.
2301
2302         * wtf/PlatformGTK.cmake:
2303         * wtf/glib/MainThreadGLib.cpp: Renamed from Source/WTF/wtf/gtk/MainThreadGtk.cpp.
2304         (WTF::initializeMainThreadPlatform):
2305         (WTF::scheduleDispatchFunctionsOnMainThread):
2306         * wtf/glib/RunLoopGLib.cpp: Renamed from Source/WTF/wtf/gtk/RunLoopGtk.cpp.
2307         (WTF::RunLoop::RunLoop):
2308         (WTF::RunLoop::~RunLoop):
2309         (WTF::RunLoop::run):
2310         (WTF::RunLoop::stop):
2311         (WTF::RunLoop::wakeUp):
2312         (WTF::RunLoop::TimerBase::TimerBase):
2313         (WTF::RunLoop::TimerBase::~TimerBase):
2314         (WTF::RunLoop::TimerBase::start):
2315         (WTF::RunLoop::TimerBase::stop):
2316         (WTF::RunLoop::TimerBase::isActive):
2317         * wtf/glib/WorkQueueGLib.cpp: Renamed from Source/WTF/wtf/gtk/WorkQueueGtk.cpp.
2318         (WTF::WorkQueue::platformInitialize):
2319         (WTF::WorkQueue::platformInvalidate):
2320         (WTF::WorkQueue::registerSocketEventHandler):
2321         (WTF::WorkQueue::unregisterSocketEventHandler):
2322         (WTF::WorkQueue::dispatch):
2323         (WTF::WorkQueue::dispatchAfter):
2324
2325 2015-05-19  Andreas Kling  <akling@apple.com>
2326
2327         Give StringView a utf8() API.
2328         <https://webkit.org/b/145201>
2329
2330         Reviewed by Anders Carlsson
2331
2332         Added an LChar version of StringImpl::utf8ForCharacters() and use that to give
2333         StringView a utf8() API just like String has.
2334
2335         * wtf/text/StringImpl.cpp:
2336         (WTF::StringImpl::utf8ForCharacters):
2337         * wtf/text/StringImpl.h:
2338         * wtf/text/StringView.cpp:
2339         (WTF::StringView::utf8):
2340         * wtf/text/StringView.h:
2341
2342 2015-05-19  Yusuke Suzuki  <utatane.tea@gmail.com>
2343
2344         Move AtomicStringImpl table related operations from AtomicString to AtomicStringImpl
2345         https://bugs.webkit.org/show_bug.cgi?id=145109
2346
2347         Reviewed by Darin Adler.
2348
2349         Now AtomicStringImpl table operations are located in AtomicString.
2350         But they should be under AtomicStringImpl.
2351         This patch simply moves these operations to AtomicStringImpl.
2352
2353         And this patch renames static AtomicString::find to static AtomicStringImpl::lookUp
2354         because it conflicts with AtomicStringImpl's member function name.
2355
2356         * WTF.vcxproj/WTF.vcxproj:
2357         * WTF.vcxproj/WTF.vcxproj.filters:
2358         * WTF.vcxproj/copy-files.cmd:
2359         * WTF.xcodeproj/project.pbxproj:
2360         * wtf/CMakeLists.txt:
2361         * wtf/PlatformMac.cmake:
2362         * wtf/PlatformWin.cmake:
2363         * wtf/text/AtomicString.cpp:
2364         (WTF::AtomicString::lower):
2365         (WTF::AtomicString::convertToASCIILowercase):
2366         (WTF::AtomicString::fromUTF8Internal):
2367         (WTF::AtomicStringTableLocker::AtomicStringTableLocker): Deleted.
2368         (WTF::stringTable): Deleted.
2369         (WTF::addToStringTable): Deleted.
2370         (WTF::CStringTranslator::hash): Deleted.
2371         (WTF::CStringTranslator::equal): Deleted.
2372         (WTF::CStringTranslator::translate): Deleted.
2373         (WTF::AtomicString::add): Deleted.
2374         (WTF::UCharBufferTranslator::hash): Deleted.
2375         (WTF::UCharBufferTranslator::equal): Deleted.
2376         (WTF::UCharBufferTranslator::translate): Deleted.
2377         (WTF::HashAndCharactersTranslator::hash): Deleted.
2378         (WTF::HashAndCharactersTranslator::equal): Deleted.
2379         (WTF::HashAndCharactersTranslator::translate): Deleted.
2380         (WTF::HashAndUTF8CharactersTranslator::hash): Deleted.
2381         (WTF::HashAndUTF8CharactersTranslator::equal): Deleted.
2382         (WTF::HashAndUTF8CharactersTranslator::translate): Deleted.
2383         (WTF::SubstringTranslator::translate): Deleted.
2384         (WTF::SubstringTranslator8::hash): Deleted.
2385         (WTF::SubstringTranslator8::equal): Deleted.
2386         (WTF::SubstringTranslator16::hash): Deleted.
2387         (WTF::SubstringTranslator16::equal): Deleted.
2388         (WTF::LCharBufferTranslator::hash): Deleted.
2389         (WTF::LCharBufferTranslator::equal): Deleted.
2390         (WTF::LCharBufferTranslator::translate): Deleted.
2391         (WTF::CharBufferFromLiteralDataTranslator::hash): Deleted.
2392         (WTF::CharBufferFromLiteralDataTranslator::equal): Deleted.
2393         (WTF::CharBufferFromLiteralDataTranslator::translate): Deleted.
2394         (WTF::AtomicString::addFromLiteralData): Deleted.
2395         (WTF::AtomicString::addSlowCase): Deleted.
2396         (WTF::AtomicString::remove): Deleted.
2397         (WTF::AtomicString::findSlowCase): Deleted.
2398         (WTF::AtomicString::findInternal): Deleted.
2399         (WTF::AtomicString::isInAtomicStringTable): Deleted.
2400         * wtf/text/AtomicString.h:
2401         (WTF::AtomicString::AtomicString):
2402         (WTF::AtomicString::fromUTF8):
2403         (WTF::AtomicString::find): Deleted.
2404         (WTF::AtomicString::add): Deleted.
2405         (WTF::AtomicString::addWithStringTableProvider): Deleted.
2406         * wtf/text/AtomicStringImpl.cpp: Copied from Source/WTF/wtf/text/AtomicString.cpp.
2407         (WTF::AtomicStringTableLocker::AtomicStringTableLocker):
2408         (WTF::stringTable):
2409         (WTF::addToStringTable):
2410         (WTF::CStringTranslator::hash):
2411         (WTF::CStringTranslator::equal):
2412         (WTF::CStringTranslator::translate):
2413         (WTF::AtomicStringImpl::add):
2414         (WTF::UCharBufferTranslator::hash):
2415         (WTF::UCharBufferTranslator::equal):
2416         (WTF::UCharBufferTranslator::translate):
2417         (WTF::HashAndCharactersTranslator::hash):
2418         (WTF::HashAndCharactersTranslator::equal):
2419         (WTF::HashAndCharactersTranslator::translate):
2420         (WTF::HashAndUTF8CharactersTranslator::hash):
2421         (WTF::HashAndUTF8CharactersTranslator::equal):
2422         (WTF::HashAndUTF8CharactersTranslator::translate):
2423         (WTF::SubstringTranslator::translate):
2424         (WTF::SubstringTranslator8::hash):
2425         (WTF::SubstringTranslator8::equal):
2426         (WTF::SubstringTranslator16::hash):
2427         (WTF::SubstringTranslator16::equal):
2428         (WTF::LCharBufferTranslator::hash):
2429         (WTF::LCharBufferTranslator::equal):
2430         (WTF::LCharBufferTranslator::translate):
2431         (WTF::CharBufferFromLiteralDataTranslator::hash):
2432         (WTF::CharBufferFromLiteralDataTranslator::equal):
2433         (WTF::CharBufferFromLiteralDataTranslator::translate):
2434         (WTF::AtomicStringImpl::addLiteral):
2435         (WTF::AtomicStringImpl::addSlowCase):
2436         (WTF::AtomicStringImpl::remove):
2437         (WTF::AtomicStringImpl::lookUpSlowCase):
2438         (WTF::AtomicStringImpl::addUTF8):
2439         (WTF::AtomicStringImpl::lookUpInternal):
2440         (WTF::AtomicStringImpl::isInAtomicStringTable):
2441         * wtf/text/AtomicStringImpl.h:
2442         (WTF::AtomicStringImpl::lookUp):
2443         (WTF::AtomicStringImpl::add):
2444         (WTF::AtomicStringImpl::addWithStringTableProvider):
2445         (WTF::AtomicStringImpl::AtomicStringImpl): Deleted.
2446         * wtf/text/StringImpl.cpp:
2447         (WTF::StringImpl::~StringImpl):
2448         * wtf/text/StringImpl.h:
2449         * wtf/text/WTFString.h:
2450         (WTF::String::String):
2451         * wtf/text/cf/AtomicStringCF.cpp:
2452         (WTF::AtomicString::add): Deleted.
2453         * wtf/text/cf/AtomicStringImplCF.cpp: Renamed from Source/WTF/wtf/text/cf/AtomicStringCF.cpp.
2454         (WTF::AtomicStringImpl::add):
2455
2456 2015-05-19  Ting-Wei Lan  <lantw44@gmail.com>
2457
2458         [SOUP] Use st_birthtime to get creation time of files on systems support it
2459         https://bugs.webkit.org/show_bug.cgi?id=144989
2460
2461         Reviewed by Carlos Garcia Campos.
2462
2463         Define HAVE(STAT_BIRTHTIME) as 1 on operating systems supporting
2464         getting creation time of files using st_birthtime in stat.
2465
2466         * wtf/Platform.h:
2467
2468 2015-05-19  Chris Dumez  <cdumez@apple.com>
2469
2470         Mark static variables as const when possible
2471         https://bugs.webkit.org/show_bug.cgi?id=145161
2472
2473         Reviewed by Andreas Kling.
2474
2475         * wtf/dtoa.cpp:
2476         (WTF::pow5mult):
2477
2478 2015-05-19  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
2479
2480         [EFL] Remove unnecessary PLATFORM(EFL) macro in EFL specific files
2481         https://bugs.webkit.org/show_bug.cgi?id=145160
2482
2483         Reviewed by Csaba Osztrogonác.
2484
2485         * wtf/efl/EflTypedefs.h: Remove PLATFORM(EFL).
2486         * wtf/efl/UniquePtrEfl.h: ditto.
2487
2488 2015-05-18  Michael Catanzaro  <mcatanzaro@igalia.com>
2489
2490         [CMake] Ignore warnings in system headers
2491         https://bugs.webkit.org/show_bug.cgi?id=144747
2492
2493         Reviewed by Darin Adler.
2494
2495         Separate include directories into WebKit project includes and system includes. Suppress all
2496         warnings from headers in system include directories using the SYSTEM argument to
2497         the include_directories command.
2498
2499         * wtf/CMakeLists.txt:
2500         * wtf/PlatformEfl.cmake:
2501         * wtf/PlatformGTK.cmake:
2502
2503 2015-05-18  Myles C. Maxfield  <mmaxfield@apple.com>
2504
2505         Addressing post-review comments on r184353
2506         https://bugs.webkit.org/show_bug.cgi?id=145146
2507
2508         Reviewed by Benjamin Poulain.
2509
2510         Create an overload for equalIgnoringASCIICase() for AtomicString and string literals.
2511
2512         * wtf/text/AtomicString.h:
2513         (WTF::equalIgnoringASCIICase):
2514
2515 2015-05-18  Skachkov Alexandr  <gskachkov@gmail.com>
2516
2517         [ES6] Arrow function syntax. Feature flag for arrow function
2518         https://bugs.webkit.org/show_bug.cgi?id=145108
2519
2520         Reviewed by Ryosuke Niwa.
2521
2522         Added feature flag ENABLE_ES6_ARROWFUNCTION_SYNTAX for arrow function
2523
2524         * wtf/FeatureDefines.h:
2525
2526 2015-05-17  Benjamin Poulain  <benjamin@webkit.org>
2527
2528         Do not use fastMallocGoodSize anywhere
2529         https://bugs.webkit.org/show_bug.cgi?id=145103
2530
2531         Reviewed by Michael Saboff.
2532
2533         It is silly we see fastMallocGoodSize in profiles, it does absolutely nothing.
2534
2535         This patch keeps fastMallocGoodSize() around for older code linking
2536         with newer WebKit, but remove any use of it inside WebKit.
2537
2538         * wtf/FastMalloc.cpp:
2539         (WTF::fastMallocGoodSize):
2540         * wtf/FastMalloc.h:
2541         * wtf/Vector.h:
2542         (WTF::VectorBufferBase::allocateBuffer):
2543         (WTF::VectorBufferBase::tryAllocateBuffer):
2544         (WTF::VectorBufferBase::reallocateBuffer):
2545
2546 2015-05-15  Dan Bernstein  <mitz@apple.com>
2547
2548         Build fix for some versions of clang.
2549
2550         * wtf/SaturatedArithmetic.h:
2551         (signedAddOverflows):
2552         (signedSubtractOverflows):
2553
2554 2015-05-14  Dan Bernstein  <mitz@apple.com>
2555
2556         Reverted r177753, now that <rdar://problem/19347133> is fixed.
2557
2558         Rubber-stamped by Benjamin Poulain.
2559
2560         * wtf/SaturatedArithmetic.h:
2561         (signedAddOverflows):
2562         (signedSubtractOverflows):
2563
2564 2015-05-14  Myles C. Maxfield  <mmaxfield@apple.com>
2565
2566         Add String literal overloads to equalIgnoringASCIICase()
2567         https://bugs.webkit.org/show_bug.cgi?id=145008
2568
2569         Reviewed by Benjamin Poulain.
2570
2571         Create an overload for equalIgnoringASCIICase for string literals.
2572
2573         * wtf/text/StringImpl.h:
2574         (WTF::equalIgnoringASCIICase): Use a non-templated helper function.
2575         * wtf/text/StringImpl.cpp:
2576         (WTF::equalIgnoringASCIICase): Implement it.
2577         * wtf/text/StringView.h:
2578         (WTF::equalIgnoringASCIICase): Use a non-templated helper function.
2579         * wtf/text/StringView.cpp:
2580         (WTF::equalIgnoringASCIICase): Implement it.
2581         * wtf/text/WTFString.h:
2582         (WTF::equalIgnoringASCIICase): Delegate to StringImpl's implementation.
2583
2584 2015-05-14  Žan Doberšek  <zdobersek@igalia.com>
2585
2586         [GTK] RunLoop constructor should properly retrieve or establish the thread-default GMainContext
2587         https://bugs.webkit.org/show_bug.cgi?id=144732
2588
2589         Reviewed by Carlos Garcia Campos.
2590
2591         RunLoop constructor in the GTK implementation should use the
2592         existing thread-default context, create a new one if not on
2593         the main thread, or use the global-default one if on the main
2594         thread.
2595
2596         In RunLoop::run(), the GMainContext should then be pushed as
2597         the thread-default before calling g_main_loop_run(), and popped
2598         off when the main loop stops.
2599
2600         * wtf/gtk/RunLoopGtk.cpp:
2601         (WTF::RunLoop::RunLoop):
2602         (WTF::RunLoop::run):
2603
2604 2015-05-13  Oliver Hunt  <oliver@apple.com>
2605        Ensure that all the smart pointer types in WTF clear their pointer before deref
2606        https://bugs.webkit.org/show_bug.cgi?id=143789
2607
2608        Reviewed by Ryosuke Niwa.
2609
2610        In order to prevent use after free bugs caused by destructors
2611        that end up trying to access the smart pointer itself, we should
2612        make sure we always clear the m_ptr field before calling deref.
2613
2614        Essentially the UaF path is:
2615        struct Foo : RefCounted<Foo> {
2616          Wibble* m_wibble;
2617          void doSomething();
2618          ~Foo() { m_wibble->doSomethingLikeCleanup(); }
2619        };
2620
2621        struct Wibble {
2622          void doSomethingLikeCleanup()
2623          {
2624            if (m_foo) {
2625                /* if this branch is not here we get a null deref */
2626                m_foo->doSomething();
2627            }
2628          }
2629          void replaceFoo(Foo* foo) { m_foo = foo; }
2630          RefPtr<Foo> m_foo;
2631        };
2632
2633        Wibble* someWibble = /* a Wibble with m_foo->m_refCount == 1 */;
2634                             /* and m_foo points to someWibble       */;
2635
2636        someWibble->replaceFoo(someOtherFoo);
2637        + someWibble->m_foo->m_ptr->deref();
2638          + someWibble->m_foo->m_ptr->~Foo()
2639            + someWibble->m_foo->m_ptr->m_wibble->doSomethingLikeCleanup()
2640              + someWibble->m_foo->m_ptr->m_wibble /* someWibble */ ->m_foo->m_ptr /*logically dead*/ ->doSomething()
2641
2642        By clearing m_ptr first we either force a null pointer deref or
2643        we force our code down a path that does not use the dead smart
2644        pointer.
2645
2646        * wtf/PassRefPtr.h:
2647        (WTF::PassRefPtr::~PassRefPtr):
2648        * wtf/Ref.h:
2649        (WTF::Ref::~Ref):
2650        (WTF::Ref::operator=):
2651        * wtf/RefPtr.h:
2652        (WTF::RefPtr::~RefPtr):
2653        * wtf/RetainPtr.h:
2654        (WTF::RetainPtr::~RetainPtr):
2655        (WTF::RetainPtr<T>::clear):
2656
2657 2015-05-12  Michael Saboff  <msaboff@apple.com>
2658
2659         If JSC cannot get executable memory, it shouldn't call madvise
2660         https://bugs.webkit.org/show_bug.cgi?id=144931
2661
2662         Reviewed by Mark Lam.
2663
2664         Made calling madvise conditional on really getting mmapped memory.
2665
2666         * wtf/OSAllocatorPosix.cpp:
2667         (WTF::OSAllocator::reserveUncommitted):
2668
2669 2015-05-11  Brent Fulgham  <bfulgham@apple.com>
2670
2671         [Win] Move Windows build target to Windows 7 (or newer)
2672         https://bugs.webkit.org/show_bug.cgi?id=144890
2673         <rdar://problem/20707307>
2674
2675         Reviewed by Anders Carlsson.
2676
2677         Update linked SDK and minimal Windows level to be compatible with
2678         Windows 7 or newer.
2679
2680         * WTF.vcxproj/WTF.vcxproj:
2681         * WTF.vcxproj/WTFGenerated.vcxproj:
2682         * config.h:
2683
2684 2015-05-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2685
2686         [GTK] WorkQueue objects are not released
2687         https://bugs.webkit.org/show_bug.cgi?id=144824
2688
2689         Reviewed by Žan Doberšek.
2690
2691         Do not keep a reference of the WorkQueue for the entire life of
2692         its worker thread, since every task scheduled on the WorkQueue
2693         already takes a reference. Instead, take a reference of the main
2694         loop to make sure that when the worker thread starts, the main
2695         loop hasn't been released to avoid runtime warnings (see
2696         webkit.org/b/140998). Also removed the g_main_context_pop_thread_default()
2697         from the thread body, since the thread-specific context queue will
2698         be freed anyway when the thread exits.
2699         If the WorkQueue is released early, before the thread has started,
2700         schedule a main loop quit in the context, to make sure it will
2701         be the first thing run by the main loop and the thread will exit.
2702
2703         * wtf/WorkQueue.h: Remove unused event loop mutex.
2704         * wtf/gtk/WorkQueueGtk.cpp:
2705         (WTF::WorkQueue::platformInitialize):
2706         (WTF::WorkQueue::platformInvalidate):
2707
2708 2015-05-09  Yoav Weiss  <yoav@yoav.ws>
2709
2710         Remove the PICTURE_SIZES build flag
2711         https://bugs.webkit.org/show_bug.cgi?id=144679
2712
2713         Reviewed by Benjamin Poulain.
2714
2715         Removed the PICTURE_SIZES build time flag.
2716
2717         * wtf/FeatureDefines.h:
2718
2719 2015-05-08  Myles C. Maxfield  <mmaxfield@apple.com>
2720
2721         Remove convenience constructors for TextRun
2722         https://bugs.webkit.org/show_bug.cgi?id=144752
2723
2724         Reviewed by Anders Carlsson.
2725
2726         No reason why StringView shouldn't have a StringImpl* constructor.
2727
2728         Test: StringView8Bit in TestWebKitAPI
2729
2730         * wtf/text/StringView.h: Add the constructor.
2731
2732 2015-05-08  Commit Queue  <commit-queue@webkit.org>
2733
2734         Unreviewed, rolling out r183996.
2735         https://bugs.webkit.org/show_bug.cgi?id=144806
2736
2737         ASan detected use-after free (Requested by ap on #webkit).
2738
2739         Reverted changeset:
2740
2741         "Remove convenience constructors for TextRun"
2742         https://bugs.webkit.org/show_bug.cgi?id=144752
2743         http://trac.webkit.org/changeset/183996
2744
2745 2015-05-08  Myles C. Maxfield  <mmaxfield@apple.com>
2746
2747         Remove convenience constructors for TextRun
2748         https://bugs.webkit.org/show_bug.cgi?id=144752
2749
2750         Reviewed by Anders Carlsson.
2751
2752         No reason why StringView shouldn't have a StringImpl* constructor.
2753
2754         Test: StringView8Bit in TestWebKitAPI
2755
2756         * wtf/text/StringView.h: Add the constructor.
2757
2758 2015-05-08  Andreas Kling  <akling@apple.com>
2759
2760         Optimize serialization of quoted JSON strings.
2761         <https://webkit.org/b/144754>
2762
2763         Reviewed by Darin Adler.
2764
2765         Add a StringBuilder API for appending a quoted JSON string. This is used by
2766         JSON.stringify() to implement efficient appending of strings while escaping
2767         quotes, control characters and \uNNNN-style characters.
2768
2769         The main benefit comes from only doing a single buffer expansion up front,
2770         instead of doing it every time we append something. The fudge factor is pretty
2771         large, since the maximum number of output characters per input character is 6.
2772
2773         The first landing of this patch had two bugs in it:
2774
2775         - Made \uNNNN escapes uppercase hexadecimal instead of lowercase.
2776         - Didn't preallocate enough space for 8-bit input strings.
2777
2778         Both were caught by existing tests on our bots, and both were due to last-minute
2779         changes before landing. :/
2780
2781         * wtf/text/StringBuilder.cpp:
2782         (WTF::appendQuotedJSONStringInternal):
2783         (WTF::StringBuilder::appendQuotedJSONString):
2784         * wtf/text/StringBuilder.h:
2785
2786 2015-05-07  Commit Queue  <commit-queue@webkit.org>
2787
2788         Unreviewed, rolling out r183961.
2789         https://bugs.webkit.org/show_bug.cgi?id=144784
2790
2791         Broke js/dom/JSON-stringify.html (Requested by kling on
2792         #webkit).
2793
2794         Reverted changeset:
2795
2796         "Optimize serialization of quoted JSON strings."
2797         https://bugs.webkit.org/show_bug.cgi?id=144754
2798         http://trac.webkit.org/changeset/183961
2799
2800 2015-05-07  Andreas Kling  <akling@apple.com>
2801
2802         Optimize serialization of quoted JSON strings.
2803         <https://webkit.org/b/144754>
2804
2805         Reviewed by Darin Adler.
2806
2807         Add a StringBuilder API for appending a quoted JSON string. This is used by
2808         JSON.stringify() to implement efficient appending of strings while escaping
2809         quotes, control characters and \uNNNN-style characters.
2810
2811         The main benefit comes from only doing a single buffer expansion up front,
2812         instead of doing it every time we append something. The fudge factor is pretty
2813         large for 16-bit strings, since the maximum number of output characters per
2814         input character is 6.
2815
2816         * wtf/text/StringBuilder.cpp:
2817         (WTF::appendQuotedJSONStringInternal):
2818         (WTF::StringBuilder::appendQuotedJSONString):
2819         * wtf/text/StringBuilder.h:
2820
2821 2015-05-07  Martin Robinson  <mrobinson@igalia.com>
2822
2823         [GTK] All spell checking layout tests fail
2824         https://bugs.webkit.org/show_bug.cgi?id=144648
2825
2826         Reviewed by Carlos Garcia Campos.
2827
2828         * wtf/Platform.h: Activate UNIFIED_TEXT_CHECKING for GTK+.
2829
2830 2015-05-07  Dan Bernstein  <mitz@apple.com>
2831
2832         <rdar://problem/19317140> [Xcode] Remove usage of AspenFamily.xcconfig in Source/
2833         https://bugs.webkit.org/show_bug.cgi?id=144727
2834
2835         Reviewed by Darin Adler.
2836
2837         * Configurations/Base.xcconfig: Don’t include AspenFamily.xcconfig, and define
2838         INSTALL_PATH_PREFIX and LD_DYLIB_INSTALL_NAME for the iOS 8.x Simulator.
2839
2840 2015-05-07  Žan Doberšek  <zdobersek@igalia.com>
2841
2842         [GTK] Clean up RunLoop implementation
2843         https://bugs.webkit.org/show_bug.cgi?id=144729
2844
2845         Reviewed by Carlos Garcia Campos.
2846
2847         Clean up the RunLoop implementation for the GTK port,
2848         removing unnecessary methods and using simpler variable names.
2849
2850         Nested GMainLoops in RunLoop::run() are now created for the
2851         RunLoop's GMainContext, and not for the default context (enforced
2852         through the null argument to g_main_loop_new()).
2853
2854         * wtf/RunLoop.h:
2855         * wtf/gtk/RunLoopGtk.cpp:
2856         (WTF::RunLoop::RunLoop):
2857         (WTF::RunLoop::~RunLoop):
2858         (WTF::RunLoop::run):
2859         (WTF::RunLoop::stop):
2860         (WTF::RunLoop::wakeUp):
2861         (WTF::RunLoop::TimerBase::start):
2862         (WTF::RunLoop::innermostLoop): Deleted.
2863         (WTF::RunLoop::pushNestedMainLoop): Deleted.
2864         (WTF::RunLoop::popNestedMainLoop): Deleted.
2865
2866 2015-05-05  Carlos Garcia Campos  <cgarcia@igalia.com>
2867
2868         [GTK] Async operations running in the WorkQueue thread should schedule their sources to the WorkQueue main lopp
2869         https://bugs.webkit.org/show_bug.cgi?id=144541
2870
2871         Reviewed by Žan Doberšek.
2872
2873         They are currently sent to the main thread run loop, because we
2874         are not setting the WorkQueue main context as the default one in
2875         the worker thread.
2876
2877         * wtf/gtk/WorkQueueGtk.cpp:
2878         (WTF::WorkQueue::platformInitialize): Call
2879         g_main_context_push_thread_default() to set the WorkQueue main
2880         context as the default of the thread before running the main loop,
2881         and g_main_context_pop_thread_default() when the main loop quits.
2882
2883 2015-05-04  Commit Queue  <commit-queue@webkit.org>
2884
2885         Unreviewed, rolling out r183661.
2886         https://bugs.webkit.org/show_bug.cgi?id=144594
2887
2888         Caused ~3.5MB regression on membuster(!) (Requested by kling_
2889         on #webkit).
2890
2891         Reverted changeset:
2892
2893         "Decrease minimum Vector size."
2894         https://bugs.webkit.org/show_bug.cgi?id=144453
2895         http://trac.webkit.org/changeset/183661
2896
2897 2015-05-04  Zan Dobersek  <zdobersek@igalia.com>
2898
2899         [WTF] Remove Functional.h inclusions
2900         https://bugs.webkit.org/show_bug.cgi?id=144400
2901
2902         Reviewed by Darin Adler.
2903
2904         Remove most of the Functional.h header inclusions. The header is preserved
2905         since it's still used by older versions of Safari, and for the callOnMainThread()
2906         stub in DeprecatedSymbolsUsedBySafari.mm.
2907
2908         * wtf/MainThread.cpp:
2909         * wtf/RunLoop.h:
2910         * wtf/WorkQueue.cpp:
2911         * wtf/WorkQueue.h:
2912         * wtf/efl/DispatchQueueEfl.h:
2913         * wtf/efl/DispatchQueueWorkItemEfl.h:
2914
2915 2015-05-02  Commit Queue  <commit-queue@webkit.org>
2916
2917         Unreviewed, rolling out r183722.
2918         https://bugs.webkit.org/show_bug.cgi?id=144534
2919
2920         Made all the tests assert (Requested by ap on #webkit).
2921
2922         Reverted changeset:
2923
2924         "Generated static StringImpls should have static flag set."
2925         https://bugs.webkit.org/show_bug.cgi?id=144516
2926         http://trac.webkit.org/changeset/183722
2927
2928 2015-05-02  Andreas Kling  <akling@apple.com>
2929
2930         Generated static StringImpls should have static flag set.
2931         <https://webkit.org/b/144516>
2932
2933         Reviewed by Darin Adler.
2934
2935         Discovered this while tracking down a string ref leak. Turns out that the strings
2936         generated by StaticString.pm were not getting the static flag set on them.
2937
2938         The only practical difference from this AFAICT is that now the garbage collector
2939         will correctly see that these strings have no extra memory cost to worry about.
2940
2941         * wtf/text/StringImpl.h:
2942
2943 2015-05-01  Martin Robinson  <mrobinson@igalia.com>
2944
2945         USE(...) macro should expect unprefixed variables
2946         https://bugs.webkit.org/show_bug.cgi?id=144454
2947
2948         Reviewed by Daniel Bates.
2949
2950         * wtf/Assertions.cpp: Replace all occurrences WTF_USE with USE.
2951         * wtf/Platform.h: Replace all occurrences WTF_USE with USE. Modify the USE
2952         macro to look for unprefixed variables.
2953         * wtf/WTFThreadData.h: Replace all occurrences WTF_USE with USE.
2954
2955 2015-05-01  Joseph Pecoraro  <pecoraro@apple.com>
2956
2957         Enable ENABLE_ES6_TEMPLATE_LITERAL_SYNTAX by default on all ports (Windows was missed)
2958         https://bugs.webkit.org/show_bug.cgi?id=144495
2959
2960         Reviewed by Csaba Osztrogonác.
2961
2962         * wtf/FeatureDefines.h:
2963         This covers all ports that haven't defined the flag otherwise.
2964
2965 2015-04-30  Alex Christensen  <achristensen@webkit.org>
2966
2967         Decrease minimum Vector size.
2968         https://bugs.webkit.org/show_bug.cgi?id=144453
2969
2970         Reviewed by Andreas Kling.
2971
2972         * wtf/Vector.h:
2973         Make the default min size 4 to save memory on small Vectors.
2974
2975 2015-04-30  Yusuke Suzuki  <utatane.tea@gmail.com>
2976
2977         Use the default hash value for Symbolized StringImpl
2978         https://bugs.webkit.org/show_bug.cgi?id=144347
2979
2980         Reviewed by Darin Adler.
2981
2982         Use a default hash value calculation for symbolized StringImpl.
2983
2984         * wtf/text/StringImpl.cpp:
2985         (WTF::StringImpl::createSymbol):
2986         * wtf/text/StringImpl.h:
2987         (WTF::StringImpl::StringImpl):
2988         (WTF::StringImpl::symbolAwareHash):
2989         (WTF::StringImpl::existingSymbolAwareHash):
2990         (WTF::StringImpl::hashForSymbol):
2991         * wtf/text/StringStatics.cpp:
2992         (WTF::StringImpl::nextHashForSymbol):
2993         (WTF::StringImpl::hashAndFlagsForSymbol): Deleted.
2994
2995 2015-04-29  Alexey Proskuryakov  <ap@apple.com>
2996
2997         LazyNeverDestroyed is not thread safe in debug builds, causing assertions
2998         https://bugs.webkit.org/show_bug.cgi?id=144378
2999
3000         Reviewed by Darin Adler.
3001
3002         * wtf/NeverDestroyed.h:
3003
3004 2015-04-28  Geoffrey Garen  <ggaren@apple.com>
3005
3006         It shouldn't take 1846 lines of code and 5 FIXMEs to sort an array.
3007         https://bugs.webkit.org/show_bug.cgi?id=144013
3008
3009         Reviewed by Mark Lam.
3010
3011         Remove this custom tree implementation because it is unused. (It was
3012         previously used to achieve a stable array sort in certain cases.)
3013
3014         * WTF.vcxproj/WTF.vcxproj:
3015         * WTF.vcxproj/WTF.vcxproj.filters:
3016         * WTF.xcodeproj/project.pbxproj:
3017         * wtf/AVLTree.h: Removed.
3018         * wtf/CMakeLists.txt:
3019
3020 2015-04-29  Myles C. Maxfield  <mmaxfield@apple.com>
3021
3022         [OS X] Use CTFontCreateForCSS instead of doing font search ourselves
3023         https://bugs.webkit.org/show_bug.cgi?id=132159
3024
3025         Reviewed by Darin Adler.
3026
3027         * wtf/Platform.h:
3028
3029         Opt-in using ENABLE(PLATFORM_FONT_LOOKUP)
3030
3031 2015-04-29  Yusuke Suzuki  <utatane.tea@gmail.com>
3032
3033         REGRESSION (r183373): ASSERT failed in wtf/SHA1.h
3034         https://bugs.webkit.org/show_bug.cgi?id=144257
3035
3036         Reviewed by Darin Adler.
3037
3038         * wtf/SHA1.h:
3039         (WTF::SHA1::addBytes):
3040
3041 2015-04-29  Martin Robinson  <mrobinson@igalia.com>
3042
3043         [CMake] [GTK] Organize and clean up unused CMake variables
3044         https://bugs.webkit.org/show_bug.cgi?id=144364
3045
3046         Reviewed by Gyuyoung Kim.
3047
3048         * wtf/PlatformGTK.cmake: Add variables specific to this project.
3049
3050 2015-04-28  Michael Catanzaro  <mcatanzaro@igalia.com>
3051
3052         Fully replace ENABLE_LLINT_C_LOOP with ENABLE_JIT
3053         https://bugs.webkit.org/show_bug.cgi?id=144304
3054
3055         Reviewed by Geoffrey Garen.
3056
3057         No longer check ENABLE_LLINT_C_LOOP to determine the value of ENABLE_JIT.
3058
3059         * wtf/Platform.h:
3060
3061 2015-04-28  Commit Queue  <commit-queue@webkit.org>
3062
3063         Unreviewed, rolling out r183514.
3064         https://bugs.webkit.org/show_bug.cgi?id=144359
3065
3066         It broke cloop test bots (Requested by mcatanzaro on #webkit).
3067
3068         Reverted changeset:
3069
3070         "Fully replace ENABLE_LLINT_C_LOOP with ENABLE_JIT"
3071         https://bugs.webkit.org/show_bug.cgi?id=144304
3072         http://trac.webkit.org/changeset/183514
3073
3074 2015-04-28  Michael Catanzaro  <mcatanzaro@igalia.com>
3075
3076         Fully replace ENABLE_LLINT_C_LOOP with ENABLE_JIT
3077         https://bugs.webkit.org/show_bug.cgi?id=144304
3078
3079         Reviewed by Geoffrey Garen.
3080
3081         No longer check ENABLE_LLINT_C_LOOP to determine the value of ENABLE_JIT.
3082
3083         * wtf/Platform.h:
3084
3085 2015-04-28  Alex Christensen  <achristensen@webkit.org>
3086
3087         Properly reset deleted count when clearing HashTables.
3088         https://bugs.webkit.org/show_bug.cgi?id=144343
3089
3090         Reviewed by Andreas Kling.
3091
3092         * wtf/HashTable.h:
3093         (WTF::KeyTraits>::clear):
3094         Reset m_deletedCount, which appears to have been forgotten.
3095
3096 2015-04-28  Alex Christensen  <achristensen@webkit.org>
3097
3098         [Content Extensions] Use less memory for CombinedURLFilters.
3099         https://bugs.webkit.org/show_bug.cgi?id=144290
3100
3101         Reviewed by Andreas Kling.
3102
3103         * wtf/Forward.h:
3104         * wtf/Vector.h:
3105         Added a minCapacity template parameter to allow changing the minimum size of an 
3106         allocated buffer. The default minCapacity is kept at 16 unless otherwise specified 
3107         to have no change on existing code, but this could be changed later. A smaller 
3108         default minCapacity would use less memory with small Vectors but spend more time 
3109         copying when expanding to large Vectors.
3110
3111 2015-04-27  Brent Fulgham  <bfulgham@apple.com>
3112
3113         [Win] Deactivate WebGL until Windows tests work properly
3114         https://bugs.webkit.org/show_bug.cgi?id=144291
3115         <rdar://problem/20707307>
3116
3117         Reviewed by Zalan Bujtas.
3118
3119         * wtf/FeatureDefines.h: Force WebGL off for Windows builds.
3120
3121 2015-04-27  Michael Catanzaro  <mcatanzaro@igalia.com>
3122
3123         Rename WTF_USE_3D_GRAPHICS to ENABLE_GRAPHICS_CONTEXT_3D
3124         https://bugs.webkit.org/show_bug.cgi?id=144193
3125
3126         Reviewed by Darin Adler.
3127
3128         * wtf/FeatureDefines.h:
3129         * wtf/Platform.h:
3130
3131 2015-04-22  Martin Robinson  <mrobinson@igalia.com>
3132
3133         [CMake] Autogenerate cmakeconfig.h.cmake
3134         https://bugs.webkit.org/show_bug.cgi?id=143997
3135
3136         Reviewed by Csaba Osztrogonác.
3137
3138         * wtf/Platform.h: Move a GTK-specific setting from cmakeconfig.h to here.
3139
3140 2015-04-25  Martin Robinson  <mrobinson@igalia.com>
3141
3142         Rename ENABLE_3D_RENDERING to ENABLE_3D_TRANSFORMS
3143         https://bugs.webkit.org/show_bug.cgi?id=144182
3144
3145         Reviewed by Simon Fraser.
3146
3147         * wtf/FeatureDefines.h: Replace all instances of 3D_RENDERING with 3D_TRANSFORMS.
3148
3149 2015-04-24  Commit Queue  <commit-queue@webkit.org>
3150
3151         Unreviewed, rolling out r183288.
3152         https://bugs.webkit.org/show_bug.cgi?id=144189
3153
3154         Made js/sort-with-side-effecting-comparisons.html time out in
3155         debug builds (Requested by ap on #webkit).
3156
3157         Reverted changeset:
3158
3159         "It shouldn't take 1846 lines of code and 5 FIXMEs to sort an
3160         array."
3161         https://bugs.webkit.org/show_bug.cgi?id=144013
3162         http://trac.webkit.org/changeset/183288
3163
3164 2015-04-21  Geoffrey Garen  <ggaren@apple.com>
3165
3166         It shouldn't take 1846 lines of code and 5 FIXMEs to sort an array.
3167         https://bugs.webkit.org/show_bug.cgi?id=144013
3168
3169         Reviewed by Mark Lam.
3170
3171         Remove this custom tree implementation because it is unused. (It was
3172         previously used to achieve a stable array sort in certain cases.)
3173
3174         * WTF.vcxproj/WTF.vcxproj:
3175         * WTF.vcxproj/WTF.vcxproj.filters:
3176         * WTF.xcodeproj/project.pbxproj:
3177         * wtf/AVLTree.h: Removed.
3178         * wtf/CMakeLists.txt:
3179
3180 2015-04-24  Darin Adler  <darin@apple.com>
3181
3182         Convert OwnPtr and PassOwnPtr uses to std::unique_ptr
3183         https://bugs.webkit.org/show_bug.cgi?id=128007
3184
3185         Reviewed by Anders Carlsson.
3186
3187         * WTF.vcxproj/WTF.vcxproj: Removed OwnPtr source files.
3188         * WTF.vcxproj/WTF.vcxproj.filters: Ditto.
3189         * WTF.xcodeproj/project.pbxproj: Ditto.
3190         * wtf/CMakeLists.txt: Ditto.
3191
3192         * wtf/Forward.h: Removed OwnPtr and PassOwnPtr.
3193         * wtf/HashTraits.h: Ditto.
3194
3195         * wtf/OwnPtr.h: Removed.
3196         * wtf/OwnPtrCommon.h: Removed.
3197         * wtf/PassOwnPtr.h: Removed.
3198
3199         * wtf/SizeLimits.cpp: Removed OwnPtr.
3200         * wtf/VectorTraits.h: Removed OwnPtr specialization.
3201
3202 2015-04-23  Jer Noble  <jer.noble@apple.com>
3203
3204         Disable HAVE_AVKIT on AppleTV
3205         https://bugs.webkit.org/show_bug.cgi?id=144142
3206
3207         Reviewed by Dan Bernstein.
3208
3209         * wtf/Platform.h:
3210
3211 2015-04-23  Alexey Proskuryakov  <ap@apple.com>
3212
3213         [iOS] WebKit services should inherit environment variables for home
3214         https://bugs.webkit.org/show_bug.cgi?id=144078
3215         rdar://problem/20571678
3216
3217         Reviewed by Dan Bernstein.
3218
3219         * wtf/spi/darwin/XPCSPI.h: Added xpc_copy_bootstrap and xpc_dictionary_apply.
3220
3221 2015-04-23  Alexey Proskuryakov  <ap@apple.com>
3222
3223         Undo the WTF part of the previous build fix, we don't use private headers in WTF.
3224
3225         * WTF.xcodeproj/project.pbxproj:
3226
3227 2015-04-23  Alexey Proskuryakov  <ap@apple.com>
3228
3229         Build fix.
3230
3231         * WTF.xcodeproj/project.pbxproj: Make RAMSize.h a private header, now that it's used
3232         from outside WTF.
3233
3234 2015-04-23  Andreas Kling  <akling@apple.com>
3235
3236         There should only be one way to get the system memory size.
3237         <https://webkit.org/b/144081>
3238
3239         Reviewed by Antti Koivisto.
3240
3241         Merge all the logic from other RAM size fetcher helpers into WTF's.
3242
3243         Darwin ports now use host_info() instead of sysctl(), since that was the more common way
3244         of doing this.
3245
3246         Also bumped the fallback answer from 128 MB to 512 MB to bring it closer to today's hardware.
3247
3248         Finally, the number is rounded up to the next multiple of 128 MB, to avoid misunderstandings
3249         on some systems where the number returned by the kernel is slightly lower than the marketing
3250         number. Removed the "fudging" that was used in some places, since this fixes that cleanly.
3251
3252         * wtf/RAMSize.cpp:
3253         (WTF::computeRAMSize):
3254
3255 2015-04-22  Darin Adler  <darin@apple.com>
3256
3257         Eliminate remaining uses of OwnPtr and PassOwnPtr in WebCore outside the editing and platform directories
3258         https://bugs.webkit.org/show_bug.cgi?id=143949
3259
3260         Reviewed by Andreas Kling.
3261
3262         * wtf/MathExtras.h:
3263         (wtf_ceil): Deleted. This was a workaround for a bug that was introduced in Leopard and
3264         fixed in Snow Leopard <rdar://problem/6286405>, so we don't need the workaround any more.
3265
3266 2015-04-22  Alexey Proskuryakov  <ap@apple.com>
3267
3268         [Mac] In nightlies and local builds, WebKit services can get terminated under memory pressure
3269         https://bugs.webkit.org/show_bug.cgi?id=144052
3270         rdar://problem/19754404
3271
3272         Build fix. Landing a forward declaration that should have been part of the original patch.
3273
3274         * wtf/spi/darwin/XPCSPI.h:
3275
3276 2015-04-21  Chris Dumez  <cdumez@apple.com>
3277
3278         Make Vector(const Vector<T, otherCapacity, otherOverflowBehaviour>&) constructor explicit
3279         https://bugs.webkit.org/show_bug.cgi?id=143970
3280
3281         Reviewed by Darin Adler.
3282
3283         Make Vector(const Vector<T, otherCapacity, otherOverflowBehaviour>&)
3284         constructor explicit as it copies the vector and it is easy to call it
3285         by mistake.
3286
3287         * wtf/RefCountedArray.h:
3288         (WTF::RefCountedArray::RefCountedArray):
3289         * wtf/Vector.h:
3290
3291 2015-04-21  Darin Adler  <darin@apple.com>
3292
3293         Remove some stray uses of OwnPtr and PassOwnPtr in WTF (outside of the template definitions and traits)
3294         https://bugs.webkit.org/show_bug.cgi?id=143944
3295
3296         Reviewed by Andreas Kling.
3297
3298         * wtf/FilePrintStream.h: Removed unneeded include.
3299         * wtf/HashTable.h: Fixed class template name in comment.
3300         * wtf/HashTraits.h: Removed unneeded forward declaration.
3301         * wtf/ListHashSet.h: Removed unneeded includes.
3302         * wtf/ThreadingWin.cpp: Removed unneeded includes.
3303         (WTF::wtfThreadEntryPoint): Changed code to use unique_ptr.
3304         (WTF::createThreadInternal): Changed code to use make_unique and release.
3305         * wtf/efl/RunLoopEfl.cpp: Removed unneeded includes.
3306
3307 2015-04-19  Darin Adler  <darin@apple.com>
3308
3309         Update RefPtr documentation and deprecation
3310         https://bugs.webkit.org/show_bug.cgi?id=143936
3311
3312         Reviewed by Andreas Kling.
3313
3314         * WTF.vcxproj/WTF.vcxproj: Removed PassRef.h
3315         * WTF.vcxproj/WTF.vcxproj.filters: Ditto.
3316         * WTF.xcodeproj/project.pbxproj: Ditto.
3317         * wtf/CMakeLists.txt: Ditto.
3318
3319 2015-04-17  Alexey Proskuryakov  <ap@apple.com>
3320
3321         Use ASan poisoning to taint moved-out-of Refs
3322         https://bugs.webkit.org/show_bug.cgi?id=143894
3323         rdar://problem/19443723
3324
3325         Reviewed by Darin Adler.
3326
3327         * wtf/Ref.h: (WTF::Ref::~Ref):
3328
3329 2015-04-17  Alexey Proskuryakov  <ap@apple.com>
3330
3331         Remove unused BoundsCheckedPointer
3332         https://bugs.webkit.org/show_bug.cgi?id=143896
3333
3334         Reviewed by Geoffrey Garen.
3335
3336         * WTF.vcxproj/WTF.vcxproj:
3337         * WTF.vcxproj/WTF.vcxproj.filters:
3338         * WTF.xcodeproj/project.pbxproj:
3339         * wtf/BoundsCheckedPointer.h: Removed.
3340         * wtf/CMakeLists.txt:
3341
3342 2015-04-16  Yusuke Suzuki  <utatane.tea@gmail.com>
3343
3344         [ES6] Implement Symbol.for and Symbol.keyFor
3345         https://bugs.webkit.org/show_bug.cgi?id=143404
3346
3347         Reviewed by Geoffrey Garen.
3348
3349         When we register symbolized StringImpl* into SymbolRegistry, symbolized StringImpl* is aware of that.
3350         And when destructing it, it removes its reference from SymbolRegistry as if atomic StringImpl do so with AtomicStringTable.
3351         While AtomicStringTable (in WebCore case) exists in thread local storage,
3352         SymbolRegistry exists per VM and StringImpl* has a reference to the registered SymbolRegistry.
3353
3354         Since StringImpl has isSymbol etc. members, it's class is aware of Symbol use cases.
3355         So introduce SymbolRegistry in WTF layers as if AtomicStringTable.
3356
3357         * WTF.vcxproj/WTF.vcxproj:
3358         * WTF.vcxproj/WTF.vcxproj.filters:
3359         * WTF.xcodeproj/project.pbxproj:
3360         * wtf/CMakeLists.txt:
3361         * wtf/text/AtomicString.cpp:
3362         (WTF::AtomicString::addSlowCase):
3363         (WTF::AtomicString::findSlowCase):
3364         (WTF::AtomicString::findInternal):
3365         (WTF::AtomicString::find): Deleted.
3366         * wtf/text/AtomicString.h:
3367         (WTF::AtomicString::find):
3368         * wtf/text/StringImpl.cpp:
3369         (WTF::StringImpl::~StringImpl):
3370         (WTF::StringImpl::createSymbol):
3371         (WTF::StringImpl::createSymbolEmpty):
3372         * wtf/text/StringImpl.h:
3373         (WTF::StringImpl::StringImpl):
3374         (WTF::StringImpl::extractFoldedStringInSymbol):
3375         (WTF::StringImpl::symbolRegistry):
3376         (WTF::StringImpl::createSymbolEmpty): Deleted.
3377         * wtf/text/SymbolRegistry.cpp: Copied from Source/JavaScriptCore/runtime/SymbolConstructor.h.
3378         (WTF::SymbolRegistry::~SymbolRegistry):
3379         (WTF::SymbolRegistry::symbolForKey):
3380         (WTF::SymbolRegistry::keyForSymbol):
3381         (WTF::SymbolRegistry::remove):
3382         * wtf/text/SymbolRegistry.h: Added.
3383         (WTF::SymbolRegistryKey::hash):
3384         (WTF::SymbolRegistryKey::impl):
3385         (WTF::SymbolRegistryKey::isHashTableDeletedValue):
3386         (WTF::SymbolRegistryKey::hashTableDeletedValue):
3387         (WTF::DefaultHash<SymbolRegistryKey>::Hash::hash):
3388         (WTF::DefaultHash<SymbolRegistryKey>::Hash::equal):
3389         (WTF::HashTraits<SymbolRegistryKey>::isEmptyValue):
3390         (WTF::SymbolRegistryKey::SymbolRegistryKey):
3391
3392 2015-04-16  Antti Koivisto  <antti@apple.com>
3393
3394         Use CommonCrypto for SHA1 and MD5
3395         https://bugs.webkit.org/show_bug.cgi?id=143826
3396
3397         Reviewed by Anders Carlsson.
3398
3399         CommonCrypto SHA1 implementation is ~4x faster than the naive WTF one. Use it when available.
3400
3401         These are covered by existing API tests.
3402
3403         * wtf/MD5.cpp:
3404         (WTF::MD5::MD5):
3405         (WTF::MD5::addBytes):
3406         (WTF::MD5::checksum):
3407         * wtf/MD5.h:
3408         * wtf/SHA1.cpp:
3409         (WTF::SHA1::SHA1):
3410         (WTF::SHA1::addBytes):
3411         (WTF::SHA1::computeHash):
3412
3413             Remove the side effect where computeHash resets the state. No one relies on it.
3414
3415         (WTF::SHA1::hexDigest):
3416         (WTF::SHA1::computeHexDigest):
3417         * wtf/SHA1.h:
3418
3419 2015-04-16  Csaba Osztrogonác  <ossy@webkit.org>
3420
3421         Remove the unnecessary WTF_CHANGES define
3422         https://bugs.webkit.org/show_bug.cgi?id=143825
3423
3424         Reviewed by Andreas Kling.
3425
3426         * config.h:
3427
3428 2015-04-15  Руслан Ижбулатов  <lrn1986@gmail.com>
3429
3430         Harmonize binary semaphore ifdefs
3431
3432         They should be either OS(WINDOWS) (in which case we'd need
3433         BinarySemaphoreWin.cpp, which is not shipped by WebKitGTK)
3434         or PLATFORM(WIN) (in which case Mutex/ThreadCondition-based
3435         implementation is used).
3436
3437         This fixes errors like:
3438           CXX      Source/WTF/wtf/threads/libWTF_la-BinarySemaphore.lo
3439         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp: In constructor 'WTF::BinarySemaphore::BinarySemaphore()':
3440         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:34:7: error: class 'WTF::BinarySemaphore' does not have any field named 'm_isSet'
3441              : m_isSet(false)
3442                ^
3443         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp: In member function 'void WTF::BinarySemaphore::signal()':
3444         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:44:24: error: 'm_mutex' was not declared in this scope
3445              MutexLocker locker(m_mutex);
3446                                 ^
3447         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:46:5: error: 'm_isSet' was not declared in this scope
3448              m_isSet = true;
3449              ^
3450         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:47:5: error: 'm_condition' was not declared in this scope
3451              m_condition.signal();
3452              ^
3453         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp: In member function 'bool WTF::BinarySemaphore::wait(double)':
3454         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:52:24: error: 'm_mutex' was not declared in this scope
3455              MutexLocker locker(m_mutex);
3456                                 ^
3457         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:55:13: error: 'm_isSet' was not declared in this scope
3458              while (!m_isSet) {
3459                      ^
3460         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:56:21: error: 'm_condition' was not declared in this scope
3461                  timedOut = !m_condition.timedWait(m_mutex, absoluteTime);
3462                              ^
3463         ../webkitgtk-2.4.8/Source/WTF/wtf/threads/BinarySemaphore.cpp:62:5: error: 'm_isSet' was not declared in this scope
3464              m_isSet = false;
3465              ^
3466         GNUmakefile:52762: recipe for target 'Source/WTF/wtf/threads/libWTF_la-BinarySemaphore.lo' failed
3467
3468         [W32] Inconsistent ifdefs in BinarySemaphore.h and BinarySemaphore.cpp
3469         https://bugs.webkit.org/show_bug.cgi?id=143756
3470
3471         Reviewed by Darin Adler.
3472
3473         * wtf/threads/BinarySemaphore.h:
3474
3475 2015-04-12  Michael Catanzaro  <mcatanzaro@igalia.com>
3476
3477         Fix -Wparentheses warning with GCC 5 in SaturatedArithmetic.h
3478         https://bugs.webkit.org/show_bug.cgi?id=143457
3479
3480         Reviewed by Benjamin Poulain.
3481
3482         Tested by WTF.SaturatedArithmeticAddition and WTF.SaturatedArithmeticSubtraction.
3483
3484         * wtf/SaturatedArithmetic.h:
3485         (signedAddOverflows): Use && instead of & to avoid triggering -Wparentheses in newer
3486         versions of GCC and Clang, and to improve the clarity of the function.
3487         (signedSubtractOverflows): Changed correspondingly, although there was no warning here.
3488
3489 2015-04-08  Sam Weinig  <sam@webkit.org>
3490
3491         Allow LaunchServices to handle URLs on link navigations
3492         <rdar://problem/19446826>
3493         https://bugs.webkit.org/show_bug.cgi?id=143544
3494
3495         Reviewed by Anders Carlsson.
3496
3497         * wtf/Platform.h:
3498         Add HAVE macro for this functionality.
3499
3500 2015-04-09  Andy Estes  <aestes@apple.com>
3501
3502         [Cocoa] Add a HAVE(AVKIT) and use it
3503         https://bugs.webkit.org/show_bug.cgi?id=143593
3504
3505         Reviewed by David Kilzer.
3506
3507         * wtf/Platform.h: Defined HAVE(AVKIT) to be true on all Cocoa platforms except Watch OS.
3508
3509 2015-04-09  Andy Estes  <aestes@apple.com>
3510
3511         [Content Filtering] Add a HAVE(PARENTAL_CONTROLS) and use it
3512         https://bugs.webkit.org/show_bug.cgi?id=143559
3513
3514         Reviewed by David Kilzer.
3515
3516         Added PLATFORM(WATCHOS). Used PLATFORM() since Watch OS is just a variant of OS(IOS).
3517         Defined HAVE(PARENTAL_CONTROLS) to be true on all Cocoa platforms except Watch OS.
3518
3519         * wtf/Platform.h:
3520
3521 2015-04-08  Alex Christensen  <achristensen@webkit.org> and Patrick Gansterer  <paroga@webkit.org>
3522
3523         Add CMake build system for WinCairo port.
3524         https://bugs.webkit.org/show_bug.cgi?id=115944
3525
3526         Reviewed by Chris Dumez.
3527
3528         * wtf/FeatureDefines.h:
3529         * wtf/PlatformWin.cmake:
3530
3531 2015-04-05  Antti Koivisto  <antti@apple.com>
3532
3533         Bloom filter should support longer hashes
3534         https://bugs.webkit.org/show_bug.cgi?id=143419
3535
3536         Reviewed by Dan Bernstein.
3537
3538         It currently supports 'unsigned' hash only which is inconvenient and doesn't have enough independent bits for larger filters.
3539
3540         Support arbitrarily sized hashes of type std::array<uint8_t, hashSize> (like SHA1::Digest and MD5::Digest).
3541
3542         * wtf/BloomFilter.h:
3543         (WTF::BloomFilter<keyBits>::keysFromHash):
3544         (WTF::BloomFilter<keyBits>::mayContain):
3545         (WTF::BloomFilter<keyBits>::add):
3546
3547 2015-04-03  Antti Koivisto  <antti@apple.com>
3548
3549         Add non-counting Bloom filter implementation
3550         https://bugs.webkit.org/show_bug.cgi?id=143366
3551
3552         Reviewed by Sam Weinig.
3553
3554         Add a traditional single-bit-per-bucket Bloom filter in addition to the existing counting implementation.
3555
3556         - rename BloomFilter -> CountingBloomFilter.
3557         - add a new basic BloomFilter type.
3558         - update some terminology to match http://en.wikipedia.org/wiki/Bloom_filter and modernize the code a bit.
3559         - add API tests.
3560
3561         * wtf/BloomFilter.h:
3562         (WTF::BloomFilter::BloomFilter):
3563         (WTF::BloomFilter::add):
3564
3565             Also support merging.
3566
3567         (WTF::BloomFilter::mayContain):
3568         (WTF::BloomFilter::arrayIndex):
3569         (WTF::BloomFilter::bitMask):
3570         (WTF::BloomFilter<keyBits>::mayContain):
3571         (WTF::BloomFilter<keyBits>::add):
3572         (WTF::BloomFilter<keyBits>::isBitSet):
3573         (WTF::BloomFilter<keyBits>::setBit):
3574         (WTF::BloomFilter<keyBits>::clear):
3575         (WTF::CountingBloomFilter::CountingBloomFilter):
3576         (WTF::CountingBloomFilter::mayContain):
3577         (WTF::CountingBloomFilter::firstBucket):
3578         (WTF::CountingBloomFilter::secondBucket):
3579         (WTF::CountingBloomFilter<keyBits>::add):
3580         (WTF::CountingBloomFilter<keyBits>::remove):
3581         (WTF::CountingBloomFilter<keyBits>::clear):
3582         (WTF::CountingBloomFilter<keyBits>::likelyEmpty):
3583         (WTF::CountingBloomFilter<keyBits>::isClear):
3584         (WTF::BloomFilter::maximumCount): Deleted.
3585         (WTF::BloomFilter::firstSlot): Deleted.
3586         (WTF::BloomFilter::secondSlot): Deleted.
3587         (WTF::BloomFilter<keyBits>::remove): Deleted.
3588         (WTF::BloomFilter<keyBits>::likelyEmpty): Deleted.
3589         (WTF::BloomFilter<keyBits>::isClear): Deleted.
3590
3591 015-04-01  Antti Koivisto  <antti@apple.com>
3592
3593         Value assignment operator of Optional should be stricter
3594         https://bugs.webkit.org/show_bug.cgi?id=143303
3595
3596         Reviewed by Andreas Kling.
3597
3598         struct Foo { mutable Optional<std::chrono::seconds> s; };
3599         Foo foo, foo2;
3600         foo = foo2;
3601
3602         doesn't build because it tries to use wrong operator=.
3603
3604         * wtf/Optional.h:
3605
3606             Add enable_if test similar to std::experimental::optional.
3607
3608 2015-04-01  Alex Christensen  <achristensen@webkit.org>
3609
3610         Progress towards CMake on Windows and Mac.
3611         https://bugs.webkit.org/show_bug.cgi?id=143293
3612
3613         Reviewed by Filip Pizlo.
3614
3615         * wtf/CMakeLists.txt:
3616         Don't use bmalloc on Windows yet.
3617         * wtf/FeatureDefines.h:
3618         Temporarily disabled WebGL on Windows CMake builds.
3619         * wtf/PlatformMac.cmake:
3620         Tell open source builders where to find unicode headers.
3621
3622 2015-03-31  Alexey Proskuryakov  <ap@apple.com>
3623
3624         Fix the build after <http://trac.webkit.org/changeset/182205>.
3625
3626         * wtf/text/StringImpl.h: (WTF::StringImpl::extractFoldedStringInSymbol):
3627         A function cannot be both exported and inline.
3628
3629 2015-03-31  Yusuke Suzuki  <utatane.tea@gmail.com>
3630
3631         Clean up Identifier factories to clarify the meaning of StringImpl*
3632         https://bugs.webkit.org/show_bug.cgi?id=143146
3633
3634         Reviewed by Filip Pizlo.
3635
3636         Introduce StringKind into `StringImpl`. There's 3 kinds
3637         1. StringNormal (non-atomic, non-symbol)
3638         2. StringAtomic (atomic, non-symbol)
3639         3. StringSymbol (non-atomic, symbol)
3640         They are mutually exclusive.
3641
3642         * wtf/text/AtomicString.cpp:
3643         (WTF::AtomicString::addSlowCase):
3644         (WTF::AtomicString::findSlowCase):
3645         When registering a string into AtomicStringTable,
3646         it should not be a symbol string
3647         because symbol and atomic types are mutually exclusive.
3648         When a symbol string comes, we extract an owner string
3649         from a symbol string by using `StringImpl::extractFoldedStringInSymbol()`.
3650         It always succeeds because a symbol (non empty) string
3651         is always BufferSubstring and has an owner string.
3652         Empty symbol string doesn't have an owner string.
3653         This case is filtered by `!string.length()` guard.
3654         * wtf/text/AtomicString.h:
3655         (WTF::AtomicString::add):
3656         (WTF::AtomicString::addWithStringTableProvider):
3657         * wtf/text/StringImpl.cpp:
3658         (WTF::StringImpl::~StringImpl):
3659         (WTF::StringImpl::createSymbol):
3660         (WTF::StringImpl::createUnique): Deleted.
3661         * wtf/text/StringImpl.h:
3662         (WTF::StringImpl::StringImpl):
3663         (WTF::StringImpl::createSymbolEmpty):
3664         (WTF::StringImpl::flagIsAtomic):
3665         (WTF::StringImpl::flagIsSymbol):
3666         (WTF::StringImpl::maskStringKind):
3667         (WTF::StringImpl::stringKind):
3668         (WTF::StringImpl::isSymbol):
3669         (WTF::StringImpl::isAtomic):
3670         (WTF::StringImpl::setIsAtomic):
3671         (WTF::StringImpl::extractFoldedStringInSymbol):
3672         (WTF::StringImpl::createUniqueEmpty): Deleted.
3673         (WTF::StringImpl::flagIsUnique): Deleted.
3674         (WTF::StringImpl::isUnique): Deleted.
3675         * wtf/text/StringStatics.cpp:
3676         (WTF::StringImpl::hashAndFlagsForSymbol):
3677         (WTF::StringImpl::hashAndFlagsForUnique): Deleted.
3678
3679 2015-03-30  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
3680
3681         [CMake][EFL] Remove redundant library link and include path
3682         https://bugs.webkit.org/show_bug.cgi?id=143221
3683
3684         Reviewed by Csaba Osztrogonác.
3685
3686         * wtf/PlatformEfl.cmake: Remove unnecessary library link and include path.
3687
3688 2015-03-27  Myles C. Maxfield  <mmaxfield@apple.com>
3689
3690         Support building WTF on Windows without Cygwin
3691         https://bugs.webkit.org/show_bug.cgi?id=143084
3692
3693         Reviewed by Brent Fulgham.
3694
3695         Windows doesn't have "touch".
3696
3697         * WTF.vcxproj/WTFGenerated.make:
3698
3699 2015-03-26  Alex Christensen  <achristensen@webkit.org>
3700
3701         Progress towards CMake on Mac.
3702         https://bugs.webkit.org/show_bug.cgi?id=143112
3703
3704         Reviewed by Chris Dumez.
3705
3706         * wtf/PlatformMac.cmake:
3707
3708 2015-03-25  Filip Pizlo  <fpizlo@apple.com>
3709
3710         Unreviewed, we have edited this file in 2015.
3711
3712         * wtf/Platform.h:
3713
3714 2015-03-25  Filip Pizlo  <fpizlo@apple.com>
3715
3716         Heap variables shouldn't end up in the stack frame
3717         https://bugs.webkit.org/show_bug.cgi?id=141174
3718
3719         Reviewed by Geoffrey Garen.
3720
3721         * wtf/FastBitVector.h:
3722         (WTF::FastBitVector::resize): Small change: don't resize if you don't have to resize.
3723
3724 2015-03-25  Filip Pizlo  <fpizlo@apple.com>
3725
3726         Change Atomic methods from using the_wrong_naming_conventions to using theRightNamingConventions. Also make seq_cst the default.
3727
3728         Rubber stamped by Geoffrey Garen.
3729
3730         * wtf/Atomics.h:
3731         (WTF::Atomic::load):
3732         (WTF::Atomic::store):
3733         (WTF::Atomic::compareExchangeWeak):
3734         (WTF::Atomic::compareExchangeStrong):
3735         (WTF::Atomic::compare_exchange_weak): Deleted.
3736         (WTF::Atomic::compare_exchange_strong): Deleted.
3737         * wtf/ByteSpinLock.h:
3738         (WTF::ByteSpinLock::lock):
3739         * wtf/SpinLock.h:
3740         (WTF::SpinLockBase::lock):
3741
3742 2015-03-24  Beth Dakin  <bdakin@apple.com>
3743
3744         Add events related to force click gesture
3745         https://bugs.webkit.org/show_bug.cgi?id=142836
3746         -and corresponding-
3747         rdar://problem/20210239
3748
3749         Reviewed by Dean Jackson.
3750
3751         New enable flag for the events.
3752         * wtf/FeatureDefines.h:
3753
3754 2015-03-23  Filip Pizlo  <fpizlo@apple.com>
3755
3756         JSC should have a low-cost asynchronous disassembler
3757         https://bugs.webkit.org/show_bug.cgi?id=142997
3758
3759         Reviewed by Mark Lam.
3760
3761         * wtf/StringPrintStream.h:
3762
3763 2015-03-22  Benjamin Poulain  <benjamin@webkit.org>
3764
3765         CSS Selectors: fix attribute case-insensitive matching of Contain and List
3766         https://bugs.webkit.org/show_bug.cgi?id=142932
3767
3768         Reviewed by Darin Adler.
3769
3770         Add some utility functions to the string classes to find substrings
3771         using ASCII case-insensitive comparisons.
3772
3773         * wtf/text/AtomicString.h:
3774         (WTF::AtomicString::contains):
3775         Add the light version that only lock one register.
3776
3777         (WTF::AtomicString::containsIgnoringASCIICase):
3778         (WTF::AtomicString::findIgnoringASCIICase):
3779
3780         * wtf/text/StringCommon.h:
3781         (WTF::findIgnoringASCIICase):
3782         This is the common implementation used by StringView and StringImpl.
3783
3784         * wtf/text/StringImpl.cpp:
3785         (WTF::StringImpl::findIgnoringASCIICase):
3786         * wtf/text/StringImpl.h:
3787         * wtf/text/StringView.cpp:
3788         (WTF::StringView::containsIgnoringASCIICase):
3789         (WTF::StringView::findIgnoringASCIICase):
3790         * wtf/text/StringView.h:
3791         * wtf/text/WTFString.h:
3792         (WTF::String::findIgnoringASCIICase):
3793         (WTF::String::contains):
3794         (WTF::String::containsIgnoringASCIICase):
3795
3796 2015-03-19  Andreas Kling  <akling@apple.com>
3797
3798         DFGAllocator should use bmalloc's aligned allocator.
3799         <https://webkit.org/b/142871>
3800
3801         Reviewed by Geoffrey Garen.
3802
3803         Remove PageAllocationAligned since it has no more clients.
3804
3805         * WTF.vcxproj/WTF.vcxproj:
3806         * WTF.vcxproj/WTF.vcxproj.filters:
3807         * WTF.xcodeproj/project.pbxproj:
3808         * wtf/CMakeLists.txt:
3809         * wtf/PageAllocationAligned.cpp: Removed.
3810         * wtf/PageAllocationAligned.h: Removed.
3811
3812 2015-03-18  Dhi Aurrahman  <diorahman@rockybars.com>
3813
3814         Fix StringView misplaced implementations after r181525 and r181558
3815         https://bugs.webkit.org/show_bug.cgi?id=142772
3816
3817         Reviewed by Darin Adler.
3818
3819         Fix misplaced implementations in StringView::startsWithIgnoringASCIICase and 
3820         StringView::endsWith. 
3821
3822         Add some tests in [1] to cover the StringView::startsWith, 
3823         StringView::startsWithIgnoringASCIICase, StringView::endsWith and 
3824         StringView::endsWithIgnoringASCIICase implementations.
3825
3826         [1] Tools/TestWebKitAPI/Tests/WTF/StringView.cpp.
3827
3828         * wtf/text/StringView.cpp:
3829         (WTF::StringView::startsWithIgnoringASCIICase):
3830         (WTF::StringView::endsWith):
3831         (WTF::StringView::endsWithIgnoringASCIICase):
3832
3833 2015-03-17  Michael Saboff  <msaboff@apple.com>
3834
3835         Windows X86-64 should use the fixed executable allocator
3836         https://bugs.webkit.org/show_bug.cgi?id=142749
3837
3838         Reviewed by Filip Pizlo.
3839
3840         Set ENABLE_EXECUTABLE_ALLOCATOR_FIXED for Windows.
3841         Needed to export MetaAllocator::currentStatistics() for use in JavaScriptCore.
3842
3843         * wtf/MetaAllocator.h:
3844         * wtf/Platform.h:
3845
3846 2015-03-16  Ryosuke Niwa  <rniwa@webkit.org>
3847
3848         Enable ES6 classes by default
3849         https://bugs.webkit.org/show_bug.cgi?id=142774
3850
3851         Reviewed by Gavin Barraclough.
3852
3853         * wtf/FeatureDefines.h:
3854
3855 2015-03-16  Csaba Osztrogonác  <ossy@webkit.org>
3856
3857         [ARM] Enable generating idiv instructions if it is supported
3858         https://bugs.webkit.org/show_bug.cgi?id=142725
3859
3860         Reviewed by Michael Saboff.
3861
3862         * wtf/Platform.h: Set HAVE_ARM_IDIV_INSTRUCTIONS based on GCC macro too.
3863
3864 2015-03-16  Benjamin Poulain  <benjamin@webkit.org>
3865
3866         Fix StringView after r181525
3867         Unreviewed.
3868
3869         Fix 2 silly mistakes I made in r181525.
3870
3871         * wtf/text/StringView.cpp:
3872         (WTF::StringView::startsWith):
3873         (WTF::StringView::startsWithIgnoringASCIICase):
3874         (WTF::StringView::endsWith):
3875         (WTF::StringView::endsWithIgnoringASCIICase):
3876         The implementation was inside the #ifdef.
3877
3878         * wtf/text/StringView.h:
3879         The symbols were not exported.
3880
3881 2015-03-16  Max Stepin  <maxstepin@gmail.com>
3882
3883         Add APNG support
3884         https://bugs.webkit.org/show_bug.cgi?id=17022
3885
3886         Reviewed by Carlos Garcia Campos.
3887
3888         * wtf/FeatureDefines.h:
3889
3890 2015-03-15  Benjamin Poulain  <benjamin@webkit.org>
3891
3892         CSS: fix the case-insensitive matching of the attribute selectors Begin, End and Hyphen
3893         https://bugs.webkit.org/show_bug.cgi?id=142715
3894
3895         Reviewed by Brent Fulgham.
3896
3897         Add the necessary infrastructure to test startsWith() and endsWith() with
3898         ASCII case-insentive comparisons.
3899
3900         * wtf/text/AtomicString.h:
3901         (WTF::AtomicString::startsWith):
3902         (WTF::AtomicString::startsWithIgnoringASCIICase):
3903         (WTF::AtomicString::endsWith):
3904         (WTF::AtomicString::endsWithIgnoringASCIICase):
3905
3906         * wtf/text/StringCommon.h:
3907         (WTF::loadUnaligned):
3908         (WTF::equal):
3909         I moved the low level equal() code from StringImpl to StringCommon
3910         since it is used by both StringImpl and StringView.
3911
3912         (WTF::equalCommon):
3913         (WTF::equalIgnoringASCIICaseCommon):
3914         Ideally we should drop the "Common" part of the name but StringView
3915         wants this inline for some reason. I prefered keeping the current behavior
3916         since I don't know how StringView's matching performance was evaluated.
3917
3918         (WTF::startsWith):
3919         (WTF::startsWithIgnoringASCIICase):
3920         (WTF::endsWith):
3921         (WTF::endsWithIgnoringASCIICase):
3922         Make all that code shared between StringView and Stringimpl.
3923
3924         * wtf/text/StringImpl.cpp:
3925         (WTF::StringImpl::startsWith):
3926         (WTF::StringImpl::startsWithIgnoringASCIICase):
3927         (WTF::StringImpl::endsWith):
3928         (WTF::StringImpl::endsWithIgnoringASCIICase):
3929         (WTF::equal):
3930         (WTF::stringImplContentEqual): Deleted.
3931         * wtf/text/StringImpl.h:
3932         (WTF::loadUnaligned): Deleted.
3933         (WTF::equal): Deleted.
3934
3935         * wtf/text/StringView.cpp:
3936         (WTF::StringView::startsWith):
3937         (WTF::StringView::startsWithIgnoringASCIICase):
3938         (WTF::StringView::endsWith):
3939         (WTF::StringView::endsWithIgnoringASCIICase):
3940         * wtf/text/StringView.h:
3941         Since those are new, we can safely make them out-of-line and
3942         evaluate the inlining impact as needed.
3943
3944         * wtf/text/WTFString.h:
3945         (WTF::String::startsWithIgnoringASCIICase):
3946         (WTF::String::endsWith):
3947         (WTF::String::endsWithIgnoringASCIICase):
3948
3949 2015-03-15  Benjamin Poulain  <bpoulain@apple.com>
3950
3951         Change the exact attribute matching to be ASCII case-insensitive
3952         https://bugs.webkit.org/show_bug.cgi?id=142609
3953
3954         Reviewed by Darin Adler.
3955
3956         Add support for ASCII case insensitive comparisons to all the string
3957         classes.
3958
3959         The new file StringCommon.h has the common algorithm to avoid repeating
3960         the same code with different types.
3961
3962         * WTF.vcxproj/WTF.vcxproj:
3963         * WTF.vcxproj/WTF.vcxproj.filters:
3964         * wtf/ASCIICType.h:
3965         (WTF::toASCIILower):
3966         * wtf/CMakeLists.txt:
3967         * wtf/text/AtomicString.h:
3968         (WTF::equalIgnoringASCIICase):
3969         * wtf/text/StringCommon.h: Added.
3970         (WTF::equalIgnoringASCIICase):
3971         (WTF::equalIgnoringASCIICaseCommon):
3972         * wtf/text/StringImpl.cpp:
3973         (WTF::equalIgnoringASCIICase):
3974         (WTF::equalIgnoringASCIICaseNonNull):
3975         (WTF::StringImpl::utf8Impl):
3976         (WTF::StringImpl::defaultWritingDirection): Deleted.
3977         (WTF::StringImpl::adopt): Deleted.
3978         (WTF::StringImpl::sizeInBytes): Deleted.
3979         (WTF::putUTF8Triple): Deleted.
3980         (WTF::StringImpl::utf8): Deleted.
3981         * wtf/text/StringImpl.h:
3982         (WTF::StringImpl::isSubString): Deleted.
3983         (WTF::find): Deleted.
3984
3985 2015-03-14  Michael Saboff  <msaboff@apple.com>
3986
3987         Disable Yarr JIT for ARMv7k
3988         https://bugs.webkit.org/show_bug.cgi?id=142645
3989
3990         Rubber stamped by Geoffrey Garen.
3991
3992         Changed the setting of ENABLE_YARR_JIT to be predicated on ENABLED_JIT.
3993
3994         * wtf/Platform.h:
3995
3996 2015-03-14  Michael Saboff  <msaboff@apple.com>
3997
3998         ES6: Add binary and octal literal support
3999         https://bugs.webkit.org/show_bug.cgi?id=142681
4000
4001         Reviewed by Ryosuke Niwa.
4002
4003         * wtf/ASCIICType.h:
4004         (WTF::isASCIIBinaryDigit): New support function.
4005         (WTF::isASCIIOctalDigit): Updated to use logical and (&&) instead of binary and (&).
4006
4007 2015-03-13  Mark Lam  <mark.lam@apple.com>
4008
4009         Replace TCSpinLock with a new WTF::SpinLock based on WTF::Atomic.
4010         <https://webkit.org/b/142674>
4011
4012         Reviewed by Filip Pizlo.
4013
4014         We no longer use TCMalloc in our code, and we now have C++11.  This replaces the
4015         TCMalloc_SpinLock with a new WTF::SpinLock based on WTF::Atomic (which is a
4016         wrapper around std::atomic).
4017
4018         Note that there is a StaticSpinLock and a SpinLock:
4019
4020         1. StaticSpinLock is an alias for SpinLockBase, and its initialization relies on
4021            static / global std:atomic being automatically initialized to 0 at compile time.
4022            Hence, StaticSpinLock should only be used for statics / globals (including
4023            static members of classes / structs).
4024
4025         2. SpinLock is derived from SpinLockBase, and adds a default constructor to
4026            initialize its internal atomic value to 0.  Because SpinLock has a constructor,
4027            it cannot be used for statics / globals.  Objects that want to embed a spin
4028            lock as an instance field should use SpinLock so that it is initialized properly.
4029            std::atomic will not automatically initialize instance fields to 0.  Hence,
4030            StaticSpinLock will not work correctly as instance fields of a class / struct.
4031
4032         * WTF.vcxproj/WTF.vcxproj:
4033         * WTF.vcxproj/WTF.vcxproj.filters:
4034         * WTF.xcodeproj/project.pbxproj:
4035         * wtf/CMakeLists.txt:
4036         * wtf/MetaAllocator.cpp:
4037         (WTF::MetaAllocator::~MetaAllocator):
4038         (WTF::MetaAllocator::MetaAllocator):
4039         * wtf/MetaAllocator.h:
4040         * wtf/SpinLock.h: Added.
4041         (WTF::SpinLockBase::lock):
4042         (WTF::SpinLockBase::unlock):
4043         (WTF::SpinLockBase::isLocked):
4044         (WTF::SpinLockBase::slowLock):
4045         (WTF::SpinLock::SpinLock):
4046         * wtf/TCSpinLock.h: Removed.
4047         * wtf/text/AtomicString.cpp:
4048
4049 2015-03-13  Mark Lam  <mark.lam@apple.com>
4050
4051         Introduce WTF::Atomic to wrap std::atomic for a friendlier CAS.
4052         <https://webkit.org/b/142661>
4053
4054         Reviewed by Filip Pizlo.
4055
4056         The CAS functions provided by std::atomic takes a reference to the expected
4057         value and modifies it if the CAS fails.  However, in a lot of our CAS usage,
4058         we don't want the expected value to change.  The solution to this is to
4059         provide a WTF::Atomic struct that wraps std::atomic, and provide CAS
4060         methods that won't alter the expected value if the CAS fails.
4061
4062         The method names in WTF::Atomic are chosen to be identical to those
4063         in std::atomic so that WTF::Atomic can be a simple drop in replacement
4064         for std::atomic.
4065
4066         Also changed ByteSpinLock to use WTF::Atomic instead of std::atomic.
4067
4068         * wtf/Atomics.h:
4069         (WTF::Atomic::load):
4070         (WTF::Atomic::store):
4071         (WTF::Atomic::compare_exchange_weak):
4072         (WTF::Atomic::compare_exchange_strong):
4073         * wtf/ByteSpinLock.h:
4074         (WTF::ByteSpinLock::ByteSpinLock):
4075         (WTF::ByteSpinLock::lock):
4076
4077 2015-03-12  Filip Pizlo  <fpizlo@apple.com>
4078
4079         Bytecode liveness analysis should have more lambdas and fewer sets
4080         https://bugs.webkit.org/show_bug.cgi?id=142647
4081
4082         Reviewed by Mark Lam.
4083         
4084         Add a method for iterating each set bit in a FastBitVector. Uses a functor as a callback since
4085         this allows for a more efficient algorithm.
4086
4087         * wtf/FastBitVector.h:
4088         (WTF::FastBitVector::forEachSetBit):
4089
4090 2015-03-12  Michael Saboff  <msaboff@apple.com>
4091
4092         Disable Yarr JIT for ARMv7k
4093         https://bugs.webkit.org/show_bug.cgi?id=142645
4094
4095         Reviewed by Oliver Hunt.
4096
4097         Make the setting of ENABLE_YARR_JIT match ENABLE_JIT for ARMv7k.
4098
4099         * wtf/Platform.h:
4100
4101 2015-03-12  Mark Lam  <mark.lam@apple.com>
4102
4103         Change WTF::ByteSpinLock to use std::atomic.
4104         <https://webkit.org/b/142644>
4105
4106         Reviewed by Filip Pizlo.
4107
4108         * wtf/ByteSpinLock.h:
4109         (WTF::ByteSpinLock::ByteSpinLock):
4110         (WTF::ByteSpinLock::lock):
4111         (WTF::ByteSpinLock::unlock):
4112         (WTF::ByteSpinLock::isHeld):
4113
4114 2015-03-12  Csaba Osztrogonác  <ossy@webkit.org>
4115
4116         [ARM][Linux] GC sometimes stuck in an infinite loop if parallel GC is enabled
4117         https://bugs.webkit.org/show_bug.cgi?id=141290
4118
4119         Reviewed by Carlos Garcia Campos.
4120
4121         * wtf/Platform.h: Enable parallel GC after r181319.
4122
4123 2015-03-11  Myles C. Maxfield  <mmaxfield@apple.com>
4124
4125         Use out-of-band messaging for RenderBox::firstLineBaseline() and RenderBox::inlineBlockBaseline()
4126         https://bugs.webkit.org/show_bug.cgi?id=142569
4127
4128         Reviewed by David Hyatt.
4129
4130         Provide a callback to Optional::valueOrCompute() which is evaluated only if necessary.
4131
4132         * wtf/Optional.h:
4133         (WTF::Optional::valueOrCompute):
4134
4135 2015-03-10  Brent Fulgham  <bfulgham@apple.com>
4136
4137         [Win] 17 different JSC tests started to fail in DST
4138         https://bugs.webkit.org/show_bug.cgi?id=142531
4139
4140         Reviewed by Chris Dumez.
4141
4142         The stock 'GetTimeZoneInformation' call does not always match the actual Daylight
4143         Savings calendar. This results in a period of time when these tests fail.
4144
4145         If available, we should take advantage of the new 'GetTimeZoneInformationForYear',
4146         which accesses a dynamic calendar of DST dates, which is presumbably updated by
4147         Microsoft from year-to-year.
4148
4149         * wtf/DateMath.cpp:
4150         (WTF::timeZoneInformationForYearFunction): New function to conditionally access
4151         some Vista (and newer) functionality.
4152         (WTF::calculateUTCOffset): Call new function (if available) to calculate proper UTC
4153         time offset.
4154
4155 2015-03-10  Alex Christensen  <achristensen@webkit.org>
4156
4157         Use unsigned for HashSet size.
4158         https://bugs.webkit.org/show_bug.cgi?id=142518
4159
4160         Reviewed by Benjamin Poulain.
4161
4162         * wtf/HashCountedSet.h:
4163         (WTF::Traits>::size):
4164         (WTF::Traits>::capacity):
4165         * wtf/HashMap.h:
4166         (WTF::X>::size):
4167         (WTF::X>::capacity):
4168         * wtf/HashSet.h:
4169         (WTF::V>::size):
4170         (WTF::V>::capacity):
4171         * wtf/HashTable.h:
4172         (WTF::HashTable::Stats::recordCollisionAtCount):
4173         (WTF::HashTable::Stats::dumpStats):
4174         (WTF::HashTable::size):
4175         (WTF::HashTable::capacity):
4176         (WTF::KeyTraits>::deallocateTable):
4177         (WTF::KeyTraits>::checkTableConsistencyExceptSize):
4178         * wtf/HashTraits.h:
4179         * wtf/ListHashSet.h:
4180         (WTF::U>::size):
4181         (WTF::U>::capacity):
4182
4183 2015-03-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
4184
4185         Remove PassRefPtr from svg/properties classes.
4186         https://bugs.webkit.org/show_bug.cgi?id=142063.
4187
4188         Reviewed by Darin Adler.
4189
4190         * wtf/Ref.h:
4191         (WTF::static_reference_cast): Add a stat_cast function to Ref<>.
4192
4193 2015-03-10  Mark Lam  <mark.lam@apple.com>
4194
4195         [Win] JSC Build Warnings Need to be Resolved.
4196         <https://webkit.org/b/142366>
4197
4198         Reviewed by Brent Fulgham.
4199
4200         * wtf/Compiler.h:
4201         - MSVC also does not have the CONSIDERS_UNREACHABLE_CODE quirk.
4202
4203 2015-03-10  Geoffrey Garen  <ggaren@apple.com>
4204
4205         bmalloc: tryFastMalloc shouldn't crash
4206         https://bugs.webkit.org/show_bug.cgi?id=142443
4207
4208         Reviewed by Sam Weinig.
4209
4210         Rolling back in r181307 with a check for whether bmalloc is enabled, to
4211         avoid crashes when running with ASan and GuardMalloc.
4212
4213         * wtf/FastMalloc.cpp:
4214         (WTF::fastMalloc):
4215         (WTF::fastRealloc):
4216         (WTF::fastAlignedMalloc):
4217         (WTF::tryFastMalloc):
4218         (WTF::tryFastRealloc): Deleted.
4219         * wtf/FastMalloc.h:
4220
4221 2015-03-10  Michael Catanzaro  <mcatanzaro@igalia.com>
4222
4223         GCC: CRASH() should be annotated with NORETURN
4224         https://bugs.webkit.org/show_bug.cgi?id=142524
4225
4226         Reviewed by Anders Carlsson.
4227
4228         Add COMPILER(GCC) to #ifdefs that already exist for Clang.
4229
4230         * wtf/Assertions.cpp:
4231         * wtf/Assertions.h:
4232
4233 2015-03-09  Commit Queue  <commit-queue@webkit.org>
4234
4235         Unreviewed, rolling out r181307.
4236         https://bugs.webkit.org/show_bug.cgi?id=142525
4237
4238         Broke ASan tests (Requested by ap on #webkit).
4239
4240         Reverted changeset:
4241