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