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