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