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