[CMake] Properly test if compiler supports compiler flags
[WebKit-https.git] / Source / WTF / ChangeLog
1 2017-08-08  Michael Catanzaro  <mcatanzaro@igalia.com>
2
3         [CMake] Properly test if compiler supports compiler flags
4         https://bugs.webkit.org/show_bug.cgi?id=174490
5
6         Reviewed by Konstantin Tokarev.
7
8         * wtf/Compiler.h:
9
10 2017-08-07  Filip Pizlo  <fpizlo@apple.com>
11
12         Baseline JIT should do caging
13         https://bugs.webkit.org/show_bug.cgi?id=175037
14
15         Reviewed by Mark Lam.
16
17         * wtf/Gigacage.h:
18         (Gigacage::disableDisablingPrimitiveGigacageIfShouldBeEnabled):
19         (Gigacage::isDisablingPrimitiveGigacageDisabled):
20         (Gigacage::isPrimitiveGigacagePermanentlyEnabled):
21         (Gigacage::canPrimitiveGigacageBeDisabled):
22
23 2017-08-07  Filip Pizlo  <fpizlo@apple.com>
24
25         Unreviewed, try to fix Windows build.
26
27         * wtf/Gigacage.cpp:
28         * wtf/Gigacage.h:
29
30 2017-08-06  Filip Pizlo  <fpizlo@apple.com>
31
32         Primitive auxiliaries and JSValue auxiliaries should have separate gigacages
33         https://bugs.webkit.org/show_bug.cgi?id=174919
34
35         Reviewed by Keith Miller.
36         
37         This mirrors the changes from bmalloc/Gigacage.h.
38         
39         Also it teaches CagedPtr how to reason about multiple gigacages.
40
41         * wtf/CagedPtr.h:
42         (WTF::CagedPtr::get const):
43         (WTF::CagedPtr::operator[] const):
44         * wtf/Gigacage.cpp:
45         (Gigacage::tryMalloc):
46         (Gigacage::tryAllocateVirtualPages):
47         (Gigacage::freeVirtualPages):
48         (Gigacage::tryAlignedMalloc):
49         (Gigacage::alignedFree):
50         (Gigacage::free):
51         * wtf/Gigacage.h:
52         (Gigacage::disablePrimitiveGigacage):
53         (Gigacage::addPrimitiveDisableCallback):
54         (Gigacage::removePrimitiveDisableCallback):
55         (Gigacage::name):
56         (Gigacage::basePtr):
57         (Gigacage::caged):
58         (Gigacage::isCaged):
59         (Gigacage::tryAlignedMalloc):
60         (Gigacage::alignedFree):
61         (Gigacage::free):
62         (Gigacage::disableGigacage): Deleted.
63         (Gigacage::addDisableCallback): Deleted.
64         (Gigacage::removeDisableCallback): Deleted.
65
66 2017-08-07  Brian Burg  <bburg@apple.com>
67
68         Remove CANVAS_PATH compilation guard
69         https://bugs.webkit.org/show_bug.cgi?id=175207
70
71         Reviewed by Sam Weinig.
72
73         * wtf/FeatureDefines.h:
74
75 2017-08-05  Filip Pizlo  <fpizlo@apple.com>
76
77         REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372
78         https://bugs.webkit.org/show_bug.cgi?id=175083
79
80         Reviewed by Oliver Hunt.
81         
82         Adds a classic ReadWriteLock class. I wrote my own because I can never remember if the pthread one is
83         guaranted to bias in favor of writers or not.
84
85         * WTF.xcodeproj/project.pbxproj:
86         * wtf/Condition.h:
87         (WTF::ConditionBase::construct):
88         (WTF::Condition::Condition):
89         * wtf/Lock.h:
90         (WTF::LockBase::construct):
91         (WTF::Lock::Lock):
92         * wtf/ReadWriteLock.cpp: Added.
93         (WTF::ReadWriteLockBase::construct):
94         (WTF::ReadWriteLockBase::readLock):
95         (WTF::ReadWriteLockBase::readUnlock):
96         (WTF::ReadWriteLockBase::writeLock):
97         (WTF::ReadWriteLockBase::writeUnlock):
98         * wtf/ReadWriteLock.h: Added.
99         (WTF::ReadWriteLockBase::ReadLock::tryLock):
100         (WTF::ReadWriteLockBase::ReadLock::lock):
101         (WTF::ReadWriteLockBase::ReadLock::unlock):
102         (WTF::ReadWriteLockBase::WriteLock::tryLock):
103         (WTF::ReadWriteLockBase::WriteLock::lock):
104         (WTF::ReadWriteLockBase::WriteLock::unlock):
105         (WTF::ReadWriteLockBase::read):
106         (WTF::ReadWriteLockBase::write):
107         (WTF::ReadWriteLock::ReadWriteLock):
108
109 2017-08-04  Matt Lewis  <jlewis3@apple.com>
110
111         Unreviewed, rolling out r220271.
112
113         Rolling out due to Layout Test failing on iOS Simulator.
114
115         Reverted changeset:
116
117         "Remove STREAMS_API compilation guard"
118         https://bugs.webkit.org/show_bug.cgi?id=175165
119         http://trac.webkit.org/changeset/220271
120
121 2017-08-04  Youenn Fablet  <youenn@apple.com>
122
123         Remove STREAMS_API compilation guard
124         https://bugs.webkit.org/show_bug.cgi?id=175165
125
126         Reviewed by Darin Adler.
127
128         * wtf/FeatureDefines.h:
129
130 2017-08-03  Brian Burg  <bburg@apple.com>
131
132         Remove ENABLE(WEB_SOCKET) guards
133         https://bugs.webkit.org/show_bug.cgi?id=167044
134
135         Reviewed by Joseph Pecoraro.
136
137         * wtf/FeatureDefines.h:
138
139 2017-08-03  Youenn Fablet  <youenn@apple.com>
140
141         Remove FETCH_API compilation guard
142         https://bugs.webkit.org/show_bug.cgi?id=175154
143
144         Reviewed by Chris Dumez.
145
146         * wtf/FeatureDefines.h:
147
148 2017-08-03  Brady Eidson  <beidson@apple.com>
149
150         Add SW IDLs and stub out basic functionality.
151         https://bugs.webkit.org/show_bug.cgi?id=175115
152
153         Reviewed by Chris Dumez.
154
155         * wtf/FeatureDefines.h:
156
157 2017-08-03  Yusuke Suzuki  <utatane.tea@gmail.com>
158
159         Unreviewed, build fix for Windows port
160         https://bugs.webkit.org/show_bug.cgi?id=175013
161
162         * wtf/Threading.h:
163
164 2017-08-03  Yusuke Suzuki  <utatane.tea@gmail.com>
165
166         Merge ThreadHolder to WTF::Thread itself
167         https://bugs.webkit.org/show_bug.cgi?id=175013
168
169         Reviewed by Mark Lam.
170
171         Currently, we store ThreadHolder* to the TLS, and ThreadHolder* holds Ref<Thread>.
172         When we get Thread& from the current thread TLS, we need to dereference the ThreadHolder*.
173         However, ideally, we can store Thread* directly to the current thread TLS.
174         While the ThreadHolder design is beautiful, it's worth optimizing by storing Thread* directly
175         since Thread::current() is so frequently executed.
176
177         This patch merges ThreadHolder to Thread. And we now store Thread* directly in the TLS.
178         When storing it to TLS, we call leakRef() to keep Thread ref count incremented by the TLS.
179         And when destroying the TLS, we call `deref()` to ensure that Thread* is dereferenced from
180         the TLS.
181
182         * WTF.xcodeproj/project.pbxproj:
183         * wtf/CMakeLists.txt:
184         * wtf/ThreadHolder.cpp: Removed.
185         * wtf/ThreadHolder.h: Removed.
186         * wtf/ThreadHolderPthreads.cpp: Removed.
187         * wtf/ThreadHolderWin.cpp: Removed.
188         * wtf/Threading.cpp:
189         (WTF::Thread::entryPoint):
190         (WTF::initializeThreading):
191         * wtf/Threading.h:
192         (WTF::Thread::currentMayBeNull):
193         (WTF::Thread::current):
194         * wtf/ThreadingPthreads.cpp:
195         (WTF::Thread::waitForCompletion):
196         (WTF::Thread::initializeCurrentTLS):
197         (WTF::Thread::initializeTLSKey):
198         (WTF::Thread::initializeTLS):
199         (WTF::Thread::destructTLS):
200         (WTF::Thread::createCurrentThread): Deleted.
201         * wtf/ThreadingWin.cpp:
202         (WTF::Thread::initializeCurrentTLS):
203         (WTF::threadMapMutex):
204         (WTF::Thread::initializeTLSKey):
205         (WTF::Thread::currentDying):
206         (WTF::Thread::get):
207         (WTF::Thread::initializeTLS):
208         (WTF::Thread::destructTLS):
209         (WTF::waitForThreadCompletion):
210         (WTF::Thread::createCurrentThread): Deleted.
211
212 2017-08-03  Yusuke Suzuki  <utatane.tea@gmail.com>
213
214         [Linux][WTF] Use one global semaphore to notify thread suspend and resume completion
215         https://bugs.webkit.org/show_bug.cgi?id=175124
216
217         Reviewed by Carlos Garcia Campos.
218
219         POSIX sem_t is used to notify thread suspend and resume completion in Linux ports
220         since sem_post is async-signal-safe function. Since we guard suspend() and resume()
221         with one global lock, this semaphore is also guarded by this lock. So we do not need
222         to have semaphore per WTF::Thread.
223
224         This patch introduces one global Semaphore. And drop per thread semaphore.
225
226         * wtf/Threading.h:
227         * wtf/ThreadingPthreads.cpp:
228         (WTF::Thread::~Thread):
229         (WTF::Semaphore::Semaphore):
230         (WTF::Semaphore::~Semaphore):
231         (WTF::Semaphore::wait):
232         (WTF::Semaphore::post):
233         (WTF::Thread::signalHandlerSuspendResume):
234         (WTF::Thread::initializePlatformThreading):
235         (WTF::Thread::suspend):
236         (WTF::Thread::resume):
237         (WTF::Thread::Thread): Deleted.
238         * wtf/ThreadingWin.cpp:
239         (WTF::Thread::Thread): Deleted.
240
241 2017-08-03  Yusuke Suzuki  <utatane.tea@gmail.com>
242
243         [Linux][WTF] Reduce sizeof(WTF::Thread) by using a pointer to PlatformRegisters
244         https://bugs.webkit.org/show_bug.cgi?id=175119
245
246         Reviewed by Carlos Garcia Campos.
247
248         sizeof(PlatformRegisters) is so large. In my Linux box, it is 256. It enlarges the sizeof(WTF::Thread).
249         However, it is not necessary to hold it in WTF::Thread member. Thread's ucontext data and its stack is
250         effective while suspending the thread. So, we can just use the pointer to the PlatformRegister instead
251         of copying it to the member of the WTF::Thread.
252
253         * wtf/Threading.h:
254         * wtf/ThreadingPthreads.cpp:
255         (WTF::Thread::signalHandlerSuspendResume):
256         (WTF::Thread::getRegisters):
257
258 2017-08-02  Yusuke Suzuki  <utatane.tea@gmail.com>
259
260         Unreviewed, build fix for Windows port
261         https://bugs.webkit.org/show_bug.cgi?id=174716
262
263         This ugliness will be fixed in https://bugs.webkit.org/show_bug.cgi?id=175013.
264
265         * wtf/ThreadHolder.h:
266         * wtf/Threading.h:
267
268 2017-08-02  Yusuke Suzuki  <utatane.tea@gmail.com>
269
270         Merge WTFThreadData to Thread::current
271         https://bugs.webkit.org/show_bug.cgi?id=174716
272
273         Reviewed by Mark Lam.
274
275         We placed thread specific data in WTFThreadData previously. But now, we have a new good place
276         to put thread specific data: WTF::Thread. Before this patch, WTFThreadData and WTF::Thread
277         sometimes have the completely same fields (m_stack etc.) due to initialization order limitations.
278         This patch merges WTFThreadData to WTF::Thread. We apply WTFThreadData's initialization style
279         to WTF::Thread. So, WTF::Thread's holder now uses fast TLS for darwin environment. Thus,
280         Thread::current() access is now accelerated. And WTF::Thread::current() can be accessed even
281         before calling WTF::initializeThreading.
282
283         * WTF.xcodeproj/project.pbxproj:
284         * wtf/CMakeLists.txt:
285         * wtf/LockAlgorithm.h:
286         * wtf/LockAlgorithmInlines.h:
287         * wtf/MainThread.h:
288         * wtf/ParkingLot.cpp:
289         * wtf/StackStats.cpp:
290         (WTF::StackStats::PerThreadStats::PerThreadStats):
291         (WTF::StackStats::CheckPoint::CheckPoint):
292         (WTF::StackStats::CheckPoint::~CheckPoint):
293         (WTF::StackStats::probe):
294         (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
295         * wtf/ThreadHolder.cpp:
296         (WTF::ThreadHolder::initializeCurrent):
297         * wtf/ThreadHolder.h:
298         (WTF::ThreadHolder::ThreadHolder):
299         (WTF::ThreadHolder::currentMayBeNull):
300         (WTF::ThreadHolder::current):
301         * wtf/ThreadHolderPthreads.cpp:
302         (WTF::ThreadHolder::initializeKey):
303         (WTF::ThreadHolder::initialize):
304         (WTF::ThreadHolder::destruct):
305         (WTF::ThreadHolder::initializeOnce): Deleted.
306         (WTF::ThreadHolder::current): Deleted.
307         * wtf/ThreadHolderWin.cpp:
308         (WTF::ThreadHolder::initializeKey):
309         (WTF::ThreadHolder::currentDying):
310         (WTF::ThreadHolder::initialize):
311         (WTF::ThreadHolder::initializeOnce): Deleted.
312         (WTF::ThreadHolder::current): Deleted.
313         * wtf/Threading.cpp:
314         (WTF::Thread::initializeInThread):
315         (WTF::Thread::entryPoint):
316         (WTF::Thread::create):
317         (WTF::Thread::didExit):
318         (WTF::initializeThreading):
319         (WTF::Thread::currentMayBeNull): Deleted.
320         * wtf/Threading.h:
321         (WTF::Thread::current):
322         (WTF::Thread::atomicStringTable):
323         (WTF::Thread::setCurrentAtomicStringTable):
324         (WTF::Thread::stackStats):
325         (WTF::Thread::savedStackPointerAtVMEntry):
326         (WTF::Thread::setSavedStackPointerAtVMEntry):
327         (WTF::Thread::savedLastStackTop):
328         (WTF::Thread::setSavedLastStackTop):
329         * wtf/ThreadingPrimitives.h:
330         * wtf/ThreadingPthreads.cpp:
331         (WTF::Thread::createCurrentThread):
332         (WTF::Thread::current): Deleted.
333         * wtf/ThreadingWin.cpp:
334         (WTF::Thread::createCurrentThread):
335         (WTF::Thread::current): Deleted.
336         * wtf/WTFThreadData.cpp: Removed.
337         * wtf/WTFThreadData.h: Removed.
338         * wtf/text/AtomicString.cpp:
339         * wtf/text/AtomicStringImpl.cpp:
340         (WTF::stringTable):
341         * wtf/text/AtomicStringTable.cpp:
342         (WTF::AtomicStringTable::create):
343         * wtf/text/AtomicStringTable.h:
344
345 2017-08-02  Joseph Pecoraro  <pecoraro@apple.com>
346
347         NeverDestroyed related leaks seen on bots
348         https://bugs.webkit.org/show_bug.cgi?id=175113
349
350         Reviewed by Yusuke Suzuki.
351
352         * wtf/NeverDestroyed.h:
353         (WTF::NeverDestroyed::NeverDestroyed):
354         Previously the result of makeNeverDestroyed was not always moving into
355         the `static NeverDestroyed` static local variable. In some cases it would
356         re-invoke the constructor, creating a new NeverDestroyed object. In the
357         case of a Vector it was causing leaks.
358
359         Adding a move constructor convinces the compiler to move the result
360         of makeNeverDestroyed into the NeverDestroyed static. It doesn't actually
361         invoke the move constructor here, which I believe means it is deciding
362         to perform optional copy elision optimization.
363         'http://en.cppreference.com/w/cpp/language/copy_elision
364
365 2017-08-02  Filip Pizlo  <fpizlo@apple.com>
366
367         All C++ accesses to JSObject::m_butterfly should do caging
368         https://bugs.webkit.org/show_bug.cgi?id=175039
369
370         Reviewed by Keith Miller.
371         
372         Adds a smart pointer class that does various kinds of caging for you.
373
374         * WTF.xcodeproj/project.pbxproj:
375         * wtf/CMakeLists.txt:
376         * wtf/CagedPtr.h: Added.
377         (WTF::CagedPtr::CagedPtr):
378         (WTF::CagedPtr::get const):
379         (WTF::CagedPtr::getMayBeNull const):
380         (WTF::CagedPtr::operator== const):
381         (WTF::CagedPtr::operator!= const):
382         (WTF::CagedPtr::operator bool const):
383         (WTF::CagedPtr::operator* const):
384         (WTF::CagedPtr::operator-> const):
385
386 2017-08-02  Filip Pizlo  <fpizlo@apple.com>
387
388         We should be OK with the gigacage being disabled on gmalloc
389         https://bugs.webkit.org/show_bug.cgi?id=175082
390
391         Reviewed by Michael Saboff.
392
393         * wtf/Gigacage.h:
394         (Gigacage::shouldBeEnabled):
395
396 2017-08-01  Filip Pizlo  <fpizlo@apple.com>
397
398         Bmalloc and GC should put auxiliaries (butterflies, typed array backing stores) in a gigacage (separate multi-GB VM region)
399         https://bugs.webkit.org/show_bug.cgi?id=174727
400
401         Reviewed by Mark Lam.
402         
403         For the Gigacage project to have minimal impact, we need to have some abstraction that allows code to
404         avoid having to guard itself with #if's. This adds a Gigacage abstraction that overlays the Gigacage
405         namespace from bmalloc, which always lets you call things like Gigacage::caged and Gigacage::tryMalloc.
406         
407         Because of how many places need to possibly allocate in a gigacage, or possibly perform caged accesses,
408         it's better to hide the question of whether or not it's enabled inside this API.
409
410         * WTF.xcodeproj/project.pbxproj:
411         * wtf/CMakeLists.txt:
412         * wtf/FastMalloc.cpp:
413         * wtf/Gigacage.cpp: Added.
414         (Gigacage::tryMalloc):
415         (Gigacage::tryAllocateVirtualPages):
416         (Gigacage::freeVirtualPages):
417         (Gigacage::tryAlignedMalloc):
418         (Gigacage::alignedFree):
419         (Gigacage::free):
420         * wtf/Gigacage.h: Added.
421         (Gigacage::ensureGigacage):
422         (Gigacage::disableGigacage):
423         (Gigacage::addDisableCallback):
424         (Gigacage::removeDisableCallback):
425         (Gigacage::caged):
426         (Gigacage::isCaged):
427         (Gigacage::tryAlignedMalloc):
428         (Gigacage::alignedFree):
429         (Gigacage::free):
430
431 2017-07-31  Matt Lewis  <jlewis3@apple.com>
432
433         Unreviewed, rolling out r220060.
434
435         This broke our internal builds. Contact reviewer of patch for
436         more information.
437
438         Reverted changeset:
439
440         "Merge WTFThreadData to Thread::current"
441         https://bugs.webkit.org/show_bug.cgi?id=174716
442         http://trac.webkit.org/changeset/220060
443
444 2017-07-31  Yusuke Suzuki  <utatane.tea@gmail.com>
445
446         Merge WTFThreadData to Thread::current
447         https://bugs.webkit.org/show_bug.cgi?id=174716
448
449         Reviewed by Sam Weinig.
450
451         We placed thread specific data in WTFThreadData previously. But now, we have a new good place
452         to put thread specific data: WTF::Thread. Before this patch, WTFThreadData and WTF::Thread
453         sometimes have the completely same fields (m_stack etc.) due to initialization order limitations.
454         This patch merges WTFThreadData to WTF::Thread. We apply WTFThreadData's initialization style
455         to WTF::Thread. So, WTF::Thread's holder now uses fast TLS for darwin environment. Thus,
456         Thread::current() access is now accelerated. And WTF::Thread::current() can be accessed even
457         before calling WTF::initializeThreading.
458
459         * WTF.xcodeproj/project.pbxproj:
460         * wtf/CMakeLists.txt:
461         * wtf/LockAlgorithm.h:
462         * wtf/LockAlgorithmInlines.h:
463         * wtf/MainThread.h:
464         * wtf/ParkingLot.cpp:
465         * wtf/StackStats.cpp:
466         (WTF::StackStats::PerThreadStats::PerThreadStats):
467         (WTF::StackStats::CheckPoint::CheckPoint):
468         (WTF::StackStats::CheckPoint::~CheckPoint):
469         (WTF::StackStats::probe):
470         (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
471         * wtf/ThreadHolder.cpp:
472         (WTF::ThreadHolder::initializeCurrent):
473         * wtf/ThreadHolder.h:
474         (WTF::ThreadHolder::ThreadHolder):
475         (WTF::ThreadHolder::currentMayBeNull):
476         (WTF::ThreadHolder::current):
477         * wtf/ThreadHolderPthreads.cpp:
478         (WTF::ThreadHolder::initialize):
479         (WTF::ThreadHolder::destruct):
480         (WTF::ThreadHolder::current): Deleted.
481         * wtf/ThreadHolderWin.cpp:
482         (WTF::ThreadHolder::currentDying):
483         (WTF::ThreadHolder::initialize):
484         (WTF::ThreadHolder::current): Deleted.
485         * wtf/Threading.cpp:
486         (WTF::Thread::initializeInThread):
487         (WTF::Thread::entryPoint):
488         (WTF::Thread::didExit):
489         (WTF::initializeThreading):
490         (WTF::Thread::currentMayBeNull): Deleted.
491         * wtf/Threading.h:
492         (WTF::Thread::atomicStringTable):
493         (WTF::Thread::setCurrentAtomicStringTable):
494         (WTF::Thread::stackStats):
495         (WTF::Thread::savedStackPointerAtVMEntry):
496         (WTF::Thread::setSavedStackPointerAtVMEntry):
497         (WTF::Thread::savedLastStackTop):
498         (WTF::Thread::setSavedLastStackTop):
499         (WTF::Thread::current):
500         * wtf/ThreadingPrimitives.h:
501         * wtf/ThreadingPthreads.cpp:
502         (WTF::Thread::createCurrentThread):
503         (WTF::Thread::current): Deleted.
504         * wtf/ThreadingWin.cpp:
505         (WTF::Thread::createCurrentThread):
506         (WTF::Thread::current): Deleted.
507         * wtf/WTFThreadData.cpp: Removed.
508         * wtf/WTFThreadData.h: Removed.
509         * wtf/text/AtomicString.cpp:
510         * wtf/text/AtomicStringImpl.cpp:
511         (WTF::stringTable):
512         * wtf/text/AtomicStringTable.cpp:
513         (WTF::AtomicStringTable::create):
514         * wtf/text/AtomicStringTable.h:
515
516 2017-07-31  Xabier Rodriguez Calvar  <calvaris@igalia.com>
517
518         Created a bool pretty printer at WTF for debugging purposes
519         https://bugs.webkit.org/show_bug.cgi?id=174893
520
521         Reviewed by Darin Adler.
522
523         * wtf/PrintStream.cpp:
524         (WTF::printInternal): The overload taking bool uses boolForPrinting
525         * wtf/PrintStream.h:
526         (WTF::boolForPrinting): Converts a bool in "true" or "false".
527
528 2017-07-30  Yusuke Suzuki  <utatane.tea@gmail.com>
529
530         [WTF] Introduce Private Symbols
531         https://bugs.webkit.org/show_bug.cgi?id=174935
532
533         Reviewed by Darin Adler.
534
535         Upcoming proposal of class fields[1] requires private fields.
536         The simple way to implement it is adding a property with a private symbol.
537         Currently, we have private symbols for internal properties. They are usual
538         Symbols managed by the hash table. So basically private symbols are statically
539         created in BuiltinNames. However this new proposal encourages users to create
540         such private symbols more and more.
541
542         So, this patch introduces notion of "Private" into WTF SymbolImpl. This patch
543         adds PrivateSymbolImpl. This is SymbolImpl with "Private" flag. We do not need
544         to look up the symbol from the hash table to check whether the given symbol
545         is a private one.
546
547         [1]: https://github.com/tc39/proposal-class-fields
548
549         * wtf/text/StringImpl.h:
550         * wtf/text/SymbolImpl.cpp:
551         (WTF::PrivateSymbolImpl::create):
552         (WTF::PrivateSymbolImpl::createNullSymbol):
553         * wtf/text/SymbolImpl.h:
554         (WTF::SymbolImpl::isPrivate):
555         (WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl):
556         (WTF::SymbolImpl::SymbolImpl):
557         (WTF::PrivateSymbolImpl::PrivateSymbolImpl):
558
559 2017-07-30  Brady Eidson  <beidson@apple.com>
560
561         Add URLSchemeHandler API tests that verify the lack of URLSchemeTask object leaks.
562         https://bugs.webkit.org/show_bug.cgi?id=174958
563
564         Reviewed by Darin Adler.
565
566         This patch adds a new template class "InstanceCounted<T>".
567         
568         For each specialization, "InstanceCounted" will keep track of the total number of
569         instances in existence.
570         
571         This makes explicate leak checking in API tests possible.
572         
573         Since this adds some runtime and storage overhead the code that actually does anything
574         is only compiled in debug builds.
575         
576         * WTF.xcodeproj/project.pbxproj:
577         * wtf/InstanceCounted.h: Added.
578         (WTF::InstanceCounted::InstanceCounted):
579         (WTF::InstanceCounted::instanceCount):
580         (WTF::InstanceCounted::~InstanceCounted):
581
582 2017-07-27  Yusuke Suzuki  <utatane.tea@gmail.com>
583
584         [WTF] Drop Thread initialization wait in some platforms by introducing StackBounds::newThreadStackBounds(PlatformThreadHandle&)
585         https://bugs.webkit.org/show_bug.cgi?id=174303
586
587         Reviewed by Mark Lam.
588
589         Currently, the caller thread of Thread::create() need to wait for completion of the initialization of the target thread.
590         This is because we need to initialize Thread::m_stack in the target thread. Before this patch, a target thread's
591         StackBounds can only be retrieved by the target thread itself. However, this potentially causes context-switching between
592         the caller and the target threads and hurts efficiency of creating threads.
593
594         Fortunately, in some platforms (including major platforms except for Windows), we can get StackBounds of a target
595         thread from a caller thread. This allows us to avoid waiting for completion of thread initialization.
596
597         In this patch, we introduce HAVE_STACK_BOUNDS_FOR_NEW_THREAD and StackBounds::newThreadStackBounds. When creating
598         a new thread, we will use StackBounds::newThreadStackBounds to get StackBounds if possible. As a result, we
599         do not need to wait for completion of thread initialization to ensure m_stack field of Thread is initialized.
600
601         While some documents claim that it is possible on Windows to get the StackBounds of another thread[1], the method relies on
602         undocumented Windows NT APIs (NtQueryInformationThread, NtReadVirtualMemory etc.). So in this patch, we just
603         use the conservative approach simply waiting for completion of thread initialization.
604
605         [1]: https://stackoverflow.com/questions/3918375/how-to-get-thread-stack-information-on-windows
606
607         * wtf/Platform.h:
608         * wtf/StackBounds.cpp:
609         (WTF::StackBounds::newThreadStackBounds):
610         (WTF::StackBounds::currentThreadStackBoundsInternal):
611         (WTF::StackBounds::initialize): Deleted.
612         * wtf/StackBounds.h:
613         (WTF::StackBounds::currentThreadStackBounds):
614         (WTF::StackBounds::StackBounds):
615         * wtf/Threading.cpp:
616         (WTF::Thread::NewThreadContext::NewThreadContext):
617         (WTF::Thread::entryPoint):
618         (WTF::Thread::create):
619         (WTF::Thread::initialize): Deleted.
620         * wtf/Threading.h:
621         * wtf/ThreadingPrimitives.h:
622         * wtf/ThreadingPthreads.cpp:
623         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
624         (WTF::wtfThreadEntryPoint):
625         (WTF::Thread::establishHandle):
626         (WTF::Thread::initializeCurrentThreadInternal):
627         (WTF::Thread::current):
628         * wtf/ThreadingWin.cpp:
629         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
630         (WTF::Thread::initializeCurrentThreadInternal):
631         (WTF::Thread::current):
632         * wtf/win/MainThreadWin.cpp:
633         (WTF::initializeMainThreadPlatform):
634
635 2017-07-27  JF Bastien  <jfbastien@apple.com>
636
637         Update lock benchmarks
638         https://bugs.webkit.org/show_bug.cgi?id=174907
639
640         Reviewed by Filip Pizlo.
641
642         * benchmarks/ConditionSpeedTest.cpp:
643         (main):
644         * benchmarks/LockFairnessTest.cpp:
645         * benchmarks/LockSpeedTest.cpp:
646         * benchmarks/ToyLocks.h:
647
648 2017-07-26  Brian Burg  <bburg@apple.com>
649
650         Remove WEB_TIMING feature flag
651         https://bugs.webkit.org/show_bug.cgi?id=174795
652
653         Reviewed by Alex Christensen.
654
655         * wtf/FeatureDefines.h:
656
657 2017-07-26  Claudio Saavedra  <csaavedra@igalia.com>
658
659         [WPE] Enable KeyboardEvent key and code attributes
660         https://bugs.webkit.org/show_bug.cgi?id=174822
661
662         Reviewed by Žan Doberšek.
663
664         There is no reason for this to be disabled from what I see.
665
666         * wtf/FeatureDefines.h: Enable KeyboardEvent key and code attributes.
667
668 2017-07-23  Filip Pizlo  <fpizlo@apple.com>
669
670         B3 should do LICM
671         https://bugs.webkit.org/show_bug.cgi?id=174750
672
673         Reviewed by Keith Miller and Saam Barati.
674         
675         Moved DFG::NaturalLoops to WTF. The new templatized NaturalLoops<> uses the same Graph abstraction as
676         Dominators<>. This allows us to add a B3::NaturalLoops for free.
677         
678         Also made small tweaks to RangeSet, which the LICM uses.
679
680         * WTF.xcodeproj/project.pbxproj:
681         * wtf/CMakeLists.txt:
682         * wtf/Dominators.h:
683         * wtf/NaturalLoops.h: Added.
684         (WTF::NaturalLoop::NaturalLoop):
685         (WTF::NaturalLoop::graph):
686         (WTF::NaturalLoop::header):
687         (WTF::NaturalLoop::size):
688         (WTF::NaturalLoop::at):
689         (WTF::NaturalLoop::operator[]):
690         (WTF::NaturalLoop::contains):
691         (WTF::NaturalLoop::index):
692         (WTF::NaturalLoop::isOuterMostLoop):
693         (WTF::NaturalLoop::dump):
694         (WTF::NaturalLoop::addBlock):
695         (WTF::NaturalLoops::NaturalLoops):
696         (WTF::NaturalLoops::graph):
697         (WTF::NaturalLoops::numLoops):
698         (WTF::NaturalLoops::loop):
699         (WTF::NaturalLoops::headerOf):
700         (WTF::NaturalLoops::innerMostLoopOf):
701         (WTF::NaturalLoops::innerMostOuterLoop):
702         (WTF::NaturalLoops::belongsTo):
703         (WTF::NaturalLoops::loopDepth):
704         (WTF::NaturalLoops::loopsOf):
705         (WTF::NaturalLoops::dump):
706         * wtf/RangeSet.h:
707         (WTF::RangeSet::begin):
708         (WTF::RangeSet::end):
709         (WTF::RangeSet::addAll):
710
711 2017-07-23  Michael Catanzaro  <mcatanzaro@igalia.com>
712
713         Implement FALLTHROUGH attribute for C with GCC
714         https://bugs.webkit.org/show_bug.cgi?id=174555
715
716         Reviewed by Darin Adler.
717
718         My previous attempt to silence the JSC -Wimplicit-fallthrough warnings failed because they
719         are coming from a C file, and our FALLTHROUGH macro is only implemented for C++. So
720         implement it for C as well, using C attribute syntax.
721  
722         Note this is only possible to do for GCC, because Clang only supports this attribute using
723         the [[C++ attribute syntax]].
724
725         * wtf/Compiler.h:
726
727 2017-07-14  Filip Pizlo  <fpizlo@apple.com>
728
729         It should be easy to decide how WebKit yields
730         https://bugs.webkit.org/show_bug.cgi?id=174298
731
732         Reviewed by Saam Barati.
733         
734         Created a Thread::yield() abstraction for sched_yield(), and made WTF use it everywhere that it
735         had previously used std::this_thread::yield().
736         
737         To make it less annoying to experiment with changes to the lock algorithm in the future, this also
738         moves the meat of the algorithm into LockAlgorithmInlines.h. Only two files include that header.
739         Since LockAlgorithm.h no longer includes ParkingLot.h, a bunch of files in WK now need to include
740         timing headers (Seconds, MonotonicTime, etc) manually.
741
742         * WTF.xcodeproj/project.pbxproj:
743         * benchmarks/ToyLocks.h:
744         * wtf/CMakeLists.txt:
745         * wtf/Lock.cpp:
746         * wtf/LockAlgorithm.h:
747         (WTF::LockAlgorithm::lockSlow): Deleted.
748         (WTF::LockAlgorithm::unlockSlow): Deleted.
749         * wtf/LockAlgorithmInlines.h: Added.
750         (WTF::hasParkedBit>::lockSlow):
751         (WTF::hasParkedBit>::unlockSlow):
752         * wtf/MainThread.cpp:
753         * wtf/RunLoopTimer.h:
754         * wtf/Threading.cpp:
755         * wtf/Threading.h:
756         * wtf/ThreadingPthreads.cpp:
757         (WTF::Thread::yield):
758         * wtf/ThreadingWin.cpp:
759         (WTF::Thread::yield):
760         * wtf/WordLock.cpp:
761         (WTF::WordLockBase::lockSlow):
762         (WTF::WordLockBase::unlockSlow):
763
764 2017-07-22  Yusuke Suzuki  <utatane.tea@gmail.com>
765
766         [WTF] Extend ThreadGroup::add results from bool to ThreadGroupAddResult
767         https://bugs.webkit.org/show_bug.cgi?id=174705
768
769         Reviewed by Mark Lam.
770
771         After starting using ThreadGroup to bookkeep active threads for Signals,
772         we would like to know tristate of ThreadGroup::add result, NewlyAdded, AlreadyAdded, NotAdded.
773         This patch extends the result of ThreadGroup::add from bool to ThreadGroupAddResult tristate.
774         Note that NotAdded is returned if the target thread is dying.
775
776         * wtf/ThreadGroup.cpp:
777         (WTF::ThreadGroup::add):
778         (WTF::ThreadGroup::addCurrentThread):
779         * wtf/ThreadGroup.h:
780         * wtf/Threading.cpp:
781         (WTF::Thread::addToThreadGroup):
782         * wtf/Threading.h:
783         * wtf/threads/Signals.cpp:
784         (WTF::registerThreadForMachExceptionHandling):
785
786 2017-07-21  Commit Queue  <commit-queue@webkit.org>
787
788         Unreviewed, rolling out r219732.
789         https://bugs.webkit.org/show_bug.cgi?id=174748
790
791         static is not threadsafe in WebKit tree (Requested by
792         yusukesuzuki on #webkit).
793
794         Reverted changeset:
795
796         "[WTF] Drop initializeDate"
797         https://bugs.webkit.org/show_bug.cgi?id=174714
798         http://trac.webkit.org/changeset/219732
799
800 2017-07-21  Yusuke Suzuki  <utatane.tea@gmail.com>
801
802         [WTF] Drop initializeDate
803         https://bugs.webkit.org/show_bug.cgi?id=174714
804
805         Reviewed by Darin Adler.
806
807         minYear static variable will be initialized in an exclusive manner, which is ensured by C++ "static" semantics.
808         Thus, we do not need to call initializeDate() explicitly.
809
810         * wtf/DateMath.cpp:
811         (WTF::equivalentYearForDST):
812         (WTF::initializeDates): Deleted.
813         * wtf/Threading.cpp:
814         (WTF::initializeThreading):
815
816 2017-07-21  Yusuke Suzuki  <utatane.tea@gmail.com>
817
818         [JSC] Introduce static symbols
819         https://bugs.webkit.org/show_bug.cgi?id=158863
820
821         Reviewed by Darin Adler.
822
823         We add a new class StaticSymbolImpl. StaticSymbolImpl can offer
824         the way to create static SymbolImpl. It can be shared between
825         multiple VMs and multiple threads.
826
827         * wtf/text/SymbolImpl.h:
828         (WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl):
829         (WTF::SymbolImpl::StaticSymbolImpl::operator SymbolImpl&):
830         For StaticSymbolImpl's hashForSymbol, we use usual string hash value.
831         Since all the SymbolImpls are unique, basically, any value is OK here.
832         Non-confilicting to the other SymbolImpls is ideal.
833
834 2017-07-21  Yusuke Suzuki  <utatane.tea@gmail.com>
835
836         [WTF] Newly added AtomicStringImpl should use BufferInternal static string if StringImpl is static
837         https://bugs.webkit.org/show_bug.cgi?id=174501
838
839         Reviewed by Darin Adler.
840
841         When creating AtomicStringImpl from static StringImpl, we can just use createWithoutCopying
842         to create a BufferInternal AtomicStringImpl which m_data{8,16} is static string's one.
843
844         * wtf/text/AtomicStringImpl.cpp:
845         (WTF::CStringTranslator::hash):
846         (WTF::CStringTranslator::equal):
847         (WTF::CStringTranslator::translate):
848         (WTF::AtomicStringImpl::add):
849         (WTF::HashTranslatorCharBuffer::HashTranslatorCharBuffer):
850         (WTF::UCharBufferTranslator::hash):
851         (WTF::UCharBufferTranslator::equal):
852         (WTF::UCharBufferTranslator::translate):
853         (WTF::LCharBufferTranslator::hash):
854         (WTF::LCharBufferTranslator::equal):
855         (WTF::LCharBufferTranslator::translate):
856         (WTF::BufferFromStaticDataTranslator::hash):
857         (WTF::BufferFromStaticDataTranslator::equal):
858         (WTF::BufferFromStaticDataTranslator::translate):
859         (WTF::AtomicStringImpl::addLiteral):
860         (WTF::addSymbol):
861         (WTF::addStatic):
862         (WTF::AtomicStringImpl::addSlowCase):
863         (WTF::AtomicStringImpl::lookUp):
864         (WTF::CharBufferFromLiteralDataTranslator::hash): Deleted.
865         (WTF::CharBufferFromLiteralDataTranslator::equal): Deleted.
866         (WTF::CharBufferFromLiteralDataTranslator::translate): Deleted.
867         (WTF::addSubstring): Deleted.
868         * wtf/text/StringImpl.h:
869
870 2017-07-21  Konstantin Tokarev  <annulen@yandex.ru>
871
872        [cmake] Unreviewed, add definitions necessary to use ICU shipped with macOS
873
874        macOS system ICU libraries are built with U_DISABLE_RENAMING=1 and
875        U_SHOW_CPLUSPLUS_API=0. After r219155 we have to pass this definitons
876        explicitly, because ICU headers in the tree are not modified anymore.
877
878         * wtf/PlatformMac.cmake: Rely on ICU_LIBRARIES instead of passing ICU
879         library name explicitly in WTF_LIBRARIES.
880
881 2017-07-20  Chris Dumez  <cdumez@apple.com>
882
883         Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable
884         https://bugs.webkit.org/show_bug.cgi?id=174660
885
886         Reviewed by Geoffrey Garen.
887
888         Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable.
889         This essentially replaces a branch to figure out if the new size is less or greater than the
890         current size by an assertion.
891
892         * wtf/IndexSparseSet.h:
893         (WTF::OverflowHandler>::IndexSparseSet):
894         (WTF::OverflowHandler>::clear):
895         * wtf/Insertion.h:
896         (WTF::executeInsertions):
897         * wtf/RangeSet.h:
898         (WTF::RangeSet::compact):
899         * wtf/Vector.h:
900         (WTF::removeRepeatedElements):
901         * wtf/persistence/Coders.h:
902
903 2017-07-20  Yusuke Suzuki  <utatane.tea@gmail.com>
904
905         [WTF] Use ThreadGroup to bookkeep active threads for Mach exception
906         https://bugs.webkit.org/show_bug.cgi?id=174678
907
908         Reviewed by Mark Lam.
909
910         We can use ThreadGroup to bookkeep active threads for Mach exceptions.
911         When the thread dies, it is automatically removed from the thread groups.
912         So we do not need to call unregisterThreadForMachExceptionHandling.
913
914         * wtf/ThreadGroup.cpp:
915         (WTF::ThreadGroup::~ThreadGroup):
916         (WTF::ThreadGroup::add):
917         * wtf/ThreadGroup.h:
918         * wtf/ThreadHolder.cpp:
919         (WTF::ThreadHolder::~ThreadHolder):
920         * wtf/Threading.cpp:
921         (WTF::Thread::addToThreadGroup):
922         (WTF::Thread::removeFromThreadGroup):
923         * wtf/Threading.h:
924         * wtf/threads/Signals.cpp:
925         (WTF::setExceptionPorts):
926         (WTF::activeThreads):
927         (WTF::registerThreadForMachExceptionHandling):
928         (WTF::installSignalHandler):
929         (WTF::unregisterThreadForMachExceptionHandling): Deleted.
930         * wtf/threads/Signals.h:
931
932 2017-07-19  Yusuke Suzuki  <utatane.tea@gmail.com>
933
934         [WTF] Remove unnecessary indirection of WTF::Thread entry point
935         https://bugs.webkit.org/show_bug.cgi?id=174291
936
937         Reviewed by Mark Lam.
938
939         Now wtfThreadEntryPoint is almost the same. Only the difference is function signature due to platform APIs.
940         We remove ThreadFunctionInvocation indirection in ThreadingPthread.cpp and ThreadingWin.cpp.
941
942         Also, ThreadFunctionInvocation keeps a RefPtr to the Thread object. This was previously needed to keep the
943         Thread object alive until the thread itself could install the ThreadHolder into its thread local storage.
944         The ThreadHolder has a Ref that keeps the Thread object alive for the lifetime of the thread. Since
945         Thread::create() now waits for the thread to be initialized before returning and Thread::create() hold a Ref
946         to the Thread object, we are guaranteed that the Thread object will be alive long enough for it to be installed
947         in the thread's ThreadHolder, and we no longer need ThreadFunctionInvocation.
948
949         And we also simplify ThreadHolder::initialize a bit. Now Thread::create waits for the completion of Thread
950         initialization. So, after establishing thread handle, we can call ThreadHolder::initialize before completing
951         Thread initialization.
952
953         Also we drop errno.h ifdefs in ThreadingWin.cpp. This is introduced to support WinCE. But now WinCE port is removed.
954
955         * WTF.xcodeproj/project.pbxproj:
956         * wtf/ThreadFunctionInvocation.h: Removed.
957         * wtf/ThreadHolder.h:
958         * wtf/ThreadHolderWin.cpp:
959         (WTF::ThreadHolder::initialize):
960         * wtf/Threading.cpp:
961         (WTF::Thread::entryPoint):
962         (WTF::Thread::create):
963         (WTF::threadEntryPoint): Deleted.
964         * wtf/Threading.h:
965         * wtf/ThreadingPthreads.cpp:
966         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
967         (WTF::wtfThreadEntryPoint):
968         (WTF::Thread::establishHandle):
969         (WTF::Thread::initializeCurrentThreadInternal):
970         (WTF::Thread::current):
971         (WTF::Thread::establishPlatformSpecificHandle):
972         (WTF::Thread::createInternal): Deleted.
973         (WTF::Thread::establish): Deleted.
974         * wtf/ThreadingWin.cpp:
975         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
976         (WTF::Thread::initializeCurrentThreadInternal):
977         (WTF::wtfThreadEntryPoint):
978         (WTF::Thread::establishHandle):
979         (WTF::Thread::current):
980         (WTF::Thread::establishPlatformSpecificHandle):
981         (WTF::Thread::createInternal): Deleted.
982         (WTF::Thread::establish): Deleted.
983         * wtf/win/MainThreadWin.cpp:
984         (WTF::initializeMainThreadPlatform):
985
986 2017-07-19  Yusuke Suzuki  <utatane.tea@gmail.com>
987
988         [WTF] Implement WTF::ThreadGroup
989         https://bugs.webkit.org/show_bug.cgi?id=174081
990
991         Reviewed by Mark Lam.
992
993         This patch implements WTF::ThreadGroup. It implements core of JSC::MachineThreads with more reliable way.
994         JSC::MachineThreads was complicated because of managing dead threads. Each JSC::MachineThreads has its
995         own TLS with a registered destructor. And everytime a thread dies, the registered TLS destructor is called.
996         And this destructor will remove the current dying thread from JSC::MachineThreads.
997
998         However the above implementation is tricky. And each JSC::MachineThreads requires own TLS space, which is
999         not considered in WTF's Windows ThreadSpecific implementation. Current design works well since we only
1000         have small number of MachineThreads right now.
1001
1002         Instead, we use more reliable way. After introducing WTF::Thread, WTF::Thread has WTF::Thread::didExit,
1003         which is called when associated TLS (with WTF::Thread) is destroyed. We leverage this mechanism to remove
1004         WTF::Thread from MachineThreads.
1005
1006         This patch introduces WTF::ThreadGroup. It is tightly integrated with WTF::Thread: WTF::Thread knows
1007         ThreadGroups which includes this thread. And WTF::ThreadGroup of course knows WTF::Threads added to it.
1008         WTF::Thread::didExit carefully remove itself from WTF::ThreadGroups.
1009
1010         The most important part of this patch is locking. WTF::Thread can die. And WTF::ThreadGroup can die.
1011         If we take a design using two fine grain locks in WTF::Thread and WTF::ThreadGroup, we easily encounter
1012         dead lock. Consider the following case.
1013
1014         1. When adding WTF::Thread (TH) to WTF::ThreadGroup (THG), we first hold a lock of THG, and hold a lock of TH (locking order is THG -> TH).
1015         2. When TH dies, TH need to hold a lock of TH to iterate THGs. And we hold a lock of THG to unregister TH from it (locking order is TH -> THG).
1016         3. When suspending and resuming THs in THG, we first hold a lock of THG. And then, we hold a lock of TH to suspend and resume it (locking order is THG -> TH).
1017         4. When destroying THG, we need to hold a lock of TH to unregister THG from TH. We can hold a lock of THG before that (locking order is THG -> TH).
1018
1019         Then, it easily causes dead lock. We cannot swap the locking order of (2) since iterating THG requires a lock of TH.
1020         To solve this problem, we use std::shared_ptr and std::weak_ptr.
1021
1022         1. When adding WTF::Thread (TH) to WTF::ThreadGroup (THG), we first hold THG, and hold a lock of TH. (THG -> TH)
1023         2. When TH dies, TH first hold lock of TH. And we use std::weak_ptr<>::lock() to retain non-destructed ThreadGroups.
1024         If some of ThreadGroups are dying, we just ignore them. It is ok because such a ThreadGroup will be destructed. So we do not need to unregister this thread from
1025         such a ThreadGroup. Then, we have Vector<std::shared_ptr<ThreadGroup>>. So we unlock a lock of TH. To unregister a thread from thread group, we first hold a
1026         lock of THG and then hold a lock of TH. Both lifetime is ensured: THG is retained by std::shared_ptr. And TH is itself. (TH), (THG -> TH).
1027         3. When suspending and resuming THs in THG, we first hold a lock of THG. And then, we hold a lock of TH to suspend and resume it (THG -> TH).
1028         4. When destroying THG, we hold a lock of THG. And hold a lock of TH. During holding THG's lock, registered thread never dies because (2) holds THG lock. (THG -> TH).
1029
1030         We also fix suspend and resume locking mechanism to avoid dead lock. We should hold the global lock when suspending and resuming.
1031         If we use per-thread lock, the suspended thread can hold the lock of the other threads. It causes dead lock.
1032
1033         * WTF.xcodeproj/project.pbxproj:
1034         * wtf/AutomaticThread.cpp:
1035         * wtf/CMakeLists.txt:
1036         * wtf/CrossThreadCopier.h:
1037         * wtf/ParkingLot.h:
1038         * wtf/ThreadGroup.cpp: Copied from Source/JavaScriptCore/wasm/WasmMachineThreads.cpp.
1039         (WTF::ThreadGroup::~ThreadGroup):
1040         (WTF::ThreadGroup::add):
1041         (WTF::ThreadGroup::addCurrentThread):
1042         * wtf/ThreadGroup.h: Copied from Source/JavaScriptCore/wasm/WasmMachineThreads.cpp.
1043         (WTF::ThreadGroup::create):
1044         (WTF::ThreadGroup::threads):
1045         (WTF::ThreadGroup::getLock):
1046         (WTF::ThreadGroup::weakFromThis):
1047         * wtf/Threading.cpp:
1048         (WTF::shouldRemoveThreadFromThreadGroup):
1049         (WTF::Thread::didExit):
1050         (WTF::Thread::addToThreadGroup):
1051         (WTF::Thread::removeFromThreadGroup):
1052         * wtf/Threading.h:
1053         * wtf/ThreadingPthreads.cpp:
1054         (WTF::Thread::resume):
1055         (WTF::Thread::getRegisters):
1056         * wtf/ThreadingWin.cpp:
1057         (WTF::Thread::resume):
1058         (WTF::Thread::getRegisters):
1059
1060 2017-07-18  Andy Estes  <aestes@apple.com>
1061
1062         [Xcode] Enable CLANG_WARN_RANGE_LOOP_ANALYSIS
1063         https://bugs.webkit.org/show_bug.cgi?id=174631
1064
1065         Reviewed by Tim Horton.
1066
1067         * Configurations/Base.xcconfig:
1068
1069 2017-07-18  Yusuke Suzuki  <utatane.tea@gmail.com>
1070
1071         WTF::Thread should have the threads stack bounds.
1072         https://bugs.webkit.org/show_bug.cgi?id=173975
1073
1074         Reviewed by Mark Lam.
1075
1076         We move StackBounds from WTFThreadData to WTF::Thread.
1077         One important thing is that we should make valid StackBounds
1078         visible to Thread::create() caller. When the caller get
1079         WTF::Thread from Thread::create(), this WTF::Thread should
1080         have a valid StackBounds. But StackBounds information can be
1081         retrived only in the WTF::Thread's thread itself.
1082
1083         We also clean up WTF::initializeThreading. StringImpl::empty()
1084         is now statically initialized by using constexpr constructor.
1085         Thus we do not need to call StringImpl::empty() explicitly here.
1086         And WTF::initializeThreading() does not have any main thread
1087         affinity right now in all the platforms. So we fix the comment
1088         in Threading.h. Then, now, WTF::initializeThreading() is called
1089         in UI thread when using Web thread in iOS.
1090
1091         * wtf/StackBounds.h:
1092         (WTF::StackBounds::emptyBounds):
1093         (WTF::StackBounds::StackBounds):
1094         * wtf/Threading.cpp:
1095         (WTF::threadEntryPoint):
1096         (WTF::Thread::create):
1097         (WTF::Thread::currentMayBeNull):
1098         (WTF::Thread::initialize):
1099         (WTF::initializeThreading):
1100         * wtf/Threading.h:
1101         (WTF::Thread::stack):
1102         * wtf/ThreadingPthreads.cpp:
1103         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
1104         (WTF::Thread::current):
1105         (WTF::initializeCurrentThreadEvenIfNonWTFCreated): Deleted.
1106         (WTF::Thread::currentMayBeNull): Deleted.
1107         * wtf/ThreadingWin.cpp:
1108         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
1109         (WTF::Thread::initializeCurrentThreadInternal):
1110         (WTF::Thread::current):
1111         * wtf/WTFThreadData.cpp:
1112         (WTF::WTFThreadData::WTFThreadData):
1113         * wtf/WTFThreadData.h:
1114         (WTF::WTFThreadData::stack):
1115
1116 2017-07-18  Andy Estes  <aestes@apple.com>
1117
1118         [Xcode] Enable CLANG_WARN_OBJC_LITERAL_CONVERSION
1119         https://bugs.webkit.org/show_bug.cgi?id=174631
1120
1121         Reviewed by Sam Weinig.
1122
1123         * Configurations/Base.xcconfig:
1124
1125 2017-07-18  Andy Estes  <aestes@apple.com>
1126
1127         [Xcode] Enable CLANG_WARN_NON_LITERAL_NULL_CONVERSION
1128         https://bugs.webkit.org/show_bug.cgi?id=174631
1129
1130         Reviewed by Dan Bernstein.
1131
1132         * Configurations/Base.xcconfig:
1133
1134 2017-07-18  Andy Estes  <aestes@apple.com>
1135
1136         [Xcode] Enable CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING
1137         https://bugs.webkit.org/show_bug.cgi?id=174631
1138
1139         Reviewed by Darin Adler.
1140
1141         * Configurations/Base.xcconfig:
1142
1143 2017-07-17  Konstantin Tokarev  <annulen@yandex.ru>
1144
1145         [cmake] Set library types before their targets are created
1146         https://bugs.webkit.org/show_bug.cgi?id=174600
1147
1148         Reviewed by Michael Catanzaro.
1149
1150         Since r219560 library targets are created before PlatformXXX.cmake
1151         files are processed, however library type must be passed in
1152         add_library() call and cannot be changed afterwards. Set these
1153         variables in OptionsXXX.cmake.
1154
1155         * wtf/PlatformGTK.cmake:
1156         * wtf/PlatformMac.cmake:
1157
1158 2017-07-17  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
1159
1160         Move USE_AVFOUNDATION definition on Windows to wtf/Platform.h
1161         https://bugs.webkit.org/show_bug.cgi?id=174356
1162
1163         Reviewed by Brent Fulgham.
1164
1165         Move the definition of USE_AVFOUNDATION on Windows to wtf/platform.h
1166
1167         Add a custom command to generate AVFoundationHeaderDetection.h, which
1168         is renamed from WebCoreHeaderDetection.h
1169
1170         * AVFoundationSupport.py: Moved from Source/WebCore/AVFoundationSupport.py.
1171         * wtf/Platform.h:
1172         * wtf/PlatformWin.cmake:
1173
1174 2017-07-17  Darin Adler  <darin@apple.com>
1175
1176         Improve use of NeverDestroyed
1177         https://bugs.webkit.org/show_bug.cgi?id=174348
1178
1179         Reviewed by Sam Weinig.
1180
1181         * wtf/HashSet.h: Added an overload of HashSet::add that takes an initializer list of
1182         const references. This is handy to add a bunch of values all at once. Later we can
1183         consider optimizing to grow the hash table only once instead of deciding whether to
1184         grow repeatedly as we add each value.
1185         (WTF::copyToVector): Changed to use std::copy, removing 4 of the 6 lines of code here.
1186
1187         * wtf/MemoryPressureHandler.cpp: Include NeverDestroyed.h here ...
1188         * wtf/MemoryPressureHandler.h: ... not here.
1189
1190         * wtf/NeverDestroyed.h: Added the ability to have a const NeverDestroyed.
1191         Added a makeNeverDestroyed function that deduces the type from the argument.
1192         With auto, this can be used to avoid writing out a long type twice.
1193
1194         * wtf/ThreadingPthreads.cpp: Removed unneeded include of NeverDestroyed.h.
1195         * wtf/text/AtomicString.cpp: Ditto.
1196
1197 2017-07-17  Konstantin Tokarev  <annulen@yandex.ru>
1198
1199         [CMake] Create targets before WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS is called
1200         https://bugs.webkit.org/show_bug.cgi?id=174557
1201
1202         Reviewed by Michael Catanzaro.
1203
1204         * wtf/CMakeLists.txt:
1205
1206 2017-07-14  Jonathan Bedard  <jbedard@apple.com>
1207
1208         Add iOS 11 SPI
1209         https://bugs.webkit.org/show_bug.cgi?id=174430
1210         <rdar://problem/33269288>
1211
1212         Reviewed by Tim Horton.
1213
1214         * Configurations/WTF.xcconfig: Exclude MachExceptions.def when building iOS 11 for
1215         the iOS simulator.
1216
1217 2017-07-14  Commit Queue  <commit-queue@webkit.org>
1218
1219         Unreviewed, rolling out r219510.
1220         https://bugs.webkit.org/show_bug.cgi?id=174525
1221
1222         Need to revert length() == 0 check for null string (Requested
1223         by yusukesuzuki on #webkit).
1224
1225         Reverted changeset:
1226
1227         "[WTF] Newly added AtomicStringImpl should use BufferInternal
1228         static string if StringImpl is static"
1229         https://bugs.webkit.org/show_bug.cgi?id=174501
1230         http://trac.webkit.org/changeset/219510
1231
1232 2017-07-14  Yusuke Suzuki  <utatane.tea@gmail.com>
1233
1234         [WTF] Newly added AtomicStringImpl should use BufferInternal static string if StringImpl is static
1235         https://bugs.webkit.org/show_bug.cgi?id=174501
1236
1237         Reviewed by Darin Adler.
1238
1239         When creating AtomicStringImpl from static StringImpl, we can just use createWithoutCopying
1240         to create a BufferInternal AtomicStringImpl which m_data{8,16} is static string's one.
1241
1242         * wtf/text/AtomicStringImpl.cpp:
1243         (WTF::CStringTranslator::hash):
1244         (WTF::CStringTranslator::equal):
1245         (WTF::CStringTranslator::translate):
1246         (WTF::AtomicStringImpl::add):
1247         (WTF::HashTranslatorCharBuffer::HashTranslatorCharBuffer):
1248         (WTF::UCharBufferTranslator::hash):
1249         (WTF::UCharBufferTranslator::equal):
1250         (WTF::UCharBufferTranslator::translate):
1251         (WTF::LCharBufferTranslator::hash):
1252         (WTF::LCharBufferTranslator::equal):
1253         (WTF::LCharBufferTranslator::translate):
1254         (WTF::BufferFromStaticDataTranslator::hash):
1255         (WTF::BufferFromStaticDataTranslator::equal):
1256         (WTF::BufferFromStaticDataTranslator::translate):
1257         (WTF::AtomicStringImpl::addLiteral):
1258         (WTF::addSymbol):
1259         (WTF::addStatic):
1260         (WTF::AtomicStringImpl::addSlowCase):
1261         (WTF::AtomicStringImpl::lookUp):
1262         (WTF::CharBufferFromLiteralDataTranslator::hash): Deleted.
1263         (WTF::CharBufferFromLiteralDataTranslator::equal): Deleted.
1264         (WTF::CharBufferFromLiteralDataTranslator::translate): Deleted.
1265         (WTF::addSubstring): Deleted.
1266         * wtf/text/StringImpl.h:
1267
1268 2017-07-14  Yusuke Suzuki  <utatane.tea@gmail.com>
1269
1270         [WTF] Use std::unique_ptr for StackTrace
1271         https://bugs.webkit.org/show_bug.cgi?id=174495
1272
1273         Reviewed by Alex Christensen.
1274
1275         Instead of returning pointer to heap allocated StackTrace,
1276         we should return std::unique_ptr<StackTrace>.
1277         And we also move WTFGetBackTrace from Assertions.cpp to
1278         StackTrace.cpp to consolidate stack trace related operations
1279         into StackTrace.cpp.
1280
1281         * wtf/Assertions.cpp:
1282         * wtf/StackTrace.cpp:
1283         (WTFGetBacktrace):
1284         (WTF::StackTrace::captureStackTrace):
1285         * wtf/StackTrace.h:
1286
1287 2017-07-13  Yusuke Suzuki  <utatane.tea@gmail.com>
1288
1289         Unreviewed, annotate inline for operator==/!= for FastAllocator
1290         https://bugs.webkit.org/show_bug.cgi?id=174366
1291
1292         * wtf/FastMalloc.h:
1293         (WTF::operator==):
1294         (WTF::operator!=):
1295
1296 2017-07-12  Commit Queue  <commit-queue@webkit.org>
1297
1298         Unreviewed, rolling out r219176.
1299         https://bugs.webkit.org/show_bug.cgi?id=174436
1300
1301         "Can cause infinite recursion on iOS" (Requested by mlam on
1302         #webkit).
1303
1304         Reverted changeset:
1305
1306         "WTF::Thread should have the threads stack bounds."
1307         https://bugs.webkit.org/show_bug.cgi?id=173975
1308         http://trac.webkit.org/changeset/219176
1309
1310 2017-07-12  Adrian Perez de Castro  <aperez@igalia.com>
1311
1312         [WTF] Failure to build when the compiler specifically targets ARMv8-A / defines __ARM_ARCH_8A__
1313         https://bugs.webkit.org/show_bug.cgi?id=174425
1314
1315         Reviewed by Michael Catanzaro.
1316
1317         * wtf/Platform.h: Also check for __ARCH_ARM_8A__ to detect ARMv8.
1318
1319 2017-07-12  Michael Saboff  <msaboff@apple.com>
1320
1321         Unreviewed build fix when both DATA_LOG_TO_FILE and DATA_LOG_FILENAME are defined.
1322
1323         * wtf/DataLog.cpp:
1324         (WTF::initializeLogFileOnce): Changed declaration of logBasename from
1325         char* logBasename to const char* logBasename.
1326
1327 2017-07-12  Matt Lewis  <jlewis3@apple.com>
1328
1329         Unreviewed, rolling out r219401.
1330
1331         This revision rolled out the previous patch, but after talking
1332         with reviewer, a rebaseline is what was needed.Rolling back in
1333         before rebaseline.
1334
1335         Reverted changeset:
1336
1337         "Unreviewed, rolling out r219379."
1338         https://bugs.webkit.org/show_bug.cgi?id=174400
1339         http://trac.webkit.org/changeset/219401
1340
1341 2017-07-12  Matt Lewis  <jlewis3@apple.com>
1342
1343         Unreviewed, rolling out r219379.
1344
1345         This revision caused a consistent failure in the test
1346         fast/dom/Window/property-access-on-cached-window-after-frame-
1347         removed.html.
1348
1349         Reverted changeset:
1350
1351         "Remove NAVIGATOR_HWCONCURRENCY"
1352         https://bugs.webkit.org/show_bug.cgi?id=174400
1353         http://trac.webkit.org/changeset/219379
1354
1355 2017-07-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1356
1357         Unreviewed, attempt to fix Windows build
1358         https://bugs.webkit.org/show_bug.cgi?id=174366
1359
1360         * wtf/FastMalloc.h:
1361         (WTF::operator==):
1362         (WTF::operator!=):
1363         (WTF::FastAllocator::operator==): Deleted.
1364         (WTF::FastAllocator::operator!=): Deleted.
1365
1366 2017-07-11  Carlos Garcia Campos  <cgarcia@igalia.com>
1367
1368         [GTK][WPE] Enable FILE_LOCK and implement lockFile and unlockFile
1369         https://bugs.webkit.org/show_bug.cgi?id=174357
1370
1371         Reviewed by Michael Catanzaro.
1372
1373         * wtf/Platform.h: Enable FILE_LOCK in GTK and WPE ports.
1374
1375 2017-07-11  Dean Jackson  <dino@apple.com>
1376
1377         Remove NAVIGATOR_HWCONCURRENCY
1378         https://bugs.webkit.org/show_bug.cgi?id=174400
1379
1380         Reviewed by Sam Weinig.
1381
1382         * wtf/FeatureDefines.h:
1383
1384 2017-07-11  Dean Jackson  <dino@apple.com>
1385
1386         Rolling out r219372.
1387
1388         * wtf/FeatureDefines.h:
1389
1390 2017-07-11  Dean Jackson  <dino@apple.com>
1391
1392         Remove NAVIGATOR_HWCONCURRENCY
1393         https://bugs.webkit.org/show_bug.cgi?id=174400
1394
1395         Reviewed by Sam Weinig.
1396
1397         * wtf/FeatureDefines.h:
1398
1399 2017-07-11  Yusuke Suzuki  <utatane.tea@gmail.com>
1400
1401         [WTF] Drop unnecessary AtomicString constructor since we have constexpr hash function
1402         https://bugs.webkit.org/show_bug.cgi?id=174347
1403
1404         Reviewed by Alex Christensen.
1405
1406         Previously, we calculate hash value in perl script and generate source code with that value.
1407         This AtomicString constructor takes this pre-calculated hash value to efficiently construct
1408         itself. But now, we have constexpr hash function, then we do not need to specify hash value
1409         directly in this way. Thus we drop this functionality.
1410
1411         * wtf/text/AtomicString.h:
1412         * wtf/text/AtomicStringImpl.cpp:
1413         (WTF::HashAndCharactersTranslator::hash): Deleted.
1414         (WTF::HashAndCharactersTranslator::equal): Deleted.
1415         (WTF::HashAndCharactersTranslator::translate): Deleted.
1416         * wtf/text/AtomicStringImpl.h:
1417         (WTF::AtomicStringImpl::add):
1418
1419 2017-07-10  Per Arne Vollan  <pvollan@apple.com>
1420
1421         [Win] Link error when building WTF from WTF.proj project file.
1422         https://bugs.webkit.org/show_bug.cgi?id=174316
1423         <rdar://problem/33178200>
1424
1425         Reviewed by Brent Fulgham.
1426
1427         WTF_CPU_X86 cmake variable needs to be set for link libraries directories to be correct.
1428
1429         * WTF.vcxproj/WTF.proj:
1430
1431 2017-07-03  Brian Burg  <bburg@apple.com>
1432
1433         Web Replay: remove some unused code
1434         https://bugs.webkit.org/show_bug.cgi?id=173903
1435
1436         Rubber-stamped by Joseph Pecoraro.
1437
1438         * wtf/FeatureDefines.h:
1439
1440 2017-07-10  Brady Eidson  <beidson@apple.com>
1441
1442         Cleanup lifetime issues of UniqueIDBDatabase and IDBBackingStore.
1443         <rdar://problem/32908525> and https://bugs.webkit.org/show_bug.cgi?id=174244
1444
1445         Reviewed by David Kilzer and Alex Christensen. 
1446
1447         Add proper "kill" support to CrossThreadQueue, as well as isEmpty() support.
1448
1449         * wtf/CrossThreadQueue.h:
1450         (WTF::CrossThreadQueue<DataType>::append):
1451         (WTF::CrossThreadQueue<DataType>::kill):
1452         (WTF::CrossThreadQueue<DataType>::isKilled):
1453         (WTF::CrossThreadQueue<DataType>::isEmpty):
1454         (WTF::CrossThreadQueue::isKilled): Deleted.
1455
1456 2017-07-09  Yusuke Suzuki  <utatane.tea@gmail.com>
1457
1458         [JSC] Use fastMalloc / fastFree for STL containers
1459         https://bugs.webkit.org/show_bug.cgi?id=174297
1460
1461         Reviewed by Sam Weinig.
1462
1463         * wtf/FastMalloc.h:
1464         (WTF::FastAllocator::FastAllocator):
1465         (WTF::FastAllocator::allocate):
1466         (WTF::FastAllocator::deallocate):
1467         (WTF::FastAllocator::operator==):
1468         (WTF::FastAllocator::operator!=):
1469
1470 2017-07-07  Brent Fulgham  <bfulgham@apple.com>
1471
1472         [WK2] Use a rolling 30-day uptime for processing statistics
1473         https://bugs.webkit.org/show_bug.cgi?id=174235
1474         <rdar://problem/33164381>
1475
1476         Reviewed by Chris Dumez.
1477
1478         Modify Deque to allow it to be used in a template specialization in KeyedDecoder.
1479
1480         * wtf/Deque.h:
1481
1482 2017-07-07  Commit Queue  <commit-queue@webkit.org>
1483
1484         Unreviewed, rolling out r219238, r219239, and r219241.
1485         https://bugs.webkit.org/show_bug.cgi?id=174265
1486
1487         "fast/workers/dedicated-worker-lifecycle.html is flaky"
1488         (Requested by yusukesuzuki on #webkit).
1489
1490         Reverted changesets:
1491
1492         "[WTF] Implement WTF::ThreadGroup"
1493         https://bugs.webkit.org/show_bug.cgi?id=174081
1494         http://trac.webkit.org/changeset/219238
1495
1496         "Unreviewed, build fix after r219238"
1497         https://bugs.webkit.org/show_bug.cgi?id=174081
1498         http://trac.webkit.org/changeset/219239
1499
1500         "Unreviewed, CLoop build fix after r219238"
1501         https://bugs.webkit.org/show_bug.cgi?id=174081
1502         http://trac.webkit.org/changeset/219241
1503
1504 2017-07-07  Yusuke Suzuki  <utatane.tea@gmail.com>
1505
1506         Unreviewed, Windows build fix after r219233 part 4
1507         https://bugs.webkit.org/show_bug.cgi?id=174231
1508
1509         * wtf/Assertions.h:
1510
1511 2017-07-06  Yusuke Suzuki  <utatane.tea@gmail.com>
1512
1513         Unreviewed, Windows build fix after r219233 part 3
1514         https://bugs.webkit.org/show_bug.cgi?id=174231
1515
1516         * wtf/Assertions.h:
1517         (compilerFenceForCrash):
1518
1519 2017-07-06  Yusuke Suzuki  <utatane.tea@gmail.com>
1520
1521         Unreviewed, Windows build fix after r219233 part 2
1522         https://bugs.webkit.org/show_bug.cgi?id=174231
1523
1524         * wtf/Assertions.h:
1525
1526 2017-07-06  Yusuke Suzuki  <utatane.tea@gmail.com>
1527
1528         Unreviewed, Windows build fix after r219233
1529         https://bugs.webkit.org/show_bug.cgi?id=174231
1530
1531         * wtf/Compiler.h:
1532
1533 2017-07-06  Yusuke Suzuki  <utatane.tea@gmail.com>
1534
1535         Unreviewed, build fix after r219238
1536         https://bugs.webkit.org/show_bug.cgi?id=174081
1537
1538         * wtf/Threading.cpp:
1539         (WTF::Thread::addToThreadGroup):
1540
1541 2017-07-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1542
1543         [WTF] Implement WTF::ThreadGroup
1544         https://bugs.webkit.org/show_bug.cgi?id=174081
1545
1546         Reviewed by Mark Lam.
1547
1548         This patch implements WTF::ThreadGroup. It implements core of JSC::MachineThreads with more reliable way.
1549         JSC::MachineThreads was complicated because of managing dead threads. Each JSC::MachineThreads has its
1550         own TLS with a registered destructor. And everytime a thread dies, the registered TLS destructor is called.
1551         And this destructor will remove the current dying thread from JSC::MachineThreads.
1552
1553         However the above implementation is tricky. And each JSC::MachineThreads requires own TLS space, which is
1554         not considered in WTF's Windows ThreadSpecific implementation. Current design works well since we only
1555         have small number of MachineThreads right now.
1556
1557         Instead, we use more reliable way. After introducing WTF::Thread, WTF::Thread has WTF::Thread::didExit,
1558         which is called when associated TLS (with WTF::Thread) is destroyed. We leverage this mechanism to remove
1559         WTF::Thread from MachineThreads.
1560
1561         This patch introduces WTF::ThreadGroup. It is tightly integrated with WTF::Thread: WTF::Thread knows
1562         ThreadGroups which includes this thread. And WTF::ThreadGroup of course knows WTF::Threads added to it.
1563         WTF::Thread::didExit carefully remove itself from WTF::ThreadGroups.
1564
1565         The most important part of this patch is locking. WTF::Thread can die. And WTF::ThreadGroup can die.
1566         If we take a design using two fine grain locks in WTF::Thread and WTF::ThreadGroup, we easily encounter
1567         dead lock. Consider the following case.
1568
1569         1. When adding WTF::Thread (TH) to WTF::ThreadGroup (THG), we first hold a lock of THG, and hold a lock of TH (locking order is THG -> TH).
1570         2. When TH dies, TH need to hold a lock of TH to iterate THGs. And we hold a lock of THG to unregister TH from it (locking order is TH -> THG).
1571         3. When suspending and resuming THs in THG, we first hold a lock of THG. And then, we hold a lock of TH to suspend and resume it (locking order is THG -> TH).
1572         4. When destroying THG, we need to hold a lock of TH to unregister THG from TH. We can hold a lock of THG before that (locking order is THG -> TH).
1573
1574         Then, it easily causes dead lock. We cannot swap the locking order of (2) since iterating THG requires a lock of TH.
1575         To solve this problem, we introduce one global lock ThreadGroup::destructionMutex (GL).
1576
1577         1. When adding WTF::Thread (TH) to WTF::ThreadGroup (THG), we first hold GL, and hold a lock of THG. Do not hold a
1578         lock of TH. TH's thread groups information is guarded by GL instead of a lock of TH (locking order is GL -> THG).
1579         2. When TH dies, TH need to hold GL to iterate THGs. And we hold a lock of THG to unregister TH from it (locking order is GL -> THG).
1580         3. When suspending and resuming THs in THG, we first hold a lock of THG. And then, we hold a lock of TH to suspend and resume it (locking order is THG -> TH).
1581         4. When destroying THG, we need to hold GL to unregister THG from TH. We can hold a lock of THG after that (locking order is GL -> THG).
1582
1583         We still have a lock of THG. By separating GL and THG's lock, we can hold a lock of THG while completely unrelated TH is destructed which takes a lock of GL and unrelated THG.
1584
1585         * WTF.xcodeproj/project.pbxproj:
1586         * wtf/AutomaticThread.cpp:
1587         * wtf/CMakeLists.txt:
1588         * wtf/CrossThreadCopier.h:
1589         * wtf/ParkingLot.h:
1590         * wtf/ThreadGroup.cpp: Copied from Source/JavaScriptCore/wasm/WasmMachineThreads.cpp.
1591         (WTF::ThreadGroup::destructionMutex):
1592         (WTF::ThreadGroup::~ThreadGroup):
1593         (WTF::ThreadGroup::add):
1594         (WTF::ThreadGroup::addCurrentThread):
1595         (WTF::ThreadGroup::removeCurrentThread):
1596         * wtf/ThreadGroup.h: Copied from Source/JavaScriptCore/wasm/WasmMachineThreads.cpp.
1597         (WTF::ThreadGroup::create):
1598         (WTF::ThreadGroup::threads):
1599         (WTF::ThreadGroup::getLock):
1600         * wtf/Threading.cpp:
1601         (WTF::Thread::didExit):
1602         (WTF::Thread::addToThreadGroup):
1603         (WTF::Thread::removeFromThreadGroup):
1604         * wtf/Threading.h:
1605         (WTF::Thread::canAddToThreadGroup):
1606
1607 2017-07-06  Yusuke Suzuki  <utatane.tea@gmail.com>
1608
1609         [WTF] Clean up StringStatics.cpp by using LazyNeverDestroyed<> for Atoms
1610         https://bugs.webkit.org/show_bug.cgi?id=174150
1611
1612         Reviewed by Mark Lam.
1613
1614         This patch cleans up StringStatics.cpp and remove it from the tree.
1615
1616         1. Move StringImpl methods to appropriate place, "StringImpl.cpp".
1617
1618         StringImpl::hashSlowCase() and StringImpl::concurrentHash() are defined in
1619         StringStatics.cpp. But they should be defined in StringImpl.cpp.
1620         This patch just moves them to StringImpl.cpp.
1621
1622         2. Use LazyNeverDestroyed to initialize AtomicString atoms like emptyAtom.
1623
1624         Previously, we initialized AtomicString atoms like emptyAtom in a hacky way.
1625         We first define them as extern global variables. However, AtomicString has
1626         a non-trivial constructor. Thus, we cannot do this because it requires global
1627         constructor calls. This is why we have StringStatics.cpp. In this file, we
1628         include "StaticConstructors.h". After including this file, all the global
1629         constructor call disabled in Windows. And in GCC environment, we allocate
1630         void* storage for that variable. And we use placement new in AtomicString::init()
1631         to initialize these storage.
1632         However, we already have better way for that: LazyNeverDestroyed. It just allocates
1633         storage like the above. And it does not have any global constructors. Thus
1634         we can just declare it as a global variable. And we initialize them lazily in
1635         AtomicString::init(). This way effectively avoids "StaticConstructors.h" hacky way.
1636         And it makes "StringStatics.cpp" unnecessary.
1637         Then, we just move these variables and AtomicString::init() to AtomicString.cpp.
1638
1639         And we also change emptyAtom to emptyAtom() to get the value from LazyNeverDestroyed<>.
1640
1641         * WTF.xcodeproj/project.pbxproj:
1642         * wtf/CMakeLists.txt:
1643         * wtf/text/AtomicString.cpp:
1644         (WTF::AtomicString::convertASCIICase):
1645         (WTF::AtomicString::fromUTF8Internal):
1646         (WTF::AtomicString::init):
1647         * wtf/text/AtomicString.h:
1648         (WTF::nullAtom):
1649         (WTF::emptyAtom):
1650         (WTF::starAtom):
1651         (WTF::xmlAtom):
1652         (WTF::xmlnsAtom):
1653         (WTF::AtomicString::fromUTF8):
1654         * wtf/text/StringBuilder.h:
1655         (WTF::StringBuilder::toAtomicString):
1656         * wtf/text/StringImpl.cpp:
1657         (WTF::StringImpl::hashSlowCase):
1658         (WTF::StringImpl::concurrentHash):
1659         * wtf/text/StringStatics.cpp: Removed.
1660
1661 2017-07-06  Keith Miller  <keith_miller@apple.com>
1662
1663         Add extra insurance to prevent clang from making crash traces sad
1664         https://bugs.webkit.org/show_bug.cgi?id=174231
1665
1666         Reviewed by Saam Barati.
1667
1668         This patch makes it slightly harder for Clang to coalesce our crash calls.
1669         Additionally, it also makes Clang never tail call the WTFCrashWithInfo so
1670         our stack trace should always be "reasonable".
1671
1672         * wtf/Assertions.h:
1673         * wtf/Compiler.h:
1674
1675 2017-07-06  Matt Lewis  <jlewis3@apple.com>
1676
1677         Unreviewed, rolling out r219178.
1678
1679         This caused a consistent failure with the API test
1680         StringBuilderTest.ToAtomicStringOnEmpty on all Debug testers.
1681
1682         Reverted changeset:
1683
1684         "[WTF] Clean up StringStatics.cpp by using
1685         LazyNeverDestroyed<> for Atoms"
1686         https://bugs.webkit.org/show_bug.cgi?id=174150
1687         http://trac.webkit.org/changeset/219178
1688
1689 2017-07-05  Don Olmstead  <don.olmstead@sony.com>
1690
1691         [WTF] Move SoftLinking.h into WTF
1692         https://bugs.webkit.org/show_bug.cgi?id=174000
1693
1694         Reviewed by Alex Christensen.
1695
1696         * WTF.xcodeproj/project.pbxproj:
1697         * wtf/SoftLinking.h: Copied from Source/WebCore/platform/ios/QuickLookSoftLink.mm.
1698         * wtf/cocoa/SoftLinking.h: Renamed from Source/WebCore/platform/cocoa/SoftLinking.h.
1699         * wtf/win/SoftLinking.h: Renamed from Source/WebCore/platform/win/SoftLinking.h.
1700
1701 2017-07-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1702
1703         Upgrade GCC baseline
1704         https://bugs.webkit.org/show_bug.cgi?id=174155
1705
1706         Reviewed by Michael Catanzaro.
1707
1708         * wtf/Compiler.h:
1709
1710 2017-07-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1711
1712         WTF::StringImpl::copyChars segfaults when built with GCC 7
1713         https://bugs.webkit.org/show_bug.cgi?id=173407
1714
1715         Reviewed by Andreas Kling.
1716
1717         With GCC 7, StringImpl::copyChars() behaves as unexpected.
1718         This function violates strict aliasing rule.
1719
1720         This optimization is originally introduced to improve performance
1721         in SunSpider's string tests in 2008. When running it in my Linux
1722         box, it no longer causes any observable difference. So, we just
1723         remove this optimization.
1724
1725                                         baseline                  patched
1726
1727         string-base64                7.7544+-0.1761            7.6138+-0.2071          might be 1.0185x faster
1728         string-fasta                10.5429+-0.2746     ?     10.7500+-0.2669        ? might be 1.0196x slower
1729         string-tagcloud             14.8588+-0.2828           14.8039+-0.3039
1730         string-unpack-code          36.1769+-0.4251           35.3397+-0.5398          might be 1.0237x faster
1731         string-validate-input        8.5182+-0.2206            8.3514+-0.2179          might be 1.0200x faster
1732
1733         * wtf/text/StringImpl.h:
1734         (WTF::StringImpl::copyChars):
1735
1736 2017-07-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1737
1738         Use std::lock_guard instead of std::unique_lock if move semantics and try_lock is not necessary
1739         https://bugs.webkit.org/show_bug.cgi?id=174148
1740
1741         Reviewed by Mark Lam.
1742
1743         It is not necessary to use std::unique_lock if we do not use additional features compared to std::lock_guard.
1744
1745         (WTF::ThreadHolder::get):
1746         (WTF::ThreadHolder::initialize):
1747         (WTF::ThreadHolder::destruct):
1748         * wtf/Threading.cpp:
1749         (WTF::Thread::didExit):
1750         * wtf/ThreadingPthreads.cpp:
1751         (WTF::Thread::changePriority):
1752         (WTF::Thread::waitForCompletion):
1753         (WTF::Thread::detach):
1754         (WTF::Thread::signal):
1755         (WTF::Thread::resume):
1756         (WTF::Thread::getRegisters):
1757         (WTF::Thread::establish):
1758         * wtf/ThreadingWin.cpp:
1759         (WTF::Thread::changePriority):
1760         (WTF::Thread::waitForCompletion):
1761         (WTF::Thread::detach):
1762         (WTF::Thread::resume):
1763         (WTF::Thread::getRegisters):
1764         (WTF::Thread::establish):
1765         * wtf/WordLock.cpp:
1766         (WTF::WordLockBase::unlockSlow):
1767
1768 2017-07-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1769
1770         [WTF] Clean up StringStatics.cpp by using LazyNeverDestroyed<> for Atoms
1771         https://bugs.webkit.org/show_bug.cgi?id=174150
1772
1773         Reviewed by Mark Lam.
1774
1775         This patch cleans up StringStatics.cpp and remove it from the tree.
1776
1777         1. Move StringImpl methods to appropriate place, "StringImpl.cpp".
1778
1779         StringImpl::hashSlowCase() and StringImpl::concurrentHash() are defined in
1780         StringStatics.cpp. But they should be defined in StringImpl.cpp.
1781         This patch just moves them to StringImpl.cpp.
1782
1783         2. Use LazyNeverDestroyed to initialize AtomicString atoms like emptyAtom.
1784
1785         Previously, we initialized AtomicString atoms like emptyAtom in a hacky way.
1786         We first define them as extern global variables. However, AtomicString has
1787         a non-trivial constructor. Thus, we cannot do this because it requires global
1788         constructor calls. This is why we have StringStatics.cpp. In this file, we
1789         include "StaticConstructors.h". After including this file, all the global
1790         constructor call disabled in Windows. And in GCC environment, we allocate
1791         void* storage for that variable. And we use placement new in AtomicString::init()
1792         to initialize these storage.
1793         However, we already have better way for that: LazyNeverDestroyed. It just allocates
1794         storage like the above. And it does not have any global constructors. Thus
1795         we can just declare it as a global variable. And we initialize them lazily in
1796         AtomicString::init(). This way effectively avoids "StaticConstructors.h" hacky way.
1797         And it makes "StringStatics.cpp" unnecessary.
1798         Then, we just move these variables and AtomicString::init() to AtomicString.cpp.
1799
1800         And we also change emptyAtom to emptyAtom() to get the value from LazyNeverDestroyed<>.
1801
1802         * WTF.xcodeproj/project.pbxproj:
1803         * wtf/CMakeLists.txt:
1804         * wtf/text/AtomicString.cpp:
1805         (WTF::AtomicString::convertASCIICase):
1806         (WTF::AtomicString::fromUTF8Internal):
1807         (WTF::AtomicString::init):
1808         * wtf/text/AtomicString.h:
1809         (WTF::nullAtom):
1810         (WTF::emptyAtom):
1811         (WTF::starAtom):
1812         (WTF::xmlAtom):
1813         (WTF::xmlnsAtom):
1814         (WTF::AtomicString::fromUTF8):
1815         * wtf/text/StringBuilder.h:
1816         (WTF::StringBuilder::toAtomicString):
1817         * wtf/text/StringImpl.cpp:
1818         (WTF::StringImpl::hashSlowCase):
1819         (WTF::StringImpl::concurrentHash):
1820         * wtf/text/StringStatics.cpp: Removed.
1821
1822 2017-07-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1823
1824         WTF::Thread should have the threads stack bounds.
1825         https://bugs.webkit.org/show_bug.cgi?id=173975
1826
1827         Reviewed by Keith Miller.
1828
1829         We move StackBounds from WTFThreadData to WTF::Thread.
1830         One important thing is that we should make valid StackBounds
1831         visible to Thread::create() caller. When the caller get
1832         WTF::Thread from Thread::create(), this WTF::Thread should
1833         have a valid StackBounds. But StackBounds information can be
1834         retrived only in the WTF::Thread's thread itself.
1835
1836         We also clean up WTF::initializeThreading. StringImpl::empty()
1837         is now statically initialized by using constexpr constructor.
1838         Thus we do not need to call StringImpl::empty() explicitly here.
1839         And WTF::initializeThreading() does not have any main thread
1840         affinity right now in all the platforms. So we fix the comment
1841         in Threading.h. Then, now, WTF::initializeThreading() is called
1842         in UI thread when using Web thread in iOS.
1843
1844         * wtf/StackBounds.h:
1845         (WTF::StackBounds::emptyBounds):
1846         (WTF::StackBounds::StackBounds):
1847         * wtf/StackStats.cpp:
1848         (WTF::StackStats::PerThreadStats::PerThreadStats):
1849         * wtf/Threading.cpp:
1850         (WTF::threadEntryPoint):
1851         (WTF::Thread::create):
1852         (WTF::Thread::currentMayBeNull):
1853         (WTF::Thread::initialize):
1854         (WTF::initializeThreading):
1855         * wtf/Threading.h:
1856         (WTF::Thread::stack):
1857         * wtf/ThreadingPthreads.cpp:
1858         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
1859         (WTF::Thread::current):
1860         (WTF::initializeCurrentThreadEvenIfNonWTFCreated): Deleted.
1861         (WTF::Thread::currentMayBeNull): Deleted.
1862         * wtf/ThreadingWin.cpp:
1863         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
1864         (WTF::Thread::initializeCurrentThreadInternal):
1865         (WTF::Thread::current):
1866         * wtf/WTFThreadData.cpp:
1867         (WTF::WTFThreadData::WTFThreadData):
1868         * wtf/WTFThreadData.h:
1869         (WTF::WTFThreadData::stack): Deleted.
1870
1871 2017-07-05  Keith Miller  <keith_miller@apple.com>
1872
1873         Crashing with information should have an abort reason
1874         https://bugs.webkit.org/show_bug.cgi?id=174185
1875
1876         Reviewed by Saam Barati.
1877
1878         Fix an ifdef to actually work with X86_64. It turns out X64_64 is
1879         not an architecture... Whoops.
1880
1881         * wtf/Assertions.cpp:
1882
1883 2017-07-03  Myles C. Maxfield  <mmaxfield@apple.com>
1884
1885         Remove copy of ICU headers from WebKit
1886         https://bugs.webkit.org/show_bug.cgi?id=116407
1887
1888         Reviewed by Alex Christensen.
1889
1890         Add an extra rsync command to CopyWTFHeaders which copies the ICU headers
1891         to DSTROOT/usr/local/include/. These headers already live inside a
1892         "unicode" folder, so an example path of a header is
1893         DSTROOT/usr/local/include/unicode/uchar.h. This is already in the search
1894         path of the other WebKit projects, so those other projects can remove
1895         their explicit listing of the old place these headers lived.
1896
1897         Also add the remaining ICU 55.1 headers which the other projects (like
1898         WebCore) need. Revert any local changes to these headers in favor of
1899         using the GCC_PREPROCESSOR_DEFINITIONS build setting. This is so we can
1900         compile the same way against unmodified headers.
1901
1902         * Configurations/Base.xcconfig:
1903         * Configurations/CopyWTFHeaders.xcconfig:
1904         * WTF.xcodeproj/project.pbxproj:
1905         * icu/unicode/alphaindex.h: Added.
1906         * icu/unicode/appendable.h: Added.
1907         * icu/unicode/basictz.h: Added.
1908         * icu/unicode/brkiter.h: Added.
1909         (BreakIterator::isBufferClone):
1910         * icu/unicode/bytestrie.h: Added.
1911         * icu/unicode/bytestriebuilder.h: Added.
1912         * icu/unicode/calendar.h: Added.
1913         (Calendar::createInstance):
1914         (Calendar::roll):
1915         (Calendar::internalSet):
1916         (Calendar::weekNumber):
1917         * icu/unicode/caniter.h: Added.
1918         * icu/unicode/chariter.h: Renamed from Source/WebCore/icu/unicode/chariter.h.
1919         * icu/unicode/choicfmt.h: Added.
1920         * icu/unicode/coleitr.h: Added.
1921         (CollationElementIterator::primaryOrder):
1922         (CollationElementIterator::secondaryOrder):
1923         (CollationElementIterator::tertiaryOrder):
1924         (CollationElementIterator::isIgnorable):
1925         * icu/unicode/coll.h: Added.
1926         * icu/unicode/compactdecimalformat.h: Added.
1927         * icu/unicode/curramt.h: Added.
1928         (CurrencyAmount::getCurrency):
1929         (CurrencyAmount::getISOCurrency):
1930         * icu/unicode/currpinf.h: Added.
1931         (CurrencyPluralInfo::operator!=):
1932         * icu/unicode/currunit.h: Added.
1933         (CurrencyUnit::getISOCurrency):
1934         * icu/unicode/datefmt.h: Added.
1935         * icu/unicode/dbbi.h: Added.
1936         * icu/unicode/dcfmtsym.h: Added.
1937         (DecimalFormatSymbols::getSymbol):
1938         (DecimalFormatSymbols::getConstSymbol):
1939         (DecimalFormatSymbols::setSymbol):
1940         (DecimalFormatSymbols::getLocale):
1941         (DecimalFormatSymbols::getCurrencyPattern):
1942         * icu/unicode/decimfmt.h: Added.
1943         (DecimalFormat::getConstSymbol):
1944         * icu/unicode/docmain.h: Added.
1945         * icu/unicode/dtfmtsym.h: Added.
1946         * icu/unicode/dtintrv.h: Added.
1947         (DateInterval::getFromDate):
1948         (DateInterval::getToDate):
1949         (DateInterval::operator!=):
1950         * icu/unicode/dtitvfmt.h: Added.
1951         (DateIntervalFormat::operator!=):
1952         * icu/unicode/dtitvinf.h: Added.
1953         (DateIntervalInfo::operator!=):
1954         * icu/unicode/dtptngen.h: Added.
1955         * icu/unicode/dtrule.h: Added.
1956         * icu/unicode/enumset.h: Added.
1957         (EnumSet::EnumSet):
1958         (EnumSet::~EnumSet):
1959         (EnumSet::clear):
1960         (EnumSet::add):
1961         (EnumSet::remove):
1962         (EnumSet::contains):
1963         (EnumSet::set):
1964         (EnumSet::get):
1965         (EnumSet::isValidEnum):
1966         (EnumSet::isValidValue):
1967         (EnumSet::operator=):
1968         (EnumSet::getAll):
1969         (EnumSet::flag):
1970         * icu/unicode/errorcode.h: Added.
1971         * icu/unicode/fieldpos.h: Added.
1972         (FieldPosition::operator=):
1973         (FieldPosition::operator==):
1974         (FieldPosition::operator!=):
1975         * icu/unicode/filteredbrk.h: Added.
1976         * icu/unicode/fmtable.h: Added.
1977         (Formattable::getDate):
1978         (Formattable::getString):
1979         (Formattable::getLong):
1980         (Formattable::toUFormattable):
1981         (Formattable::fromUFormattable):
1982         * icu/unicode/format.h: Added.
1983         * icu/unicode/fpositer.h: Added.
1984         * icu/unicode/gender.h: Added.
1985         * icu/unicode/gregocal.h: Added.
1986         * icu/unicode/icudataver.h: Added.
1987         * icu/unicode/icuplug.h: Added.
1988         * icu/unicode/idna.h: Added.
1989         * icu/unicode/listformatter.h: Added.
1990         (ListFormatData::ListFormatData):
1991         * icu/unicode/locdspnm.h: Added.
1992         (LocaleDisplayNames::createInstance):
1993         * icu/unicode/locid.h: Added.
1994         (Locale::operator!=):
1995         (Locale::getCountry):
1996         (Locale::getLanguage):
1997         (Locale::getScript):
1998         (Locale::getVariant):
1999         (Locale::getName):
2000         (Locale::isBogus):
2001         * icu/unicode/measfmt.h: Added.
2002         * icu/unicode/measunit.h: Added.
2003         * icu/unicode/measure.h: Added.
2004         (Measure::getNumber):
2005         (Measure::getUnit):
2006         * icu/unicode/messagepattern.h: Added.
2007         * icu/unicode/msgfmt.h: Added.
2008         * icu/unicode/normalizer2.h: Added.
2009         * icu/unicode/normlzr.h: Added.
2010         (Normalizer::operator!= ):
2011         (Normalizer::quickCheck):
2012         (Normalizer::isNormalized):
2013         (Normalizer::compare):
2014         * icu/unicode/numfmt.h: Added.
2015         (NumberFormat::isParseIntegerOnly):
2016         (NumberFormat::isLenient):
2017         * icu/unicode/numsys.h: Added.
2018         * icu/unicode/parsepos.h: Added.
2019         (ParsePosition::operator=):
2020         (ParsePosition::operator==):
2021         (ParsePosition::operator!=):
2022         (ParsePosition::getIndex):
2023         (ParsePosition::setIndex):
2024         (ParsePosition::getErrorIndex):
2025         (ParsePosition::setErrorIndex):
2026         * icu/unicode/plurfmt.h: Added.
2027         * icu/unicode/plurrule.h: Added.
2028         * icu/unicode/rbbi.h: Added.
2029         (RuleBasedBreakIterator::operator!=):
2030         * icu/unicode/rbnf.h: Added.
2031         (RuleBasedNumberFormat::isLenient):
2032         (RuleBasedNumberFormat::getDefaultRuleSet):
2033         * icu/unicode/rbtz.h: Added.
2034         * icu/unicode/regex.h: Added.
2035         * icu/unicode/region.h: Added.
2036         * icu/unicode/reldatefmt.h: Added.
2037         * icu/unicode/resbund.h: Added.
2038         * icu/unicode/schriter.h: Added.
2039         * icu/unicode/scientificnumberformatter.h: Added.
2040         * icu/unicode/search.h: Added.
2041         (SearchIterator::operator!=):
2042         * icu/unicode/selfmt.h: Added.
2043         * icu/unicode/simpletz.h: Added.
2044         (SimpleTimeZone::setStartRule):
2045         (SimpleTimeZone::setEndRule):
2046         (SimpleTimeZone::getOffset):
2047         * icu/unicode/smpdtfmt.h: Added.
2048         (SimpleDateFormat::get2DigitYearStart):
2049         * icu/unicode/sortkey.h: Added.
2050         (CollationKey::operator!=):
2051         (CollationKey::isBogus):
2052         (CollationKey::getByteArray):
2053         * icu/unicode/stringtriebuilder.h: Added.
2054         * icu/unicode/stsearch.h: Added.
2055         * icu/unicode/symtable.h: Added.
2056         * icu/unicode/tblcoll.h: Added.
2057         * icu/unicode/timezone.h: Added.
2058         (TimeZone::getID):
2059         (TimeZone::setID):
2060         * icu/unicode/tmunit.h: Added.
2061         * icu/unicode/tmutamt.h: Added.
2062         (TimeUnitAmount::operator!=):
2063         * icu/unicode/tmutfmt.h: Added.
2064         (TimeUnitFormat::operator!=):
2065         * icu/unicode/translit.h: Added.
2066         (Transliterator::getMaximumContextLength):
2067         (Transliterator::setID):
2068         (Transliterator::integerToken):
2069         (Transliterator::pointerToken):
2070         * icu/unicode/tzfmt.h: Added.
2071         * icu/unicode/tznames.h: Added.
2072         * icu/unicode/tzrule.h: Added.
2073         * icu/unicode/tztrans.h: Added.
2074         * icu/unicode/ubidi.h: Added.
2075         * icu/unicode/ucal.h: Renamed from Source/JavaScriptCore/icu/unicode/ucal.h.
2076         * icu/unicode/ucasemap.h: Added.
2077         * icu/unicode/ucat.h: Added.
2078         * icu/unicode/ucharstrie.h: Added.
2079         * icu/unicode/ucharstriebuilder.h: Added.
2080         * icu/unicode/uchriter.h: Added.
2081         * icu/unicode/uclean.h: Added.
2082         * icu/unicode/ucnv_cb.h: Renamed from Source/WebCore/icu/unicode/ucnv_cb.h.
2083         * icu/unicode/ucnvsel.h: Added.
2084         * icu/unicode/ucoleitr.h: Renamed from Source/WebCore/icu/unicode/ucoleitr.h.
2085         * icu/unicode/uconfig.h:
2086         * icu/unicode/ucsdet.h: Renamed from Source/WebCore/icu/unicode/ucsdet.h.
2087         * icu/unicode/udat.h: Renamed from Source/JavaScriptCore/icu/unicode/udat.h.
2088         * icu/unicode/udata.h: Added.
2089         * icu/unicode/udateintervalformat.h: Added.
2090         * icu/unicode/udatpg.h: Renamed from Source/JavaScriptCore/icu/unicode/udatpg.h.
2091         * icu/unicode/udisplaycontext.h: Renamed from Source/JavaScriptCore/icu/unicode/udisplaycontext.h.
2092         * icu/unicode/ufieldpositer.h: Renamed from Source/JavaScriptCore/icu/unicode/ufieldpositer.h.
2093         * icu/unicode/uformattable.h: Renamed from Source/JavaScriptCore/icu/unicode/uformattable.h.
2094         * icu/unicode/ugender.h: Added.
2095         * icu/unicode/uidna.h: Renamed from Source/WebCore/icu/unicode/uidna.h.
2096         * icu/unicode/uldnames.h: Added.
2097         * icu/unicode/ulistformatter.h: Added.
2098         * icu/unicode/ulocdata.h: Added.
2099         * icu/unicode/umisc.h: Renamed from Source/JavaScriptCore/icu/unicode/umisc.h.
2100         * icu/unicode/umsg.h: Added.
2101         * icu/unicode/unifilt.h: Added.
2102         * icu/unicode/unifunct.h: Added.
2103         * icu/unicode/unimatch.h: Added.
2104         * icu/unicode/unirepl.h: Added.
2105         * icu/unicode/uniset.h: Added.
2106         (UnicodeSet::operator!=):
2107         (UnicodeSet::isFrozen):
2108         (UnicodeSet::containsSome):
2109         (UnicodeSet::isBogus):
2110         (UnicodeSet::fromUSet):
2111         (UnicodeSet::toUSet):
2112         (UnicodeSet::span):
2113         (UnicodeSet::spanBack):
2114         * icu/unicode/unum.h: Renamed from Source/JavaScriptCore/icu/unicode/unum.h.
2115         * icu/unicode/unumsys.h: Renamed from Source/JavaScriptCore/icu/unicode/unumsys.h.
2116         * icu/unicode/upluralrules.h: Added.
2117         * icu/unicode/uregex.h: Added.
2118         * icu/unicode/uregion.h: Added.
2119         * icu/unicode/urep.h: Added.
2120         * icu/unicode/ures.h: Added.
2121         (ures_getUnicodeString):
2122         (ures_getNextUnicodeString):
2123         (ures_getUnicodeStringByIndex):
2124         (ures_getUnicodeStringByKey):
2125         * icu/unicode/usearch.h: Renamed from Source/WebCore/icu/unicode/usearch.h.
2126         * icu/unicode/usetiter.h: Added.
2127         (UnicodeSetIterator::isString):
2128         (UnicodeSetIterator::getCodepoint):
2129         (UnicodeSetIterator::getCodepointEnd):
2130         * icu/unicode/ushape.h: Renamed from Source/WebCore/icu/unicode/ushape.h.
2131         * icu/unicode/uspoof.h: Added.
2132         * icu/unicode/usprep.h: Added.
2133         * icu/unicode/ustdio.h: Added.
2134         * icu/unicode/ustream.h: Added.
2135         * icu/unicode/ustringtrie.h: Added.
2136         * icu/unicode/utf32.h: Added.
2137         * icu/unicode/utmscale.h: Added.
2138         * icu/unicode/utrace.h: Added.
2139         * icu/unicode/utrans.h: Added.
2140         * icu/unicode/utypes.h:
2141         * icu/unicode/vtzone.h: Added.
2142
2143 2017-07-04  Yusuke Suzuki  <utatane.tea@gmail.com>
2144
2145         [WTF] Make double-conversion's cache data constant and drop double_conversion::initialize()
2146         https://bugs.webkit.org/show_bug.cgi?id=174124
2147
2148         Reviewed by Saam Barati.
2149
2150         We annotate double-conversion's cache data as const and constexpr. And move it out of function.
2151         Since they are not involving global constructors, they are compiled as rodata and initialized
2152         without calling double_conversion::initialize().
2153
2154         And we drop double_conversion::initialize() function since it is no longer necessary.
2155
2156         * wtf/Threading.cpp:
2157         (WTF::initializeThreading):
2158         * wtf/dtoa/cached-powers.cc:
2159         * wtf/dtoa/cached-powers.h:
2160
2161 2017-07-04  Yusuke Suzuki  <utatane.tea@gmail.com>
2162
2163         [WTF] Initialize srandom and srand with cryptographically random number
2164         https://bugs.webkit.org/show_bug.cgi?id=174123
2165
2166         Reviewed by Mark Lam.
2167
2168         Use cryptographically random number instead of current time as a seed.
2169
2170         * wtf/RandomNumberSeed.h:
2171         (WTF::initializeRandomNumberGenerator):
2172
2173 2017-07-04  Joseph Pecoraro  <pecoraro@apple.com>
2174
2175         Xcode duplicate UUID for DisallowCType.h and DispatchPtr.h
2176         https://bugs.webkit.org/show_bug.cgi?id=174117
2177
2178         Reviewed by Alexey Proskuryakov.
2179
2180         * WTF.xcodeproj/project.pbxproj:
2181         Give DisallowCType.h and DispatchPtr.h different UUIDs.
2182
2183 2017-07-03  Saam Barati  <sbarati@apple.com>
2184
2185         LayoutTest workers/bomb.html is a Crash
2186         https://bugs.webkit.org/show_bug.cgi?id=167757
2187         <rdar://problem/33086462>
2188
2189         Reviewed by Keith Miller.
2190
2191         * wtf/AutomaticThread.cpp:
2192         (WTF::AutomaticThreadCondition::waitFor):
2193         * wtf/AutomaticThread.h:
2194
2195 2017-07-03  Commit Queue  <commit-queue@webkit.org>
2196
2197         Unreviewed, rolling out r219060.
2198         https://bugs.webkit.org/show_bug.cgi?id=174108
2199
2200         crashing constantly when initializing UIWebView (Requested by
2201         thorton on #webkit).
2202
2203         Reverted changeset:
2204
2205         "WTF::Thread should have the threads stack bounds."
2206         https://bugs.webkit.org/show_bug.cgi?id=173975
2207         http://trac.webkit.org/changeset/219060
2208
2209 2017-07-03  Matt Lewis  <jlewis3@apple.com>
2210
2211         Unreviewed, rolling out r219103.
2212
2213         Caused multiple build failures.
2214
2215         Reverted changeset:
2216
2217         "Remove copy of ICU headers from WebKit"
2218         https://bugs.webkit.org/show_bug.cgi?id=116407
2219         http://trac.webkit.org/changeset/219103
2220
2221 2017-07-03  Myles C. Maxfield  <mmaxfield@apple.com>
2222
2223         Remove copy of ICU headers from WebKit
2224         https://bugs.webkit.org/show_bug.cgi?id=116407
2225
2226         Reviewed by Alex Christensen.
2227
2228         Add an extra rsync command to CopyWTFHeaders which copies the ICU headers
2229         to DSTROOT/usr/local/include/. These headers already live inside a
2230         "unicode" folder, so an example path of a header is
2231         DSTROOT/usr/local/include/unicode/uchar.h. This is already in the search
2232         path of the other WebKit projects, so those other projects can remove
2233         their explicit listing of the old place these headers lived.
2234
2235         Also add the remaining ICU 55.1 headers which the other projects (like
2236         WebCore) need. Revert any local changes to these headers in favor of
2237         using the GCC_PREPROCESSOR_DEFINITIONS build setting. This is so we can
2238         compile the same way against unmodified headers.
2239
2240         * Configurations/Base.xcconfig:
2241         * Configurations/CopyWTFHeaders.xcconfig:
2242         * WTF.xcodeproj/project.pbxproj:
2243         * icu/unicode/alphaindex.h: Added.
2244         * icu/unicode/appendable.h: Added.
2245         * icu/unicode/basictz.h: Added.
2246         * icu/unicode/brkiter.h: Added.
2247         (BreakIterator::isBufferClone):
2248         * icu/unicode/bytestrie.h: Added.
2249         * icu/unicode/bytestriebuilder.h: Added.
2250         * icu/unicode/calendar.h: Added.
2251         (Calendar::createInstance):
2252         (Calendar::roll):
2253         (Calendar::internalSet):
2254         (Calendar::weekNumber):
2255         * icu/unicode/caniter.h: Added.
2256         * icu/unicode/chariter.h: Renamed from Source/WebCore/icu/unicode/chariter.h.
2257         * icu/unicode/choicfmt.h: Added.
2258         * icu/unicode/coleitr.h: Added.
2259         (CollationElementIterator::primaryOrder):
2260         (CollationElementIterator::secondaryOrder):
2261         (CollationElementIterator::tertiaryOrder):
2262         (CollationElementIterator::isIgnorable):
2263         * icu/unicode/coll.h: Added.
2264         * icu/unicode/compactdecimalformat.h: Added.
2265         * icu/unicode/curramt.h: Added.
2266         (CurrencyAmount::getCurrency):
2267         (CurrencyAmount::getISOCurrency):
2268         * icu/unicode/currpinf.h: Added.
2269         (CurrencyPluralInfo::operator!=):
2270         * icu/unicode/currunit.h: Added.
2271         (CurrencyUnit::getISOCurrency):
2272         * icu/unicode/datefmt.h: Added.
2273         * icu/unicode/dbbi.h: Added.
2274         * icu/unicode/dcfmtsym.h: Added.
2275         (DecimalFormatSymbols::getSymbol):
2276         (DecimalFormatSymbols::getConstSymbol):
2277         (DecimalFormatSymbols::setSymbol):
2278         (DecimalFormatSymbols::getLocale):
2279         (DecimalFormatSymbols::getCurrencyPattern):
2280         * icu/unicode/decimfmt.h: Added.
2281         (DecimalFormat::getConstSymbol):
2282         * icu/unicode/docmain.h: Added.
2283         * icu/unicode/dtfmtsym.h: Added.
2284         * icu/unicode/dtintrv.h: Added.
2285         (DateInterval::getFromDate):
2286         (DateInterval::getToDate):
2287         (DateInterval::operator!=):
2288         * icu/unicode/dtitvfmt.h: Added.
2289         (DateIntervalFormat::operator!=):
2290         * icu/unicode/dtitvinf.h: Added.
2291         (DateIntervalInfo::operator!=):
2292         * icu/unicode/dtptngen.h: Added.
2293         * icu/unicode/dtrule.h: Added.
2294         * icu/unicode/enumset.h: Added.
2295         (EnumSet::EnumSet):
2296         (EnumSet::~EnumSet):
2297         (EnumSet::clear):
2298         (EnumSet::add):
2299         (EnumSet::remove):
2300         (EnumSet::contains):
2301         (EnumSet::set):
2302         (EnumSet::get):
2303         (EnumSet::isValidEnum):
2304         (EnumSet::isValidValue):
2305         (EnumSet::operator=):
2306         (EnumSet::getAll):
2307         (EnumSet::flag):
2308         * icu/unicode/errorcode.h: Added.
2309         * icu/unicode/fieldpos.h: Added.
2310         (FieldPosition::operator=):
2311         (FieldPosition::operator==):
2312         (FieldPosition::operator!=):
2313         * icu/unicode/filteredbrk.h: Added.
2314         * icu/unicode/fmtable.h: Added.
2315         (Formattable::getDate):
2316         (Formattable::getString):
2317         (Formattable::getLong):
2318         (Formattable::toUFormattable):
2319         (Formattable::fromUFormattable):
2320         * icu/unicode/format.h: Added.
2321         * icu/unicode/fpositer.h: Added.
2322         * icu/unicode/gender.h: Added.
2323         * icu/unicode/gregocal.h: Added.
2324         * icu/unicode/icudataver.h: Added.
2325         * icu/unicode/icuplug.h: Added.
2326         * icu/unicode/idna.h: Added.
2327         * icu/unicode/listformatter.h: Added.
2328         (ListFormatData::ListFormatData):
2329         * icu/unicode/locdspnm.h: Added.
2330         (LocaleDisplayNames::createInstance):
2331         * icu/unicode/locid.h: Added.
2332         (Locale::operator!=):
2333         (Locale::getCountry):
2334         (Locale::getLanguage):
2335         (Locale::getScript):
2336         (Locale::getVariant):
2337         (Locale::getName):
2338         (Locale::isBogus):
2339         * icu/unicode/measfmt.h: Added.
2340         * icu/unicode/measunit.h: Added.
2341         * icu/unicode/measure.h: Added.
2342         (Measure::getNumber):
2343         (Measure::getUnit):
2344         * icu/unicode/messagepattern.h: Added.
2345         * icu/unicode/msgfmt.h: Added.
2346         * icu/unicode/normalizer2.h: Added.
2347         * icu/unicode/normlzr.h: Added.
2348         (Normalizer::operator!= ):
2349         (Normalizer::quickCheck):
2350         (Normalizer::isNormalized):
2351         (Normalizer::compare):
2352         * icu/unicode/numfmt.h: Added.
2353         (NumberFormat::isParseIntegerOnly):
2354         (NumberFormat::isLenient):
2355         * icu/unicode/numsys.h: Added.
2356         * icu/unicode/parsepos.h: Added.
2357         (ParsePosition::operator=):
2358         (ParsePosition::operator==):
2359         (ParsePosition::operator!=):
2360         (ParsePosition::getIndex):
2361         (ParsePosition::setIndex):
2362         (ParsePosition::getErrorIndex):
2363         (ParsePosition::setErrorIndex):
2364         * icu/unicode/plurfmt.h: Added.
2365         * icu/unicode/plurrule.h: Added.
2366         * icu/unicode/rbbi.h: Added.
2367         (RuleBasedBreakIterator::operator!=):
2368         * icu/unicode/rbnf.h: Added.
2369         (RuleBasedNumberFormat::isLenient):
2370         (RuleBasedNumberFormat::getDefaultRuleSet):
2371         * icu/unicode/rbtz.h: Added.
2372         * icu/unicode/regex.h: Added.
2373         * icu/unicode/region.h: Added.
2374         * icu/unicode/reldatefmt.h: Added.
2375         * icu/unicode/resbund.h: Added.
2376         * icu/unicode/schriter.h: Added.
2377         * icu/unicode/scientificnumberformatter.h: Added.
2378         * icu/unicode/search.h: Added.
2379         (SearchIterator::operator!=):
2380         * icu/unicode/selfmt.h: Added.
2381         * icu/unicode/simpletz.h: Added.
2382         (SimpleTimeZone::setStartRule):
2383         (SimpleTimeZone::setEndRule):
2384         (SimpleTimeZone::getOffset):
2385         * icu/unicode/smpdtfmt.h: Added.
2386         (SimpleDateFormat::get2DigitYearStart):
2387         * icu/unicode/sortkey.h: Added.
2388         (CollationKey::operator!=):
2389         (CollationKey::isBogus):
2390         (CollationKey::getByteArray):
2391         * icu/unicode/stringtriebuilder.h: Added.
2392         * icu/unicode/stsearch.h: Added.
2393         * icu/unicode/symtable.h: Added.
2394         * icu/unicode/tblcoll.h: Added.
2395         * icu/unicode/timezone.h: Added.
2396         (TimeZone::getID):
2397         (TimeZone::setID):
2398         * icu/unicode/tmunit.h: Added.
2399         * icu/unicode/tmutamt.h: Added.
2400         (TimeUnitAmount::operator!=):
2401         * icu/unicode/tmutfmt.h: Added.
2402         (TimeUnitFormat::operator!=):
2403         * icu/unicode/translit.h: Added.
2404         (Transliterator::getMaximumContextLength):
2405         (Transliterator::setID):
2406         (Transliterator::integerToken):
2407         (Transliterator::pointerToken):
2408         * icu/unicode/tzfmt.h: Added.
2409         * icu/unicode/tznames.h: Added.
2410         * icu/unicode/tzrule.h: Added.
2411         * icu/unicode/tztrans.h: Added.
2412         * icu/unicode/ubidi.h: Added.
2413         * icu/unicode/ucal.h: Renamed from Source/JavaScriptCore/icu/unicode/ucal.h.
2414         * icu/unicode/ucasemap.h: Added.
2415         * icu/unicode/ucat.h: Added.
2416         * icu/unicode/ucharstrie.h: Added.
2417         * icu/unicode/ucharstriebuilder.h: Added.
2418         * icu/unicode/uchriter.h: Added.
2419         * icu/unicode/uclean.h: Added.
2420         * icu/unicode/ucnv_cb.h: Renamed from Source/WebCore/icu/unicode/ucnv_cb.h.
2421         * icu/unicode/ucnvsel.h: Added.
2422         * icu/unicode/ucoleitr.h: Renamed from Source/WebCore/icu/unicode/ucoleitr.h.
2423         * icu/unicode/uconfig.h:
2424         * icu/unicode/ucsdet.h: Renamed from Source/WebCore/icu/unicode/ucsdet.h.
2425         * icu/unicode/udat.h: Renamed from Source/JavaScriptCore/icu/unicode/udat.h.
2426         * icu/unicode/udata.h: Added.
2427         * icu/unicode/udateintervalformat.h: Added.
2428         * icu/unicode/udatpg.h: Renamed from Source/JavaScriptCore/icu/unicode/udatpg.h.
2429         * icu/unicode/udisplaycontext.h: Renamed from Source/JavaScriptCore/icu/unicode/udisplaycontext.h.
2430         * icu/unicode/ufieldpositer.h: Renamed from Source/JavaScriptCore/icu/unicode/ufieldpositer.h.
2431         * icu/unicode/uformattable.h: Renamed from Source/JavaScriptCore/icu/unicode/uformattable.h.
2432         * icu/unicode/ugender.h: Added.
2433         * icu/unicode/uidna.h: Renamed from Source/WebCore/icu/unicode/uidna.h.
2434         * icu/unicode/uldnames.h: Added.
2435         * icu/unicode/ulistformatter.h: Added.
2436         * icu/unicode/ulocdata.h: Added.
2437         * icu/unicode/umisc.h: Renamed from Source/JavaScriptCore/icu/unicode/umisc.h.
2438         * icu/unicode/umsg.h: Added.
2439         * icu/unicode/unifilt.h: Added.
2440         * icu/unicode/unifunct.h: Added.
2441         * icu/unicode/unimatch.h: Added.
2442         * icu/unicode/unirepl.h: Added.
2443         * icu/unicode/uniset.h: Added.
2444         (UnicodeSet::operator!=):
2445         (UnicodeSet::isFrozen):
2446         (UnicodeSet::containsSome):
2447         (UnicodeSet::isBogus):
2448         (UnicodeSet::fromUSet):
2449         (UnicodeSet::toUSet):
2450         (UnicodeSet::span):
2451         (UnicodeSet::spanBack):
2452         * icu/unicode/unum.h: Renamed from Source/JavaScriptCore/icu/unicode/unum.h.
2453         * icu/unicode/unumsys.h: Renamed from Source/JavaScriptCore/icu/unicode/unumsys.h.
2454         * icu/unicode/upluralrules.h: Added.
2455         * icu/unicode/uregex.h: Added.
2456         * icu/unicode/uregion.h: Added.
2457         * icu/unicode/urep.h: Added.
2458         * icu/unicode/ures.h: Added.
2459         (ures_getUnicodeString):
2460         (ures_getNextUnicodeString):
2461         (ures_getUnicodeStringByIndex):
2462         (ures_getUnicodeStringByKey):
2463         * icu/unicode/usearch.h: Renamed from Source/WebCore/icu/unicode/usearch.h.
2464         * icu/unicode/usetiter.h: Added.
2465         (UnicodeSetIterator::isString):
2466         (UnicodeSetIterator::getCodepoint):
2467         (UnicodeSetIterator::getCodepointEnd):
2468         * icu/unicode/ushape.h: Renamed from Source/WebCore/icu/unicode/ushape.h.
2469         * icu/unicode/usprep.h: Added.
2470         * icu/unicode/ustdio.h: Added.
2471         * icu/unicode/ustream.h: Added.
2472         * icu/unicode/ustringtrie.h: Added.
2473         * icu/unicode/utf32.h: Added.
2474         * icu/unicode/utmscale.h: Added.
2475         * icu/unicode/utrace.h: Added.
2476         * icu/unicode/utrans.h: Added.
2477         * icu/unicode/utypes.h:
2478         * icu/unicode/vtzone.h: Added.
2479
2480 2017-07-03  Keith Miller  <keith_miller@apple.com>
2481
2482         Fix ifndef in Assertions.h
2483         https://bugs.webkit.org/show_bug.cgi?id=174104
2484
2485         Reviewed by Saam Barati.
2486
2487         The ifndef should have been checking for
2488         CRASH_WITH_SECURITY_IMPLICATION_AND_INFO since that is what the
2489         ifndef defines.
2490
2491         * wtf/Assertions.h:
2492
2493 2017-07-03  Andy Estes  <aestes@apple.com>
2494
2495         [Xcode] Add an experimental setting to build with ccache
2496         https://bugs.webkit.org/show_bug.cgi?id=173875
2497
2498         Reviewed by Tim Horton.
2499
2500         * Configurations/DebugRelease.xcconfig: Included ccache.xcconfig.
2501
2502 2017-07-03  Daewoong Jang  <daewoong.jang@navercorp.com>
2503
2504         Remove an unused function export
2505         https://bugs.webkit.org/show_bug.cgi?id=174084
2506
2507         Reviewed by Yusuke Suzuki.
2508
2509         * wtf/Threading.h:
2510
2511 2017-07-02  Yusuke Suzuki  <utatane.tea@gmail.com>
2512
2513         WTF::Thread should have the threads stack bounds.
2514         https://bugs.webkit.org/show_bug.cgi?id=173975
2515
2516         Reviewed by Mark Lam.
2517
2518         We move StackBounds from WTFThreadData to WTF::Thread.
2519         One important thing is that we should make valid StackBounds
2520         visible to Thread::create() caller. When the caller get
2521         WTF::Thread from Thread::create(), this WTF::Thread should
2522         have a valid StackBounds. But StackBounds information can be
2523         retrived only in the WTF::Thread's thread itself.
2524
2525         * wtf/StackBounds.h:
2526         (WTF::StackBounds::emptyBounds):
2527         (WTF::StackBounds::StackBounds):
2528         * wtf/StackStats.cpp:
2529         (WTF::StackStats::PerThreadStats::PerThreadStats):
2530         * wtf/Threading.cpp:
2531         (WTF::threadEntryPoint):
2532         (WTF::Thread::create):
2533         (WTF::Thread::currentMayBeNull):
2534         (WTF::Thread::initialize):
2535         * wtf/Threading.h:
2536         (WTF::Thread::stack):
2537         * wtf/ThreadingPthreads.cpp:
2538         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
2539         (WTF::Thread::current):
2540         (WTF::initializeCurrentThreadEvenIfNonWTFCreated): Deleted.
2541         (WTF::Thread::currentMayBeNull): Deleted.
2542         * wtf/ThreadingWin.cpp:
2543         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
2544         (WTF::Thread::initializeCurrentThreadInternal):
2545         (WTF::Thread::current):
2546         * wtf/WTFThreadData.cpp:
2547         (WTF::WTFThreadData::WTFThreadData):
2548         * wtf/WTFThreadData.h:
2549         (WTF::WTFThreadData::stack): Deleted.
2550
2551 2017-07-01  Dan Bernstein  <mitz@apple.com>
2552
2553         [iOS] Remove code only needed when building for iOS 9.x
2554         https://bugs.webkit.org/show_bug.cgi?id=174068
2555
2556         Reviewed by Tim Horton.
2557
2558         * wtf/Platform.h:
2559         * wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
2560         * wtf/spi/darwin/dyldSPI.h:
2561
2562 2017-07-01  Caio Lima  <ticaiolima@gmail.com>
2563
2564         [JSC] WTFGetBacktrace can return numberOfFrames == 0 in some architectures
2565         https://bugs.webkit.org/show_bug.cgi?id=172768
2566
2567         Reviewed by Mark Lam.
2568
2569         In some architectures, like ARMv6 running on a Raspberry pi, the
2570         backtrace function from "execinfo.h" is returning 0. In
2571         that case, the RELEASE_ASSERT in StackTrace::captureStackTrace
2572         fails causing a runtime crash.
2573         This patch is adding a guard for the case described above to
2574         avoid a runtime crash in such case.
2575
2576         * wtf/StackTrace.cpp:
2577         (WTF::StackTrace::captureStackTrace):
2578
2579 2017-07-01  Dan Bernstein  <mitz@apple.com>
2580
2581         [macOS] Remove code only needed when building for OS X Yosemite
2582         https://bugs.webkit.org/show_bug.cgi?id=174067
2583
2584         Reviewed by Tim Horton.
2585
2586         * Configurations/Base.xcconfig:
2587         * Configurations/DebugRelease.xcconfig:
2588         * wtf/Platform.h:
2589         * wtf/mac/AppKitCompatibilityDeclarations.h:
2590         * wtf/spi/cocoa/SecuritySPI.h:
2591         * wtf/text/TextBreakIterator.cpp:
2592
2593 2017-07-01  Joseph Pecoraro  <pecoraro@apple.com>
2594
2595         Add a warning if WEBGL2 is enabled without WEBGL
2596         https://bugs.webkit.org/show_bug.cgi?id=174054
2597
2598         Reviewed by Sam Weinig.
2599
2600         * wtf/FeatureDefines.h:
2601
2602 2017-06-30  Keith Miller  <keith_miller@apple.com>
2603
2604         Force crashWithInfo to be out of line.
2605         https://bugs.webkit.org/show_bug.cgi?id=174028
2606
2607         Reviewed by Filip Pizlo.
2608
2609         The first pass at making crashes hold information about why they
2610         were crashing had the problem that it would inline the assertion.
2611         This meant that clang could coalesce DFG_ASSERTS with other
2612         assertion failures in the same function. This patch moves it out
2613         of line to help fix that issue.
2614
2615         * wtf/Assertions.cpp:
2616         (WTFCrashWithInfo):
2617         * wtf/Assertions.h:
2618         (WTF::isIntegralType):
2619
2620 2017-06-30  Yusuke Suzuki  <utatane.tea@gmail.com>
2621
2622         [WTF] Drop SymbolRegistry::keyForSymbol
2623         https://bugs.webkit.org/show_bug.cgi?id=174052
2624
2625         Reviewed by Sam Weinig.
2626
2627         Since we can know whether a given symbol is registered by checking RegisteredSymbolImpl,
2628         we do not need to query key string for a given symbol by using SymbolRegistry::keyForSymbol.
2629
2630         * wtf/text/SymbolImpl.h:
2631         (WTF::SymbolImpl::extractFoldedString): Deleted.
2632         * wtf/text/SymbolRegistry.cpp:
2633         (WTF::SymbolRegistry::keyForSymbol): Deleted.
2634         * wtf/text/SymbolRegistry.h:
2635
2636 2017-06-29  Jer Noble  <jer.noble@apple.com>
2637
2638         Make Legacy EME API controlled by RuntimeEnabled setting.
2639         https://bugs.webkit.org/show_bug.cgi?id=173994
2640
2641         Reviewed by Sam Weinig.
2642
2643         * wtf/FeatureDefines.h:
2644
2645 2017-06-30  Ryosuke Niwa  <rniwa@webkit.org>
2646
2647         Ran sort-Xcode-project-file.
2648
2649         * WTF.xcodeproj/project.pbxproj:
2650
2651 2017-06-30  Matt Lewis  <jlewis3@apple.com>
2652
2653         Unreviewed, rolling out r218992.
2654
2655         The patch broke the iOS device builds.
2656
2657         Reverted changeset:
2658
2659         "DFG_ASSERT should allow stuffing registers before trapping."
2660         https://bugs.webkit.org/show_bug.cgi?id=174005
2661         http://trac.webkit.org/changeset/218992
2662
2663 2017-06-30  Keith Miller  <keith_miller@apple.com>
2664
2665         DFG_ASSERT should allow stuffing registers before trapping.
2666         https://bugs.webkit.org/show_bug.cgi?id=174005
2667
2668         Reviewed by Mark Lam.
2669
2670         Add new template functions that enable stuffing up to five values
2671         into registers before crashing.
2672
2673         * wtf/Assertions.h:
2674         (CRASH_WITH_INFO):
2675
2676 2017-06-28  Brent Fulgham  <bfulgham@apple.com>
2677
2678         Teach ResourceLoadStatistics to recognize changes in the file system
2679         https://bugs.webkit.org/show_bug.cgi?id=173800
2680         <rdar://problem/32937842>
2681
2682         Reviewed by Chris Dumez.
2683
2684         * wtf/DispatchPtr.h: Added (moved from WebKit2)
2685         * wtf/Platform.h: Make sure USE_FILE_LOCK is enabled.
2686
2687 2017-06-28  David Kilzer  <ddkilzer@apple.com>
2688
2689         Fix typo in comment: WordResult => WorkResult
2690
2691         * wtf/AutomaticThread.h:
2692
2693 2017-06-27  Caio Lima  <ticaiolima@gmail.com>
2694
2695         [ESnext] Implement Object Rest - Implementing Object Rest Destructuring
2696         https://bugs.webkit.org/show_bug.cgi?id=167962
2697
2698         Reviewed by Saam Barati.
2699
2700         * wtf/HashSet.h:
2701         (WTF::=):
2702
2703 2017-06-26  Yusuke Suzuki  <utatane.tea@gmail.com>
2704
2705         [WTF] Drop Thread::create(obsolete things) API since we can use lambda
2706         https://bugs.webkit.org/show_bug.cgi?id=173825
2707
2708         Reviewed by Saam Barati.
2709
2710         Thread::create(ThreadFunction, void* data, const char* name) is a bit old API.
2711         Since we have C++ lambda, the above API is simply unnecessary. And C++ lambda
2712         based one is better since the above API needs casting data to and from void*.
2713
2714         * wtf/Function.h:
2715         Avoid ambiguity.
2716         * wtf/ParallelJobsGeneric.cpp:
2717         (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
2718         (WTF::ParallelEnvironment::ThreadPrivate::workerThread): Deleted.
2719         * wtf/ParallelJobsGeneric.h:
2720         * wtf/Threading.cpp:
2721         * wtf/ThreadingWin.cpp:
2722         (WTF::createThread):
2723
2724 2017-06-25  Yusuke Suzuki  <utatane.tea@gmail.com>
2725
2726         initializeThreading() [first] causes WTFCrash due to maxSingleAllocationSize not being initialized
2727         https://bugs.webkit.org/show_bug.cgi?id=173720
2728
2729         Reviewed by Mark Lam.
2730
2731         When using std::numeric_limits<size_t>::max() for global variable's initialization,
2732         it seems that it invokes static constructor to initialize this in VC++.
2733         We avoid this edge case by introducing a workaround using SIZE_MAX here.
2734
2735         When I perform git-grep, there is only one site (this) using std::numeric_limits<>::xxx()
2736         to initialize global variable.
2737
2738         * wtf/FastMalloc.cpp:
2739
2740 2017-06-25  Konstantin Tokarev  <annulen@yandex.ru>
2741
2742         Remove excessive headers from JavaScriptCore
2743         https://bugs.webkit.org/show_bug.cgi?id=173812
2744
2745         Reviewed by Darin Adler.
2746
2747         * wtf/Bag.h:
2748
2749 2017-06-23  Keith Miller  <keith_miller@apple.com>
2750
2751         Switch VMTraps to use halt instructions rather than breakpoint instructions
2752         https://bugs.webkit.org/show_bug.cgi?id=173677
2753         <rdar://problem/32178892>
2754
2755         Reviewed by JF Bastien.
2756
2757         Remove the Trap signal handler code since it plays badly with lldb and combine
2758         SIGBUS with SIGSEGV since distiguishing them is generally non-portable.
2759
2760         Also, update the platform code to only use signaling VMTraps
2761         on where we have an appropriate instruction (x86 and ARM64).
2762
2763         * wtf/Platform.h:
2764         * wtf/threads/Signals.cpp:
2765         (WTF::fromMachException):
2766         (WTF::toMachMask):
2767         (WTF::installSignalHandler):
2768         (WTF::jscSignalHandler):
2769         * wtf/threads/Signals.h:
2770         (WTF::toSystemSignal):
2771         (WTF::fromSystemSignal):
2772
2773 2017-06-23  Antti Koivisto  <antti@apple.com>
2774
2775         Add notifyutil registrations for going in and out of simulated low memory state
2776         https://bugs.webkit.org/show_bug.cgi?id=173797
2777
2778         Reviewed by Andreas Kling.
2779
2780         Add
2781
2782         notifyutil -p org.WebKit.lowMemory.begin
2783         notifyutil -p org.WebKit.lowMemory.end
2784
2785         for debugging.
2786
2787         * wtf/cocoa/MemoryPressureHandlerCocoa.mm:
2788         (WTF::MemoryPressureHandler::install):
2789
2790 2017-06-23  Konstantin Tokarev  <annulen@yandex.ru>
2791
2792         Remove more unused headers from WTF
2793         https://bugs.webkit.org/show_bug.cgi?id=173761
2794
2795         Reviewed by Yusuke Suzuki.
2796
2797         * wtf/Liveness.h:
2798         * wtf/PageAllocation.h:
2799         * wtf/ParallelJobs.h:
2800
2801 2017-06-22  Andreas Kling  <akling@apple.com>
2802
2803         Rename MemoryPressureHandler::setTabCount to setPageCount
2804         https://bugs.webkit.org/show_bug.cgi?id=173750
2805
2806         Reviewed by Daniel Bates.
2807
2808         This function is counting WebCore::Page objects (excluding utility Pages used
2809         by SVG-as-image and the web inspector) so let's name it appropriately.
2810         Not all WebKit clients have tabs.
2811
2812         * wtf/MemoryPressureHandler.cpp:
2813         (WTF::MemoryPressureHandler::setPageCount):
2814         (WTF::MemoryPressureHandler::thresholdForMemoryKill):
2815         (WTF::MemoryPressureHandler::measurementTimerFired):
2816         (WTF::MemoryPressureHandler::setTabCount): Deleted.
2817         * wtf/MemoryPressureHandler.h:
2818
2819 2017-06-21  Andreas Kling  <akling@apple.com>
2820
2821         Increase memory kill limits for WebContent processes that manage multiple tabs.
2822         https://bugs.webkit.org/show_bug.cgi?id=173674
2823
2824         Reviewed by Geoffrey Garen.
2825
2826         When opening <a target=_blank> links, we currently have to use the same WebContent
2827         process for the new tab, to support scripting the window.opener object.
2828         This means that some WebContent processes end up hosting multiple tabs, making it
2829         more likely that those processes will hit the memory limits.
2830
2831         Address this by adding some additional allowance for multi-tab processes:
2832
2833             For each additional tab, up to 4 tabs, add 1GB to the memory kill limit.
2834
2835         * wtf/MemoryPressureHandler.cpp:
2836         (WTF::thresholdForMemoryKillWithProcessState):
2837         (WTF::MemoryPressureHandler::setTabCount):
2838         (WTF::MemoryPressureHandler::thresholdForMemoryKill):
2839         (WTF::MemoryPressureHandler::measurementTimerFired):
2840         * wtf/MemoryPressureHandler.h:
2841
2842 2017-06-21  Chris Dumez  <cdumez@apple.com>
2843
2844         Allow constructing a WTF:Function from a function pointer
2845         https://bugs.webkit.org/show_bug.cgi?id=173660
2846
2847         Reviewed by Alex Christensen.
2848
2849         Allow constructing a WTF:Function from a function pointer and
2850         assigning a function pointer to a WTF:Function.
2851
2852         * wtf/Function.h:
2853
2854 2017-06-20  Simon Fraser  <simon.fraser@apple.com>
2855
2856         Remove WILL_REVEAL_EDGE_EVENTS code
2857         https://bugs.webkit.org/show_bug.cgi?id=173632
2858
2859         Reviewed by Sam Weinig, Beth Dakin.
2860
2861         Remove will-reveal-edge events, which never took off.
2862
2863         * wtf/FeatureDefines.h:
2864
2865 2017-06-20  Konstantin Tokarev  <annulen@yandex.ru>
2866
2867         Remove excessive include directives from WTF
2868         https://bugs.webkit.org/show_bug.cgi?id=173553
2869
2870         Reviewed by Saam Barati.
2871
2872         * wtf/AutomaticThread.h:
2873         * wtf/BagToHashMap.h:
2874         * wtf/CrossThreadCopier.h:
2875         * wtf/CrossThreadQueue.h:
2876         * wtf/DateMath.h:
2877         * wtf/Expected.h:
2878         * wtf/HashMap.h:
2879         * wtf/Indenter.h:
2880         * wtf/MessageQueue.h:
2881         * wtf/MetaAllocator.h:
2882         * wtf/MetaAllocatorHandle.h:
2883         * wtf/RandomNumberSeed.h:
2884         * wtf/Ref.h:
2885         * wtf/RefPtr.h:
2886         * wtf/RunLoop.h:
2887         * wtf/SchedulePair.h:
2888         * wtf/StackStats.h:
2889         * wtf/SynchronizedFixedQueue.h:
2890         * wtf/ThreadMessage.h:
2891         * wtf/Threading.cpp:
2892         * wtf/Threading.h:
2893         * wtf/ThreadingPthreads.cpp:
2894         * wtf/ThreadingWin.cpp:
2895         * wtf/WTFThreadData.h:
2896         * wtf/WorkQueue.h:
2897         * wtf/glib/GRefPtr.h:
2898         * wtf/text/AtomicStringTable.h:
2899         * wtf/text/LineBreakIteratorPoolICU.h:
2900
2901 2017-06-20  Yusuke Suzuki  <utatane.tea@gmail.com>
2902
2903         [WTF] Enable WTF::Signals only when HAVE(MACHINE_CONTEXT) is true
2904         https://bugs.webkit.org/show_bug.cgi?id=173590
2905
2906         Reviewed by Carlos Garcia Campos.
2907
2908         WTF::Signals require a feature rewriting a value of a machine context.
2909         This is only available under HAVE(MACHINE_CONTEXT).
2910         This patch disables WTF::Signals on !HAVE(MACHINE_CONTEXT) environments.
2911
2912         * wtf/threads/Signals.cpp:
2913         * wtf/threads/Signals.h:
2914
2915 2017-06-20  Yusuke Suzuki  <utatane.tea@gmail.com>
2916
2917         [WTF] Rebaseline std::optional
2918         https://bugs.webkit.org/show_bug.cgi?id=173582
2919
2920         Reviewed by JF Bastien.
2921
2922         Update the copy of our std::optional to the latest version.
2923         It adds std::optional::has_value() and std::optional::reset().
2924
2925         * wtf/Optional.h:
2926
2927 2017-06-18  Yusuke Suzuki  <utatane.tea@gmail.com>
2928
2929         [WTF] Include execinfo.h and dlfcn.h based on platform defines
2930         https://bugs.webkit.org/show_bug.cgi?id=173531
2931
2932         Reviewed by Alex Christensen.
2933
2934         execinfo.h and dlfcn.h can be missing in some libc libraries.
2935         When including it, we should honor platform defines like HAVE(DLADDR).
2936
2937         * wtf/StackTrace.cpp:
2938
2939 2017-06-18  Darin Adler  <darin@apple.com>
2940
2941         Fix Ref to deref before assignment, add tests for this to RefPtr, Ref, Function
2942         https://bugs.webkit.org/show_bug.cgi?id=173526
2943
2944         Reviewed by Sam Weinig.
2945
2946         * wtf/Ref.h: Changed operator= to not be defined inside the class definition.
2947         Added swap functions. Changed operator= implementations to use swap in the
2948         conventional manner, the same way that RefPtr does.
2949
2950 2017-06-18  Chris Dumez  <cdumez@apple.com>
2951
2952         Use WTF::Function instead of std::function in WTF/
2953         https://bugs.webkit.org/show_bug.cgi?id=173519
2954
2955         Reviewed by Sam Weinig.
2956
2957         Use WTF::Function instead of std::function in WTF/ to avoid
2958         copying.
2959
2960         * wtf/Brigand.h:
2961         * wtf/Condition.h:
2962         * wtf/Expected.h:
2963         * wtf/FunctionDispatcher.h:
2964         * wtf/MainThread.h:
2965         * wtf/MemoryPressureHandler.h:
2966         (WTF::MemoryPressureHandler::setMemoryKillCallback):
2967         (WTF::MemoryPressureHandler::setMemoryPressureStatusChangedCallback):
2968         (WTF::MemoryPressureHandler::setDidExceedInactiveLimitWhileActiveCallback):
2969         * wtf/Optional.h:
2970         * wtf/ParkingLot.h:
2971         * wtf/RefCounter.h:
2972         (WTF::RefCounter<T>::RefCounter):
2973         * wtf/WorkQueue.h:
2974         * wtf/linux/MemoryPressureHandlerLinux.cpp:
2975         (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
2976         * wtf/text/WTFString.cpp:
2977         (WTF::String::split):
2978         * wtf/text/WTFString.h:
2979
2980 2017-06-16  Alex Christensen  <achristensen@webkit.org>
2981
2982         Fix Mac CMake build.
2983
2984         * wtf/PlatformMac.cmake:
2985         Generate MachExceptionsServer.h
2986
2987 2017-06-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2988
2989         [iOS DnD] Upstream iOS drag and drop implementation into OpenSource WebKit
2990         https://bugs.webkit.org/show_bug.cgi?id=173366
2991         <rdar://problem/32767014>
2992
2993         Reviewed by Tim Horton.
2994
2995         Define ENABLE_DRAG_SUPPORT as 1 by default and 0 for iOS, and define ENABLE_DATA_INTERACTION as 0 by default.
2996         These are overridden to both be 1 for iOS 11+ in the FeatureDefines.xcconfig within each individual project.
2997
2998         * wtf/Platform.h:
2999
3000 2017-06-15  Chris Dumez  <cdumez@apple.com>
3001
3002         Fix typo in XPCSPI.h
3003         https://bugs.webkit.org/show_bug.cgi?id=173426
3004
3005         Reviewed by Alex Christensen.
3006
3007         We should check if xpc_release is defined before defining it,
3008         not xpc_retain.
3009
3010         * wtf/spi/darwin/XPCSPI.h:
3011
3012 2017-06-15  Konstantin Tokarev  <annulen@yandex.ru>
3013
3014         Implement FALLTHROUGH macro for compilers other than Clang
3015         https://bugs.webkit.org/show_bug.cgi?id=173385
3016
3017         Reviewed by Alex Christensen.
3018
3019         FALLTHROUGH should be able to use [[gnu::fallthrough]] attribute of
3020         GCC, and [[fallthrough]] from C++17, whichever is available.
3021
3022         * wtf/Compiler.h:
3023
3024 2017-06-14  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
3025
3026         MediaSource duration attribute should not be equal to Infinity when set to a value greater than 2^64
3027         https://bugs.webkit.org/show_bug.cgi?id=171668
3028
3029         Reviewed by Jer Noble.
3030
3031         MediaSource duration attribute is a double represented in MediaSource by a MediaTime instance created with
3032         MediaTime::CreateWithDouble(). This method implements an overflow control mechanism which sets MediaTime to
3033         Infinity when the double value passed as argument is greater than 2^64.
3034
3035         This patch removes the overflow control mechanism when time value is represented as a double. This patch also
3036         modifies the behavior of mathematical operations between a double MediaTime and rational MediaTime: the rational
3037         MediaTime is converted to a double before applying the operation. Double MediaTime precision is the same as for
3038         double. Overflow mechanisms still apply to the conversion of a double MediaTime to rational with setTimescale()
3039         method. No behavior change for rational MediaTime.
3040
3041         * wtf/MediaTime.cpp:
3042         (WTF::MediaTime::createWithFloat):
3043         (WTF::MediaTime::createWithDouble):
3044         (WTF::MediaTime::operator+):
3045         (WTF::MediaTime::operator-):
3046
3047 2017-06-13  Zan Dobersek  <zdobersek@igalia.com>
3048
3049         [GTK][WPE] Use CMAKE_THREAD_LIBS_INIT in WTF platform CMake files
3050         https://bugs.webkit.org/show_bug.cgi?id=173310
3051
3052         Reviewed by Xabier Rodriguez-Calvar.
3053
3054         In the WTF platform CMake files for the GTK+ and WPE ports, use the
3055         CMAKE_THREAD_LIBS_INIT variable to specify the threading library we
3056         should be linking against. On some platforms this variable will be
3057         empty because the given compiler will automatically handle the -pthread
3058         compiler flag and sort out linking on its own.
3059
3060         The same approach is already used for the JSCOnly configuration.
3061
3062         * wtf/PlatformGTK.cmake:
3063         * wtf/PlatformWPE.cmake:
3064
3065 2017-06-13  Youenn Fablet  <youenn@apple.com>
3066
3067         Filter SDP from ICE candidates in case of local ICE candidate filtering
3068         https://bugs.webkit.org/show_bug.cgi?id=173120
3069
3070         Reviewed by Eric Carlson.
3071
3072         Adding split helper routine with functor parameter.
3073
3074         * wtf/text/WTFString.cpp:
3075         (WTF::String::split):
3076         * wtf/text/WTFString.h:
3077         (WTF::String::contains):
3078
3079 2017-06-13  Don Olmstead  <don.olmstead@sony.com>
3080
3081         [WTF] Remove redundant includes in config.h
3082         https://bugs.webkit.org/show_bug.cgi?id=173292
3083
3084         Reviewed by Alex Christensen.
3085
3086         * config.h:
3087         * wtf/ExportMacros.h:
3088
3089 2017-06-12  Jer Noble  <jer.noble@apple.com>
3090
3091         Screen sleeps while doing WebRTC video
3092         https://bugs.webkit.org/show_bug.cgi?id=173278
3093
3094         Reviewed by Eric Carlson.
3095
3096         Drive-by fix: add some generic methods for iterating over collections.
3097
3098         * WTF.xcodeproj/project.pbxproj:
3099         * wtf/Algorithms.h: Added.
3100         (WTF::forEach):
3101         (WTF::anyOf):
3102         (WTF::allOf):
3103
3104 2017-06-12  Carlos Garcia Campos  <cgarcia@igalia.com>
3105
3106         [GTK] Move WebKit GType macros to WTF
3107         https://bugs.webkit.org/show_bug.cgi?id=173249
3108
3109         Reviewed by Žan Doberšek.
3110
3111         They can be used by glib-based ports and eventually by JavaScriptCore glib bindings too.
3112
3113         * wtf/glib/WTFGType.h: Copied from Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h.
3114
3115 2017-06-11  Yusuke Suzuki  <utatane.tea@gmail.com>
3116
3117         [WTF] Make ThreadMessage portable
3118         https://bugs.webkit.org/show_bug.cgi?id=172073
3119
3120         Reviewed by Keith Miller.
3121
3122         Recently, we change ThreadMessage semantics: message handler
3123         can be executed in the sender thread.
3124         This allows ThreadMessage to be implemented in a portable way.
3125
3126         This patch implements ThreadMessage for all the platforms.
3127         We use platform-independent Thread APIs, suspend(), resume(),
3128         and getRegisters().
3129
3130         * wtf/PlatformRegisters.h:
3131         (WTF::registersFromUContext):
3132         * wtf/ThreadMessage.cpp:
3133         (WTF::sendMessageScoped):
3134         (WTF::ThreadMessageData::ThreadMessageData): Deleted.
3135         (): Deleted.
3136         (WTF::initializeThreadMessages): Deleted.
3137         (WTF::sendMessageUsingSignal): Deleted.
3138         (WTF::sendMessageUsingMach): Deleted.
3139         (WTF::deliverMessagesUsingMach): Deleted.
3140         * wtf/ThreadMessage.h:
3141         * wtf/Threading.cpp:
3142         (WTF::initializeThreading):
3143         * wtf/Threading.h:
3144         (WTF::Thread::threadMessages): Deleted.
3145         * wtf/ThreadingPthreads.cpp:
3146         (WTF::Thread::signalHandlerSuspendResume):
3147         (WTF::threadStateMetadata):
3148         (WTF::Thread::getRegisters):
3149         * wtf/threads/Signals.cpp:
3150         (WTF::handleSignalsWithMach):
3151
3152 2017-06-11  Yusuke Suzuki  <utatane.tea@gmail.com>
3153
3154         [WTF] Drop unnecessary includes in Threading.h
3155         https://bugs.webkit.org/show_bug.cgi?id=173167
3156
3157         Reviewed by Darin Adler.
3158
3159         Threading.h includes bunch of headers. But some of them are not necessary.
3160         This patch cleans up it a bit.
3161
3162         * wtf/Assertions.cpp:
3163         * wtf/LocklessBag.h:
3164         * wtf/Threading.h:
3165         * wtf/ThreadingPrimitives.h:
3166
3167 2017-06-10  Yusuke Suzuki  <utatane.tea@gmail.com>
3168
3169         [WTF] Add RegisteredSymbolImpl
3170         https://bugs.webkit.org/show_bug.cgi?id=173230
3171
3172         Reviewed by Mark Lam.
3173
3174         Most symbols are not registered in SymbolRegistry. However, we currently always
3175         allocate a pointer member to point to a SymbolRegistry, and this pointer is always null.
3176         SymbolImpl is immutable, and it will never be registered with a SymbolRegistry
3177         after it is created. Hence, this member is wasteful.
3178
3179         Instead, we add a new derived class RegisteredSymbolImpl, which will set a flag in
3180         SymbolImpl to indicate that it is registered with a SymbolRegistry. The only way to
3181         create a RegisteredSymbolImpl is via a factory method provided by the SymbolRegistry.
3182         The factory method will pass the SymbolRegistry this pointer to the RegisteredSymbolImpl's
3183         constructor for initializing the RegisteredSymbolImpl's m_symbolRegistry field.
3184         By doing so,
3185
3186         1. We do not need to set m_symbolRegistry after creating a Symbol. It is clean.
3187         2. We reduce the size of SymbolImpls that do not need to be registered.
3188
3189         * wtf/text/StringImpl.cpp:
3190         (WTF::StringImpl::~StringImpl):
3191         * wtf/text/StringImpl.h:
3192         * wtf/text/SymbolImpl.cpp:
3193         (WTF::SymbolImpl::create):
3194         (WTF::RegisteredSymbolImpl::create):
3195         * wtf/text/SymbolImpl.h:
3196         (WTF::SymbolImpl::hashForSymbol):
3197         (WTF::SymbolImpl::isRegistered):
3198         (WTF::SymbolImpl::SymbolImpl):
3199         (WTF::RegisteredSymbolImpl::symbolRegistry):
3200         (WTF::RegisteredSymbolImpl::clearSymbolRegistry):
3201         (WTF::RegisteredSymbolImpl::RegisteredSymbolImpl):
3202         (WTF::SymbolImpl::symbolRegistry):
3203         * wtf/text/SymbolRegistry.cpp:
3204         (WTF::SymbolRegistry::~SymbolRegistry):
3205         (WTF::SymbolRegistry::symbolForKey):
3206         (WTF::SymbolRegistry::keyForSymbol):
3207         (WTF::SymbolRegistry::remove):
3208         * wtf/text/SymbolRegistry.h:
3209
3210 2017-06-10  Dan Bernstein  <mitz@apple.com>
3211
3212         Reverted r218056 because it made the IDE reindex constantly.
3213
3214         * Configurations/DebugRelease.xcconfig:
3215
3216 2017-06-10  Dan Bernstein  <mitz@apple.com>
3217
3218         [Xcode] With Xcode 9 developer beta, everything rebuilds when switching between command-line and IDE
3219         https://bugs.webkit.org/show_bug.cgi?id=173223
3220
3221         Reviewed by Sam Weinig.
3222
3223         The rebuilds were happening due to a difference in the compiler options that the IDE and
3224         xcodebuild were specifying. Only the IDE was passing the -index-store-path option. To make
3225         xcodebuild pass that option, too, set CLANG_INDEX_STORE_ENABLE to YES if it is unset, and
3226         specify an appropriate path in CLANG_INDEX_STORE_PATH.
3227
3228         * Configurations/DebugRelease.xcconfig:
3229
3230 2017-06-09  Chris Dumez  <cdumez@apple.com>
3231
3232         Update Thread::create() to take in a WTF::Function instead of a std::function
3233         https://bugs.webkit.org/show_bug.cgi?id=173175
3234
3235         Reviewed by Mark Lam.
3236
3237         Update Thread::create() to take in a WTF::Function instead of a std::function. Unlike
3238         std::function, WTF:Function is not copyable and does not make implicit copies of captured
3239         variables. Doing captures such as [string = string.isolatedCopy()] when passing an
3240         std::function to another thread has lead to bugs in the past due to implicit copying of
3241         the captured string.
3242
3243         * wtf/Threading.cpp:
3244         (WTF::Thread::create):
3245         * wtf/Threading.h:
3246
3247 2017-06-09  Chris Dumez  <cdumez@apple.com>
3248
3249         Update WorkQueue::concurrentApply() to take a WTF::Function instead of an std::function
3250         https://bugs.webkit.org/show_bug.cgi?id=173165
3251
3252         Reviewed by Saam Barati.
3253
3254         Update WorkQueue::concurrentApply() to take a WTF::Function instead of an std::function
3255         as std::function has issues with regards to thread safety.
3256
3257         * wtf/WorkQueue.h:
3258         * wtf/cocoa/WorkQueueCocoa.cpp:
3259         (WTF::WorkQueue::concurrentApply):
3260
3261 2017-06-08  Xabier Rodriguez Calvar  <calvaris@igalia.com>
3262
3263         MediaTime class has rounding issues in different platforms
3264         https://bugs.webkit.org/show_bug.cgi?id=172640
3265
3266         Reviewed by Jer Noble.
3267
3268         The way a timescale is set when creating a MediaTime from a double
3269         can create rounding issues in different platforms because in some
3270         rounding is made and in others, it truncates. This way we ensure a
3271         common behavior.
3272
3273         Dumping MediaTimes is also confusing and by the output you don't
3274         know if it's containing a double or a fraction. Now, if it
3275         contains a double, it only prints the double because printing the
3276         fraction is misleading (it currently prints the double read as an
3277         integer) and if it contains a fraction it shows the fraction and
3278         its double representation separated by an = instead of a ,.
3279
3280         * wtf/MediaTime.cpp:
3281         (WTF::MediaTime::createWithDouble): When creating MediaTime from
3282         double, we round instead of leaving it to the cast operation.
3283         (WTF::MediaTime::dump):
3284
3285 2017-06-07  Jer Noble  <jer.noble@apple.com>
3286
3287         Refactoring: MediaEngineSupportParameters should take a ContentType rather than separate type & codecs strings
3288         https://bugs.webkit.org/show_bug.cgi?id=173038
3289
3290         Reviewed by Eric Carlson.
3291
3292         Drive by fix: add a version of split that takes a UChar and returns a Vector<String>.
3293
3294         * wtf/text/WTFString.h:
3295         (WTF::String::split):
3296
3297 2017-06-07  Zan Dobersek  <zdobersek@igalia.com>
3298
3299         [GCrypt] RSA-PSS support
3300         https://bugs.webkit.org/show_bug.cgi?id=172856
3301
3302         Reviewed by Jiewen Tan.
3303
3304         * wtf/Platform.h: Define HAVE_RSA_PSS to 1 for USE(GCRYPT). Support for RSA-PSS
3305         is provided by default through the libgcrypt library.
3306
3307 2017-06-06  Chris Dumez  <cdumez@apple.com>
3308
3309         Unreviewed, rolling out r214974.
3310
3311         Causes some tabs to start using a huge amount of CPU after 8
3312         minutes in the background
3313
3314         Reverted changeset:
3315
3316         "Make inactive web processes behave as though under memory
3317         pressure."
3318         https://bugs.webkit.org/show_bug.cgi?id=170042
3319         http://trac.webkit.org/changeset/214974
3320
3321 2017-06-06  Don Olmstead  <don.olmstead@am.sony.com>
3322
3323         [WebCore] Enable REQUEST_ANIMATION_FRAME_TIMER for all ports
3324         https://bugs.webkit.org/show_bug.cgi?id=172780
3325
3326         Reviewed by Alex Christensen.
3327
3328         * wtf/Platform.h:
3329
3330 2017-06-06  Darin Adler  <darin@apple.com>
3331
3332         Cut down use of WTF_ARRAY_LENGTH
3333         https://bugs.webkit.org/show_bug.cgi?id=172997
3334
3335         Reviewed by Chris Dumez.
3336
3337         * wtf/DateMath.cpp:
3338         (WTF::equalLettersIgnoringASCIICase): Added helper function template.
3339         (WTF::parseDateFromNullTerminatedCharacters): Use a modern for loop instead of
3340         WTF_ARRAY_LENGTH. Use startsWithLettersIgnoringASCIICase and
3341         equalLettersIgnoringASCIICase instead of strncasecmp.
3342
3343         * wtf/text/IntegerToStringConversion.h:
3344         (WTF::numberToStringImpl): Use std::end instead of WTF_ARRAY_LENGTH.
3345         (WTF::writeNumberToBufferImpl): Ditto.
3346
3347 2017-06-06  Filip Pizlo  <fpizlo@apple.com>
3348
3349         index out of bound in bytecodebasicblock
3350         https://bugs.webkit.org/show_bug.cgi?id=172963
3351
3352         Reviewed by Saam Barati and Mark Lam.
3353
3354         * wtf/Assertions.h:
3355         (UNREACHABLE_FOR_PLATFORM):
3356
3357 2017-06-05  Jer Noble  <jer.noble@apple.com>
3358
3359         Allow clients to specify a list of codecs which should require hardware decode support.
3360         https://bugs.webkit.org/show_bug.cgi?id=172787
3361
3362         Reviewed by Alex Christensen.
3363
3364         Add a couple of convenience methods:
3365         - a String::split() that returns a vector (rather than taking an out-reference to a vector).
3366         - A Vector::map() template which takes a Callable and returns a Vector of a different type.
3367
3368         * wtf/Vector.h:
3369         (WTF::Vector::map):
3370         * wtf/text/WTFString.h:
3371         (WTF::String::split):
3372
3373 2017-06-04  Konstantin Tokarev  <annulen@yandex.ru>
3374
3375         Fix build of Windows-specific code with ICU 59.1
3376         https://bugs.webkit.org/show_bug.cgi?id=172729
3377
3378         Reviewed by Darin Adler.
3379
3380         * wtf/text/win/WCharStringExtras.h: Added new header file wuth helper
3381         functions for conversion between WTF::String and wchart_t*.
3382         (WTF::stringToNullTerminatedWChar):
3383         (WTF::wcharToString):
3384         (WTF::nullTerminatedWCharToString):
3385
3386 2017-06-02  Stephan Szabo  <stephan.szabo@am.sony.com>
3387
3388         [JSCOnly] Build static jsc.exe on Windows
3389         https://bugs.webkit.org/show_bug.cgi?id=172833
3390
3391         Reviewed by Konstantin Tokarev.
3392
3393         * wtf/PlatformJSCOnly.cmake:
3394
3395 2017-06-02  Simon Fraser  <simon.fraser@apple.com>
3396
3397         Get <chrono> out of StdLibExtras.h
3398         https://bugs.webkit.org/show_bug.cgi?id=172744
3399
3400         Reviewed by Zalan Bujtas.
3401
3402         We hates std::chrono. Don't include it everywhere to discourage use.
3403
3404         * wtf/StdLibExtras.h:
3405
3406 2017-06-02  Filip Pizlo  <fpizlo@apple.com>
3407
3408         Atomics.load and Atomics.store need to be fully fenced
3409         https://bugs.webkit.org/show_bug.cgi?id=172844
3410
3411         Reviewed by Keith Miller.
3412         
3413         Add loadFullyFenced and storeFullyFenced to Atomic<>.
3414
3415         * wtf/Atomics.h:
3416         (WTF::Atomic::loadFullyFenced):
3417         (WTF::Atomic::storeRelaxed):
3418         (WTF::Atomic::storeFullyFenced):
3419         (WTF::atomicLoadFullyFenced):
3420         (WTF::atomicStoreFullyFenced):
3421
3422 2017-06-01  Keith Miller  <keith_miller@apple.com>
3423
3424         Undo rollout in r217638 with bug fix
3425         https://bugs.webkit.org/show_bug.cgi?id=172824
3426
3427         Unreviewed, reland patch with unused set_state code removed.
3428
3429         * Configurations/WTF.xcconfig:
3430         * WTF.xcodeproj/project.pbxproj:
3431         * wtf/Platform.h:
3432         * wtf/PlatformRegisters.h:
3433         (WTF::registersFromUContext):
3434         * wtf/StackBounds.h:
3435         (WTF::StackBounds::StackBounds):
3436         * wtf/ThreadHolder.cpp:
3437         (WTF::ThreadHolder::~ThreadHolder):
3438         * wtf/ThreadMessage.cpp:
3439         (WTF::sendMessageUsingSignal):
3440         (WTF::sendMessageUsingMach):
3441         (WTF::deliverMessagesUsingMach):
3442         (WTF::sendMessageScoped):
3443         * wtf/ThreadMessage.h:
3444         (WTF::sendMessage):
3445         * wtf/Threading.h:
3446         (WTF::Thread::machThread):
3447         * wtf/mac/MachExceptions.defs: Copied from Source/WTF/wtf/ThreadMessage.h.
3448         * wtf/threads/Signals.cpp:
3449         (WTF::startMachExceptionHandlerThread):
3450         (WTF::fromMachException):
3451         (WTF::toMachMask):
3452         (WTF::handleSignalsWithMach):
3453         (WTF::setExceptionPorts):
3454         (WTF::activeThreads):
3455         (WTF::registerThreadForMachExceptionHandling):
3456         (WTF::unregisterThreadForMachExceptionHandling):
3457         (WTF::installSignalHandler):
3458         (WTF::jscSignalHandler):
3459         * wtf/threads/Signals.h:
3460
3461 2017-05-31  Commit Queue  <commit-queue@webkit.org>
3462
3463         Unreviewed, rolling out r217611 and r217631.
3464         https://bugs.webkit.org/show_bug.cgi?id=172785
3465
3466         "caused wasm-hashset-many.html to become flaky." (Requested by
3467         keith_miller on #webkit).
3468
3469         Reverted changesets:
3470
3471         "Reland r216808, underlying lldb bug has been fixed."
3472         https://bugs.webkit.org/show_bug.cgi?id=172759
3473         http://trac.webkit.org/changeset/217611
3474
3475         "Use dispatch queues for mach exceptions"
3476         https://bugs.webkit.org/show_bug.cgi?id=172775
3477         http://trac.webkit.org/changeset/217631
3478
3479 2017-05-31  Keith Miller  <keith_miller@apple.com>
3480
3481         Use dispatch queues for mach exceptions
3482         https://bugs.webkit.org/show_bug.cgi?id=172775
3483
3484         Reviewed by Geoffrey Garen.
3485
3486         This patch adds support for using a dispatch queue to handle our
3487         mach exceptions. We use a high priority concurrent dispatch queue
3488         to handle our mach exceptions. We don't know the priority of the
3489         thread whose exception we are handling so the most conservative
3490         answer is to respond with a high priority. These events are both
3491         rare and usually quite fast so it is likely not a significant cost
3492         when the thread with an exception has a low priority.
3493
3494         * wtf/threads/Signals.cpp:
3495         (WTF::startMachExceptionHandlerThread):
3496
3497 2017-05-31  Keith Miller  <keith_miller@apple.com>
3498
3499         Reland r216808, underlying lldb bug has been fixed.
3500         https://bugs.webkit.org/show_bug.cgi?id=172759
3501
3502         Unreviewed, relanding old patch. See: rdar://problem/31183352
3503
3504         * Configurations/WTF.xcconfig:
3505         * WTF.xcodeproj/project.pbxproj:
3506         * wtf/Platform.h:
3507         * wtf/PlatformRegisters.h:
3508         (WTF::registersFromUContext):
3509         * wtf/StackBounds.h:
3510         (WTF::StackBounds::StackBounds):
3511         * wtf/ThreadHolder.cpp:
3512         (WTF::ThreadHolder::~ThreadHolder):
3513         * wtf/ThreadMessage.cpp:
3514         (WTF::sendMessageUsingSignal):
3515         (WTF::sendMessageUsingMach):
3516         (WTF::deliverMessagesUsingMach):
3517         (WTF::sendMessageScoped):
3518         * wtf/ThreadMessage.h:
3519         (WTF::sendMessage):
3520         * wtf/Threading.h:
3521         (WTF::Thread::machThread):
3522         * wtf/mac/MachExceptions.defs: Copied from Source/WTF/wtf/ThreadMessage.h.
3523         * wtf/threads/Signals.cpp:
3524         (WTF::startMachExceptionHandlerThread):
3525         (WTF::fromMachException):
3526         (WTF::toMachMask):
3527         (WTF::handleSignalsWithMach):
3528         (WTF::setExceptionPorts):
3529         (WTF::activeThreads):
3530         (WTF::registerThreadForMachExceptionHandling):
3531         (WTF::unregisterThreadForMachExceptionHandling):
3532         (WTF::installSignalHandler):
3533         (WTF::jscSignalHandler):
3534         * wtf/threads/Signals.h:
3535
3536 2017-05-31  Matt Lewis  <jlewis3@apple.com>
3537
3538         Unreviewed, rolling out r217603.
3539
3540         This patch broke the internal builds.
3541
3542         Reverted changeset:
3543
3544         "Get <chrono> out of StdLibExtras.h"
3545         https://bugs.webkit.org/show_bug.cgi?id=172744
3546         http://trac.webkit.org/changeset/217603
3547
3548 2017-05-31  Simon Fraser  <simon.fraser@apple.com>
3549
3550         Get <chrono> out of StdLibExtras.h
3551         https://bugs.webkit.org/show_bug.cgi?id=172744
3552
3553         Reviewed by Saam Barati.
3554
3555         We hates std::chrono. Don't include it everywhere to discourage use.
3556
3557         * wtf/StdLibExtras.h:
3558
3559 2017-05-30  Ryosuke Niwa  <rniwa@webkit.org>
3560
3561         Only include DataDetectorsUI headers in iOS
3562         https://bugs.webkit.org/show_bug.cgi?id=172633
3563
3564         Reviewed by David Kilzer.
3565
3566         Enable data detectors only on iOS and not other variants of iOS.
3567
3568         * wtf/FeatureDefines.h:
3569         * wtf/Platform.h:
3570