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