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