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