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