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