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