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