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