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