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