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