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