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