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